-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Streamable HTTP is silently failing when trying to execute a feature that is only supported if sessions are enabled.
Guilty code here:
typescript-sdk/src/server/streamableHttp.ts
Lines 665 to 685 in a1608a6
if (requestId === undefined) { | |
// For standalone SSE streams, we can only send requests and notifications | |
if (isJSONRPCResponse(message) || isJSONRPCError(message)) { | |
throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request"); | |
} | |
const standaloneSse = this._streamMapping.get(this._standaloneSseStreamId) | |
if (standaloneSse === undefined) { | |
// The spec says the server MAY send messages on the stream, so it's ok to discard if no stream | |
return; | |
} | |
// Generate and store event ID if event store is provided | |
let eventId: string | undefined; | |
if (this._eventStore) { | |
// Stores the event and gets the generated event ID | |
eventId = await this._eventStore.storeEvent(this._standaloneSseStreamId, message); | |
} | |
// Send the message to the standalone SSE stream | |
this.writeSSEEvent(standaloneSse, message, eventId); | |
return; |
It exits at the following:
// The spec says the server MAY send messages on the stream, so it's ok to discard if no stream
return;
It does not help that none of the readme docs do not state explicitly that these features require session implementation (which brings other complexities like event store, etc. especially when horizontally scaled).
To Reproduce
Steps to reproduce the behavior:
- Run a stateless MCP server
- Attempt sampling or elicitation as per README.md - Sampling section
- Observe a timeout happening with no clear indication or a specified error.
Expected behavior
- Clear error being sent back.
- Logging being done.
- Not silently returning.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working