Summary
packages/middleware/node/test/streamableHttp.test.ts has tests that call reader.read() once and then assert the accumulated text contains multiple SSE events. On Node v26.7.0, fetch can deliver those SSE events in separate chunks, so the middleware behavior works but the tests fail before reading the later events.
Reproduction
- Run
pnpm install --frozen-lockfile
- Run
pnpm build:all
- Run
pnpm --filter @modelcontextprotocol/node test -- test/streamableHttp.test.ts
Observed failures:
should handle batch request messages with SSE stream for responses reads only the req-1 event and then fails before reading req-2.
should store and replay MCP server tool notifications reads an earlier {} event and then fails before reading Second notification from MCP server.
Suggested fix
Read from the SSE stream until the expected event text appears or a short timeout/cancel occurs, instead of assuming multiple SSE events share one fetch chunk. I pushed a minimal branch here:
https://github.com/jstar0/typescript-sdk/tree/fix-node-sse-test-chunking-upstream
Verification on that branch
pnpm build:all
pnpm --filter @modelcontextprotocol/node test -- test/streamableHttp.test.ts
pnpm lint:all
Note: GitHub returned a permissions error when I tried opening a fork PR against this repository, so I am filing the reproducible failure with the prepared branch link instead.
Summary
packages/middleware/node/test/streamableHttp.test.tshas tests that callreader.read()once and then assert the accumulated text contains multiple SSE events. On Node v26.7.0, fetch can deliver those SSE events in separate chunks, so the middleware behavior works but the tests fail before reading the later events.Reproduction
pnpm install --frozen-lockfilepnpm build:allpnpm --filter @modelcontextprotocol/node test -- test/streamableHttp.test.tsObserved failures:
should handle batch request messages with SSE stream for responsesreads only thereq-1event and then fails before readingreq-2.should store and replay MCP server tool notificationsreads an earlier{}event and then fails before readingSecond notification from MCP server.Suggested fix
Read from the SSE stream until the expected event text appears or a short timeout/cancel occurs, instead of assuming multiple SSE events share one fetch chunk. I pushed a minimal branch here:
https://github.com/jstar0/typescript-sdk/tree/fix-node-sse-test-chunking-upstream
Verification on that branch
pnpm build:allpnpm --filter @modelcontextprotocol/node test -- test/streamableHttp.test.tspnpm lint:allNote: GitHub returned a permissions error when I tried opening a fork PR against this repository, so I am filing the reproducible failure with the prepared branch link instead.