-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Authors: Jonathan Hefner (@jonathanhefner)
Status: Draft
Type: Standards Track
Created: 2025-10-22
Abstract
This SEP proposes changes to the Streamable HTTP transport in order to mitigate issues regarding long-running connections and resumability.
Motivation
The Streamable HTTP transport spec does not allow servers to close a connection while computing a result. In other words, barring client-side disconnection, servers must maintain potentially long-running connections.
Specification
When a server starts an SSE stream, it MUST immediately send an SSE event consisting of an id and an empty data string in order to prime the client to reconnect with that event ID as the Last-Event-ID.
Note that the SSE standard explicitly permits setting data to an empty string, and says that the appropriate client-side handling is to record the id for Last-Event-ID but otherwise ignore the event (i.e., not call the event handler callback).
At any point after the server has sent an event ID to the client, the server MAY disconnect at will. Specifically, this part of the MCP spec will be changed from:
The server SHOULD NOT close the SSE stream before sending the JSON-RPC response for the received JSON-RPC request
To:
The server MAY close the connection before sending the JSON-RPC response if it has sent an SSE event with an event ID to the client
If a server disconnects, the client will interpret the disconnection the same as a network failure, and will attempt to reconnect. In order to prevent clients from reconnecting / polling excessively, the server SHOULD send an SSE event with a retry field indicating how long the client should wait before reconnecting. Clients MUST respect the retry field.
Rationale
Servers may disconnect at will, avoiding long-running connections. Sending a retry field will prevent the client from hammering the server with inappropriate reconnection attempts.
Backward Compatibility
- New Client + Old Server: No changes. No backward incompatibility.
- Old Client + New Server: Client should interpret an at-will disconnect the same as a network failure.
retryfield is part of the SSE standard. No backward incompatibility if client already implements proper SSE resuming logic.
Additional Information
This SEP supersedes (in part) SEP-1335.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status