Skip to content

Menu

MCP Protocol Cheat Sheet: JSON-RPC Messages, Tools, Resources and Transports

Checked against Model Context Protocol MCP specification revision 2026-07-28 (legacy handshake from 2025-11-25 noted) on 28 November 2026. Each section links to the official docs it was checked against.

This sheet is for people writing or debugging an MCP client or server who need the exact JSON on the wire. It follows specification revision 2026-07-28, the current one on modelcontextprotocol.io, and notes where the older 2025-11-25 handshake still matters. Every shape here was copied in structure from the spec pages and is marked untested because we did not run a server for this page.

Stateless MCP requestsEvery request carries its protocol version and client capabilities in _meta; a server that rejects the version answers -32022 with the versions it supports.ClientServerserver/discoverstdio: probe with thissupportedVersions, capabilitiestools/call_meta: protocolVersion,clientCapabilities-32022 Unsupported versiondata.supported lists versionsPick a version from data.supported and resendresultresultType: complete, content,isError
Every request carries its protocol version and client capabilities in _meta; a server that rejects the version answers -32022 with the versions it supports.

When to use what

The big change in 2026-07-28 is that MCP is now stateless. There is no initialize request and no notifications/initialized any more. Instead every request carries io.modelcontextprotocol/protocolVersion and io.modelcontextprotocol/clientCapabilities in params._meta, and a server that does not speak that version answers with error -32022 and a list of versions it does. If you are writing a new client, send the _meta fields on every call and handle -32022 by retrying with a version from the list. Call server/discover first only if you want to show the server's identity and capabilities up front, or if you talk stdio to servers that may still be on the old handshake.

If you maintain an existing server, the spec allows a dual-era server: answer initialize for old clients and serve per-request _meta for new ones. Most people will get this from their SDK rather than writing it by hand.

For transports, pick stdio when the client launches your server as a local process; it is newline-delimited JSON on stdin and stdout, and anything else you print to stdout breaks the stream. Pick Streamable HTTP for remote servers: each message is a POST, and the reply is either plain JSON or an SSE stream. To inspect real traffic, paste messages into our MCP JSON-RPC inspector; note it was built around the older handshake. The MCP config sheet covers how clients like Claude Code and Cursor launch servers, and our MCP Inspector post walks through debugging one.

All messages are UTF-8 JSON-RPC 2.0. Unlike plain JSON-RPC, a request id can never be null.

{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {...}}

Request: needs a string or integer id that is unique among the sender's unanswered requests

Try it: MCP JSON-RPC InspectorFrom the docs, not run by us
{"jsonrpc": "2.0", "id": 1, "result": {"resultType": "complete", ...}}

Result response: same id as the request, and result must include resultType

From the docs, not run by us
{"jsonrpc": "2.0", "id": 1, "error": {"code": -32602, "message": "..."}}

Error response: integer code, a message, and an optional data member of any type

From the docs, not run by us
{"jsonrpc": "2.0", "method": "notifications/cancelled", "params": {"requestId": "123"}}

Notification: has no id and the receiver must not reply to it

From the docs, not run by us
"resultType": "input_required"

Interim result asking the client for more input via inputRequests; retry the call with inputResponses and a new id

From the docs, not run by us

Field definitions are on the base protocol page under _meta: https://modelcontextprotocol.io/specification/2026-07-28/basic

"_meta": {"io.modelcontextprotocol/protocolVersion": "2026-07-28", ...}

Required on every request: the protocol version this one request uses

From the docs, not run by us
"io.modelcontextprotocol/clientCapabilities": {}

Required on every request: the client capabilities relevant to it; leaving out a required field gets -32602

From the docs, not run by us
"io.modelcontextprotocol/clientInfo": {"name": "ExampleClient", "version": "1.0.0"}

Recommended on every request so the server can log who called; it is self-reported and not for security decisions

