What is JSON-RPC

JSON-RPC is a remote procedure call protocol that uses JSON as its message format. It defines a simple, stateless way for a client to call a method on a server and receive a result. MCP uses JSON-RPC 2.0 as its wire format for all communication between clients and servers.

How it works

Every JSON-RPC message is a JSON object with a fixed structure. There are three types:

Request — client asks the server to do something:

{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "search_files", "arguments": {"pattern": "*.rs"}}}

Response — server returns the result:

{"jsonrpc": "2.0", "id": 1, "result": {"content": [{"type": "text", "text": "Found 42 files"}]}}

Notification — one-way message, no response expected:

{"jsonrpc": "2.0", "method": "notifications/progress", "params": {"token": "abc", "progress": 50}}

The id field links requests to responses. Notifications have no id because the sender does not expect a reply. Errors use a standard error object with a code and message instead of result.

Why it matters

JSON-RPC gives MCP a well-defined, language-agnostic message format. Any language that can read and write JSON can implement an MCP client or server. The protocol is deliberately simple — no complex framing, no binary encoding, no schema negotiation beyond JSON itself.

The separation between requests (which expect responses) and notifications (which do not) maps cleanly to MCP's needs. Tool calls are requests — the client needs the result. Progress updates and log messages are notifications — fire and forget.

JSON-RPC handles the what (message format). The transport handles the how (stdio pipes, HTTP connections). This separation lets MCP work over different transports without changing the message format.

See How MCP Works for how JSON-RPC messages flow through the full MCP architecture.