Skip to main content

Module protocol_version

Module protocol_version 

Source
Expand description

Final MCP protocol-version header validation.

This module models the 2026-07-28 HTTP rule only: every request carries an MCP-Protocol-Version header whose exact value matches the body’s io.modelcontextprotocol/protocolVersion value. Transport code owns HTTP header parsing and supplies the already-decoded field value here.

Structs§

FinalHttpRequestMetadata
HTTP metadata mirrored from the final JSON-RPC request body.
FinalProtocolVersion
A validated final protocol version.
FinalRequestAdmission
A request admitted through the final protocol-version boundary.
HeaderMismatchError
Typed local detail for a final HeaderMismatchError.
MissingRequiredClientCapabilityError
Typed final error data for a missing required client capability.
RequestVersionMetadata
The request metadata whose HTTP and JSON body values mirror each other.
UnsupportedProtocolVersionError
Typed data for a final unsupported-protocol-version response.

Enums§

HeaderMismatchReason
The exact header/body condition that failed final request admission.
ProtocolVersionError
Why final protocol-version validation rejected a request.
RequestAdmissionError
Typed failure from final request version admission.
RequiredCapabilitiesError
Why a caller could not construct required-capabilities error data.

Constants§

FINAL_PROTOCOL_VERSION
The final protocol version implemented by this narrow modern surface.
HEADER_MISMATCH_ERROR_CODE
The final MCP JSON-RPC code for malformed, missing, or mismatched headers.
MAX_REQUIRED_CAPABILITIES_ERROR_DATA_BYTES
The maximum encoded size accepted for typed required-capabilities error data.
MCP_METHOD_HEADER
The HTTP header that mirrors the JSON-RPC request method.
MCP_NAME_HEADER
The HTTP header that mirrors a method-specific tool, resource, or prompt name.
MCP_PROTOCOL_VERSION_HEADER
The HTTP header that mirrors the body’s protocol-version metadata.
MISSING_REQUIRED_CLIENT_CAPABILITY_ERROR_CODE
The final MCP JSON-RPC code for a missing required client capability.
SUPPORTED_FINAL_PROTOCOL_VERSIONS
The exact protocol versions admitted by this final-only surface.
UNSUPPORTED_PROTOCOL_VERSION_ERROR_CODE
The final MCP JSON-RPC code for a version the server does not support.

Functions§

admit_final_http_request
Admits the standard final HTTP header mirrors for a request.
admit_final_request
Admits final request metadata using the required error precedence.
validate_final_protocol_version
Validates the final HTTP header/body protocol-version mirror.