What is JSON RPC?
Quick definition
A lightweight, stateless remote procedure call protocol using JSON for serialization, enabling clients to invoke server methods across networks with standardized request-response messaging.
JSON RPC (JSON Remote Procedure Call) is a specification for making remote procedure calls using JSON as the data format. It defines a simple, transport-agnostic protocol where a client sends a JSON-formatted request to a server, which processes it and returns a JSON-formatted response. The protocol supports both synchronous calls and asynchronous notifications, making it flexible for various communication patterns.
In the context of AI agents and MCP (Model Context Protocol), JSON RPC serves as the underlying communication mechanism. It enables structured communication between MCP clients (like Claude or other AI systems) and MCP servers, allowing agents to invoke tools and access remote resources reliably. The protocol's simplicity and language-agnostic nature make it ideal for integrating diverse systems and services.
JSON RPC requires minimal overhead compared to REST APIs, as each call follows a consistent structure: a request includes a method name, parameters, and a unique identifier, while responses contain the result or error information. This makes it particularly valuable in agentic workflows where agents need to make rapid, frequent calls to multiple services while maintaining clear error handling and request tracing.
Example
How it shows up in practice
{"jsonrpc": "2.0", "method": "create_task", "params": {"title": "Fix bug", "column_id": 1}, "id": 1}Frequently asked questions
How does JSON RPC differ from REST?
JSON RPC is procedure-focused with a single endpoint, while REST is resource-focused with multiple endpoints. JSON RPC better suits agent-to-service communication where frequent method calls are needed.
Can JSON RPC work over HTTP?
Yes, JSON RPC is transport-agnostic and commonly runs over HTTP, WebSockets, or other protocols. This flexibility makes it ideal for diverse AI agent architectures.
What happens if a JSON RPC call fails?
The server returns a JSON error response containing an error code, message, and optional data field, enabling clients to handle failures gracefully and retry if needed.
Is JSON RPC used in MCP servers?
Yes, JSON RPC is the core protocol for MCP communication, allowing AI agents to call server methods and access tools in a standardized, structured way.