René's URL Explorer Experiment


Title: streamable HTTP client: the standalone GET stream advertises Accept: application/json but can only read text/event-stream, then gives up silently · Issue #3503 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: streamable HTTP client: the standalone GET stream advertises Accept: application/json but can only read text/event-stream, then gives up silently · Issue #3503 · modelcontextprotocol/python-sdk

X Title: streamable HTTP client: the standalone GET stream advertises Accept: application/json but can only read text/event-stream, then gives up silently · Issue #3503 · modelcontextprotocol/python-sdk

Description: AI disclosure: I used Claude Code to read the transport, capture the headers and build the reproduction. I hit the problem myself, ran the repro, and stand behind the report. Initial Checks 2.2.0 (latest 2.x). The two files involved are ...

Open Graph Description: AI disclosure: I used Claude Code to read the transport, capture the headers and build the reproduction. I hit the problem myself, ran the repro, and stand behind the report. Initial Checks 2.2.0 (...

X Description: AI disclosure: I used Claude Code to read the transport, capture the headers and build the reproduction. I hit the problem myself, ran the repro, and stand behind the report. Initial Checks 2.2.0 (...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/3503

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"streamable HTTP client: the standalone GET stream advertises Accept: application/json but can only read text/event-stream, then gives up silently","articleBody":"_AI disclosure: I used Claude Code to read the transport, capture the headers and build the reproduction. I hit the problem myself, ran the repro, and stand behind the report._\n\n### Initial Checks\n\n- `2.2.0` (latest 2.x). The two files involved are byte-identical at `upstream/main` (`9972c21a`); `v1.x` has the same shape.\n- Searched first. Nearby reports cover the server side of the GET (#3102, #2474, PR #3129), Accept quality factors (#3154), and the reconnect loop (#3257, #3356, #2393). None covers the `Accept` the client sends.\n\n### Release line\n\n2.x (current stable)\n\n### Description\n\n`StreamableHTTPTransport._prepare_headers` is written for the POST — `accept: application/json, text/event-stream` plus `content-type: application/json` — but all five outbound requests use it:\n\n| Call site | Request | |\n| --- | --- | --- |\n| `_handle_post_request` | POST with a body | ok |\n| `handle_get_stream` | standalone SSE GET | `Accept` overridden, `Content-Type` with no body |\n| `_handle_resumption_request` | resumption SSE GET | same |\n| `_handle_reconnection` | reconnect SSE GET | same |\n| `terminate_session` | DELETE, no body | `Content-Type` with no body |\n\n`sse_within_origin` sets `_SSE_HEADERS = {\"Accept\": \"text/event-stream\", ...}` and then does `merged.update(headers or {})`, so the caller's `Accept` wins. Those GET responses are read only through `httpx2.EventSource`, which raises `SSEError` for anything but `text/event-stream`: the client offers a representation it will then refuse. On the wire:\n\n```\nGET /mcp\n  accept: application/json, text/event-stream\n  content-type: application/json\n```\n\nThe DELETE carries the same `content-type` with no body.\n\n**What it costs.** Answer that GET with `application/json` and the offer is honoured back at the client:\n\n```\nhttpx2.SSEError: Expected response with content type 'text/event-stream', got 'application/json'.\nDEBUG mcp.client.streamable_http GET stream max reconnection attempts (2) exceeded\n```\n\n`handle_get_stream` swallows it in its broad `except Exception` and returns. Client-to-server requests keep working — the repro still prints its `tools/call` result — so the session looks healthy while notifications, sampling, elicitation and roots are gone for its lifetime, with only a DEBUG line.\n\n**Expected.** The SSE GETs advertise only `text/event-stream`, and the bodyless GET and DELETE carry no `Content-Type`.\n\n**Scope.** Under the 2025-11-25 spec the client is within its rights (it \"**MUST** include an `Accept` header, listing `text/event-stream` as a supported content type\"; listing more is not forbidden) and the server is not (it \"**MUST** either return `Content-Type: text/event-stream` [...] or else return HTTP 405 Method Not Allowed\"). A compliant server never hits this, and the repro's server is deliberately non-compliant. What still looks wrong is offering what the client cannot read, and losing the channel silently when a server takes the offer up; the stray `Content-Type` is wrong regardless. `mcp/client/sse.py` is unaffected — it passes no headers.\n\nThe repro uses `mode=\"legacy\"` because `notifications/initialized` is sent only from `ClientSession.initialize()`; the modern path adopts a `DiscoverResult`, so `start_get_stream` never fires there.\n\n### Example Code\n\n```python\n# server.py — the official server, answering the GET with the content type the client accepts.\nimport uvicorn\nfrom mcp.server.mcpserver import MCPServer\n\nserver = MCPServer(name=\"probe\", version=\"0.1.0\")\n\n\n@server.tool()\ndef echo(text: str) -> str:\n    return text\n\n\nclass TakeTheClientAtItsWord:\n    def __init__(self, app):\n        self.app = app\n\n    async def __call__(self, scope, receive, send):\n        if scope[\"type\"] == \"http\" and scope[\"method\"] == \"GET\":\n            body = b'{\"jsonrpc\":\"2.0\"}'\n            await send({\n                \"type\": \"http.response.start\",\n                \"status\": 200,\n                \"headers\": [(b\"content-type\", b\"application/json\"), (b\"content-length\", str(len(body)).encode())],\n            })\n            await send({\"type\": \"http.response.body\", \"body\": body})\n            return\n        await self.app(scope, receive, send)\n\n\nuvicorn.run(TakeTheClientAtItsWord(server.streamable_http_app()), host=\"127.0.0.1\", port=8000)\n```\n\n```python\n# client.py\nimport asyncio\nimport logging\n\nfrom mcp import Client\n\nlogging.basicConfig(level=logging.DEBUG, format=\"%(levelname)s %(name)s %(message)s\")\n\n\nasync def main() -> None:\n    async with Client(\"http://127.0.0.1:8000/mcp\", mode=\"legacy\") as client:\n        print(\"tools/call still works:\", (await client.call_tool(\"echo\", {\"text\": \"hi\"})).content[0].text)\n        await asyncio.sleep(3)\n\n\nasyncio.run(main())\n```\n\nDrop the `GET` branch from the wrapper and log `scope[\"headers\"]` to see the outgoing headers instead of the failure.\n\n### Python & MCP Python SDK\n\n```Text\nPython 3.14.3 (CPython, macOS arm64)\nmcp 2.2.0, httpx2 2.12.0, httpcore2 2.12.0, anyio 4.15.1, uvicorn 0.52.4\n```\n","author":{"url":"https://github.com/clemlesne","@type":"Person","name":"clemlesne"},"datePublished":"2026-09-14T16:56:25Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3503"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:7db23a1f-3313-fd02-e3eb-1d1df605bc62
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD6D0:3F8A67:1308D1:1A1F0C:6B00BCDA
html-safe-nonce2bdf6ccc4816bbd6ae58c9ed6eb3a263b9eb59277235ceff42e3041ddf2cfc9d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkQwOjNGOEE2NzoxMzA4RDE6MUExRjBDOjZCMDBCQ0RBIiwidmlzaXRvcl9pZCI6IjgyNzU0MDc4NzM5ODQwMjE4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacf09a361c9339ed65b2c2d78677982e7e9ef43b646aefd0387333ca5a64536b13
hovercard-subject-tagissue:5452207074
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/3503/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5cf2a283770f7df0d8c799c7e6563432a764293f31622bd49479582ff8ef1345/modelcontextprotocol/python-sdk/issues/3503
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5cf2a283770f7df0d8c799c7e6563432a764293f31622bd49479582ff8ef1345/modelcontextprotocol/python-sdk/issues/3503
og:image:altAI disclosure: I used Claude Code to read the transport, capture the headers and build the reproduction. I hit the problem myself, ran the repro, and stand behind the report. Initial Checks 2.2.0 (...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameclemlesne
hostnamegithub.com
expected-hostnamegithub.com
None93edd3bebc4afb7ce711ee74cb5d2a95927850b082a4d43e212222389cb1c415
turbo-cache-controlno-preview
go-importgithub.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git
octolytics-dimension-user_id182288589
octolytics-dimension-user_loginmodelcontextprotocol
octolytics-dimension-repository_id862584018
octolytics-dimension-repository_nwomodelcontextprotocol/python-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id862584018
octolytics-dimension-repository_network_root_nwomodelcontextprotocol/python-sdk
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release1fee81a280ea86312b69448e261b418189bfd5b5
ui-targetcanary-1
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/3503#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F3503
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F3503
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3503
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3503
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3503
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues308 (308)https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests112 (112)https://github.com/modelcontextprotocol/python-sdk/pulls
Actionshttps://github.com/modelcontextprotocol/python-sdk/actions
Projectshttps://github.com/modelcontextprotocol/python-sdk/projects
Security and quality12 (12)https://github.com/modelcontextprotocol/python-sdk/security
Insightshttps://github.com/modelcontextprotocol/python-sdk/insights
https://github.com/modelcontextprotocol/python-sdk
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3503
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3503
streamable HTTP client: the standalone GET stream advertises Accept: application/json but can only read text/event-stream, then gives up silentlyhttps://github.com/modelcontextprotocol/python-sdk/issues/3503#top
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
v1Affects the v1.x maintenance linehttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v1%22
v2Affects the v2 line (2.x on main)https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
https://github.com/clemlesne
clemlesnehttps://github.com/clemlesne
on Sep 14, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3503#issue-5452207074
Streamable HTTP server never returns the spec-mandated 405 for GET requests it won't serve as SSE (406/400 instead) — breaks client SSE-probe fallback #3102https://github.com/modelcontextprotocol/python-sdk/issues/3102
Return 405 on GET when stateless_http=True #2474https://github.com/modelcontextprotocol/python-sdk/issues/2474
fix: return 405 for pre-session GET the server won't serve as SSE #3129https://github.com/modelcontextprotocol/python-sdk/pull/3129
Fix Streamable HTTP Accept header quality-factor handling #3154https://github.com/modelcontextprotocol/python-sdk/issues/3154
handle_get_stream reconnects indefinitely when the server ends the GET stream normally (attempt = 0 defeats MAX_RECONNECTION_ATTEMPTS) #3257https://github.com/modelcontextprotocol/python-sdk/issues/3257
bug(client/streamable_http): prevent infinite SSE reconnect loops with bounded exponential backoff #3356https://github.com/modelcontextprotocol/python-sdk/issues/3356
StreamableHTTP client: _handle_reconnection resets attempt counter to 0, causing infinite retry loop #2393https://github.com/modelcontextprotocol/python-sdk/issues/2393
https://github.com/Ben-Home
Ben-Homehttps://github.com/Ben-Home
on Sep 14, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3503#issuecomment-5667731440
claudehttps://github.com/apps/claude
v2Affects the v2 line (2.x on main)https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
v1Affects the v1.x maintenance linehttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v1%22
on Sep 14, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3503#event-31119225732
https://github.com/Rainmemery
Rainmemeryhttps://github.com/Rainmemery
on Sep 15, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3503#issuecomment-5675743198
claudehttps://github.com/apps/claude
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
on Oct 8, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3503#event-32781140489
Sign up for freehttps://github.com/signup?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3503
Sign in to commenthttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3503
bugSomething isn't workinghttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
v1Affects the v1.x maintenance linehttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v1%22
v2Affects the v2 line (2.x on main)https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.