Repository navigation
Route Streamable HTTP era from the request envelope, not only the header - #3868
andrevegas wants to merge 2 commits into
Conversation
StreamableHTTPSessionManager chose the protocol era from the MCP-Protocol-Version header alone, so a request carrying the 2026-07-28 `_meta` envelope with a 2025-era or missing header was served by the legacy path: tools/list answered 200 with a 2025-shaped result and modern-only methods such as server/discover answered 200 with -32601. The 2026-07-28 transport requires 400 with HeaderMismatch (-32020) when the header does not match the envelope. Peek at the POST body (already buffered and size-limited by RequestBodyLimitMiddleware) and send requests that carry the envelope to the modern entry, whose classifier already produces HeaderMismatch. The body is replayed untouched. Unparseable bodies, notifications, batches and `initialize` stay on the legacy path, as in the stdio runner. Share the era predicate as mcp.shared.inbound.has_modern_envelope so stdio and HTTP use one definition. Refs modelcontextprotocol#3863 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ing docs An `initialize` carrying the reserved 2026-07-28 version key with a 2025-era or missing header was still served by the legacy handshake, so the same body got a successful handshake or a modern rejection depending only on the header. A handshake never carries the reserved key, so route it like any other enveloped request and let the modern entry answer HeaderMismatch. Ordinary legacy `initialize` requests are unchanged and covered by tests. Document that routing now also considers the 2026-07-28 envelope. Refs modelcontextprotocol#3863 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
This PR has been closed automatically. This repo only keeps pull requests open when they come from a maintainer, or from a contributor a maintainer has assigned to the linked issue, and you aren't currently assigned to #3863. If a maintainer assigns you to #3863, this PR reopens on its own and there's nothing more you need to do here. Assignment is a maintainer call based on capacity; comments that only ask to be assigned don't factor in. What does help is engaging on the issue itself by confirming the repro, explaining why it matters for your use case, or describing the approach you'd take. You're welcome to keep pushing commits here (just avoid force-pushing, since GitHub can't reopen a rewritten branch), but that on its own won't get the PR reviewed or the issue assigned, and realistically most auto-closed PRs stay closed. There's no need to open a new PR either way. CONTRIBUTING.md has the full reasoning, but in short:
Maintainers: reopen, remove |
Fixes #3863
StreamableHTTPSessionManagerchooses the protocol era from theMCP-Protocol-Versionheader alone. A request that carries the 2026-07-28_metaenvelope with a 2025-era or missing header is therefore served by the legacy path (HTTP 200) instead of being rejected with400/-32020(HeaderMismatch), as the 2026-07-28 transport requires.This follows the approach sketched in the issue: the manager reads the POST body (already buffered and size-limited by
RequestBodyLimitMiddleware) and sends requests that carry the envelope to the modern entry, whose classifier already returns HeaderMismatch. The body is replayed unchanged. The era check moves tomcp.shared.inbound.has_modern_envelope, shared with the stdio runner.Unparseable bodies, notifications and batches stay on the legacy path.
initializeis routed like any other request, since a handshake never carries the reserved version key.Tests cover the mismatch for
tools/list,server/discoverandinitialize(stateless and stateful; 2025-era and missing header), plus controls for valid 2025 and 2026 requests and a plain legacyinitialize. The routing description underdocs/run/is updated.AI disclosure: written with Claude Code. I reproduced the issue and reviewed the change; the full test suite (100% coverage),
pyrightandruffpass locally.