Skip to content

test(node): handle SSE responses split across chunks - #2847

Open
sjr666666 wants to merge 4 commits into
modelcontextprotocol:mainfrom
sjr666666:codex/fix-sse-test-chunking
Open

sjr666666 wants to merge 4 commits into
modelcontextprotocol:mainfrom
sjr666666:codex/fix-sse-test-chunking

Conversation

@sjr666666

Copy link
Copy Markdown

Summary

  • Read Streamable HTTP SSE responses until the expected events are received instead of assuming one reader.read() contains the full response.
  • Add a bounded cancellation timeout so a stalled stream cannot leave the test hanging.
  • Keep the production transport unchanged; this is a test reliability fix.

Fixes #2661

Verification

  • Node 26.7.0: npx --yes node@26.7.0 node_modules/vitest/vitest.mjs run test/streamableHttp.test.ts — 74 passed.
  • Node 24.12.0: pnpm --filter @modelcontextprotocol/node test — 102 passed.
  • Node 26.7.0: full @modelcontextprotocol/node workspace tests — 102 passed.
  • pnpm --filter @modelcontextprotocol/node typecheck — passed.
  • pnpm --filter @modelcontextprotocol/node build — passed.

The repository pre-push hook also runs sync:snippets --check, which currently reports 49 existing out-of-sync files outside this change; no snippet files are touched by this PR.

@sjr666666
sjr666666 requested a review from a team as a code owner September 23, 2026 13:47
@changeset-bot

changeset-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 66d2f69

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@modelcontextprotocol/node Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@2847

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@2847

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@2847

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@2847

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@2847

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@2847

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@2847

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@2847

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@2847

commit: 66d2f69

@claude claude Bot added the v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes label Sep 23, 2026
@sjr666666
sjr666666 force-pushed the codex/fix-sse-test-chunking branch from d9046d3 to d682b53 Compare October 2, 2026 06:41
@sjr666666

Copy link
Copy Markdown
Author

@felixweinberger — updated the branch onto main so the required checks could re-run; all 14 green, including build, test (20) and test (24). Bumping in case it slipped through: test-only change that makes the node middleware SSE tests accumulate a streamed response across fetch chunks instead of assuming the first read holds a whole event, so chunked-delivery regressions fail the suite rather than passing intermittently. No runtime change, changeset included.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streamable HTTP SSE tests assume multiple events share one fetch chunk

1 participant