Skip to content

Commit 91a643c

Browse files
authored
Merge pull request modelcontextprotocol#2567 from modelcontextprotocol/sep/sessionless-mcp
SEP-2567: Sessionless MCP via Explicit State Handles
2 parents 77a4816 + b4e8380 commit 91a643c

16 files changed

Lines changed: 667 additions & 74 deletions

File tree

docs/docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,8 @@
420420
"seps/2133-extensions",
421421
"seps/2148-contributor-ladder",
422422
"seps/2149-working-group-charter-template",
423-
"seps/2243-http-standardization"
423+
"seps/2243-http-standardization",
424+
"seps/2567-sessionless-mcp"
424425
]
425426
},
426427
{

docs/seps/2567-sessionless-mcp.mdx

Lines changed: 293 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: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ title: Architecture
77
The Model Context Protocol (MCP) follows a client-host-server architecture where each
88
host can run multiple client instances. This architecture enables users to integrate AI
99
capabilities across applications while maintaining clear security boundaries and
10-
isolating concerns. Built on JSON-RPC, MCP provides a stateful session protocol focused
11-
on context exchange and sampling coordination between clients and servers.
10+
isolating concerns. Built on JSON-RPC, MCP provides a protocol focused on context
11+
exchange and sampling coordination between clients and servers.
1212

1313
## Core Components
1414

@@ -60,7 +60,7 @@ The host process acts as the container and coordinator:
6060

6161
Each client is created by the host and maintains an isolated server connection:
6262

63-
- Establishes one stateful session per server
63+
- Establishes one connection per server
6464
- Handles protocol negotiation and capability exchange
6565
- Routes protocol messages bidirectionally
6666
- Manages subscriptions and notifications
@@ -115,12 +115,12 @@ implementation:
115115

116116
The Model Context Protocol uses a capability-based negotiation system where clients and
117117
servers explicitly declare their supported features during initialization. Capabilities
118-
determine which protocol features and primitives are available during a session.
118+
determine which protocol features and primitives are available during a connection.
119119

120120
- Servers declare capabilities like resource subscriptions, tool support, and prompt
121121
templates
122122
- Clients declare capabilities like sampling support and notification handling
123-
- Both parties must respect declared capabilities throughout the session
123+
- Both parties must respect declared capabilities throughout the connection
124124
- Additional capabilities can be negotiated through extensions to the protocol
125125

126126
```mermaid
@@ -130,10 +130,10 @@ sequenceDiagram
130130
participant Server
131131
132132
Host->>+Client: Initialize client
133-
Client->>+Server: Initialize session with capabilities
133+
Client->>+Server: Initialize with capabilities
134134
Server-->>Client: Respond with supported capabilities
135135
136-
Note over Host,Server: Active Session with Negotiated Features
136+
Note over Host,Server: Active Connection with Negotiated Features
137137
138138
loop Client Requests
139139
Host->>Client: User- or model-initiated action
@@ -155,11 +155,11 @@ sequenceDiagram
155155
end
156156
157157
Host->>Client: Terminate
158-
Client->>-Server: End session
158+
Client->>-Server: End connection
159159
deactivate Server
160160
```
161161

162-
Each capability unlocks specific protocol features for use during the session. For
162+
Each capability unlocks specific protocol features for use during the connection. For
163163
example:
164164

165165
- Implemented [server features](/specification/draft/server) must be advertised in the

docs/specification/draft/basic/authorization.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,8 +539,7 @@ Specifically:
539539
Authorization: Bearer <access-token>
540540
```
541541

542-
Note that authorization **MUST** be included in every HTTP request from client to server,
543-
even if they are part of the same logical session.
542+
Note that authorization **MUST** be included in every HTTP request from client to server.
544543

545544
2. Access tokens **MUST NOT** be included in the URI query string
546545

docs/specification/draft/basic/index.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +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, capability negotiation, and
11-
session control
10+
- **Lifecycle Management**: Connection initialization and capability negotiation
1211
- **Authorization**: Authentication and authorization framework for HTTP-based transports
1312
- **Server Features**: Resources, prompts, and tools exposed by servers
1413
- **Client Features**: Sampling and root directory lists provided by clients
@@ -45,8 +44,8 @@ these types of messages:
4544

4645
- Requests **MUST** include a string or integer ID.
4746
- Unlike base JSON-RPC, the ID **MUST NOT** be `null`.
48-
- The request ID **MUST NOT** have been previously used by the requestor within the same
49-
session.
47+
- The request ID **MUST NOT** match the ID of any other request the sender has issued and
48+
not yet received a response for.
5049

5150
### Responses
5251

docs/specification/draft/basic/lifecycle.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ For details, see [the Protocol Version Header section in Transports](/specificat
189189
#### Capability Negotiation
190190

191191
Client and server capabilities establish which optional protocol features will be
192-
available during the session.
192+
available during the connection.
193193

194194
Key capabilities include:
195195

docs/specification/draft/basic/transports.mdx

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ MCP endpoint.
121121
- The server **MAY** send JSON-RPC _requests_ and _notifications_ before sending the
122122
JSON-RPC _response_. These messages **MUST** relate to the originating client
123123
_request_.
124-
- The server **MAY** terminate the SSE stream if the [session](#session-management)
125-
expires.
126124
- After the JSON-RPC _response_ has been sent, the server **SHOULD** terminate the
127125
SSE stream.
128126
- Disconnection **MAY** occur at any time (e.g., due to network conditions).
@@ -174,9 +172,7 @@ lost:
174172

175173
1. Servers **MAY** attach an `id` field to their SSE events, as described in the
176174
[SSE standard](https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation).
177-
- If present, the ID **MUST** be globally unique across all streams within that
178-
[session](#session-management)—or all streams with that specific client, if session
179-
management is not in use.
175+
- If present, the ID **MUST** be globally unique across all streams.
180176
- Event IDs **SHOULD** encode sufficient information to identify the originating
181177
stream, enabling the server to correlate a `Last-Event-ID` to the correct stream.
182178
2. If the client wishes to resume after a disconnection (whether due to network failure
@@ -195,38 +191,6 @@ lost:
195191
In other words, these event IDs should be assigned by servers on a _per-stream_ basis, to
196192
act as a cursor within that particular stream.
197193

198-
### Session Management
199-
200-
An MCP "session" consists of logically related interactions between a client and a
201-
server, beginning with the [initialization phase](/specification/draft/basic/lifecycle). To support
202-
servers which want to establish stateful sessions:
203-
204-
1. A server using the Streamable HTTP transport **MAY** assign a session ID at
205-
initialization time, by including it in an `MCP-Session-Id` header on the HTTP
206-
response containing the `InitializeResult`.
207-
- The session ID **SHOULD** be globally unique and cryptographically secure (e.g., a
208-
securely generated UUID, a JWT, or a cryptographic hash).
209-
- The session ID **MUST** only contain visible ASCII characters (ranging from 0x21 to
210-
0x7E).
211-
- The client **MUST** handle the session ID in a secure manner, see [Session Hijacking mitigations](/specification/draft/basic/security_best_practices#session-hijacking) for more details.
212-
2. If an `MCP-Session-Id` is returned by the server during initialization, clients using
213-
the Streamable HTTP transport **MUST** include it in the `MCP-Session-Id` header on
214-
all of their subsequent HTTP requests.
215-
- Servers that require a session ID **SHOULD** respond to requests without an
216-
`MCP-Session-Id` header (other than initialization) with HTTP 400 Bad Request.
217-
3. The server **MAY** terminate the session at any time, after which it **MUST** respond
218-
to requests containing that session ID with HTTP 404 Not Found.
219-
4. When a client receives HTTP 404 in response to a request containing an
220-
`MCP-Session-Id`, it **MUST** start a new session by sending a new `InitializeRequest`
221-
without a session ID attached.
222-
5. Clients that no longer need a particular session (e.g., because the user is leaving
223-
the client application) **SHOULD** send an HTTP DELETE to the MCP endpoint with the
224-
`MCP-Session-Id` header, to explicitly terminate the session.
225-
- The server **MAY** respond to this request with HTTP 405 Method Not Allowed,
226-
indicating that the server does not allow clients to terminate sessions. If the
227-
server returns HTTP 405, it **MUST** include an `Allow` header listing the methods
228-
it does support.
229-
230194
### Sequence Diagram
231195

232196
```mermaid
@@ -237,13 +201,13 @@ sequenceDiagram
237201
note over Client, Server: initialization
238202
239203
Client->>+Server: POST InitializeRequest
240-
Server->>-Client: InitializeResponse<br>MCP-Session-Id: 1868a90c...
204+
Server->>-Client: InitializeResponse
241205
242-
Client->>+Server: POST InitializedNotification<br>MCP-Session-Id: 1868a90c...
206+
Client->>+Server: POST InitializedNotification
243207
Server->>-Client: 202 Accepted
244208
245209
note over Client, Server: client requests
246-
Client->>+Server: POST ... request ...<br>MCP-Session-Id: 1868a90c...
210+
Client->>+Server: POST ... request ...
247211
248212
alt single HTTP response
249213
Server->>Client: ... response ...
@@ -256,11 +220,11 @@ sequenceDiagram
256220
deactivate Server
257221
258222
note over Client, Server: client notifications/responses
259-
Client->>+Server: POST ... notification/response ...<br>MCP-Session-Id: 1868a90c...
223+
Client->>+Server: POST ... notification/response ...
260224
Server->>-Client: 202 Accepted
261225
262226
note over Client, Server: server requests
263-
Client->>+Server: GET<br>MCP-Session-Id: 1868a90c...
227+
Client->>+Server: GET
264228
loop while connection remains open
265229
Server-)Client: ... SSE messages from server ...
266230
end
@@ -306,7 +270,6 @@ These headers are **REQUIRED** for compliance.
306270
```http
307271
POST /mcp HTTP/1.1
308272
Content-Type: application/json
309-
Mcp-Session-Id: 1f3a4b5c-6d7e-8f9a-0b1c-2d3e4f5a6b7c
310273
Mcp-Method: tools/call
311274
Mcp-Name: get_weather
312275
@@ -328,7 +291,6 @@ Mcp-Name: get_weather
328291
```http
329292
POST /mcp HTTP/1.1
330293
Content-Type: application/json
331-
Mcp-Session-Id: 1f3a4b5c-6d7e-8f9a-0b1c-2d3e4f5a6b7c
332294
Mcp-Method: resources/read
333295
Mcp-Name: file:///projects/myapp/config.json
334296
@@ -369,7 +331,6 @@ Mcp-Method: initialize
369331
```http
370332
POST /mcp HTTP/1.1
371333
Content-Type: application/json
372-
Mcp-Session-Id: 1f3a4b5c-6d7e-8f9a-0b1c-2d3e4f5a6b7c
373334
Mcp-Method: notifications/initialized
374335
375336
{
@@ -486,7 +447,6 @@ including the tool name and the reason for rejection.
486447
```http
487448
POST /mcp HTTP/1.1
488449
Content-Type: application/json
489-
Mcp-Session-Id: 1f3a4b5c-6d7e-8f9a-0b1c-2d3e4f5a6b7c
490450
Mcp-Method: tools/call
491451
Mcp-Name: execute_sql
492452
Mcp-Param-Region: us-west1

docs/specification/draft/basic/utilities/ping.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ the client or server can initiate a ping by sending a `ping` request.
1515
<Warning>
1616

1717
`ping` is an MCP-level liveness check and **MAY** be sent by either party at any
18-
time on an established session/connection.
18+
time on an established connection.
1919

2020
In Streamable HTTP, implementations **SHOULD** prefer transport-level SSE
2121
keepalive mechanisms for idle-connection maintenance; `ping` remains available

docs/specification/draft/changelog.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ the previous revision, [2025-11-25](/specification/2025-11-25).
99

1010
## Major changes
1111

12-
N/A
12+
1. Remove protocol-level sessions and the `Mcp-Session-Id` header from the Streamable HTTP transport. List endpoints (`tools/list`, `resources/list`, `prompts/list`) no longer vary per-connection. Servers that need cross-call state use explicit, server-minted handles passed as ordinary tool arguments ([SEP-2567](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2567)).
1313

1414
## Minor changes
1515

0 commit comments

Comments
 (0)