part…
Building governance for MCP?
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
The gateway applies what the guide teaches: policies on discovery, invocation and authorisation.
MCP reuses the JSON-RPC codes and, since 2026-07-28, partitions the range reserved for server errors to prevent different implementations from assigning contradictory meanings to the same number. A gateway is, by definition, the place where different implementations meet, so this policy affects you directly.
| Code | Name | Typical use in MCP |
|---|---|---|
-32700 |
Parse error | Invalid JSON. |
-32600 |
Invalid request | Not a valid JSON-RPC request (e.g. a batch). |
-32601 |
Method not found | Unknown method or unsupported capability. Over HTTP, with status 404. |
-32602 |
Invalid params | Invalid parameters; also unknown tool/prompt, invalid cursor, non-existent resource, invalid log level, missing mandatory _meta. Over HTTP, 400. |
-32603 |
Internal error | Internal server error. |
-32000..-32099 range| Sub-range | Status | Rule |
|---|---|---|
-32000..-32019 |
Legacy | Assigned by implementations before the policy. New codes MUST NOT be assigned here; new implementations SHOULD NOT use them. Except for -32002, the receiver MUST NOT assume any meaning. |
-32020..-32099 |
Reserved for the spec | Only the spec defines codes here. Implementations MUST NOT emit undefined codes from this sub-range and MUST use the defined ones only with their meaning. |
| Code | Name | When | HTTP |
|---|---|---|---|
-32020 |
HeaderMismatch |
MCP-Protocol-Version, Mcp-Method, Mcp-Name or Mcp-Param-* headers missing, malformed or not matching the body. |
400 |
-32021 |
MissingRequiredClientCapability |
The request requires a capability the client did not declare. data.requiredCapabilities lists them. |
400 |
-32022 |
UnsupportedProtocolVersion |
Unsupported version. data.supported and data.requested. |
400 |
-32002 resource not found (2025-11-25 and earlier). Replaced by -32602. Modern implementations MUST NOT emit it, but clients SHOULD keep accepting it from old servers.-32042 URL elicitation required (2025-11-25 only). Removed together with elicitationId and notifications/elicitation/complete.Both remain reserved and will not be reused.
-32768..-32000); the rest of the integer space is free.Remember (lesson 7.2): an unknown tool or a malformed request is a protocol error (-32602); a failure in the tool's logic or in the validation of its arguments is an execution error that travels as a complete result with isError: true, so that the model can self-correct.
-32768..-32000 and document their catalogue. Do not "borrow" -32001.-32002 from a legacy server → -32602 towards a modern host (with data.uri if it was present).-32022 (retry with another version) and -32021 (do not retry: capability missing), never on the text of message.1. Which code does a modern server return when a resource does not exist?
Since 2026-07-28 it is -32602 (Invalid params); -32002 remains reserved and is only accepted from old servers.
2. Which sub-range is reserved exclusively for the specification?
-32020..-32099 belongs to the spec; -32000..-32019 is legacy and admits no new codes.
3. Where should an implementation define its own error codes?
The spec recommends leaving the range reserved by JSON-RPC.
4. Which HTTP status accompanies HeaderMismatch?
The three errors defined by MCP (-32020, -32021, -32022) go with 400 Bad Request.