Skip to content

feat: conformance scenario for MCP-Protocol-Version header 400#241

Open
pja-ant wants to merge 1 commit intomainfrom
protocol-version-header-400-conformance
Open

feat: conformance scenario for MCP-Protocol-Version header 400#241
pja-ant wants to merge 1 commit intomainfrom
protocol-version-header-400-conformance

Conversation

@pja-ant
Copy link
Copy Markdown
Contributor

@pja-ant pja-ant commented Apr 22, 2026

Summary

  • Adds ServerProtocolVersionHeaderScenario testing the spec MUST that servers respond 400 Bad Request to an invalid or unsupported MCP-Protocol-Version header (basic/transports#protocol-version-header).
  • Three header values exercised: a malformed string, and well-formed-but-unsupported dates both before (2000-01-01) and after (2099-01-01) any real version — the past/future pair catches servers doing single-bound string comparison instead of an allowlist.
  • Each value is tested pre-init (no session) and post-init (after a full handshake with valid Mcp-Session-Id), so header validation is isolated from session-ID validation on stateful servers. Six checks total.

Test plan

  • npm run typecheck
  • npm run lint
  • npx vitest run src/scenarios/server/protocol-version-header.test.ts — 7 unit tests
  • Smoke-tested against examples/servers/typescript — 6/6 SUCCESS, post-init bodies confirm "Unsupported protocol version: <value>"

…sponse

Tests the spec MUST (basic/transports#protocol-version-header) that servers
respond with HTTP 400 to requests carrying an invalid or unsupported
MCP-Protocol-Version header.

The scenario sends tools/list with three bad header values:
- malformed: "invalid-protocol-version"
- unsupported past date: "2000-01-01"
- unsupported future date: "2099-01-01"

Each is tested both before initialize (no session) and after a full
initialize handshake (with valid Mcp-Session-Id), so header validation is
isolated from session-ID validation on stateful servers. Six checks total.
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 22, 2026

Open in StackBlitz

npx https://pkg.pr.new/@modelcontextprotocol/conformance@241

commit: 878c03e

@pja-ant pja-ant requested review from felixweinberger and pcarleton and removed request for pcarleton April 22, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant