Streamable HTTP: no precedence between UnsupportedProtocolVersionError (-32022) and HeaderMismatch (-32020) when an unsupported version arrives without the modern headers
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 53/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- documentation
Research direction
Read the Streamable HTTP Protocol Version Header and Server Validation sections, then compare the compatibility matrix in the versioning docs. The issue describes the required precedence rule and says a draft diff is ready for docs/specification/draft/. Update the relevant specification text and matrix, then confirm they consistently cover unsupported versions, missing headers or _meta fields, and header/body mismatches.
Written by the indexing model from the issue text.
Description
What's broken?
The spec is ambiguous or self-contradictory
Where in the spec or docs?
https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http#protocol-version-header
(also #server-validation on the same page, and
https://modelcontextprotocol.io/specification/2026-07-28/basic/versioning#compatibility-matrix).
The draft pages have the same text.
What should happen?
The spec should say which error a server returns when a request:
- has an
MCP-Protocol-Versionheader naming a version the server does not implement, and - also fails another Server Validation check, typically a missing
Mcp-Method(orMcp-Name) header.
A 2025-11-25 client produces this request whenever it sends the version header, because
that revision has no Mcp-Method header. It also happens with a future modern revision
whose required headers differ from 2026-07-28's.
Proposed rule: judge the version first. If the MCP-Protocol-Version header names a
version the server does not implement, respond with 400 + UnsupportedProtocolVersionError
before checking the other standard headers (Mcp-Method, Mcp-Name, Mcp-Param-*)
and the request's _meta fields, even when those checks would also fail. The single
exception is a version header that is missing, malformed, or disagrees with the body's
_meta io.modelcontextprotocol/protocolVersion: that stays HeaderMismatch (-32020),
as the existing mismatch rule says.
The _meta part is what decides the legacy-client case: a 2025-11-25 request has no
_meta at all, so a rule that ranked only the headers would still leave -32022 against
"missing _meta fields" open.
Why version-first:
- Which headers are required depends on the version. A server that does not
implement a revision cannot tell whether a request conforms to that revision's
header rules. "Mcp-Methodis missing" only means something under 2026-07-28 rules. - Only -32022 lets the client recover.
UnsupportedProtocolVersionErrorcarries
data.supported, and the client "SHOULD select a mutually supported version from the
supportedlist and retry" (versioning.mdx, Protocol Version Negotiation). A
HeaderMismatchgives no version information, and "correct the request" (the Backward
Compatibility advice) doesn't help when the real problem is the version. - It matches an existing SHOULD. versioning.mdx asks a modern-only server to "name
the protocol versions it supports in any error it returns to aninitializerequest",
because legacy clients have no other diagnostic. The -32022data.supporteddoes
exactly this. A -32020 does not.
The other deterministic choice is header-first (Server Validation before the version),
which is what the compatibility matrix currently implies for Legacy client → Modern
server. It also settles the question, but the client never learns the supported versions.
What actually happens?
Two MUSTs apply to the same request, and the spec doesn't rank them.
basic/transports/streamable-http.mdx (2026-07-28), Protocol Version Header, lines 263–269:
If the server does not implement the requested protocol version (whether the
version is unknown to the server, or is a known version the server has chosen
not to support), it MUST respond with400 Bad Requestand an
[UnsupportedProtocolVersionError] listing its supported versions.
Same file, Standard Request Headers, line 290 (Mcp-Method … "All requests") and line 293:
These headers are REQUIRED for compliance.
Same file, Server Validation, lines 597–599 and 623–625:
When rejecting a request due to header validation failure, servers MUST
return HTTP status400 Bad Requestand MUST include a JSON-RPC error
response using the following error code: [-32020HeaderMismatch]Validation failure conditions include:
- A required standard header (
MCP-Protocol-Version,Mcp-Method,Mcp-Name) is missing.
The header/body mismatch rule (lines 257–261) adds a third option, but implementations
agree on it (see below):
The header value MUST match the
io.modelcontextprotocol/protocolVersionfield
carried in the request body's_meta. If the values do not match, the server MUST
reject the request with400 Bad Requestand aHeaderMismatchJSON-RPC error.
basic/versioning.mdx, Compatibility Matrix, line 170 (Legacy → Modern) leans towards
header-first without saying so:
HTTP: the request is missing the required headers and is rejected per server
validation with400 Bad Request[…]
basic/index.mdx lines 133–135 define -32020 and -32022 but give no order.
Where implementations disagreed. While testing two 2026-07-28 implementations
against each other, the request
POST /mcp
MCP-Protocol-Version: 2025-11-25
Content-Type: application/json
{"jsonrpc":"2.0","id":40,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"old","version":"1"}}}
got -32020 from one (Server Validation first) while the other's test expected -32022.
Both readings are defensible from the text. Both projects have since adopted the
version-first order with the mismatch exception:
- zig-sdk v0.6.0 (
src/mcp/transport/envelope.zig,verify/verifyVersion; tests in
src/mcp/transport/http_test.zig), ChristianPresley/zig-sdk#44. For this request it
returns-32022withdata.supported: ["2026-07-28"]anddata.requested: "2025-11-25".
It still returns-32020for a supported version with noMcp-Method, and for a
header that disagrees with_meta. - The 2026-07-28 gateway in a VS Code fork, ChristianPresley/vscode#3
(src/vs/platform/mcp/node/mcpGatewayDispatcher.ts,prepareModernRequest).
It is dual-era, so it servesinitializeas legacy; the precedence applies to requests
it classifies as modern: header and_metanaming the same unsupported revision →
-32022even withoutMcp-Method; missing version header, or header ≠_meta→
-32020.
Conformance suite. The suite does not test the order of these two checks. We examined @modelcontextprotocol/conformance 0.2.0-alpha.12 and the current main. We also ran the suite (2026-10-21).
- No check sends a request that has an unsupported version and an incorrect
Mcp-MethodorMcp-Name. The standard header builder always adds a correctMcp-Method. sep-2575-server-unsupported-version-errorandsep-2575-http-server-unsupported-version-400(server-stateless) sendv999.0.0with correct headers. They examine the 400 status and thedatafields. They do not examine the -32022 code.ServerRejectsMissingMethodHeader(http-header-validation) sends a supported version. For 2026-07-28, this scenario isnot_scored(pending).sep-2575-http-server-header-mismatch-400(supported header,v999.0.0in_meta) expects -32020. This agrees with the mismatch exception above.
Test: We wrote two servers that are the same, except for the order of the checks. For the request above, the version-first server sent -32022 and the header-first server sent -32020. We ran server-stateless, http-header-validation, http-custom-header-server-validation and dns-rebinding-protection on each server. All 56 check results were the same. A control server that breaks the mismatch rule failed only sep-2575-http-server-header-mismatch-400. Thus, the suite runs the validation code, but it accepts both orders.
The stateless mock server (for the client scenarios) applies a third order. It sends -32602 for missing _meta keys before it examines the version. For the 2025-11-25 request above, it sent -32602 without data.supported. It does not examine Mcp-Method. The mock server is not normative, but a spec rule will also settle its order.
The zig-sdk v0.6.0 conformance server sent -32022 with data.supported for the request above. It passed server-stateless (30/30) and http-header-validation (14/14).
The VS Code gateway (ChristianPresley/vscode#4, commit 341562b287a) is a dual-era server. It sent -32022 with data.supported for an unsupported version without Mcp-Method, and for an unsupported version with an incorrect Mcp-Method. It served the 2025-11-25 request above with legacy rules. For the header v999.0.0 and a body without _meta, it sent -32022 with the supported versions of both eras. Before this fix, it selected legacy rules for that request and sent the legacy error -32000. It passed server-stateless (30/30) and http-header-validation (14/14).
Anything else?
- Related, but not the same: #2721 (
initialize.params.protocolVersionvs the header
under 2025-11-25, open), #1943 ("invalid" vs "unsupported" versions, closed). - I have a draft diff ready against
docs/specification/draft/: one paragraph after the
Protocol Version Header's unsupported-version rule, a cross-reference after the Server
Validation list, and a corrected Legacy → Modern HTTP cell in the compatibility matrix.
I also have conformance checks drafted for modelcontextprotocol/conformance (five request combinations, including the request above). I'll open
the PRs if maintainers agree with the direction. - AI disclosure (per AI_POLICY.md): this report and the proposed text were drafted with
Claude Code from my own interop testing of the two implementations above. I reviewed
the spec quotes and the test evidence.
- Dominant language
- TypeScript
- Stars
- 9.8k
- Forks
- 1.9k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 73
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/modelcontextprotocol
-
docs: add Gravitee Access Management to the Enterprise-Managed Authorization implementation tableOpenbug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
modelcontextprotocol/modelcontextprotocol#3583 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 72/100
modelcontextprotocol/modelcontextprotocol#3581 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelcontextprotocol/modelcontextprotocol#3571 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
modelcontextprotocol/modelcontextprotocol#3554 ·
Maintainers usually reply within 1 day
-
Sampling with tools: two small correctionsMay be free again @AbarnaaSree claimed this 19 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
modelcontextprotocol/modelcontextprotocol#3490 · 2 comments ·
Maintainers usually reply within 1 day
All issues in modelcontextprotocol/modelcontextprotocol
Similar issues
-
bug
Difficulty 2/5 Half a day Newbie friendliness 62/100
garethgeorge/backrest#1451 ·
Maintainers usually reply within 1 day
-
fix(core): \.pluck() returns values in key insertion order instead of requested argument orderPossibly taken @ManyaS-Git claimed this 1 day ago. Openstatus:in-linear
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
n8n-io/n8n#45027 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 13 days
-
bug
Difficulty 2/5 Half a day Newbie friendliness 68/100
navikt/skjemabygging-formio#2399 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lidofinance/validator-ejector#233 ·
Maintainers usually reply within 1 day