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.
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
{"jsonrpc": "2.0", "id": 1, "result": {"resultType": "complete", ...}}Result response: same id as the request, and result must include resultType
{"jsonrpc": "2.0", "id": 1, "error": {"code": -32602, "message": "..."}}Error response: integer code, a message, and an optional data member of any type
{"jsonrpc": "2.0", "method": "notifications/cancelled", "params": {"requestId": "123"}}Notification: has no id and the receiver must not reply to it
"resultType": "input_required"Interim result asking the client for more input via inputRequests; retry the call with inputResponses and a new id
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
"io.modelcontextprotocol/clientCapabilities": {}Required on every request: the client capabilities relevant to it; leaving out a required field gets -32602
"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
{"method": "server/discover", "params": {"_meta": {...}}}Ask a server for supportedVersions, capabilities, optional instructions and its serverInfo in one call
{"code": -32022, "message": "Unsupported protocol version", "data": {"supported": [...], "requested": "..."}}Server rejects the version; pick one from data.supported and resend
{"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
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
{"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
"inputSchema": {"type": "object", "additionalProperties": false}Recommended schema for a tool that takes no arguments
{"method": "tools/call", "params": {"name": "get_weather", "arguments": {"location": "New York"}}}Call a tool by name with its arguments object
{"resultType": "complete", "content": [{"type": "text", "text": "..."}], "isError": false}Successful tool result; content items can be text, image, audio, resource_link or resource
{"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
"structuredContent": {...}Machine-readable result that matches the tool's optional outputSchema; may be any JSON value
{"method": "notifications/tools/list_changed"}Sent to clients that opened subscriptions/listen with toolsListChanged: true when the tool set changes
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
{"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
{"method": "resources/templates/list"}List URI templates for parameterised resources
{"method": "notifications/resources/updated", ...}Tells a subscribed client that a resource changed; subscriptions now go through subscriptions/listen
{"method": "prompts/list"}List prompt templates with their arguments and whether each is required
{"method": "prompts/get", "params": {"name": "code_review", "arguments": {"code": "..."}}}Fill in a prompt; the result is a messages array of role and content items
-32000 to -32019 is legacy and implementation-defined; -32020 to -32099 is reserved for the MCP spec.
-32700 / -32600 / -32601 / -32602 / -32603Standard JSON-RPC: parse error, invalid request, method not found, invalid params, internal error
-32602 Unknown tool: invalid_tool_nameProtocol error for an unknown tool or malformed call, returned as a JSON-RPC error and not as isError
-32602 (resource not found)Current code for a missing resource; clients should still accept the old -32002 from earlier servers
-32020 HeaderMismatchAn HTTP header such as MCP-Protocol-Version does not match the value in the body
-32021 MissingRequiredClientCapabilityThe request needs a client capability you did not declare; data.requiredCapabilities lists it
-32022 UnsupportedProtocolVersionThe server does not implement the requested protocol version
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 linestdio: the client starts the server as a subprocess; messages are newline-delimited and must not contain embedded newlines
stderrstdio: the only safe place for server logs; writing anything but MCP messages to stdout corrupts the stream
{"method": "notifications/cancelled", "params": {"requestId": "123", "reason": "..."}}stdio: how the client cancels an in-flight request; over HTTP you close the response stream instead
POST /mcp
Accept: application/json, text/event-streamStreamable HTTP: every client message is its own POST and the client must accept both reply types
MCP-Protocol-Version: 2026-07-28Required header on every HTTP POST; must match the version in _meta or the server returns 400 with -32020
Mcp-Method: tools/call
Mcp-Name: get_weatherRequired routing headers: Mcp-Method on all requests, Mcp-Name on tools/call, resources/read and prompts/get
404 + -32601Streamable HTTP answer for a method the server does not implement
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
initializefirst and expecting every server to answer it.Servers that only support
2026-07-28reject it. Send per-request_metaand handle-32022; on stdio, probe withserver/discoverand fall back toinitializeonly 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
protocolVersionandclientCapabilitiesin_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: trueand 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
idwhen retrying aninput_requiredcall.The spec requires a different
idfor the retry. Send the original arguments plusinputResponsesand the server'srequestState.Still checking for error
-32002alone when a resource is missing.Current servers send
-32602. Accept both so you work with old and new servers.
Related cheat sheets
Sources
- https://modelcontextprotocol.io/specification/latest
- https://modelcontextprotocol.io/specification/2026-07-28/basic
- https://modelcontextprotocol.io/specification/2026-07-28/basic/versioning
- https://modelcontextprotocol.io/specification/2026-07-28/server/discover
- https://modelcontextprotocol.io/specification/2026-07-28/server/tools
- https://modelcontextprotocol.io/specification/2026-07-28/server/resources
- https://modelcontextprotocol.io/specification/2026-07-28/server/prompts
- https://modelcontextprotocol.io/specification/2026-07-28/basic/transports
- https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/stdio
- https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-http
- https://modelcontextprotocol.io/specification/2026-07-28/changelog
- https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle
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.