You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`Mcp-Name`| request | Mirrors the request's principal name (`tools/call.params.name`, `prompts/get.params.name`, `resources/read.params.uri`); mismatch ⇒ `-32020`|
253
+
|`Mcp-Param-{Header}`| request | Per-tool parameter passthrough; see below |
254
+
255
+
The header-name set is exhaustive: for protocol versions earlier than
256
+
`2026-07-28`, only `Mcp-Protocol-Version` and `Mcp-Session-Id` are recognised.
257
+
258
+
**Body↔header mirroring.** When `Mcp-Method` or `Mcp-Name` is present but
259
+
does not match the JSON-RPC body, the server returns
260
+
[`CodeHeaderMismatch`](#error-codes) (`-32020`). The same applies to a
261
+
mismatch between `Mcp-Protocol-Version` and the body's
262
+
`_meta.io.modelcontextprotocol/protocolVersion`.
263
+
264
+
**`Mcp-Param-*` passthrough.** A tool may annotate properties of its
265
+
`InputSchema` with `x-mcp-header: "<HeaderName>"`. When a client invokes that
266
+
tool over HTTP, the SDK serializes the matching argument(s) as
267
+
`Mcp-Param-<HeaderName>` request headers (using `=?base64?...?=` encoding for
268
+
non-ASCII values). On the server, the headers are validated against the body
269
+
and either accepted or rejected with `-32020`. Properties so annotated must
270
+
be typed `string`, `integer`, or `boolean`; tools that fail validation at
271
+
registration time are silently dropped from `tools/list`.
272
+
191
273
#### Resumability and Redelivery
192
274
193
275
By default, the streamable server does not support [resumability or
@@ -201,6 +283,13 @@ value. The SDK provides a `MemoryEventStore` for testing or simple use cases;
201
283
for production use it is generally advisable to use a more sophisticated
The SDK uses the standard JSON-RPC base codes (parse error `-32700`,
764
+
invalid request `-32600`, method not found `-32601`, invalid params
765
+
`-32602`, internal error `-32603`) plus the following MCP-specific codes:
766
+
767
+
| Constant | Code | Meaning |
768
+
|---|---|---|
769
+
|[`CodeHeaderMismatch`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#CodeHeaderMismatch)|`-32020`| An MCP HTTP header (`Mcp-Method`, `Mcp-Name`, `Mcp-Protocol-Version`, or `Mcp-Param-*`) does not match the JSON-RPC body |
770
+
|[`CodeMissingRequiredClientCapabilities`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#CodeMissingRequiredClientCapabilities)|`-32021`| Server requires client capabilities the client did not declare |
771
+
|[`CodeUnsupportedProtocolVersion`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#CodeUnsupportedProtocolVersion)|`-32022`| Requested protocol version not supported. Data: `UnsupportedProtocolVersionData{Supported []string, Requested string}`|
772
+
|[`CodeResourceNotFound`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp#CodeResourceNotFound)|`-32602`| Resource URI not found (variable; was `-32002` before SEP-2164) |
773
+
774
+
The error code allocation policy defined in `2026-07-28`
0 commit comments