Base Protocol
All messages between MCP clients and servers MUST follow the JSON-RPC 2.0 specification. The protocol defines three fundamental types of messages:
Type | Description | Requirements |
---|---|---|
Requests | Messages sent to initiate an operation | Must include unique ID and method name |
Responses | Messages sent in reply to requests | Must include same ID as request |
Notifications | One-way messages with no reply | Must not include an ID |
Responses are further sub-categorized as either successful results or errors. Results can follow any JSON object structure, while errors must include an error code and message at minimum.
Protocol Layers
The Model Context Protocol consists of several key components that work together:
- 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
All implementations MUST support the base protocol and lifecycle management components. Other components MAY be implemented based on the specific needs of the application.
These protocol layers establish clear separation of concerns while enabling rich interactions between clients and servers. The modular design allows implementations to support exactly the features they need.
See the following pages for more details on the different components:
Auth
Authentication and authorization are not currently part of the core MCP specification, but we are considering ways to introduce them in future. Join us in GitHub Discussions to help shape the future of the protocol!
Clients and servers MAY negotiate their own custom authentication and authorization strategies.
Schema
The full specification of the protocol is defined as a TypeScript schema. This is the source of truth for all protocol messages and structures.
There is also a JSON Schema, which is automatically generated from the TypeScript source of truth, for use with various automated tooling.