By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
MCP communicates entirely through JSON-RPC 2.0 messages. If you're building an MCP client or server, you need to understand the three message types and how they flow between peers. Get this wrong and your implementation won't handshake with anything.
JSON-RPC 2.0 is a minimal spec for remote procedure calls over JSON. MCP uses it as its wire protocol. Every message you send or receive fits into exactly one of three categories: request, response, or notification.
A request has three required fields: jsonrpc (always "2.0"), id (a unique identifier for this call), and method (the function name). The id is how you match responses back to requests.
{ "jsonrpc": "2.0", "id": 7, "method": "tools/list" }The client sends a request and waits for a response with the same id. The method name tells the server what to do. In this example, the client is asking for a list of available tools.
A response always includes the same id as the request it answers. It contains either a result field (on success) or an error field (on failure), never both.
// success
{ "jsonrpc": "2.0", "id": 7, "result": { "tools": [] } }
// failure
{ "jsonrpc": "2.0", "id": 7,
"error": { "code": -32601, "message": "Method not found" } }The error object has a code and message. Standard error codes exist for common problems like method not found. When you get a response, match its id to your outstanding requests and handle the result or error accordingly.
A notification has no id and no response. It's a one-way message: the sender publishes information and doesn't expect an answer. MCP uses notifications for progress updates, logging, or other asynchronous events.
{ "jsonrpc": "2.0", "method": "notifications/progress",
"params": { "progressToken": "t1", "progress": 40, "total": 100 } }Notifications can include params (the payload) but never an id. Because there's no id, the receiver can't correlate it to anything. It's just data flowing in one direction.
The sequence diagram shows a realistic exchange. The client sends request id=1, gets a response id=1. Then it sends request id=2. While the server is working on id=2, it sends a notification (no id) with progress. Finally it responds to id=2. Requests and responses always pair by id. Notifications stand alone.
| Code | Name | Meaning |
|---|---|---|
| -32700 | Parse error | The text was not valid JSON |
| -32600 | Invalid Request | Valid JSON, but not a valid JSON-RPC message |
| -32601 | Method not found | The server does not know that method |
| -32602 | Invalid params | Wrong or missing arguments (also used for 'resource not found' since 2026-07-28) |
| -32603 | Internal error | The server crashed handling it |
| -32020 to -32099 | Reserved for MCP | Spec-defined errors such as UnsupportedProtocolVersion |
Use these codes when you need to return an error. They're standardized so clients can handle common failure modes consistently. If your error doesn't fit a standard code, use -32603 (Internal error) or define your own in the -32000 to -32099 range.
Ids tie responses to requests, so a client can have many requests in flight at once and match answers in any order. Notifications have no id because nobody replies.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.