Skip to content

feat(initialize): add http-protocol-version-header check for post-init HTTP requests - #609

Open
seedfunded wants to merge 1 commit into
modelcontextprotocol:mainfrom
seedfunded:feat/client-protocol-version-header
Open

seedfunded wants to merge 1 commit into
modelcontextprotocol:mainfrom
seedfunded:feat/client-protocol-version-header

Conversation

@seedfunded

Copy link
Copy Markdown

Summary

Updates #102 (companion to #608, which covers server-side server-version-echo and server-version-negotiate; together they cover all three checks requested in #102).

Following AGENTS.md ("fewer scenarios, more checks"), this extends the existing client initialize scenario (2025-06-18–2025-11-25) with the http-protocol-version-header check (MUST / FAILURE):

  • Records MCP-Protocol-Version on every subsequent HTTP request received after initialize (POST notifications/requests, GET, DELETE) and verifies it matches the negotiated protocolVersion.
  • Fails with per-request violation details if any post-initialize request omits the header or sends a mismatched version.
  • Reports untestableCheck(..., 'FAILURE') per Standardize how scenarios report setup/execution failures #248 if no subsequent HTTP request arrives after initialize.
  • Resets per-run state in start() and keeps getChecks() idempotent.

Testing

  • Added src/scenarios/client/initialize.test.ts (4 tests: conformant @modelcontextprotocol/sdk Client + StreamableHTTPClientTransport pass & idempotency, missing header failure, wrong version failure, and untestable failure when no post-init request arrives).
  • Verified npm run check, npm run build, and npm test (49 test files, 645 tests passing).

…t HTTP requests

Add the client-side `http-protocol-version-header` check to the existing
`initialize` scenario (2025-06-18 through 2025-11-25) per the Streamable
HTTP transport spec: clients MUST include `MCP-Protocol-Version` matching
the negotiated protocol version on all subsequent HTTP requests after
initialization.

- Records `MCP-Protocol-Version` on every post-initialize HTTP request
  (`POST` notifications/requests, `GET`, `DELETE`) and fails if any request
  omits the header or sends a mismatched version.
- Emits `untestableCheck(..., 'FAILURE')` per modelcontextprotocol#248 if no subsequent HTTP
  request arrives after `initialize`.
- Makes `getChecks()` idempotent and resets state in `start()`.
- Adds 4 unit and negative tests in `src/scenarios/client/initialize.test.ts`
  (conformant SDK client pass + idempotency, missing header, mismatched
  version, and no post-init request).

Updates modelcontextprotocol#102

This branch has not been deployed

No deployments
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