-
Notifications
You must be signed in to change notification settings - Fork 327
Open
Description
Description
When using WorkerTransport with storage for MCP in a serverless environment (like Cloudflare Workers), the client capabilities are not persisted across requests. This causes elicitation to fail with:
Error: Client does not support form elicitation.
at Server.elicitInput
Root Cause
The TransportState interface only stores:
export interface TransportState {
sessionId?: string;
initialized: boolean;
}However, _clientCapabilities is stored on the Server instance and set during the initialize request. When a new serverless function instance handles a subsequent request (like a tool call that triggers elicitation), the capabilities are lost because:
- The transport state is restored from storage ✅
- But
_clientCapabilitieson the Server instance is not restored ❌
Steps to Reproduce
- Create an MCP server using
WorkerTransportwith storage - Register a tool that uses
server.elicitInput() - Connect a client that advertises elicitation capability
- Call the tool - elicitation fails because capabilities weren't persisted
Expected Behavior
Client capabilities should be persisted as part of the transport state so they survive across serverless function invocations.
Suggested Fix
Include clientCapabilities in TransportState:
export interface TransportState {
sessionId?: string;
initialized: boolean;
clientCapabilities?: ClientCapabilities; // Add this
}And restore them when handling requests after initialization.
Environment
@modelcontextprotocol/sdk: 1.25.2agents: latest- Runtime: Cloudflare Workers (wrangler dev)
Metadata
Metadata
Assignees
Labels
No labels