Skip to content

Commit e6a5a43

Browse files
docs: document client capabilities persistence in WorkerTransport
Update documentation to reflect PR cloudflare/agents#783 changes: - Updated TransportState interface to include initializeParams field - Added documentation explaining that client capabilities, client info, and protocol version are now persisted and restored across serverless restarts - Emphasized importance of capability persistence for elicitation and sampling features - Added detailed field descriptions for TransportState interface This enables MCP servers to properly support advanced client features like elicitation after serverless cold starts. Related: cloudflare/agents#783 Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent e822354 commit e6a5a43

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/content/docs/agents/model-context-protocol/mcp-handler-api.mdx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,12 @@ export default {
230230
With persistent storage, the transport preserves:
231231

232232
- Session ID across reconnections
233-
- Protocol version negotiation state
234233
- Initialization status
234+
- Client capabilities (like elicitation and sampling support)
235+
- Client information (name and version)
236+
- Protocol version negotiation state
235237

236-
This allows MCP clients to reconnect and resume their session in the event of a connection loss.
238+
This allows MCP clients to reconnect and resume their session in the event of a connection loss, including after serverless cold starts. The preservation of client capabilities is particularly important for features like [elicitation](https://modelcontextprotocol.io/specification/draft/client/elicitation) and [sampling](https://modelcontextprotocol.io/specification/draft/client/sampling), which require the MCP server to know what the client supports.
237239

238240
### WorkerTransport
239241

@@ -386,10 +388,16 @@ interface MCPStorageApi {
386388
interface TransportState {
387389
sessionId?: string;
388390
initialized: boolean;
389-
protocolVersion?: ProtocolVersion;
391+
initializeParams?: InitializeRequestParams;
390392
}
391393
```
392394

395+
The `TransportState` interface defines what gets persisted to storage:
396+
397+
- **sessionId** — The unique identifier for this MCP session
398+
- **initialized** — Whether the session has completed initialization
399+
- **initializeParams** — The client's capabilities, client info, and protocol version from the initialize request. This is automatically captured during initialization and restored on reconnection, enabling the server to remember what features the client supports (like elicitation or sampling) across serverless restarts.
400+
393401
<TypeScriptExample>
394402

395403
```ts

0 commit comments

Comments
 (0)