modelcontextprotocol / modelcontextprotocol/typescript-sdk
Streamable HTTP SSE tests assume multiple events share one fetch chunk
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13.4k
- Forks
- 2.2k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 4
Description
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 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: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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/middleware/node/test/streamableHttp.test.ts and run the filtered streamableHttp test command from the issue. Update the affected SSE tests to continue reading until the expected event text appears or the stated timeout/cancel condition occurs. Done means both reported scenarios pass with separate fetch chunks, along with pnpm build:all and pnpm lint:all.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend, testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100