Title: Add mcp_proxy for bidirectional message forwarding by maxisbey · Pull Request #1778 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Add mcp_proxy for bidirectional message forwarding by maxisbey · Pull Request #1778 · modelcontextprotocol/python-sdk
X Title: Add mcp_proxy for bidirectional message forwarding by maxisbey · Pull Request #1778 · modelcontextprotocol/python-sdk
Description: Adds a convenience function for proxying messages between two MCP transports, enabling bidirectional message forwarding with proper error handling. Motivation and Context This implements issue #12 - porting the TypeScript proxy pattern to Python. It's a simpler reimplementation of #1711/#1763 that addresses all review feedback from those PRs. Key differences from #1763: 72 lines vs 144 - simpler design with inline helper No pragma: no cover - all code paths are tested No timing sleeps in tests - uses anyio.Event for synchronization No logging - errors propagate to caller Correct stream ownership - proxy doesn't close streams it doesn't own How Has This Been Tested? 13 unit tests covering: Bidirectional forwarding Error callback (sync and async) Stream closure handling (ClosedResourceError, BrokenResourceError) Error callback exceptions (ignored, proxy continues) Context exit cleanup All tests pass with pytest-xdist parallel execution. Breaking Changes None - this is a new feature. Types of changes Bug fix (non-breaking change which fixes an issue) New feature (non-breaking change which adds functionality) Breaking change (fix or feature that would cause existing functionality to change) Documentation update Checklist I have read the MCP Documentation My code follows the repository's style guidelines New and existing tests pass locally I have added appropriate error handling I have added or updated documentation as needed Additional context Closes #12 Related PRs: #1711, #1763 AI Disclaimer
Open Graph Description: Adds a convenience function for proxying messages between two MCP transports, enabling bidirectional message forwarding with proper error handling. Motivation and Context This implements issue #12 ...
X Description: Adds a convenience function for proxying messages between two MCP transports, enabling bidirectional message forwarding with proper error handling. Motivation and Context This implements issue #12 ...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/1778
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ead9b0f8-08e1-27ef-9e8e-a65015813b7e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 96F4:5598D:4E9540:68F002:6A6177BF |
| html-safe-nonce | e8c6dc301a4228becb7061fb8b82ab2e9dc67bcf26f595b56c8a3a751e8e123c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NkY0OjU1OThEOjRFOTU0MDo2OEYwMDI6NkE2MTc3QkYiLCJ2aXNpdG9yX2lkIjoiMzc2MjE2NzA2OTg4ODU3NTQyMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9e3713ea7fb035132e1162d2cf02dfb7b4bc8c0e582bcce3060a2c48231ed388 |
| hovercard-subject-tag | pull_request:3093636279 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/1778/files |
| twitter:image | https://avatars.githubusercontent.com/u/224885523?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/224885523?s=400&v=4 |
| og:image:alt | Adds a convenience function for proxying messages between two MCP transports, enabling bidirectional message forwarding with proper error handling. Motivation and Context This implements issue #12 ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b05bb6314e7e93021a7b7dab54a85cbe48d821938e762c1dff815efd60699622 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 94389bfdcd393b0a5a274aee94e8a9739d063fe5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width