Title: Handle connection errors in StreamableHTTPTransport by slykar · Pull Request #2273 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Handle connection errors in StreamableHTTPTransport by slykar · Pull Request #2273 · modelcontextprotocol/python-sdk
X Title: Handle connection errors in StreamableHTTPTransport by slykar · Pull Request #2273 · modelcontextprotocol/python-sdk
Description: Motivation and Context StreamableHTTPTransport is not handling connection/request errors properly, which leads to cancellation of the whole anyio.TaskGroup. The fix should make connection/setup failures behave like normal request errors instead of letting them tear down the transport task group in a way that triggers cancellation churn. Without the fix, a request collapses into an infinite AnyIO cancellation retry loop which may cause a sustained high CPU use. How Has This Been Tested? I was primarily testing this with Agno and FastMCP. There are some changes I had to make to Agno itself as well. Here's how I've tested it: Start FastMCP server Start HTTP app running Agno Chat with the agent; ask it to use tools; everything good so far Kill MCP server Ask the agent to run tool MCP client fails and I end up with a cancellation retry loop Breaking Changes No code changes or configuration is needed. 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
Open Graph Description: Motivation and Context StreamableHTTPTransport is not handling connection/request errors properly, which leads to cancellation of the whole anyio.TaskGroup. The fix should make connection/setup fai...
X Description: Motivation and Context StreamableHTTPTransport is not handling connection/request errors properly, which leads to cancellation of the whole anyio.TaskGroup. The fix should make connection/setup fai...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/2273
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:a415df1d-0736-f8c2-5381-5dbadbb1f8bb |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C3A8:198664:298C454:392BBAD:6A60B6F2 |
| html-safe-nonce | 848dc709590ccecd9b31c833084e67ec260dd00bd234c15ef25d6eb5ce0e075c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0E4OjE5ODY2NDoyOThDNDU0OjM5MkJCQUQ6NkE2MEI2RjIiLCJ2aXNpdG9yX2lkIjoiNjE0MjE2MzUwMTIxNjQ3ODk2MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c83bb6ecf2c8edc51accf37e3f35c096006e0fd20757acee585076335a98f0ad |
| hovercard-subject-tag | pull_request:3385134638 |
| 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/2273/files |
| twitter:image | https://avatars.githubusercontent.com/u/643509?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/643509?s=400&v=4 |
| og:image:alt | Motivation and Context StreamableHTTPTransport is not handling connection/request errors properly, which leads to cancellation of the whole anyio.TaskGroup. The fix should make connection/setup fai... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | bca6f23fd7d922d0dc2568325aed306d56389f16f6750e6dbd3b63cf2cdd06e9 |
| 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 |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 52cc0a08ad6a7ba327bf003424ad1b6c8d69f9c1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width