René's URL Explorer Experiment


Title: MCPServer has no x-mcp-header declaration mechanism and never validates one, so an invalid annotation is served happily and dropped by every client · Issue #3484 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: MCPServer has no x-mcp-header declaration mechanism and never validates one, so an invalid annotation is served happily and dropped by every client · Issue #3484 · modelcontextprotocol/python-sdk

X Title: MCPServer has no x-mcp-header declaration mechanism and never validates one, so an invalid annotation is served happily and dropped by every client · Issue #3484 · modelcontextprotocol/python-sdk

Description: Summary MCPServer offers no way to mark a tool parameter with x-mcp-header, and does not validate the annotation when one is smuggled in through pydantic. A server author who gets it wrong gets no signal at all: the tool is served happil...

Open Graph Description: Summary MCPServer offers no way to mark a tool parameter with x-mcp-header, and does not validate the annotation when one is smuggled in through pydantic. A server author who gets it wrong gets no ...

X Description: Summary MCPServer offers no way to mark a tool parameter with x-mcp-header, and does not validate the annotation when one is smuggled in through pydantic. A server author who gets it wrong gets no ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"MCPServer has no x-mcp-header declaration mechanism and never validates one, so an invalid annotation is served happily and dropped by every client","articleBody":"### Summary\n\n`MCPServer` offers no way to mark a tool parameter with `x-mcp-header`, and does not validate the annotation when one is smuggled in through pydantic. A server author who gets it wrong gets no signal at all: the tool is served happily, and every conforming client silently drops it.\n\nSEP-2243's *Reference Implementation* section names this as a server-SDK requirement:\n\n> * **Server SDKs**: Provide a mechanism (attribute/decorator) for marking parameters with `x-mcp-header`\n> * **Client SDKs**: Implement the client behavior for extracting and encoding header values\n> * **Validation**: Both sides must validate header/body consistency\n\nThe client half is implemented. The server half is not: `x-mcp-header` appears in `mcp/client/session.py`, `mcp/shared/inbound.py` and `mcp_types/_v2026_07_28/`, and **nowhere under `mcp/server/`**.\n\n### 1. No declaration mechanism\n\nThe only route is pydantic passthrough:\n\n```python\n@server.tool()\nasync def fetch(\n    owner: Annotated[str, Field(json_schema_extra={\"x-mcp-header\": \"owner\"})],\n) -> str:\n    ...\n```\n\nThis works — the annotation reaches `inputSchema`, the client mirrors it, `mcp/shared/inbound.py` validates it — so this is an ergonomics and discoverability gap rather than a functional one. But it means the feature is invisible from the server API, and that a server author must know the extension keyword's exact spelling from the spec.\n\n### 2. Nothing validates the declaration server-side\n\nThis is the part that fails silently. SEP-2243 puts type restrictions on `x-mcp-header` and assigns their enforcement to the server:\n\n> | Test Case | Property Type | x-mcp-header Present | Expected Behavior |\n> | Array type | `\"type\": \"array\"` | Yes | **Server MUST reject tool definition** |\n> | Object type | `\"type\": \"object\"` | Yes | **Server MUST reject tool definition** |\n> | Null type | `\"type\": \"null\"` | Yes | **Server MUST reject tool definition** |\n\n`MCPServer` rejects none of them.\n\n```python\nimport anyio\nfrom typing import Annotated\nfrom pydantic import Field\nfrom mcp.client import Client\nfrom mcp.client._memory import InMemoryTransport\nfrom mcp.server.mcpserver import MCPServer\n\nserver = MCPServer(\"repro\")\n\n@server.tool()\nasync def bad(\n    tags: Annotated[list[str], Field(json_schema_extra={\"x-mcp-header\": \"Tags\"})],\n) -> str:\n    \"\"\"An array parameter annotated x-mcp-header -- the spec says reject.\"\"\"\n    return \"ok\"\n\nasync def main() -> None:\n    async with Client(InMemoryTransport(server), mode=\"auto\") as client:\n        print(\"negotiated:\", client.protocol_version)\n        result = await client.list_tools()\n        print(\"tools the client kept:\", [t.name for t in result.tools])\n\nanyio.run(main)\n```\n\nOutput on `mcp` 2.1.1:\n\n```\nWARNING  dropping tool 'bad': invalid x-mcp-header (property 'tags':\n         x-mcp-header is only permitted on integer/string/boolean\n         properties (got 'array'))\nnegotiated: 2026-07-28\ntools the client kept: []\n```\n\nRegistration succeeded, startup succeeded, `tools/list` served it. The client — correctly, per the client-side MUST — drops it. So the failure mode is **a tool that exists on the server and is invisible to every client**, with the only diagnostic emitted in the client's process, which in a real deployment belongs to someone else.\n\nThe validator that would catch this already exists and is already imported by the server package's transport: `find_invalid_x_mcp_header` in `mcp/shared/inbound.py`. It is simply never run against a tool the server itself is registering.\n\n### Suggested fixes\n\n1. **Run `find_invalid_x_mcp_header` at tool-registration time** and raise. This is the one that matters: it turns a silent cross-process failure into an error at the line that caused it, and it reuses code that is already there.\n2. **A first-class declaration API**, so the extension keyword does not have to be spelled by hand — whatever shape fits the SDK's conventions, e.g. `Annotated[str, McpHeader(\"Region\")]`.\n\nHappy to open a PR for (1) if the direction is agreeable.\n\n### Environment\n\n- `mcp` 2.1.1, `mcp-types` 2.1.1, Python 3.12.9\n- Both reproductions negotiate `2026-07-28`\n","author":{"url":"https://github.com/atsuki-shirasawa","@type":"Person","name":"atsuki-shirasawa"},"datePublished":"2026-09-09T01:28:35Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3484"}

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:6d7a795a-123d-5e78-36d1-a98632c1beff
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD55E:3A73AA:88CF39:ACAAF8:6B01218D
html-safe-nonce1d4fdd1528b75825e22716bb4fc8c2c61713dec6a9def56547f851856c97ad4d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTVFOjNBNzNBQTo4OENGMzk6QUNBQUY4OjZCMDEyMThEIiwidmlzaXRvcl9pZCI6IjM3NTk4NzQyNTc0NDI2NDQzNjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac74badbf27748e435e34f199914375f519043b00cf93edd15d8dc430878660b4a
hovercard-subject-tagissue:5393775805
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/3484/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ba9528d48ee9fe019a3280d63a3f40d1d52d8af548ca95009cc08f426fde4ec9/modelcontextprotocol/python-sdk/issues/3484
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ba9528d48ee9fe019a3280d63a3f40d1d52d8af548ca95009cc08f426fde4ec9/modelcontextprotocol/python-sdk/issues/3484
og:image:altSummary MCPServer offers no way to mark a tool parameter with x-mcp-header, and does not validate the annotation when one is smuggled in through pydantic. A server author who gets it wrong gets no ...
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/3484#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F3484
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%2F3484
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/3484
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3484
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3484
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/3484
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3484
#3620https://github.com/modelcontextprotocol/python-sdk/pull/3620
MCPServer has no x-mcp-header declaration mechanism and never validates one, so an invalid annotation is served happily and dropped by every clienthttps://github.com/modelcontextprotocol/python-sdk/issues/3484#top
#3620https://github.com/modelcontextprotocol/python-sdk/pull/3620
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/3484#issue-5393775805
https://github.com/atsuki-shirasawa
atsuki-shirasawahttps://github.com/atsuki-shirasawa
on Sep 9, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3484#issuecomment-5594577400
#3483https://github.com/modelcontextprotocol/python-sdk/issues/3483
#3442https://github.com/modelcontextprotocol/python-sdk/pull/3442
https://github.com/Dami-wq-k03
Dami-wq-k03https://github.com/Dami-wq-k03
on Sep 9, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3484#issuecomment-5598087566
https://github.com/atsuki-shirasawa
atsuki-shirasawahttps://github.com/atsuki-shirasawa
on Sep 9, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3484#issuecomment-5610452321
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/3484#event-30881385246
maxisbeyhttps://github.com/maxisbey
completedhttps://github.com/modelcontextprotocol/python-sdk/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#3620https://github.com/modelcontextprotocol/python-sdk/pull/3620
on Oct 2, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3484#event-32331778486
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
on Oct 2, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3484#issuecomment-5957019814
#3620https://github.com/modelcontextprotocol/python-sdk/pull/3620
Header parametershttps://py.sdk.modelcontextprotocol.io/advanced/header-parameters/
AI Disclaimerhttps://gist.github.com/maxisbey/6123d132484e4c533eab519a2800693d
Sign up for freehttps://github.com/signup?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3484
Sign in to commenthttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3484
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.