Title: Streamable HTTP stateless servers hang clients on the listen-mode GET (_handle_get_request opens a hold-open SSE stream) · Issue #3492 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Streamable HTTP stateless servers hang clients on the listen-mode GET (_handle_get_request opens a hold-open SSE stream) · Issue #3492 · modelcontextprotocol/python-sdk
X Title: Streamable HTTP stateless servers hang clients on the listen-mode GET (_handle_get_request opens a hold-open SSE stream) · Issue #3492 · modelcontextprotocol/python-sdk
Description: Environment mcp Python SDK 1.29.1 / 1.30.0, FastMCP with stateless_http=True and streamable_http_path="/", mounted in a Starlette app. Symptom A client that opens the listen-mode GET (Accept: text/event-stream) receives HTTP 200 with Con...
Open Graph Description: Environment mcp Python SDK 1.29.1 / 1.30.0, FastMCP with stateless_http=True and streamable_http_path="/", mounted in a Starlette app. Symptom A client that opens the listen-mode GET (Accept: text/...
X Description: Environment mcp Python SDK 1.29.1 / 1.30.0, FastMCP with stateless_http=True and streamable_http_path="/", mounted in a Starlette app. Symptom A client that opens the listen-mode GET (Acc...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/3492
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Streamable HTTP stateless servers hang clients on the listen-mode GET (_handle_get_request opens a hold-open SSE stream)","articleBody":"## Environment\nmcp Python SDK 1.29.1 / 1.30.0, FastMCP with `stateless_http=True` and `streamable_http_path=\"/\"`, mounted in a Starlette app.\n\n## Symptom\nA client that opens the listen-mode GET (`Accept: text/event-stream`) receives HTTP 200 with `Content-Type: text/event-stream` but the response never writes a single byte; the connection holds open indefinitely. MCP clients (e.g. Pi, Claude Code) that open this GET at connect time time out with messages like \"Timed out connecting to SSE MCP server\".\n\n## Root cause\n`StreamableHTTPServerTransport._handle_get_request` (mcp/server/streamable_http.py) unconditionally creates an SSE stream and waits for server-initiated messages. For a **stateless** server there is no session and the server never pushes, so the stream stays open with zero bytes. The handler and its dispatch branch are marked `# pragma: no cover`.\n\n## Spec\nMCP Streamable HTTP (2025-03-26) requires a server that does not support server-initiated messages to answer the listen-mode GET with 405 Method Not Allowed. There is no transport configuration that produces that 405 today; current workarounds are app-layer interception (return 405 before the stream handler) or monkey-patching the private handler.\n\n## Related\n#1764 is a different stateless-mode hang (SSE-writer zero-buffer deadlock). This is the GET-listen path.\n\n## Suggested fix\nAt the top of `_handle_get_request` (or in `handle_request`), return 405 when the transport is stateless — or more generally whenever the server publishes no server-initiated messages — before any stream creation.\n\n## Repro\nMinimal FastMCP: `FastMCP(\"x\", stateless_http=True, streamable_http_path=\"/\")`, serve, then `curl -i -H 'Accept: text/event-stream' http://localhost:PORT/mcp/` — observe 200 + zero bytes, held open (hang), instead of 405.","author":{"url":"https://github.com/jzhuge","@type":"Person","name":"jzhuge"},"datePublished":"2026-09-11T02:50:59Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3492"}
| 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:afeb9fb1-9627-7876-ed5e-9711f0e643cc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D718:D0CA2:28D3596:35E9BCA:6B056538 |
| html-safe-nonce | bafd62be63de101300bb0487ab6d22791d79f5d03e2796bc51c4d74c54f492ed |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENzE4OkQwQ0EyOjI4RDM1OTY6MzVFOUJDQTo2QjA1NjUzOCIsInZpc2l0b3JfaWQiOiIzMDQ2MjM2MDIwNjg2NTQ2MjMyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 427cab68b417aa3433195d97a9f43830ba764ea8ce2eaa5dd3a7a047ceec4442 |
| hovercard-subject-tag | issue:5419775444 |
| 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/3492/issue_layout |
| twitter:image | https://opengraph.githubassets.com/66f75530e51cc1b8f45368198658f68d2eef03a9c07864ea4e0f3b7053affcf3/modelcontextprotocol/python-sdk/issues/3492 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/66f75530e51cc1b8f45368198658f68d2eef03a9c07864ea4e0f3b7053affcf3/modelcontextprotocol/python-sdk/issues/3492 |
| og:image:alt | Environment mcp Python SDK 1.29.1 / 1.30.0, FastMCP with stateless_http=True and streamable_http_path="/", mounted in a Starlette app. Symptom A client that opens the listen-mode GET (Accept: text/... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jzhuge |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1be5cc09efdd4833c24a4ffa71d698e3999fa09071e159fe14c2c08e41c98331 |
| 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 | f6d69234e682c947a48074340e69d45d5901de31 |
| 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