From the docs, not run by us
{"method": "server/discover", "params": {"_meta": {...}}}

Ask a server for supportedVersions, capabilities, optional instructions and its serverInfo in one call

From the docs, not run by us
{"code": -32022, "message": "Unsupported protocol version", "data": {"supported": [...], "requested": "..."}}

Server rejects the version; pick one from data.supported and resend

From the docs, not run by us
{"method": "initialize", "params": {"protocolVersion": "2025-11-25", "capabilities": {...}, "clientInfo": {...}}}

Legacy handshake from 2025-11-25 and earlier, still needed for older servers; followed by notifications/initialized

From the docs, not run by us

A server that offers tools declares "tools": {"listChanged": true} (or {}) in its capabilities. Tool names should be 1 to 128 characters from letters, digits, _, - and ..

{"method": "tools/list", "params": {"cursor": "..."}}

List tools; follow nextCursor in the result to page through long lists

From the docs, not run by us
{"name": "get_weather", "description": "...", "inputSchema": {"type": "object", ...}}

One tool definition; inputSchema is JSON Schema (2020-12 unless $schema says otherwise) and must not be null

Try it: MCP Tool Schema ValidatorFrom the docs, not run by us
"inputSchema": {"type": "object", "additionalProperties": false}

Recommended schema for a tool that takes no arguments

Try it: MCP Tool Schema ValidatorFrom the docs, not run by us
{"method": "tools/call", "params": {"name": "get_weather", "arguments": {"location": "New York"}}}

Call a tool by name with its arguments object

From the docs, not run by us
{"resultType": "complete", "content": [{"type": "text", "text": "..."}], "isError": false}

Successful tool result; content items can be text, image, audio, resource_link or resource

From the docs, not run by us
{"content": [{"type": "text", "text": "Invalid departure date..."}], "isError": true}

Tool execution error the model can read and fix, such as bad input or an API failure

From the docs, not run by us
"structuredContent": {...}

Machine-readable result that matches the tool's optional outputSchema; may be any JSON value

From the docs, not run by us
{"method": "notifications/tools/list_changed"}

Sent to clients that opened subscriptions/listen with toolsListChanged: true when the tool set changes

From the docs, not run by us

Prompts are on their own page: https://modelcontextprotocol.io/specification/2026-07-28/server/prompts

{"method": "resources/list", "params": {"cursor": "..."}}

List resources with uri, name, optional title, description and mimeType

From the docs, not run by us
{"method": "resources/read", "params": {"uri": "file:///project/src/main.rs"}}

Read one resource; the result has a contents array of text or base64 blob entries

From the docs, not run by us
{"method": "resources/templates/list"}

List URI templates for parameterised resources

From the docs, not run by us
{"method": "notifications/resources/updated", ...}

Tells a subscribed client that a resource changed; subscriptions now go through subscriptions/listen

From the docs, not run by us
{"method": "prompts/list"}

List prompt templates with their arguments and whether each is required

From the docs, not run by us
{"method": "prompts/get", "params": {"name": "code_review", "arguments": {"code": "..."}}}

Fill in a prompt; the result is a messages array of role and content items

From the docs, not run by us

-32000 to -32019 is legacy and implementation-defined; -32020 to -32099 is reserved for the MCP spec.

-32700 / -32600 / -32601 / -32602 / -32603

Standard JSON-RPC: parse error, invalid request, method not found, invalid params, internal error

From the docs, not run by us
-32602 Unknown tool: invalid_tool_name

Protocol error for an unknown tool or malformed call, returned as a JSON-RPC error and not as isError

From the docs, not run by us
-32602 (resource not found)

Current code for a missing resource; clients should still accept the old -32002 from earlier servers

From the docs, not run by us
-32020 HeaderMismatch

An HTTP header such as MCP-Protocol-Version does not match the value in the body

From the docs, not run by us
-32021 MissingRequiredClientCapability

