modelcontextprotocol / modelcontextprotocol/typescript-sdk

Streamable HTTP SSE tests assume multiple events share one fetch chunk

Open Beginner friendly
#2,661 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug good first issue P3 v1 v2
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

  1. Run pnpm install --frozen-lockfile
  2. Run pnpm build:all
  3. 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.