Skip to content

Commit 8e192a2

Browse files
authored
SEP-2575: Make MCP Stateless (modelcontextprotocol#2575)
1 parent 91a643c commit 8e192a2

63 files changed

Lines changed: 3323 additions & 1953 deletions

File tree

Some content is hidden

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

docs/docs.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@
322322
"group": "Utilities",
323323
"pages": [
324324
"specification/draft/basic/utilities/cancellation",
325-
"specification/draft/basic/utilities/ping",
326325
"specification/draft/basic/utilities/progress",
326+
"specification/draft/basic/utilities/subscriptions",
327327
"specification/draft/basic/utilities/tasks",
328328
"specification/draft/basic/utilities/mrtr"
329329
]
@@ -342,6 +342,7 @@
342342
"group": "Server Features",
343343
"pages": [
344344
"specification/draft/server/index",
345+
"specification/draft/server/discover",
345346
"specification/draft/server/prompts",
346347
"specification/draft/server/resources",
347348
"specification/draft/server/tools",
@@ -428,7 +429,8 @@
428429
"group": "Accepted",
429430
"pages": [
430431
"seps/2207-oidc-refresh-token-guidance",
431-
"seps/2260-Require-Server-requests-to-be-associated-with-Client-requests"
432+
"seps/2260-Require-Server-requests-to-be-associated-with-Client-requests",
433+
"seps/2575-stateless-mcp"
432434
]
433435
},
434436
{

docs/seps/2575-stateless-mcp.mdx

Lines changed: 802 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/seps/index.mdx

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/specification/draft/architecture/index.mdx

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ title: Architecture
55
<div id="enable-section-numbers" />
66

77
The Model Context Protocol (MCP) follows a client-host-server architecture where each
8-
host can run multiple client instances. This architecture enables users to integrate AI
9-
capabilities across applications while maintaining clear security boundaries and
10-
isolating concerns. Built on JSON-RPC, MCP provides a protocol focused on context
11-
exchange and sampling coordination between clients and servers.
8+
host can run multiple client instances. MCP is a stateless protocol: every request is
9+
self-contained and carries its own protocol version, client identity, and capabilities.
10+
This architecture enables users to integrate AI capabilities across applications while
11+
maintaining clear security boundaries and isolating concerns. Built on JSON-RPC, MCP
12+
provides a protocol focused on context exchange and sampling coordination between
13+
clients and servers.
1214

1315
## Core Components
1416

@@ -58,10 +60,10 @@ The host process acts as the container and coordinator:
5860

5961
### Clients
6062

61-
Each client is created by the host and maintains an isolated server connection:
63+
Each client is created by the host and communicates with exactly one server:
6264

63-
- Establishes one connection per server
64-
- Handles protocol negotiation and capability exchange
65+
- Communicates with exactly one server
66+
- Attaches protocol version and capabilities to every request
6567
- Routes protocol messages bidirectionally
6668
- Manages subscriptions and notifications
6769
- Maintains security boundaries between servers
@@ -75,7 +77,7 @@ Servers provide specialized context and capabilities:
7577

7678
- Expose resources, tools and prompts via MCP primitives
7779
- Operate independently with focused responsibilities
78-
- Request sampling through client interfaces
80+
- Request client input (sampling, elicitation, roots) via `IncompleteResponse` within a reply
7981
- Must respect security constraints
8082
- Can be local processes or remote services
8183

@@ -100,7 +102,7 @@ implementation:
100102
servers**
101103
- Servers receive only necessary contextual information
102104
- Full conversation history stays with the host
103-
- Each server connection maintains isolation
105+
- Each server maintains isolation
104106
- Cross-server interactions are controlled by the host
105107
- Host process enforces security boundaries
106108

@@ -114,13 +116,16 @@ implementation:
114116
## Capability Negotiation
115117

116118
The Model Context Protocol uses a capability-based negotiation system where clients and
117-
servers explicitly declare their supported features during initialization. Capabilities
118-
determine which protocol features and primitives are available during a connection.
119+
servers declare their supported features on each request. Clients include their
120+
capabilities in `_meta.io.modelcontextprotocol/clientCapabilities` on every request.
121+
Servers advertise their capabilities in response to
122+
[`server/discover`](/specification/draft/server/discover), which clients may call before
123+
any other request for up-front capability discovery.
119124

120-
- Servers declare capabilities like resource subscriptions, tool support, and prompt
125+
- Servers declare capabilities like tool support, resource subscriptions, and prompt
121126
templates
122-
- Clients declare capabilities like sampling support and notification handling
123-
- Both parties must respect declared capabilities throughout the connection
127+
- Clients declare capabilities like sampling support and elicitation handling
128+
- Both parties must respect declared capabilities throughout the interaction
124129
- Additional capabilities can be negotiated through extensions to the protocol
125130

126131
```mermaid
@@ -129,43 +134,40 @@ sequenceDiagram
129134
participant Client
130135
participant Server
131136
132-
Host->>+Client: Initialize client
133-
Client->>+Server: Initialize with capabilities
134-
Server-->>Client: Respond with supported capabilities
135-
136-
Note over Host,Server: Active Connection with Negotiated Features
137+
opt Discovery
138+
Client->>Server: server/discover
139+
Server-->>Client: supported versions + capabilities
140+
end
137141
138142
loop Client Requests
139143
Host->>Client: User- or model-initiated action
140-
Client->>Server: Request (tools/resources)
144+
Client->>Server: Request (with _meta: version, clientInfo, clientCapabilities)
145+
alt Server requires client input
146+
Server-->>Client: IncompleteResponse (e.g. sampling/createMessage)
147+
Client->>Host: Forward to AI
148+
Host-->>Client: AI response
149+
Client->>Server: Original request (with input)
150+
end
141151
Server-->>Client: Response
142152
Client-->>Host: Update UI or respond to model
143153
end
144154
145-
loop Server Requests
146-
Server->>Client: Request (sampling)
147-
Client->>Host: Forward to AI
148-
Host-->>Client: AI response
149-
Client-->>Server: Response
155+
opt Subscriptions
156+
Client->>Server: subscriptions/listen (toolsListChanged, resourceSubscriptions, …)
157+
Server--)Client: notifications/subscriptions/acknowledged
158+
loop Stream
159+
Server--)Client: notifications/* (tagged with subscriptionId)
160+
end
150161
end
151-
152-
loop Notifications
153-
Server--)Client: Resource updates
154-
Client--)Server: Status changes
155-
end
156-
157-
Host->>Client: Terminate
158-
Client->>-Server: End connection
159-
deactivate Server
160162
```
161163

162-
Each capability unlocks specific protocol features for use during the connection. For
163-
example:
164+
Each capability unlocks specific protocol features on a per-request basis. For example:
164165

165166
- Implemented [server features](/specification/draft/server) must be advertised in the
166167
server's capabilities
167-
- Emitting resource subscription notifications requires the server to declare
168-
subscription support
168+
- Receiving resource update notifications requires opening a
169+
[`subscriptions/listen`](/specification/draft/basic/utilities/subscriptions) stream
170+
with the desired resource URIs
169171
- Tool invocation requires the server to declare tool capabilities
170172
- [Sampling](/specification/draft/client) requires the client to declare support in its
171173
capabilities

docs/specification/draft/basic/index.mdx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: Overview
77
The Model Context Protocol consists of several key components that work together:
88

99
- **Base Protocol**: Core JSON-RPC message types
10-
- **Lifecycle Management**: Connection initialization and capability negotiation
10+
- **Lifecycle Management**: Protocol version negotiation and per-request capability declaration
1111
- **Authorization**: Authentication and authorization framework for HTTP-based transports
1212
- **Server Features**: Resources, prompts, and tools exposed by servers
1313
- **Client Features**: Sampling and root directory lists provided by clients
@@ -225,6 +225,34 @@ may reserve particular names for purpose-specific metadata, as declared in those
225225
- Unless empty, MUST begin and end with an alphanumeric character (`[a-z0-9A-Z]`).
226226
- MAY contain hyphens (`-`), underscores (`_`), dots (`.`), and alphanumerics in between.
227227

228+
**Per-request protocol fields:**
229+
230+
Every client request **MUST** include the following `io.modelcontextprotocol/*` fields
231+
in `_meta`. Servers use these to identify the client and the protocol version in use
232+
without relying on any prior connection state. See
233+
[Lifecycle][lifecycle] for version negotiation rules.
234+
235+
| Key | Type | Required | Description |
236+
| -------------------------------------------- | -------------------- | -------- | ----------------------------------------------------------- |
237+
| `io.modelcontextprotocol/protocolVersion` | `string` | Yes | Protocol version for this request (e.g., `"DRAFT-2026-v1"`) |
238+
| `io.modelcontextprotocol/clientInfo` | `Implementation` | Yes | Client name and version |
239+
| `io.modelcontextprotocol/clientCapabilities` | `ClientCapabilities` | Yes | Client capabilities relevant to this request |
240+
| `io.modelcontextprotocol/logLevel` | `LoggingLevel` | No | Minimum log level the server should emit for this request |
241+
242+
A server **MUST NOT** rely on capabilities the client has not declared. If
243+
processing a request requires a capability the client did not include in
244+
`io.modelcontextprotocol/clientCapabilities`, the server **MUST** return a
245+
[`MissingRequiredClientCapabilityError`](/specification/draft/schema#missingrequiredclientcapabilityerror)
246+
(`-32003`) whose `data.requiredCapabilities` lists the missing capabilities. On
247+
HTTP, the response status **MUST** be `400 Bad Request`.
248+
249+
On notifications delivered via a [`subscriptions/listen`][subscriptions-listen] stream,
250+
the server **MUST** include `io.modelcontextprotocol/subscriptionId` in `_meta` so the
251+
client can correlate the notification with the originating subscription request.
252+
253+
[lifecycle]: /specification/draft/basic/lifecycle
254+
[subscriptions-listen]: /specification/draft/basic/utilities/subscriptions
255+
228256
**OpenTelemetry trace context:**
229257

230258
As an exception to the prefix requirement above, the keys `traceparent`, `tracestate`, and

0 commit comments

Comments
 (0)