Skip to content

fix(sep-2243): require -32020 when rejecting standard-header mismatches - #555

Open
cig13zs wants to merge 1 commit into
modelcontextprotocol:mainfrom
cig13zs:fix/sep-2243-standard-header-error-code-must
Open

cig13zs wants to merge 1 commit into
modelcontextprotocol:mainfrom
cig13zs:fix/sep-2243-standard-header-error-code-must

Conversation

@cig13zs

@cig13zs cig13zs commented Oct 15, 2026

Copy link
Copy Markdown

Closes #553.

The standard-header cases in http-header-validation grade the -32020 error code as a SHOULD (errorCodeSeverity: 'WARNING'). The released 2026-07-28 Server Validation text makes it a MUST, for standard and custom headers alike:

When rejecting a request due to header validation failure, servers MUST return HTTP status 400 Bad Request and MUST include a JSON-RPC error response using the following error code: -32020

That second MUST was a SHOULD until modelcontextprotocol/modelcontextprotocol#2863. The scenario description already says MUST; only the grading lagged. Because the server runner doesn't count warnings, a server that rejects correctly but with a different code passes outright:

main:   [sep-2243-server-reject-error-code] WARNING x5 ... Passed: 9/9, 0 failed, 5 warnings
branch: [sep-2243-server-reject-error-code] FAILURE x5 ... Passed: 9/14, 5 failed, 0 warnings

With every caller now wanting FAILURE, the errorCodeSeverity option on createRejectionChecks is removed rather than left with a single value. sep-2243.yaml is updated to match.

Tests: two cases in negative.test.ts run the scenario against an inline server that validates the headers correctly. Rejecting with -32020, every check passes. Rejecting with -32600, the five status checks pass and the five error-code checks fail; that case fails on main. npm run check, npm run build and npm test (643) pass. The scenario is still pending for the everything-server, which doesn't do SEP-2243 validation yet, so CI results for the reference server don't change.

AI disclosure per AI_POLICY.md: the investigation, code and tests were done primarily with Claude Code. The numbers above are from local runs.

The released 2026-07-28 Streamable HTTP text (Server Validation) says
servers rejecting a request for a header validation failure "MUST return
HTTP status 400 Bad Request and MUST include a JSON-RPC error response"
with -32020 (HeaderMismatch); the second MUST was a SHOULD before
modelcontextprotocol/modelcontextprotocol#2863. sep-2243-server-reject-error-code
still graded the standard-header cases as WARNING, so a server answering
400 with any other code passed http-header-validation outright, since the
server runner does not count warnings.

Every rejection now reports FAILURE without -32020, so the severity
option on createRejectionChecks has no remaining WARNING caller and is
removed.

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.

http-header-validation grades -32020 as SHOULD for standard headers; 2026-07-28 Server Validation makes it MUST

1 participant