Protocol
JSON-RPC
A practical explanation of how MCP uses JSON-RPC 2.0 for initialize, tools/list, tools/call, errors, and hosted HTTP endpoints.
Definition
JSON-RPC is the message envelope MCP uses for requests, responses, notifications, and errors. Each request includes a jsonrpc version, method name, optional params, and an id that lets the client match the response.
How Astrail Uses It
Astrail hosted MCP endpoints accept JSON-RPC over HTTP. The endpoint parses the method, enforces public/private access, validates params, dispatches allowed operations, and returns structured JSON-RPC results or errors.
Example
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {}
}Implementation Checklist
Always send jsonrpc as 2.0.
Use stable request IDs so clients can match responses.
Return structured errors instead of raw upstream exceptions.
Treat method names like a protocol boundary, not arbitrary function names.
FAQ
Is MCP a REST API?
MCP can run over HTTP, but the protocol payload is JSON-RPC. Methods such as initialize, tools/list, and tools/call are carried inside JSON-RPC messages.
Why does tools/call use params instead of a REST path?
The JSON-RPC method is stable across servers. The requested tool name and arguments live in params so MCP clients can use the same protocol shape for many servers.