René's URL Explorer Experiment


Title: Client never retries after -32020 HeaderMismatch, and there is no public way to pre-load the x-mcp-header map (SEP-2243 client SHOULD/MAY both unimplemented) · Issue #3483 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Client never retries after -32020 HeaderMismatch, and there is no public way to pre-load the x-mcp-header map (SEP-2243 client SHOULD/MAY both unimplemented) · Issue #3483 · modelcontextprotocol/python-sdk

X Title: Client never retries after -32020 HeaderMismatch, and there is no public way to pre-load the x-mcp-header map (SEP-2243 client SHOULD/MAY both unimplemented) · Issue #3483 · modelcontextprotocol/python-sdk

Description: Summary At 2026-07-28, a ClientSession that has not listed a tool sends tools/call with no Mcp-Param-* headers, the server rejects it with -32020, and the client stops there. SEP-2243 says it SHOULD re-list and retry, and there is no way...

Open Graph Description: Summary At 2026-07-28, a ClientSession that has not listed a tool sends tools/call with no Mcp-Param-* headers, the server rejects it with -32020, and the client stops there. SEP-2243 says it SHOUL...

X Description: Summary At 2026-07-28, a ClientSession that has not listed a tool sends tools/call with no Mcp-Param-* headers, the server rejects it with -32020, and the client stops there. SEP-2243 says it SHOUL...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Client never retries after -32020 HeaderMismatch, and there is no public way to pre-load the x-mcp-header map (SEP-2243 client SHOULD/MAY both unimplemented)","articleBody":"### Summary\n\nAt `2026-07-28`, a `ClientSession` that has not listed a tool sends `tools/call` with no `Mcp-Param-*` headers, the server rejects it with `-32020`, and **the client stops there**. SEP-2243 says it SHOULD re-list and retry, and there is no way for an application to supply the map instead — `_x_mcp_header_maps` is private and `_absorb_tool_listing` is its only writer.\n\nEverything below reproduces against the SDK's own client and server, no third-party server involved.\n\n### Reproduction\n\n```python\nimport anyio, httpx2, uvicorn\nfrom typing import Annotated\nfrom pydantic import Field\nfrom mcp.client import Client\nfrom mcp.client.streamable_http import streamable_http_client\nfrom mcp.server.mcpserver import MCPServer\nfrom mcp.shared.exceptions import MCPError\n\nserver = MCPServer(\"repro\")\n\n@server.tool()\nasync def fetch(\n    owner: Annotated[str, Field(json_schema_extra={\"x-mcp-header\": \"owner\"})],\n) -> str:\n    \"\"\"One annotated argument, as the SEP's examples have.\"\"\"\n    return f\"fetched for {owner}\"\n\nURL = \"http://127.0.0.1:8931/mcp\"\n\nasync def exercise() -> None:\n    await anyio.sleep(1.5)\n    async with httpx2.AsyncClient() as http:\n        print(\"== a session that never listed ==\")\n        async with Client(streamable_http_client(URL, http_client=http), mode=\"auto\") as client:\n            print(\"negotiated:\", client.protocol_version)\n            try:\n                r = await client.call_tool(\"fetch\", {\"owner\": \"octocat\"})\n                print(\"   result:\", r.content)\n            except MCPError as exc:\n                print(f\"   MCPError code={exc.error.code}\")\n                print(f\"   message={exc.error.message!r}\")\n\n        print(\"== a session that listed first ==\")\n        async with Client(streamable_http_client(URL, http_client=http), mode=\"auto\") as client:\n            await client.list_tools()\n            r = await client.call_tool(\"fetch\", {\"owner\": \"octocat\"})\n            print(\"   result:\", r.content)\n\nasync def main() -> None:\n    config = uvicorn.Config(server.streamable_http_app(), host=\"127.0.0.1\", port=8931, log_level=\"error\")\n    http_server = uvicorn.Server(config)\n    async with anyio.create_task_group() as tg:\n        tg.start_soon(http_server.serve)\n        await exercise()\n        http_server.should_exit = True\n\nanyio.run(main)\n```\n\nOutput on `mcp` 2.1.1:\n\n```\n== a session that never listed ==\nnegotiated: 2026-07-28\n   MCPError code=-32020\n   message=\"Mcp-Param-owner header is missing but the request body's 'owner' argument is present\"\n== a session that listed first ==\n   result: [TextContent(type='text', text='fetched for octocat', ...)]\n```\n\nThe `-32020` arrives as HTTP 400. The client neither re-lists nor retries.\n\n### What the spec asks for\n\nSEP-2243, *Client Behavior*:\n\n> **Implementation Note**: Clients MUST construct `Mcp-Param-*` headers using the most recently obtained `inputSchema` for the tool. A client that has never obtained the tool's `inputSchema` SHOULD send the request without `Mcp-Param-*` headers. **If the server rejects the request because required `Mcp-Param-*` headers are missing or do not match the body, the client SHOULD call `tools/list` to obtain the current `inputSchema`, then retry the original request with the appropriate headers.** Clients MAY pre-load tool definitions via other means (e.g., from a previous session or configuration) to enable header emission without a prior `tools/list` call.\n\nTwo mechanisms in one paragraph. The SDK implements neither.\n\n`HEADER_MISMATCH` has **zero** readers under `mcp/client/` — every occurrence is server-side (`mcp/server/_streamable_http_modern.py`, `mcp/shared/inbound.py`), producing the rejection rather than reacting to one.\n\n### Why the second half matters as much as the first\n\nAn application that opens a session per operation — for connection hygiene, or because it holds no long-lived session — has the schema in hand already, from the listing it built its tool surface with. The SEP explicitly blesses using it (*\"MAY pre-load tool definitions via other means\"*). But `_x_mcp_header_maps` is private, and the only writer is `_absorb_tool_listing`, reachable only through an in-session `list_tools()`. So the sanctioned cheap path is unreachable and the only route is a redundant wire request per call.\n\nFor us that request is ~1.3 s and ~122 KiB against a 44-tool server, paid on the calling session purely to repopulate state we already had.\n\n### What this cost, concretely\n\nWe hit this in production against the GitHub MCP server: **36 of its 44 tools** were refused with `-32020`, because our client opens one session per `tools/call` and never lists on it. The client-side symptom was a bare `-32020` from the server; nothing on our side could say why, because:\n\n`ClientSession._resolve_param_headers` (`mcp/client/session.py:1118`) returns `{}` silently when the session holds no map for the tool:\n\n```python\ndef _resolve_param_headers(self, name: str, arguments: Mapping[str, Any]) -> dict[str, str]:\n    \"\"\"`Mcp-Param-*` headers for a `tools/call`, or empty when the tool was never listed.\"\"\"\n    header_map = self._x_mcp_header_maps.get(name)\n    if header_map is None:\n        return {}\n    return mcp_param_headers(header_map, arguments)\n```\n\nAt a modern protocol version, \"this tool was never listed on this session\" is a strong signal that the call is about to be refused. The listing filter one screen away already logs when it drops a tool (`logger.warning(\"dropping tool %r: invalid x-mcp-header (%s)\", ...)`), so the precedent for saying something here is right there.\n\n### Suggested fixes, in the order we would value them\n\n1. **A public way to seed the map** — e.g. `ClientSession.preload_tool_listing(result)`, or a `tools=` argument to `adopt()`. Implements the SEP's \"MAY pre-load\" sentence, and lets a session-per-call client emit correct headers with no extra round trip.\n2. **The `-32020` retry**, bounded to one attempt: re-list, rebuild, resend. This is the SHOULD, and it is the only thing that heals a schema that gains an annotation mid-session.\n3. **A warning in `_resolve_param_headers`** when a modern session has no map for the tool it is calling. Cheapest of the three, and the one that would have turned our incident into a log line instead of an investigation.\n\nHappy to open a PR for any of these if the direction is agreeable — 1 and 3 look small; 2 needs a decision about where the retry lives relative to `validate_tool_result`.\n\n### Environment\n\n- `mcp` 2.1.1, `mcp-types` 2.1.1, Python 3.12.9\n- Transport: streamable HTTP, `mode=\"auto\"`, negotiated `2026-07-28`\n","author":{"url":"https://github.com/atsuki-shirasawa","@type":"Person","name":"atsuki-shirasawa"},"datePublished":"2026-09-09T01:28:29Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3483"}

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:040c7718-7533-18bb-1c80-47f11d1ca9f9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8C7C:FC5BE:12C517D:18F36B7:6B0123A1
html-safe-nonce2110451a272f789b00277f86ecceeaa34cb7c4b8b64ec174569b0d67960d98be
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QzdDOkZDNUJFOjEyQzUxN0Q6MThGMzZCNzo2QjAxMjNBMSIsInZpc2l0b3JfaWQiOiIzMTQ5Mzk3NDA3MTA0NTc0MzcwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacacb2a34562f6f52fee1daf183c91cf5447f54c3787dab2a34d4e44847c023cd0
hovercard-subject-tagissue:5393775217
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/3483/issue_layout
twitter:imagehttps://opengraph.githubassets.com/77b0385d40e9fca361998eeb7900694925f1110b837029553cfdbca20fdbe4e8/modelcontextprotocol/python-sdk/issues/3483
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/77b0385d40e9fca361998eeb7900694925f1110b837029553cfdbca20fdbe4e8/modelcontextprotocol/python-sdk/issues/3483
og:image:altSummary At 2026-07-28, a ClientSession that has not listed a tool sends tools/call with no Mcp-Param-* headers, the server rejects it with -32020, and the client stops there. SEP-2243 says it SHOUL...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameatsuki-shirasawa
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
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
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/3483#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F3483
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%2F3483
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/3483
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3483
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3483
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues310 (310)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/3483
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3483
#3627https://github.com/modelcontextprotocol/python-sdk/pull/3627
Client never retries after -32020 HeaderMismatch, and there is no public way to pre-load the x-mcp-header map (SEP-2243 client SHOULD/MAY both unimplemented)https://github.com/modelcontextprotocol/python-sdk/issues/3483#top
#3627https://github.com/modelcontextprotocol/python-sdk/pull/3627
spec-2026-07-28Concerns the SDK's implementation of the 2026-07-28 MCP spec revisionhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22spec-2026-07-28%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/atsuki-shirasawa
atsuki-shirasawahttps://github.com/atsuki-shirasawa
on Sep 9, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3483#issue-5393775217
https://github.com/atsuki-shirasawa
atsuki-shirasawahttps://github.com/atsuki-shirasawa
on Sep 9, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3483#issuecomment-5594577225
#3442https://github.com/modelcontextprotocol/python-sdk/pull/3442
https://github.com/Ben-Home
Ben-Homehttps://github.com/Ben-Home
on Sep 9, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3483#issuecomment-5604060199
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
spec-2026-07-28Concerns the SDK's implementation of the 2026-07-28 MCP spec revisionhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22spec-2026-07-28%22
on Sep 10, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3483#event-30881386752
https://github.com/tahakotil
tahakotilhttps://github.com/tahakotil
on Sep 11, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3483#issuecomment-5630779908
ChatGPT Codex Connectorhttps://www.chatgpt.com
maxisbeyhttps://github.com/maxisbey
completedhttps://github.com/modelcontextprotocol/python-sdk/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#3627https://github.com/modelcontextprotocol/python-sdk/pull/3627
on Oct 2, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3483#event-32339496844
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
on Oct 2, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3483#issuecomment-5956958075
#3627https://github.com/modelcontextprotocol/python-sdk/pull/3627
Header parametershttps://py.sdk.modelcontextprotocol.io/advanced/header-parameters/
modelcontextprotocol/modelcontextprotocol#3071https://github.com/modelcontextprotocol/modelcontextprotocol/pull/3071
AI Disclaimerhttps://gist.github.com/maxisbey/6123d132484e4c533eab519a2800693d
Sign up for freehttps://github.com/signup?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3483
Sign in to commenthttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3483
spec-2026-07-28Concerns the SDK's implementation of the 2026-07-28 MCP spec revisionhttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22spec-2026-07-28%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.