Protocol Revision: 2025-03-26
- Base Protocol: Core JSON-RPC message types
- Lifecycle Management: Connection initialization, capability negotiation, and session control
- Server Features: Resources, prompts, and tools exposed by servers
- Client Features: Sampling and root directory lists provided by clients
- Utilities: Cross-cutting concerns like logging and argument completion
Messages
All messages between MCP clients and servers MUST follow the JSON-RPC 2.0 specification. The protocol defines these types of messages:Requests
Requests are sent from the client to the server or vice versa, to initiate an operation.- Requests MUST include a string or integer ID.
- Unlike base JSON-RPC, the ID MUST NOT be
null
. - The request ID MUST NOT have been previously used by the requestor within the same session.
Responses
Responses are sent in reply to requests, containing the result or error of the operation.- Responses MUST include the same ID as the request they correspond to.
- Responses are further sub-categorized as either successful results or
errors. Either a
result
or anerror
MUST be set. A response MUST NOT set both. - Results MAY follow any JSON object structure, while errors MUST include an error code and message at minimum.
- Error codes MUST be integers.
Notifications
Notifications are sent from the client to the server or vice versa, as a one-way message. The receiver MUST NOT send a response.- Notifications MUST NOT include an ID.