Title: HTTP transport swallows non-2xx status codes causing client to hang · Issue #2110 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: HTTP transport swallows non-2xx status codes causing client to hang · Issue #2110 · modelcontextprotocol/python-sdk
X Title: HTTP transport swallows non-2xx status codes causing client to hang · Issue #2110 · modelcontextprotocol/python-sdk
Description: Summary When an MCP server returns non-2xx HTTP status codes (401/403/404/5xx), the Streamable HTTP and SSE transports do not reliably propagate the error to the caller. In the Streamable HTTP transport, post_writer catches exceptions an...
Open Graph Description: Summary When an MCP server returns non-2xx HTTP status codes (401/403/404/5xx), the Streamable HTTP and SSE transports do not reliably propagate the error to the caller. In the Streamable HTTP tran...
X Description: Summary When an MCP server returns non-2xx HTTP status codes (401/403/404/5xx), the Streamable HTTP and SSE transports do not reliably propagate the error to the caller. In the Streamable HTTP tran...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/2110
X: @github
Domain: redirect.github.com
IPv4 address: 140.82.114.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"HTTP transport swallows non-2xx status codes causing client to hang","articleBody":"## Summary\n\nWhen an MCP server returns non-2xx HTTP status codes (401/403/404/5xx), the Streamable HTTP and SSE transports do not reliably propagate the error to the caller. In the Streamable HTTP transport, `post_writer` catches exceptions and logs them, but the caller blocks indefinitely waiting for a response on the read stream. HTTP 404 responses are also converted to `JSONRPCError(code=32600)`, losing the original HTTP status information.\n\n## Expected Behavior\n\n- Non-2xx HTTP responses should be surfaced as exceptions to the caller, not silently logged\n- The original HTTP status code should be preserved and accessible\n- Auth-related errors (401/403) should be distinguishable from other failures\n\n## Current Behavior\n\n- `post_writer` in Streamable HTTP transport catches and logs errors without forwarding them through the read stream\n- Callers hang indefinitely waiting for a response\n- HTTP 404 is converted to `JSONRPCError(code=32600)`, destroying HTTP-level context\n\n## Affected Code\n\n- `src/mcp/client/streamable_http.py` (post_writer)\n- `src/mcp/client/sse.py` (sse_reader)\n\n## Related\n\n- #1742 — broader typed error classes design","author":{"url":"https://github.com/maxisbey","@type":"Person","name":"maxisbey"},"datePublished":"2026-02-19T20:29:41Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/2110"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:483c0a94-ee65-d13d-f72f-11a6a5f25858 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DC52:1F9C:8C3F4B:C35721:6B056CCE |
| html-safe-nonce | 76337f686ea498639303035d0073e62f229feea83af9305ac73a0d18004ac688 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzUyOjFGOUM6OEMzRjRCOkMzNTcyMTo2QjA1NkNDRSIsInZpc2l0b3JfaWQiOiIzODAyNDY2MjAyNTc2ODQxOTM0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6c9a7683dd6668fb4e40c01432b4503b0258dbd9659e947dbdd025e813d83610 |
| hovercard-subject-tag | issue:3964945600 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/modelcontextprotocol/python-sdk/2110/issue_layout |
| twitter:image | https://opengraph.githubassets.com/841d3b1ce030a2274dfa5b55a48071e46c0be06bdb456f21e58f4062e9b69a6c/modelcontextprotocol/python-sdk/issues/2110 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/841d3b1ce030a2274dfa5b55a48071e46c0be06bdb456f21e58f4062e9b69a6c/modelcontextprotocol/python-sdk/issues/2110 |
| og:image:alt | Summary When an MCP server returns non-2xx HTTP status codes (401/403/404/5xx), the Streamable HTTP and SSE transports do not reliably propagate the error to the caller. In the Streamable HTTP tran... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | maxisbey |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9b4256ac5f3e310e7945ef5b71c9cb9e264357b1eb20e91d369ed6502a4c486c |
| turbo-cache-control | no-preview |
| 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 | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f089e689ad324655ac44bf6cdbc04d976105b374 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width