Skip to content

Serve 2025-era clients as well as 2026-07-28 - #8

Merged
afternoon merged 1 commit into
mainfrom
claude/mcp-https-redirect-uri-cc9b65
Aug 31, 2026
Merged

afternoon merged 1 commit into
mainfrom
claude/mcp-https-redirect-uri-cc9b65

Conversation

@afternoon

Copy link
Copy Markdown
Owner

claude mcp add could not connect:

{"jsonrpc":"2.0","error":{"code":-32022,"message":"Unsupported protocol version: 2025-11-25",
"data":{"supported":["2026-07-28"],"requested":"2025-11-25"}},"id":0}

Why

The endpoint was modern-only (legacy: "reject"), on the reasoning that one era means one code path and no 2025 exchange served by accident. The client in question opens the plain 2025 handshake without negotiating, so it was refused before it ever reached a tool. Strictness that turns away the clients you have buys nothing.

Measured, not assumed: pointed at a bare local recorder — no auth, no TLS, no Cloudflare — that client sends initialize with protocolVersion: 2025-11-25 and no server/discover probe at all. Everything else was ruled out first: the CLI version (2.1.236 and 2.1.252 behave identically), OAuth credentials, the cached discoveryState shape, HTTPS, and the Cloudflare edge (a hand-built probe carrying the same headers and body reaches the Worker and gets a clean 401).

The change

legacy: "stateless" in api.mcp.ts. The legacy leg is the SDK's own stateless fallback built from the same buildMcpServer factory, so the two eras cannot drift: a 2025-era client gets what a 2026-era one gets, a revision behind. It costs a 405 on GET and DELETE — the 2025 session operations, which this endpoint never had — and authorization is untouched, since both eras go through the same token. A client that negotiates is still served 2026-07-28, decided per request by the SDK's own probe.

Tests

e2e/mcpFlow.test.ts now pins both eras instead of the rejection:

  • a client pinned to 2026-07-28 connects and sees the write tools;
  • a client that never negotiates (era: "legacy", the SDK's own default mode) connects, lists the same six tools, and writes a document through them;
  • an unknown revision is still answered with the supported list rather than a best guess.

Reverting the option makes the second test fail with the exact -32022 above, so this is a regression test rather than a description. bun run check, bun run test:unit (443 passed) and bun run test:e2e (16 passed) are green.

e2e/agent.ts grows an era option so a test says which era it is exercising rather than inheriting whatever the SDK defaults to next.


Generated by Claude Code

`claude mcp add` could not connect. Its client opens the plain 2025
handshake without negotiating, so the endpoint answered

    -32022 Unsupported protocol version: 2025-11-25

before a tool was ever listed. `legacy: "reject"` was chosen on the
reasoning that one era means one code path and no 2025 exchange served by
accident; what changes it is evidence rather than taste. Strictness that
turns away the clients you have buys nothing.

The legacy leg is the SDK's own stateless fallback over this same
`buildMcpServer` factory, which is what keeps the eras from drifting: a
2025-era client gets what a 2026-era one gets, a revision behind. It costs
a 405 on GET and DELETE — the 2025 session operations, which this endpoint
never had — and leaves authorization untouched, since both eras go through
the same token. A client that negotiates is still served 2026-07-28, per
request, decided by the SDK's own probe.

The end-to-end suite now pins both eras rather than the rejection: a
pinned-modern client, and one that never negotiates, which lists the same
six tools and writes a document through them. Reverting the option fails
that second test with the exact `-32022` above, so the day every client
negotiates, dropping the legacy leg is a one-line change with a test to say
whether it is safe yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MMUJEj5inbsz7XKDrCU6Aa
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
htmlcsspdf 47bd30f Commit Preview URL

Branch Preview URL
Aug 31 2026, 10:49 PM

@afternoon
afternoon marked this pull request as ready for review August 31, 2026 22:49
@afternoon
afternoon merged commit 0557200 into main Aug 31, 2026
2 checks passed
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.

2 participants