1717 * named revision belongs to (a malformed envelope behind a present claim is
1818 * a validation error, never a silent fall back to legacy handling).
1919 * - A request without a claim is legacy-era traffic.
20- * - The `MCP-Protocol-Version` header is a cross-check only: it never
21- * upgrades or downgrades a body-derived classification, and a disagreement
22- * between header and body is an explicit ladder outcome.
20+ * - The `MCP-Protocol-Version` header is a cross-check only *for
21+ * classification*: it never upgrades or downgrades a body-derived
22+ * classification, and a disagreement between header and body is an explicit
23+ * ladder outcome. Its absence likewise never changes the era — but the spec
24+ * requires the header on every modern *request* POST, so a
25+ * modern-classified request that omits it is refused one rung later, by
26+ * {@linkcode validateStandardRequestHeaders}, not here. Notification POSTs
27+ * are exempt (see the next bullet), and that rung enforces presence on
28+ * requests only.
2329 * - Notifications carry no envelope claim of their own under the current
2430 * spec, so for notification POSTs without a body claim the modern header is
2531 * determinative; the `Mcp-Method` header is validated against the body when
@@ -320,10 +326,17 @@ export const INBOUND_VALIDATION_LADDER: readonly InboundValidationRungDescriptor
320326 codes : [ HEADER_MISMATCH_ERROR_CODE ] ,
321327 conformance : [ 'http-header-validation' ] ,
322328 rationale :
323- 'SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check ' +
324- '— are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before ' +
325- 'dispatch. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge ' +
326- '`era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the ' +
329+ 'SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and ' +
330+ '`Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the ' +
331+ 'supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every ' +
332+ 'modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri`) and names them ' +
333+ 'in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the ' +
334+ 'presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard ' +
335+ 'headers at all. The classifier’s own header-mismatch cells ' +
336+ '(protocol-version, `Mcp-Method` mismatch) stay on the edge ' +
337+ '`era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing ' +
338+ '`MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. ' +
339+ 'Evaluated before the ' +
327340 'capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by ' +
328341 'the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the ' +
329342 'observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request ' +
@@ -494,6 +507,10 @@ function stripHttpOws(value: string): string {
494507 * `era-classification` rung for the `MCP-Protocol-Version` and
495508 * `Mcp-Method` *mismatch* cells) when:
496509 *
510+ * - the required `MCP-Protocol-Version` header is absent (SEP-2243 requires it
511+ * on every modern *request* POST, and lists it first among the required
512+ * standard headers — so a request missing it *and* `Mcp-Method` is answered
513+ * by this cell);
497514 * - the required `Mcp-Method` header is absent;
498515 * - the required `Mcp-Name` header is absent on a `tools/call`,
499516 * `prompts/get`, or `resources/read` request whose body carries the
@@ -511,14 +528,35 @@ function stripHttpOws(value: string): string {
511528 * call to the classifier (no headers passed) keeps routing a modern request
512529 * unchanged: the classifier remains a pure body-primary router, and this
513530 * function is the presence/`Mcp-Name` half of the standard-header rung the
514- * entry layers on top.
531+ * entry layers on top. That separation is what lets the missing
532+ * `MCP-Protocol-Version` cell live here without disturbing the body-primary
533+ * rule — classification still resolves from the body (a proxy stripping the
534+ * header must not change the era), and only this rung refuses to serve it.
515535 */
516536export function validateStandardRequestHeaders ( request : InboundHttpRequest , route : InboundModernRoute ) : InboundLadderRejection | undefined {
517537 if ( route . messageKind !== 'request' ) {
518538 return undefined ;
519539 }
520540 const method = route . message . method ;
521541
542+ // SEP-2243 names `MCP-Protocol-Version` first among the required standard
543+ // headers, so a request missing both it and `Mcp-Method` is answered by
544+ // the header the spec names first. The presence check lives here rather
545+ // than in `classifyInboundRequest` on purpose: classification stays
546+ // body-primary (a proxy stripping the header must not change the era), and
547+ // only this rung refuses to serve the request.
548+ if ( request . protocolVersionHeader === undefined ) {
549+ const claimed = route . classification . revision ;
550+ return crossCheckMismatch (
551+ 'version-header-missing' ,
552+ '(missing)' ,
553+ claimed === undefined
554+ ? 'the body carries a modern per-request envelope but the required MCP-Protocol-Version header is absent'
555+ : `the body envelope names protocol version ${ claimed } but the required MCP-Protocol-Version header is absent` ,
556+ 'standard-header-validation'
557+ ) ;
558+ }
559+
522560 if ( request . mcpMethodHeader === undefined ) {
523561 return crossCheckMismatch (
524562 'method-header-missing' ,
0 commit comments