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.
Every MCP message MUST follow JSON-RPC 2.0, but MCP imposes additional restrictions. An intermediary has to validate them in both directions, because a message that is valid in JSON-RPC may be invalid in MCP.
{ jsonrpc: "2.0"; id: string | number; method: string; params?: { [key: string]: unknown } }
id.id MUST NOT be null.id MUST NOT match that of any other request the sender has sent and not yet had answered.{ jsonrpc: "2.0"; id: string | number; result: { resultType: string; [key: string]: unknown } }
id as the request.result, which MAY have any object structure, but MUST include resultType (lesson 3.2).{ jsonrpc: "2.0"; id?: string | number; error: { code: number; message: string; data?: unknown } }
id except when it could not be read because of a malformed request.code MUST be an integer; data MAY contain anything (nested errors, version lists, etc.).{ jsonrpc: "2.0"; method: string; params?: { [key: string]: unknown } }
id. The receiver MUST NOT respond.| Message | Client → Server | Server → Client |
|---|---|---|
| Request | Yes (all core methods) | No. The server's "requests" travel embedded in InputRequiredResult.inputRequests. |
| Result / Error | No in the core (in HTTP the client MUST NOT send responses; in stdio it does not write responses either). | Yes |
| Notification | notifications/cancelled (stdio only in practice; in HTTP there are no client→server notifications defined) |
notifications/progress, notifications/message, notifications/subscriptions/acknowledged, notifications/*/list_changed, notifications/resources/updated, notifications/cancelled (only to close a listen) |
In the legacy era the server did send requests (sampling/createMessage, elicitation/create, roots/list, ping) and the client sent responses; the gateway must keep accepting that traffic from old counterparts.
params is always an object with keys (never a positional array), because _meta has to fit inside.{"jsonrpc":"2.0","id":"req-42","method":"tools/call","params":{"name":"get_weather","arguments":{"location":"Madrid"},
"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{},
"io.modelcontextprotocol/clientInfo":{"name":"gateway","version":"0.1.0"},"progressToken":"p1"}}}
{"jsonrpc":"2.0","method":"notifications/progress","params":{"progressToken":"p1","progress":1,"total":2}}
{"jsonrpc":"2.0","id":"req-42","result":{"resultType":"complete","content":[{"type":"text","text":"18 °C"}],
"_meta":{"io.modelcontextprotocol/serverInfo":{"name":"weather","version":"2.3.0"}}}}
schema.json of the version declared in _meta, not against "generic JSON-RPC".ids for each side; if you rewrite ids when forwarding (common, to avoid collisions between hosts), store the mapping and restore it in the response, including the notifications correlated by progressToken and subscriptionId.jsonrpc: "2.0" with -32600; requests without the mandatory _meta fields with -32602.1. Can a request id be null in MCP?
MCP restricts JSON-RPC: id is a string or integer, never null, and unique among in-flight requests.
2. In 2026-07-28, can a server send a JSON-RPC request to the client?
Server→client interactions travel embedded in results (MRTR).
3. Which field is mandatory in every modern result?
resultType is mandatory; _meta is optional and content depends on the method.