Title: fix(client): propagate HTTP transport exceptions to caller by gspeter-max · Pull Request #2124 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: fix(client): propagate HTTP transport exceptions to caller by gspeter-max · Pull Request #2124 · modelcontextprotocol/python-sdk
X Title: fix(client): propagate HTTP transport exceptions to caller by gspeter-max · Pull Request #2124 · modelcontextprotocol/python-sdk
Description: Summary Fixes #2110 - HTTP transport swallows non-2xx status codes causing client to hang When an MCP server returns non-2xx HTTP status codes (401/403/404/5xx), the Streamable HTTP and SSE transports catch exceptions in post_writer but only log them without forwarding them through the read stream. This causes callers to hang indefinitely waiting for a response that will never arrive. Root Cause In both sse.py and streamable_http.py, the post_writer function catches exceptions but never sends them to read_stream_writer, breaking the exception propagation pattern that works correctly in other transports (stdio, websocket). Changes src/mcp/client/sse.py: Modified exception handler in post_writer to send exceptions to read_stream_writer src/mcp/client/streamable_http.py: Modified exception handler in post_writer to send exceptions to read_stream_writer This aligns with the pattern used in working transports: stdio.py line 156: await read_stream_writer.send(exc) websocket.py line 59: await read_stream_writer.send(exc) Testing All existing client tests pass (182 passed) All shared/SSE tests pass (146 passed, 25 passed respectively) Code formatting and linting verified Commit includes proper trailers (Reported-by, Github-Issue)
Open Graph Description: Summary Fixes #2110 - HTTP transport swallows non-2xx status codes causing client to hang When an MCP server returns non-2xx HTTP status codes (401/403/404/5xx), the Streamable HTTP and SSE transpo...
X Description: Summary Fixes #2110 - HTTP transport swallows non-2xx status codes causing client to hang When an MCP server returns non-2xx HTTP status codes (401/403/404/5xx), the Streamable HTTP and SSE transpo...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/2124
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:ac234ef4-dda2-f7f5-dcb7-f12044d18ca4 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | C4B6:338161:6954B5:8CD573:6A5FFC55 |
| html-safe-nonce | e0e389d9116b2d14798b12fd4fc426d7fa2d14857c00b7b808c6e184107cf0c7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNEI2OjMzODE2MTo2OTU0QjU6OENENTczOjZBNUZGQzU1IiwidmlzaXRvcl9pZCI6Ijc2NjIyNTkyODE3NjIxODgzNzMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3005555ad4e01d16d9eb38d14a26fa0e8263b4435fd6d3921036307d2ad997b9 |
| hovercard-subject-tag | pull_request:3312275242 |
| 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/2124/files |
| twitter:image | https://avatars.githubusercontent.com/u/193389584?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/193389584?s=400&v=4 |
| og:image:alt | Summary Fixes #2110 - HTTP transport swallows non-2xx status codes causing client to hang When an MCP server returns non-2xx HTTP status codes (401/403/404/5xx), the Streamable HTTP and SSE transpo... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 79522f2cee5c5409f33a714312a1a68d41ad77a807626020d980fb1eb81def07 |
| 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 | 3df4fbea9b6b5ead5c6724a99dc5f5b62caa864b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width