Repository navigation
Conversation
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.
Problem
The MCP bridge rejected duplicate
jsonrpc,id,result, anderrormembers, but notmethodorparams. Duplicates were silently last-wins:{"jsonrpc":"2.0","id":1,"method":"initialize","method":"ping"}parsed as
ping. The bridge answered it locally and never forwarded the frame, returning success for a request that was never sent.Regression tests before the fix

Fix
Extended the duplicate check in
EnvelopeVisitor::visit_maptomethodandparams. The list now covers every member the adapter interprets: the four request keysMessage::parseaccepts, plusresult/erroron responses.Alternate fix considered:
rejecting every duplicate top-level key would also
reject repeated unknown members in server responses. The bridge never reads
those members, so I kept the existing tolerance and scoped this change to the
fields the adapter interprets.
Regression tests after the fix

Verification
methodandparamscases totests/mcp.rs; both expect-32600, no forwarded request, nonzero exit.methodcase fails onmain(Number(1)vsNull) and passes with the fix.cargo test --locked,cargo fmt --check, andcargo clippy --locked --all-targets -- -D warningspass.cargo test --locked --test mcp bounded_framesProofline review
methodending inping→-32600, zero forwarded requestsparams,jsonrpc,id,result,error→ rejectedinitializeframe still forwards