Title: streamable_http_client hangs indefinitely when server sends POST-only endpoints without SSE fallback · Issue #2232 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: streamable_http_client hangs indefinitely when server sends POST-only endpoints without SSE fallback · Issue #2232 · modelcontextprotocol/python-sdk
X Title: streamable_http_client hangs indefinitely when server sends POST-only endpoints without SSE fallback · Issue #2232 · modelcontextprotocol/python-sdk
Description: Problem When an MCP server implements only POST-based endpoints (no SSE support), the streamable_http_client in mcp/client/sse.py hangs indefinitely during connection setup. The client assumes SSE is available and blocks waiting for serv...
Open Graph Description: Problem When an MCP server implements only POST-based endpoints (no SSE support), the streamable_http_client in mcp/client/sse.py hangs indefinitely during connection setup. The client assumes SSE ...
X Description: Problem When an MCP server implements only POST-based endpoints (no SSE support), the streamable_http_client in mcp/client/sse.py hangs indefinitely during connection setup. The client assumes SSE ...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/2232
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"streamable_http_client hangs indefinitely when server sends POST-only endpoints without SSE fallback","articleBody":"## Problem\n\nWhen an MCP server implements only POST-based endpoints (no SSE support), the `streamable_http_client` in `mcp/client/sse.py` hangs indefinitely during connection setup. The client assumes SSE is available and blocks waiting for server-sent events that never arrive.\n\n## Root Cause\n\nThe `sse_client()` function attempts to establish an SSE connection via GET request. If the server only exposes POST endpoints (as seen with GitHub MCP and other stateless implementations), the GET request either:\n1. Returns a 405 Method Not Allowed that goes unhandled\n2. Hangs waiting for an SSE stream that the POST-only server never sends\n\nThe client lacks:\n- Timeout detection for failed SSE handshake\n- Fallback logic to detect POST-only servers\n- Clear error messaging distinguishing \"server error\" from \"transport mismatch\"\n\n## Impact\n\nUsers cannot connect to valid MCP servers that use POST-only transport, forcing them to use alternative clients or work around the limitation. The hang is silent—no exception is raised, making debugging difficult.\n\n## Expected Behavior\n\nOne of:\n1. **Auto-detection**: Client detects POST-only server and switches to stateless HTTP mode automatically\n2. **Explicit timeout**: GET request to SSE endpoint times out within 5-10 seconds with a clear error: \"Server does not support SSE transport. Use stateless HTTP mode instead.\"\n3. **Transport negotiation**: Client includes `Accept: application/json` header in GET request; if server responds with 406 or 415, client falls back to POST\n\n## Reproduction Steps\n\n1. Start an MCP server that only implements POST endpoints (e.g., `github-mcp` or `simple-stateless-http` example)\n2. Connect via:\n ```python\n async with sse_client(\"http://localhost:3000\") as client:\n await client.initialize()\n ```\n3. Observe: Connection hangs indefinitely; no timeout; no error message\n\n## References\n\n- Related issues: #157 (streamable_http_client hangs with GitHub MCP), #401 (HTTP errors not handled properly)\n- Related: `mcp/client/sse.py` lines 100-150 (SSE handshake logic)\n- Similar pattern in TypeScript SDK: handles POST-only servers explicitly\n\n\n---\n*Contributed by [Klement Gunndu](https://github.com/KlementMultiverse)*","author":{"url":"https://github.com/KlementMultiverse","@type":"Person","name":"KlementMultiverse"},"datePublished":"2026-03-06T12:42:00.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/2232/python-sdk/issues/2232"}
| 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:a1574627-4574-e46e-7ecb-3ae57d0e6241 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D418:11ACF6:1AAACA7:23866C4:6A5AE022 |
| html-safe-nonce | 4b29a51e1bdc555fd3c9c76ad3969e7d5952a036a5c98a430c7c4a9fba618ac7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENDE4OjExQUNGNjoxQUFBQ0E3OjIzODY2QzQ6NkE1QUUwMjIiLCJ2aXNpdG9yX2lkIjoiMzE2MDIzODQwNzA1OTk1NTc0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 396a805ff162f35358e758a3deace6775b5d9ad7a52805730fffc0eb96e57f41 |
| hovercard-subject-tag | issue:4034030974 |
| 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/2232/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c376809fd5f6b9f71c0d20b8ac2d2ea4f95f9ba06b073e855bf77d43a85d6d80/modelcontextprotocol/python-sdk/issues/2232 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c376809fd5f6b9f71c0d20b8ac2d2ea4f95f9ba06b073e855bf77d43a85d6d80/modelcontextprotocol/python-sdk/issues/2232 |
| og:image:alt | Problem When an MCP server implements only POST-based endpoints (no SSE support), the streamable_http_client in mcp/client/sse.py hangs indefinitely during connection setup. The client assumes SSE ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | KlementMultiverse |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| 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 | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width