Skip to content

fix: replay request SSE responses after disconnect#2207

Open
he-yufeng wants to merge 3 commits into
modelcontextprotocol:mainfrom
he-yufeng:fix/request-scoped-sse-replay
Open

fix: replay request SSE responses after disconnect#2207
he-yufeng wants to merge 3 commits into
modelcontextprotocol:mainfrom
he-yufeng:fix/request-scoped-sse-replay

Conversation

@he-yufeng
Copy link
Copy Markdown

Summary

  • persist request-scoped SSE events even after closeSSEStream() detaches the active controller
  • avoid throwing when the terminal response is safely stored for replay
  • add a regression test that closes a POST SSE stream, completes the tool while disconnected, and replays the final response through Last-Event-ID

To verify

  • pnpm --filter @modelcontextprotocol/node test -- streamableHttp.test.ts -t closeSSE
  • pnpm --filter @modelcontextprotocol/server test -- streamableHttp.test.ts
  • pnpm --filter @modelcontextprotocol/server typecheck
  • pnpm --filter @modelcontextprotocol/node typecheck
  • pnpm --filter @modelcontextprotocol/server lint
  • pnpm --filter @modelcontextprotocol/node lint
  • pnpm --filter @modelcontextprotocol/server build
  • pnpm --filter @modelcontextprotocol/node build
  • git diff --check

@he-yufeng he-yufeng requested a review from a team as a code owner May 29, 2026 21:45
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 29, 2026

🦋 Changeset detected

Latest commit: a706b98

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

This PR includes changesets to release 2 packages
Name Type
@modelcontextprotocol/node Patch
@modelcontextprotocol/server 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
Copy link
Copy Markdown

pkg-pr-new Bot commented May 29, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@2207

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/codemod@2207

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@2207

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@2207

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/fastify@2207

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@2207

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@2207

commit: a706b98

@he-yufeng
Copy link
Copy Markdown
Author

Added a changeset for @modelcontextprotocol/node and @modelcontextprotocol/server as patch releases. Validation for this follow-up: git diff --check; verified the changeset frontmatter and package names against packages/middleware/node/package.json and packages/server/package.json. The previous CI run was already green; this push only adds release metadata.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant