Protocol
Two layers: data and transport
MCP separates what is said (the data layer) from how it travels (the transport layer). You can swap the transport without changing a single message.
Data layer JSON-RPC 2.0
- Lifecycle: connection setup, capability negotiation, shutdown
- Server features: tools, resources, prompts
- Client features: sampling, roots, elicitation
- Utilities: notifications, progress, cancellation, logging
Transport layer
stdio: local subprocess, messages on stdin and stdout- Streamable HTTP: POST plus optional Server-Sent Events, with standard HTTP auth
Request: expects a response with the same id
{ "jsonrpc": "2.0", "id": 7, "method": "tools/call", "params": { "name": "add", "arguments": { "a": 48213, "b": 97356 } }}Response
{ "jsonrpc": "2.0", "id": 7, "result": { "content": [{ "type": "text", "text": "145569" }] }}Notification: no id, no reply
{ "jsonrpc": "2.0", "method": "notifications/tools/list_changed" }