Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/server/src/server/streamableHttp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,17 @@ export class WebStandardStreamableHTTPServerTransport implements Transport {
* Handles `GET` requests for SSE stream
*/
private async handleGetRequest(req: Request): Promise<Response> {
// Stateless transports cannot safely own a standalone GET SSE stream.
// In stateless mode, each HTTP request must use a fresh transport
// instance, so allowing GET here would create transport-local stream
// state with no durable owner across requests.
if (this.sessionIdGenerator === undefined) {
return this.createJsonErrorResponse(405, -32_000, 'Method not allowed.', {
headers: {
Allow: 'POST'
}
});
}
// The client MUST include an Accept header, listing text/event-stream as a supported content type.
const acceptHeader = req.headers.get('accept');
if (!acceptHeader?.includes('text/event-stream')) {
Expand Down
Loading