Skip to content

Commit ce55bba

Browse files
authored
Merge pull request modelcontextprotocol#134 from modelcontextprotocol/davidsp/draft
Set up draft revision structure
2 parents 169269d + 7b12e98 commit ce55bba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2735
-150
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
---
2+
title: Specification (Latest)
3+
cascade:
4+
type: docs
5+
breadcrumbs: false
6+
weight: 10
7+
aliases:
8+
- /latest
9+
---
10+
11+
{{< callout type="info" >}}
12+
**Protocol Revision**: {{< param protocolRevision >}}
13+
{{< /callout >}}
14+
15+
[Model Context Protocol](https://modelcontextprotocol.io) (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.
16+
17+
This specification defines the authoritative protocol requirements, based on the TypeScript schema in [schema.ts](https://github.com/modelcontextprotocol/specification/2024-11-05/blob/main/schema/schema.ts).
18+
19+
For implementation guides and examples, visit [modelcontextprotocol.io](https://modelcontextprotocol.io).
20+
21+
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14](https://datatracker.ietf.org/doc/html/bcp14) [[RFC2119](https://datatracker.ietf.org/doc/html/rfc2119)] [[RFC8174](https://datatracker.ietf.org/doc/html/rfc8174)] when, and only when, they appear in all capitals, as shown here.
22+
23+
## Overview
24+
25+
MCP provides a standardized way for applications to:
26+
27+
- Share contextual information with language models
28+
- Expose tools and capabilities to AI systems
29+
- Build composable integrations and workflows
30+
31+
The protocol uses [JSON-RPC](https://www.jsonrpc.org/) 2.0 messages to establish communication between:
32+
33+
- **Hosts**: LLM applications that initiate connections
34+
- **Clients**: Connectors within the host application
35+
- **Servers**: Services that provide context and capabilities
36+
37+
MCP takes some inspiration from the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/), which standardizes how to add support for programming languages across a whole ecosystem of development tools. In a similar way, MCP standardizes how to integrate additional context and tools into the ecosystem of AI applications.
38+
39+
## Key Details
40+
41+
### Base Protocol
42+
- [JSON-RPC](https://www.jsonrpc.org/) message format
43+
- Stateful connections
44+
- Server and client capability negotiation
45+
46+
### Features
47+
48+
Servers offer any of the following features to clients:
49+
50+
- **Resources**: Context and data, for the user or the AI model to use
51+
- **Prompts**: Templated messages and workflows for users
52+
- **Tools**: Functions for the AI model to execute
53+
54+
Clients may offer the following feature to servers:
55+
56+
- **Sampling**: Server-initiated agentic behaviors and recursive LLM interactions
57+
58+
### Additional Utilities
59+
60+
- Configuration
61+
- Progress tracking
62+
- Cancellation
63+
- Error reporting
64+
- Logging
65+
66+
## Security and Trust & Safety
67+
68+
The Model Context Protocol enables powerful capabilities through arbitrary data access and code execution paths. With this power comes important security and trust considerations that all implementors must carefully address.
69+
70+
### Key Principles
71+
72+
1. **User Consent and Control**
73+
- Users must explicitly consent to and understand all data access and operations
74+
- Users must retain control over what data is shared and what actions are taken
75+
- Implementors should provide clear UIs for reviewing and authorizing activities
76+
77+
2. **Data Privacy**
78+
- Hosts must obtain explicit user consent before exposing user data to servers
79+
- Hosts must not transmit resource data elsewhere without user consent
80+
- User data should be protected with appropriate access controls
81+
82+
3. **Tool Safety**
83+
- Tools represent arbitrary code execution and must be treated with appropriate caution
84+
- Hosts must obtain explicit user consent before invoking any tool
85+
- Users should understand what each tool does before authorizing its use
86+
87+
4. **LLM Sampling Controls**
88+
- Users must explicitly approve any LLM sampling requests
89+
- Users should control:
90+
- Whether sampling occurs at all
91+
- The actual prompt that will be sent
92+
- What results the server can see
93+
- The protocol intentionally limits server visibility into prompts
94+
95+
### Implementation Guidelines
96+
97+
While MCP itself cannot enforce these security principles at the protocol level, implementors **SHOULD**:
98+
99+
1. Build robust consent and authorization flows into their applications
100+
2. Provide clear documentation of security implications
101+
3. Implement appropriate access controls and data protections
102+
4. Follow security best practices in their integrations
103+
5. Consider privacy implications in their feature designs
104+
105+
## Learn More
106+
107+
Explore the detailed specification for each protocol component:
108+
109+
{{< cards >}}
110+
{{< card link="architecture" title="Architecture" icon="template" >}}
111+
{{< card link="basic" title="Base Protocol" icon="code" >}}
112+
{{< card link="server" title="Server Features" icon="server" >}}
113+
{{< card link="client" title="Client Features" icon="user" >}}
114+
{{< card link="contributing" title="Contributing" icon="pencil" >}}
115+
{{< /cards >}}
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
---
2+
title: Architecture
3+
cascade:
4+
type: docs
5+
weight: 1
6+
---
7+
8+
The Model Context Protocol (MCP) follows a client-host-server architecture where each host can run multiple client instances. This architecture enables users to integrate AI capabilities across applications while maintaining clear security boundaries and isolating concerns. Built on JSON-RPC, MCP provides a stateful session protocol focused on context exchange and sampling coordination between clients and servers.
9+
10+
## Core Components
11+
12+
```mermaid
13+
graph LR
14+
subgraph "Application Host Process"
15+
H[Host]
16+
C1[Client 1]
17+
C2[Client 2]
18+
C3[Client 3]
19+
H --> C1
20+
H --> C2
21+
H --> C3
22+
end
23+
24+
subgraph "Local machine"
25+
S1[Server 1<br>Files & Git]
26+
S2[Server 2<br>Database]
27+
R1[("Local<br>Resource A")]
28+
R2[("Local<br>Resource B")]
29+
30+
C1 --> S1
31+
C2 --> S2
32+
S1 <--> R1
33+
S2 <--> R2
34+
end
35+
36+
subgraph "Internet"
37+
S3[Server 3<br>External APIs]
38+
R3[("Remote<br>Resource C")]
39+
40+
C3 --> S3
41+
S3 <--> R3
42+
end
43+
```
44+
45+
### Host
46+
The host process acts as the container and coordinator:
47+
- Creates and manages multiple client instances
48+
- Controls client connection permissions and lifecycle
49+
- Enforces security policies and consent requirements
50+
- Handles user authorization decisions
51+
- Coordinates AI/LLM integration and sampling
52+
- Manages context aggregation across clients
53+
54+
### Clients
55+
Each client is created by the host and maintains an isolated server connection:
56+
- Establishes one stateful session per server
57+
- Handles protocol negotiation and capability exchange
58+
- Routes protocol messages bidirectionally
59+
- Manages subscriptions and notifications
60+
- Maintains security boundaries between servers
61+
62+
A host application creates and manages multiple clients, with each client having a 1:1 relationship with a particular server.
63+
64+
### Servers
65+
Servers provide specialized context and capabilities:
66+
- Expose resources, tools and prompts via MCP primitives
67+
- Operate independently with focused responsibilities
68+
- Request sampling through client interfaces
69+
- Must respect security constraints
70+
- Can be local processes or remote services
71+
72+
## Design Principles
73+
74+
MCP is built on several key design principles that inform its architecture and implementation:
75+
76+
1. **Servers should be extremely easy to build**
77+
- Host applications handle complex orchestration responsibilities
78+
- Servers focus on specific, well-defined capabilities
79+
- Simple interfaces minimize implementation overhead
80+
- Clear separation enables maintainable code
81+
82+
2. **Servers should be highly composable**
83+
- Each server provides focused functionality in isolation
84+
- Multiple servers can be combined seamlessly
85+
- Shared protocol enables interoperability
86+
- Modular design supports extensibility
87+
88+
3. **Servers should not be able to read the whole conversation, nor "see into" other servers**
89+
- Servers receive only necessary contextual information
90+
- Full conversation history stays with the host
91+
- Each server connection maintains isolation
92+
- Cross-server interactions are controlled by the host
93+
- Host process enforces security boundaries
94+
95+
4. **Features can be added to servers and clients progressively**
96+
- Core protocol provides minimal required functionality
97+
- Additional capabilities can be negotiated as needed
98+
- Servers and clients evolve independently
99+
- Protocol designed for future extensibility
100+
- Backwards compatibility is maintained
101+
102+
## Message Types
103+
MCP defines three core message types based on [JSON-RPC 2.0](https://www.jsonrpc.org/specification):
104+
105+
- **Requests**: Bidirectional messages with method and parameters expecting a response
106+
- **Responses**: Successful results or errors matching specific request IDs
107+
- **Notifications**: One-way messages requiring no response
108+
109+
Each message type follows the JSON-RPC 2.0 specification for structure and delivery semantics.
110+
111+
## Capability Negotiation
112+
113+
The Model Context Protocol uses a capability-based negotiation system where clients and servers explicitly declare their supported features during initialization. Capabilities determine which protocol features and primitives are available during a session.
114+
115+
- Servers declare capabilities like resource subscriptions, tool support, and prompt templates
116+
- Clients declare capabilities like sampling support and notification handling
117+
- Both parties must respect declared capabilities throughout the session
118+
- Additional capabilities can be negotiated through extensions to the protocol
119+
120+
```mermaid
121+
sequenceDiagram
122+
participant Host
123+
participant Client
124+
participant Server
125+
126+
Host->>+Client: Initialize client
127+
Client->>+Server: Initialize session with capabilities
128+
Server-->>Client: Respond with supported capabilities
129+
130+
Note over Host,Server: Active Session with Negotiated Features
131+
132+
loop Client Requests
133+
Host->>Client: User- or model-initiated action
134+
Client->>Server: Request (tools/resources)
135+
Server-->>Client: Response
136+
Client-->>Host: Update UI or respond to model
137+
end
138+
139+
loop Server Requests
140+
Server->>Client: Request (sampling)
141+
Client->>Host: Forward to AI
142+
Host-->>Client: AI response
143+
Client-->>Server: Response
144+
end
145+
146+
loop Notifications
147+
Server--)Client: Resource updates
148+
Client--)Server: Status changes
149+
end
150+
151+
Host->>Client: Terminate
152+
Client->>-Server: End session
153+
deactivate Server
154+
```
155+
156+
Each capability unlocks specific protocol features for use during the session. For example:
157+
- Implemented [server features]({{< ref "/specification/2024-11-05/server" >}}) must be advertised in the server's capabilities
158+
- Emitting resource subscription notifications requires the server to declare subscription support
159+
- Tool invocation requires the server to declare tool capabilities
160+
- [Sampling]({{< ref "/specification/2024-11-05/client" >}}) requires the client to declare support in its capabilities
161+
162+
This capability negotiation ensures clients and servers have a clear understanding of supported functionality while maintaining protocol extensibility.

docs/specification/basic/_index.md renamed to docs/specification/2024-11-05/basic/_index.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ These protocol layers establish clear separation of concerns while enabling rich
3636
See the following pages for more details on the different components:
3737

3838
{{< cards >}}
39-
{{< card link="/specification/basic/lifecycle" title="Lifecycle" icon="refresh" >}}
40-
{{< card link="/specification/server/resources" title="Resources" icon="document" >}}
41-
{{< card link="/specification/server/prompts" title="Prompts" icon="chat-alt-2" >}}
42-
{{< card link="/specification/server/tools" title="Tools" icon="adjustments" >}}
43-
{{< card link="/specification/server/utilities/logging" title="Logging" icon="annotation" >}}
44-
{{< card link="/specification/client/sampling" title="Sampling" icon="code" >}}
39+
{{< card link="/specification/2024-11-05/basic/lifecycle" title="Lifecycle" icon="refresh" >}}
40+
{{< card link="/specification/2024-11-05/server/resources" title="Resources" icon="document" >}}
41+
{{< card link="/specification/2024-11-05/server/prompts" title="Prompts" icon="chat-alt-2" >}}
42+
{{< card link="/specification/2024-11-05/server/tools" title="Tools" icon="adjustments" >}}
43+
{{< card link="/specification/2024-11-05/server/utilities/logging" title="Logging" icon="annotation" >}}
44+
{{< card link="/specification/2024-11-05/client/sampling" title="Sampling" icon="code" >}}
4545
{{< /cards >}}
4646

4747
## Auth
4848

49-
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](https://github.com/modelcontextprotocol/specification/discussions) to help shape the future of the protocol!
49+
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](https://github.com/modelcontextprotocol/specification/2024-11-05/discussions) to help shape the future of the protocol!
5050

5151
Clients and servers **MAY** negotiate their own custom authentication and authorization strategies.
5252

5353
## Schema
5454

55-
The full specification of the protocol is defined as a [TypeScript schema](http://github.com/modelcontextprotocol/specification/tree/main/schema/schema.ts). This is the source of truth for all protocol messages and structures.
55+
The full specification of the protocol is defined as a [TypeScript schema](http://github.com/modelcontextprotocol/specification/2024-11-05/tree/main/schema/schema.ts). This is the source of truth for all protocol messages and structures.
5656

57-
There is also a [JSON Schema](http://github.com/modelcontextprotocol/specification/tree/main/schema/schema.json), which is automatically generated from the TypeScript source of truth, for use with various automated tooling.
57+
There is also a [JSON Schema](http://github.com/modelcontextprotocol/specification/2024-11-05/tree/main/schema/schema.json), which is automatically generated from the TypeScript source of truth, for use with various automated tooling.

0 commit comments

Comments
 (0)