Skip to content

Commit e16c26c

Browse files
authored
Merge pull request modelcontextprotocol#1783 from jonathanhefner/sep-1699
SEP-1699: Support SSE polling via server-side disconnect
2 parents 6f2c22a + 528588d commit e16c26c

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

docs/specification/draft/basic/transports.mdx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,26 @@ MCP endpoint.
103103
`Content-Type: application/json`, to return one JSON object. The client **MUST**
104104
support both these cases.
105105
6. If the server initiates an SSE stream:
106-
- The SSE stream **SHOULD** eventually include JSON-RPC _response_ for the
106+
- The server **SHOULD** immediately send an SSE event consisting of an event
107+
ID and an empty `data` field in order to prime the client to reconnect
108+
(using that event ID as `Last-Event-ID`).
109+
- After the server has sent an SSE event with an event ID to the client, the
110+
server **MAY** close the _connection_ (without terminating the _SSE stream_)
111+
at any time in order to avoid holding a long-lived connection. The client
112+
**SHOULD** then "poll" the SSE stream by attempting to reconnect.
113+
- If the server does close the _connection_ prior to terminating the _SSE stream_,
114+
it **SHOULD** send an SSE event with a standard `retry` field before
115+
closing the connection. The client **MUST** respect the `retry` field,
116+
waiting the given number of milliseconds before attempting to reconnect.
117+
- The SSE stream **SHOULD** eventually include a JSON-RPC _response_ for the
107118
JSON-RPC _request_ sent in the POST body.
108119
- The server **MAY** send JSON-RPC _requests_ and _notifications_ before sending the
109120
JSON-RPC _response_. These messages **SHOULD** relate to the originating client
110121
_request_.
111-
- The server **SHOULD NOT** close the SSE stream before sending the JSON-RPC _response_
112-
for the received JSON-RPC _request_, unless the [session](#session-management)
122+
- The server **MAY** terminate the SSE stream if the [session](#session-management)
113123
expires.
114-
- After the JSON-RPC _response_ has been sent, the server **SHOULD** close the SSE
115-
stream.
124+
- After the JSON-RPC _response_ has been sent, the server **SHOULD** terminate the
125+
SSE stream.
116126
- Disconnection **MAY** occur at any time (e.g., due to network conditions).
117127
Therefore:
118128
- Disconnection **SHOULD NOT** be interpreted as the client cancelling its request.

docs/specification/draft/changelog.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ the previous revision, [2025-06-18](/specification/2025-06-18).
2020
1. Clarify that servers must respond with HTTP 403 Forbidden for invalid Origin headers in Streamable HTTP transport. (PR [#1439](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1439))
2121
2. Updated the [Security Best Practices guidance](https://modelcontextprotocol.io/specification/draft/basic/security_best_practices).
2222
3. Clarify that input validation errors should be returned as Tool Execution Errors rather than Protocol Errors to enable model self-correction ([SEP-1303](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1303)).
23+
4. Support polling SSE streams by allowing servers to disconnect at will ([SEP-1699](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1699)).
2324

2425
## Other schema changes
2526

0 commit comments

Comments
 (0)