Module: MCP::ErrorCodes
- Defined in:
- lib/mcp/error_codes.rb
Overview
MCP-specific JSON-RPC error codes, complementing the generic codes in JsonRpcHandler::ErrorCode.
All three constants below are introduced by the stateless lifecycle of the MCP 2026-07-28 draft (SEP-2575):
HEADER_MISMATCHrejects an HTTP request whose headers do not match the corresponding body values, or whose required headers are missing or malformed (noerror.data). It is reserved for the Streamable HTTP transport, since headers do not exist on stdio.MISSING_REQUIRED_CLIENT_CAPABILITYrejects a request that requires a client capability the request did not declare (error.data: { requiredCapabilities: {...} }). Raised viaServer::MissingRequiredClientCapabilityError.UNSUPPORTED_PROTOCOL_VERSIONrejects a request whose_meta-carried protocol version the server does not support (error.data: { supported: [...], requested: "..." }). Raised viaServer::UnsupportedProtocolVersionError.
The values come from the spec's MCP-specific error code block, which is allocated sequentially from -32020
toward -32099.
https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2575
Constant Summary collapse
- HEADER_MISMATCH =
-32020
- MISSING_REQUIRED_CLIENT_CAPABILITY =
-32021
- UNSUPPORTED_PROTOCOL_VERSION =
-32022