Title: Return 405 on GET when stateless_http=True · Issue #2474 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Return 405 on GET when stateless_http=True · Issue #2474 · modelcontextprotocol/python-sdk
X Title: Return 405 on GET when stateless_http=True · Issue #2474 · modelcontextprotocol/python-sdk
Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue Description When a Streamable HTTP...
Open Graph Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ...
X Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening t...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/2474
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Return 405 on GET when stateless_http=True","articleBody":"### Initial Checks\n\n- [x] I confirm that I'm using the latest version of MCP Python SDK\n- [x] I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue\n\n### Description\n\nWhen a Streamable HTTP server is configured with `stateless_http=True`, `GET /mcp` is still accepted and opens an SSE stream that has no session context and can never receive server-initiated messages — a dead-end.\n\nThe MCP Streamable HTTP spec explicitly permits returning `405 Method Not Allowed` when the server does not offer an SSE stream at the endpoint\n([spec](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports)):\n\n\u003e The server **MUST** return HTTP 405 Method Not Allowed if an SSE stream is\n\u003e not offered at the endpoint.\n\nA stateless server cannot offer one — there is no session to push to — so GET should 405. The TypeScript SDK already behaves this way in its stateless example.\n\nA prior PR (#2262) proposed essentially this change but was closed for lack of a corresponding issue per CONTRIBUTING.md. \nOpening this issue to agree on scope so the fix can be re-submitted.\n\n### Example Code\n\n```Python\nfrom mcp.server.fastmcp import FastMCP\n\nmcp = FastMCP(\"my-server\", stateless_http=True, json_response=True)\n\n@mcp.tool()\ndef ping() -\u003e str:\n return \"pong\"\n\napp = mcp.streamable_http_app()\n```\n\nA couple of clarifications for triage:\n\n### Current vs expected behavior\n\nToday (v1.27.0):\n```\n$ curl -i -X GET http://localhost:8000/mcp\nHTTP/1.1 200 OK\ncontent-type: text/event-stream\n... (stream idles until platform timeout)\n```\n\nExpected:\n```\n$ curl -i -X GET http://localhost:8000/mcp\nHTTP/1.1 405 Method Not Allowed\nAllow: POST\n```\n\n### Concrete impact\nThe idle GET SSE stream holds a long-lived connection per client with no useful payload, exhausting concurrent connection limits on serverless platforms like Cloud Run. Background previously raised in #2232 / #1941.\n\n### Proposed resolution\n\nPR #2262 already has a working implementation. Once this issue is labeled `ready for work`, reopening it (narrowed to GET per this issue's scope) should be sufficient — no new PR needed.\n\n### Python \u0026 MCP Python SDK\n\n```Text\n1.27.0\n```","author":{"url":"https://github.com/itomise","@type":"Person","name":"itomise"},"datePublished":"2026-04-19T09:15:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/2474/python-sdk/issues/2474"}
| 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:3708dec5-4687-7387-24d5-8a424b6fb8f0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8AA0:1F122E:47AC1D5:634397F:6A5E29B5 |
| html-safe-nonce | 8024d90e203cedb05fe79d7893db357629c7bb8db89bf868a338baf8094261e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QUEwOjFGMTIyRTo0N0FDMUQ1OjYzNDM5N0Y6NkE1RTI5QjUiLCJ2aXNpdG9yX2lkIjoiMjI4NDcxMjA1OTY2NDczODc0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | aa5e053b61d47e69da9a6dcb13dfc0f9c3e3fda901db1c703d7b420ec6c35a70 |
| hovercard-subject-tag | issue:4290430854 |
| 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/2474/issue_layout |
| twitter:image | https://opengraph.githubassets.com/899970f84bbf80ceaf2df9c24636f5b6c411701dc13901fc77c639d8bd8e00eb/modelcontextprotocol/python-sdk/issues/2474 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/899970f84bbf80ceaf2df9c24636f5b6c411701dc13901fc77c639d8bd8e00eb/modelcontextprotocol/python-sdk/issues/2474 |
| og:image:alt | Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | itomise |
| hostname | github.com |
| expected-hostname | github.com |
| None | 621588b5bccbeb4b6fab0bb72b5de86200d5e6df07dbdabbdb667c8649f6e38d |
| 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 | 14f1e1fce2dc2d662cbf7ef602c59756c2283f9e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width