The request needs a client capability you did not declare; data.requiredCapabilities lists it

From the docs, not run by us
-32022 UnsupportedProtocolVersion

The server does not implement the requested protocol version

From the docs, not run by us

Binding pages: https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/stdio and https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http

stdin / stdout, one JSON message per line

stdio: the client starts the server as a subprocess; messages are newline-delimited and must not contain embedded newlines

From the docs, not run by us
stderr

stdio: the only safe place for server logs; writing anything but MCP messages to stdout corrupts the stream

From the docs, not run by us
{"method": "notifications/cancelled", "params": {"requestId": "123", "reason": "..."}}

stdio: how the client cancels an in-flight request; over HTTP you close the response stream instead

From the docs, not run by us
POST /mcp Accept: application/json, text/event-stream

Streamable HTTP: every client message is its own POST and the client must accept both reply types

From the docs, not run by us
MCP-Protocol-Version: 2026-07-28

Required header on every HTTP POST; must match the version in _meta or the server returns 400 with -32020

From the docs, not run by us
Mcp-Method: tools/call Mcp-Name: get_weather

Required routing headers: Mcp-Method on all requests, Mcp-Name on tools/call, resources/read and prompts/get

From the docs, not run by us
404 + -32601

Streamable HTTP answer for a method the server does not implement

From the docs, not run by us

Worked example: Discover a server, then call one tool

Here is the smallest useful exchange under 2026-07-28, built from the spec's own examples. First the client asks the server who it is:

{"jsonrpc": "2.0", "id": "discover-1", "method": "server/discover",
 "params": {"_meta": {
   "io.modelcontextprotocol/protocolVersion": "2026-07-28",
   "io.modelcontextprotocol/clientInfo": {"name": "ExampleClient", "version": "1.0.0"},
   "io.modelcontextprotocol/clientCapabilities": {}}}}

The spec's sample reply lists "supportedVersions": ["2026-07-28"], capabilities tools and resources, the server's name in _meta, and ttlMs: 3600000 with cacheScope: "public", which means the client may cache this answer for an hour. Next the client calls a tool, with the same three _meta fields again:

{"jsonrpc": "2.0", "id": 2, "method": "tools/call",
 "params": {"name": "get_weather", "arguments": {"location": "New York"},
   "_meta": {"io.modelcontextprotocol/protocolVersion": "2026-07-28",
             "io.modelcontextprotocol/clientCapabilities": {}}}}

The answer comes back with "resultType": "complete", a content array holding one text block, and "isError": false. Notice what is missing compared with older servers: no initialize round trip, no session id, and the second request repeats the version instead of relying on the first. If the server had replied with -32022, the client would read data.supported and resend with one of those versions. We did not run this against a live server, so treat the replies as the spec's examples rather than captured output.

Common mistakes

  • Sending initialize first and expecting every server to answer it.

    Servers that only support 2026-07-28 reject it. Send per-request _meta and handle -32022; on stdio, probe with server/discover and fall back to initialize only for legacy servers.

  • Putting protocol version and capabilities only on the first request of a connection.

    The protocol is stateless now. Every request must carry protocolVersion and clientCapabilities in _meta, or the server returns -32602.

  • Returning a JSON-RPC error when a tool's own API call fails.

    Return a normal result with isError: true and a text explanation, so the model can see what went wrong and retry. Keep JSON-RPC errors for unknown tools and malformed requests.

  • Printing debug logs to stdout from a stdio server.

    Stdout carries only MCP messages. Log to stderr, which the client may show or ignore without breaking the stream.

  • Reusing the same id when retrying an input_required call.

    The spec requires a different id for the retry. Send the original arguments plus inputResponses and the server's requestState.

  • Still checking for error -32002 alone when a resource is missing.

    Current servers send -32602. Accept both so you work with old and new servers.

Sources

How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe
Reviews and commentsShow

Comments

Sign in to leave a comment.

Loading comments…