Skip to content

fix(client): accept the draft protocol version the json-schema-ref-no-deref mock advertises#398

Merged
pcarleton merged 1 commit into
mainfrom
fix/issue-397-draft-version-header
Jul 8, 2026
Merged

fix(client): accept the draft protocol version the json-schema-ref-no-deref mock advertises#398
pcarleton merged 1 commit into
mainfrom
fix/issue-397-draft-version-header

Conversation

@claude

@claude claude Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Requested by Paul Carleton · Slack thread

Fixes #397

Before / After

Before: the json-schema-ref-no-deref mock's hand-rolled server/discover handler advertises supportedVersions: ["2026-07-28"], but every other method is delegated to StreamableHTTPServerTransport from the pinned @modelcontextprotocol/sdk@^1.29.0, whose version whitelist tops out at 2025-11-25. A SEP-2575 client that probes server/discover and then honors the negotiated version got HTTP 400 Bad Request: Unsupported protocol version: 2026-07-28 on tools/list, so the sep-2106-no-network-ref-deref check always reported FAILURE ("Client did not call tools/list...") for a fully conformant client.

After: the same client's tools/list succeeds (HTTP 200 with the tool schema), the client can be evaluated on the actual SEP-2106 behavior, and the check passes/fails on $ref handling as intended. Clients sending an already-SDK-supported version (e.g. 2025-11-25) or a genuinely bogus version are unaffected.

How

Extends the existing server/discover workaround (the pattern from #347) to the version whitelist the pinned transport enforces: before delegating a POST to the SDK transport, an incoming MCP-Protocol-Version: 2026-07-28 header — exactly the version the scenario's own server/discover advertises — is rewritten to the SDK's LATEST_PROTOCOL_VERSION. Both req.headers and req.rawHeaders are patched, because the SDK's Node adapter (@hono/node-server) rebuilds its web-standard Request from rawHeaders. A regression test drives the scenario with a stateless SEP-2575 client (via the harness's sendStatelessRequest) that negotiates via server/discover and then calls tools/list with the draft version header; it fails with HTTP 400 without the fix and passes with it.

Local verification: npm run check (typecheck + eslint + prettier), npm test (355 passed), and npm run build all pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N4TdyLB13XSsPwNScYHf4C


Generated by Claude Code

…-deref mock advertises

The scenario's hand-rolled server/discover handler advertises
supportedVersions: ['2026-07-28'], but every other method is delegated
to StreamableHTTPServerTransport from the pinned SDK (^1.29.0), whose
version whitelist tops out at 2025-11-25. A SEP-2575 client that honors
the negotiated version then gets HTTP 400 on tools/list, and the
sep-2106-no-network-ref-deref check can never run.

Extend the existing server/discover workaround to the version check:
rewrite an incoming MCP-Protocol-Version: 2026-07-28 header to the
SDK's LATEST_PROTOCOL_VERSION before delegating (patching rawHeaders
too, since the SDK's Node adapter rebuilds its web-standard Request
from rawHeaders). Add a stateless-draft-client regression test.

Fixes #397

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N4TdyLB13XSsPwNScYHf4C
@pkg-pr-new

pkg-pr-new Bot commented Jul 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

npx https://pkg.pr.new/@modelcontextprotocol/conformance@398

commit: 57083e0

@pcarleton pcarleton marked this pull request as ready for review July 8, 2026 13:56
@pcarleton pcarleton merged commit 5ad96db into main Jul 8, 2026
8 checks passed
@pcarleton pcarleton deleted the fix/issue-397-draft-version-header branch July 8, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

json-schema-ref-no-deref mock rejects the protocol version its own server/discover advertises

2 participants