Repository navigation
Serve 2025-era clients as well as 2026-07-28 - #8
Merged
Merged
Conversation
`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
Deploying with
|
| 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
marked this pull request as ready for review
August 31, 2026 22:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
claude mcp addcould not connect: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
initializewithprotocolVersion: 2025-11-25and noserver/discoverprobe at all. Everything else was ruled out first: the CLI version (2.1.236 and 2.1.252 behave identically), OAuth credentials, the cacheddiscoveryStateshape, 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"inapi.mcp.ts. The legacy leg is the SDK's own stateless fallback built from the samebuildMcpServerfactory, so the two eras cannot drift: a 2025-era client gets what a 2026-era one gets, a revision behind. It costs a405on 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.tsnow pins both eras instead of the rejection:era: "legacy", the SDK's own default mode) connects, lists the same six tools, and writes a document through them;Reverting the option makes the second test fail with the exact
-32022above, so this is a regression test rather than a description.bun run check,bun run test:unit(443 passed) andbun run test:e2e(16 passed) are green.e2e/agent.tsgrows aneraoption so a test says which era it is exercising rather than inheriting whatever the SDK defaults to next.Generated by Claude Code