@@ -41,19 +41,26 @@ class JSONRPCResponse(BaseModel):
4141 result : dict [str , Any ]
4242
4343
44- # MCP-specific error codes in the range [-32000, -32099]
45- URL_ELICITATION_REQUIRED = - 32042
46- """A URL-mode elicitation is required before the request can be processed (protocol 2025-11-25 only)."""
44+ # MCP error codes occupy the JSON-RPC server-error range -32000..-32099.
45+ # Per the 2026-07-28 spec's allocation policy:
46+ # -32000..-32019 implementation-defined
47+ # -32020..-32099 reserved for spec-defined codes, allocated sequentially from -32020
48+ # -32002, -32042 reserved-never-reused (retired by earlier protocol versions)
49+
50+ HEADER_MISMATCH = - 32020
51+ """HTTP headers do not match the request body, or required headers are missing/malformed (protocol 2026-07-28)."""
4752
48- MISSING_REQUIRED_CLIENT_CAPABILITY = - 32003
53+ MISSING_REQUIRED_CLIENT_CAPABILITY = - 32021
4954"""The server requires a client capability the request did not declare (protocol 2026-07-28)."""
5055
51- UNSUPPORTED_PROTOCOL_VERSION = - 32004
56+ UNSUPPORTED_PROTOCOL_VERSION = - 32022
5257"""The request's protocol version is not supported by the server (protocol 2026-07-28)."""
5358
54- # SDK error codes: SDK-internal allocations in the JSON-RPC server-error range
55- # [-32000, -32099]; not defined by the MCP schema. New values must avoid codes
56- # the spec has allocated above.
59+ URL_ELICITATION_REQUIRED = - 32042
60+ """A URL-mode elicitation is required before the request can be processed (protocol 2025-11-25 only)."""
61+
62+ # SDK error codes: SDK-internal allocations in the implementation-defined band
63+ # -32000..-32019; not defined by the MCP schema.
5764CONNECTION_CLOSED = - 32000
5865"""SDK-only: the connection closed before a response arrived; never emitted on the wire."""
5966
0 commit comments