Add json-rpc-batch-rejection scenario for 2025-06-18+#381
Open
canardleteer wants to merge 1 commit into
Open
Conversation
…-06-18+ Add server scenario with check json-rpc-batch-rejected for spec versions where POST bodies MUST be a single JSON-RPC message. Stateful probe initializes a session before posting a [ping, ping] batch; draft uses a stateless two-method batch. Includes negative fixture, unit tests, vitest with draft lifecycle and acceptance details, and everything-server array guard for all-scenarios.test.ts. Fixes modelcontextprotocol#378
d928845 to
0cf3fe0
Compare
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.
Closes #378
Summary
json-rpc-batch-rejectionwith checkjson-rpc-batch-rejectedfor spec versions ≥2025-06-18, exercising the Streamable HTTP transport MUST that the POST body be a single JSON-RPC message (not a JSON array).[ping, ping]batch so rejection is tested on batch handling rather than unrelated session routing errors.accepts-json-rpc-batch.ts, unit tests for acceptance/rejection helpers, and an early array guard ineverything-serverso the reference server passesall-scenarios.test.ts(documented in code — negative proof remains in the broken fixture per AGENTS.md).Test plan
npm run buildnpm test(338 tests, includingall-scenarios.test.ts/json-rpc-batch-rejection)npm test -- src/scenarios/server/negative.test.ts(json-rpc-batch-rejected→FAILUREagainstaccepts-json-rpc-batch.ts)npm test -- src/scenarios/server/json-rpc-batch-rejection.test.tsnode dist/index.js server --url http://127.0.0.1:<port>/mcp --scenario json-rpc-batch-rejection --spec-version 2025-11-25againsteverything-server→SUCCESSnode dist/index.js sdk typescript-sdk-v1 --mode server --scenario json-rpc-batch-rejection --spec-version 2025-11-25→json-rpc-batch-rejectedFAILURE (typescript-sdk v1.x accepts batch arrays at 2025-11-25; intentional Tier-1 signal for that spec version until the SDK fixes batch rejection)--spec-version 2025-03-26— CLI:SKIPPED: … not applicable … (introduced in 2025-06-18), exit 0--spec-version draftrun against everything-server →json-rpc-batch-rejectedSUCCESS (stateless draft batch probe)Notes for reviewers
4xxwith a single JSON-RPC error object (not strict-32600) until SDKs converge on error codes.--spec-version 2025-03-26skips it entirely.--spec-version(or otherwise explicitly opting out of claiming full conformance at 2025-06-18+). The check is active, not pending; the margin is which spec version the SDK holds itself to.all-scenarios; failure proof is the separate negative fixture.