What are the error codes in the Model Context Protocol?
The Model Context Protocol uses JSON-RPC’s five standard error codes and, in the 2026-07-28 spec, defines three of its own. The standard ones are -32700 (parse error), -32600 (invalid request), -32601 (method not found), -32602 (invalid params), and -32603 (internal error). The three MCP codes are -32020, returned when HTTP headers don’t match the request body or are missing, -32021, when a server requires a client capability the request didn’t declare, and -32022, when the protocol version isn’t supported.
The JSON-RPC spec reserves the range -32000 to -32099 for implementation-defined server errors, which is where the MCP codes sit.
These codes cover the request, not the tool. The MCP spec returns an unknown tool name as -32602, and reports a tool that ran and failed as a normal result with isError: true, which the model can read and retry. A tool call can fail in several other ways that never get a code.
A client may pass a protocol error to the model, but the spec says that is less likely to end in a successful recovery than an isError: true result, so a tool that ran and failed belongs in the result.
published