Repository navigation
Conversation
… body Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dual-era endpoint parsed the body before routing, so a body that did not parse got 400 even when Accept or Content-Type should have answered 406 or 415 first, and the transport's onError never fired. Without a request-scoped version header such a body is handshake-era traffic, so hand it to the legacy transport, which judges headers first, answers its own -32700 and reports the error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Why
Goal: close the confirmed review findings on #985 with atomic fixes. Follow-up to #985.
On main (af5d784), every POST to
mcpStatelessStreamableHttpwent throughStreamableHttpServerTransport. That transport judgesAccept(406) andContent-Type(415) before the body, and answers invalid JSON with-32700 "Parse error: <detail>"plus_onError. The dual-era entry on this branch parses the body first. So a malformed body with a badAcceptorContent-Typegot 400, and_onErrornever fired.What changed
In
mcpDualEraStreamableHttpEndpoint, a body that does not parse goes to the legacy leg unlessMCP-Protocol-Versionnames a request-scoped revision. That is the rule the classifier already applies to bodies that make no claim. The legacy transport then answers exactly as on main. A malformed body under a request-scoped header still gets the existing JSON-RPC-32700on 400.Scope
Only bodies that fail to parse as JSON. Parseable bodies are routed as before.
Tradeoffs
Checking
AcceptandContent-Typein the entry would duplicate the transport's rules. Routing to the transport reuses them unchanged.Blast Radius
Legacy clients sending malformed JSON get main's statuses and messages back. The endpoint builds a throwaway
Serversession for such a request, as it did on main.Verification
StatelessStreamableHttpMalformedBodyTest): "a malformed body with an unacceptable Accept header answers 406" wasexpected:<406> but was:<400>. "a malformed body with an unsupported Content-Type answers 415" wasexpected:<415> but was:<400>. Both pass after the fix._onErrorhas no public observer on this endpoint. A temporary print in the transport's catch showed it fire withJsonDecodingExceptionafter the fix. The print was then removed.:kotlin-sdk-server:jvmTest,ktlintCheck detekt checkKotlinAbiall pass.🤖 Generated with Claude Code