JSON-RPC (JavaScript Object Notation Remote Procedure Call) is a stateless, lightweight remote procedure call (RPC) protocol encoded in JSON. It defines a simple specification for a client to request the execution of a method on a remote server and for the server to return a result or error. Its core components are a method name to invoke, params for arguments, and an id for correlating requests with responses, enabling structured, language-agnostic interoperability between processes.
Glossary
JSON-RPC

What is JSON-RPC?
JSON-RPC is the foundational wire protocol used by the Model Context Protocol (MCP) for all structured communication between AI clients and external servers.
Within the Model Context Protocol (MCP), JSON-RPC serves as the standardized message format for all interactions, including capability negotiation, resource requests, tool invocations, and notifications. MCP layers its own semantics—defining specific methods like tools/list or resources/read—on top of the JSON-RPC 2.0 specification. This design allows AI clients and servers to communicate reliably over various transports like stdio or Server-Sent Events (SSE), ensuring deterministic parsing and validation of all exchanged data.
Key Features of JSON-RPC
JSON-RPC is a stateless, lightweight remote procedure call protocol that uses JSON for data serialization. It defines a simple request-response mechanism for invoking methods on a remote server.
JSON Serialization
The protocol's core is its use of JavaScript Object Notation (JSON) for all message encoding. This provides a human-readable, language-agnostic, and widely supported data format. Every request, response, and notification is a single, self-contained JSON object. This simplicity enables easy debugging and interoperability across diverse programming environments, from Python and JavaScript to Go and Rust. The MCP (Model Context Protocol) adopts this format for its messages, ensuring compatibility with a vast ecosystem of tools and libraries.
Request-Response Model
JSON-RPC operates on a fundamental request-response pattern. A client sends a request object to a server, which processes it and returns a corresponding response object.
- Request Object: Must contain
jsonrpc(version),method(name of procedure),params(arguments), andid(unique identifier for the call). - Response Object: Contains
jsonrpc,id(matching the request), and either aresultfield for success or anerrorfield for failure. - Statelessness: Each request is independent; the server maintains no client state between calls, aligning with RESTful principles and simplifying server design.
Structured Error Handling
Errors are not signaled via HTTP status codes but through a standardized error object within the JSON-RPC response. This object provides precise, machine-readable failure information.
Key components of the error object:
code: A predefined integer indicating the error type (e.g., -32700 for Parse error, -32601 for Method not found).message: A short, human-readable description of the error.data: An optional field containing additional, structured information about the error, such as stack traces or validation details.
This structured approach allows clients, like MCP clients, to programmatically detect and handle different failure modes (network, validation, server logic) without parsing ambiguous text messages.
Notification Messages
JSON-RPC supports notifications, which are requests that do not require a response from the server. A notification is a request object that omits the id member. The server processes the method but sends nothing back to the client. This is critical for one-way communication patterns, such as:
- Logging events or telemetry.
- Pushing asynchronous updates from server to client.
- Issuing commands where an acknowledgment is unnecessary.
In the context of MCP transports like SSE (Server-Sent Events), notifications enable servers to push real-time updates (e.g., new resource availability) to connected clients without the overhead of a request cycle.
Batch Requests
To optimize network performance, JSON-RPC allows clients to send an array of request objects as a single batch. The server processes each request (potentially in any order) and returns an array of response objects, preserving the order of the responses. The responses in the array correspond to the requests that warranted a reply (notifications within the batch do not generate a response). This feature is essential for reducing latency in scenarios where an AI agent needs to invoke multiple tools or fetch several resources from an MCP server in rapid succession, minimizing round-trip communication overhead.
Versioning and Extensibility
The protocol is explicitly versioned via the jsonrpc member in every message, with "2.0" being the dominant and recommended version. This clear versioning prevents ambiguity. While the core specification is minimal, it is designed for extensibility. Implementations can introduce:
- Custom Error Codes: Beyond the reserved range (-32000 to -32099) for application-specific errors.
- Extended
paramsStructures: To pass complex, nested data. - Metadata in Messages: Non-standard fields that compliant peers should ignore.
This balance of a strict core with room for extension makes it ideal for frameworks like MCP, which builds its entire model of resources, tools, and prompts atop the stable JSON-RPC 2.0 foundation.
How JSON-RPC Works
JSON-RPC is the foundational message-passing protocol used by the Model Context Protocol (MCP) for all communication between clients and servers.
JSON-RPC (JavaScript Object Notation Remote Procedure Call) is a stateless, lightweight protocol that encodes remote procedure calls and their responses in JSON format. It defines a simple set of structures for requests, responses, and notifications, enabling a client to invoke a method on a server and receive a structured result. As the core wire format for MCP, it standardizes how clients call tools, fetch resources, and handle errors across diverse transports like stdio and SSE.
The protocol operates through message pairs: a client sends a request object containing a method name, params, and a unique id for correlation. The server processes the call and returns a response object with the same id, containing either a result or an error. Notifications are special requests without an id, used for one-way messages. This simple, transport-agnostic design allows MCP to provide a uniform interface for AI agents to interact with external systems, with built-in support for batch calls and strict schema validation of parameters.
Frequently Asked Questions
JSON-RPC is the foundational message format for the Model Context Protocol (MCP). These questions address its core mechanics, role in AI tool-calling, and practical implementation details.
JSON-RPC is a stateless, lightweight remote procedure call (RPC) protocol that uses JSON (JavaScript Object Notation) for data serialization. It defines a simple specification for a client to request the execution of a method on a remote server and for the server to return a response or an error. A JSON-RPC request contains mandatory jsonrpc, method, and id members, along with an optional params member for arguments. The server processes the request and sends back a response object with the same id, containing either a result or an error member. This request-response pattern, transmitted over a transport like stdio or SSE, forms the backbone of communication in protocols like the Model Context Protocol (MCP).
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
JSON-RPC is the foundational message format for the Model Context Protocol. Understanding these related concepts is essential for engineers building or integrating AI agents with external systems.
Remote Procedure Call (RPC)
A Remote Procedure Call (RPC) is a fundamental distributed computing protocol that allows a program to execute a subroutine or procedure on another computer across a network as if it were a local call. It abstracts the complexities of network communication.
- Core Mechanism: The client program sends a request message to a server, which executes the specified function and returns a response.
- Key Abstraction: Enables developers to write code that interacts with remote services using familiar local function-call semantics.
- Foundation: JSON-RPC, gRPC, and XML-RPC are all specific implementations of the RPC paradigm, differing in their serialization formats and transport layers.
JSON Schema
JSON Schema is a declarative language for validating the structure and content of JSON data. In protocols like MCP, it defines the expected format for tool inputs and resource metadata.
- Validation Role: Ensures that data passed in Tool Invocation requests conforms to a predefined structure, preventing malformed API calls.
- Tool Definition Core: An MCP Tool Definition includes a JSON Schema object that specifies the required parameters, their data types, and any constraints.
- Standardization: Provides a machine-readable contract between clients and servers, enabling automatic Schema Validation and improving interoperability.
Stdio (Standard I/O)
Stdio (Standard Input/Output) refers to the standard streams—input, output, and error—that a program uses to communicate with its environment. It is a common and simple MCP Transport.
- Local Integration: In the Stdio Transport model, an MCP client spawns a server process as a subprocess. They exchange JSON-RPC messages by writing to each other's standard input and reading from standard output.
- Framing: Messages are typically delimited by newlines, a form of Message Framing.
- Use Case: Ideal for integrating with local scripts, command-line tools, or databases where the server is a process on the same machine, avoiding network overhead.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us