Skip to content

fix(server): keep stdio SSE proxy alive after disconnect#1701

Open
AkhilTrivediX wants to merge 1 commit into
modelcontextprotocol:mainfrom
AkhilTrivediX:codex/guard-closed-sse-stdio-notifications
Open

fix(server): keep stdio SSE proxy alive after disconnect#1701
AkhilTrivediX wants to merge 1 commit into
modelcontextprotocol:mainfrom
AkhilTrivediX:codex/guard-closed-sse-stdio-notifications

Conversation

@AkhilTrivediX

Copy link
Copy Markdown

Summary

  • handle rejected SSE notification sends from the stdio stderr bridge
  • add a server regression test that reproduces an SSE client disconnect while the upstream stdio process continues writing to stderr
  • run the server regression suite as part of the standard test command

Root cause

When an Inspector SSE client disconnected, a later stderr notification from the proxied stdio server could call SSEServerTransport.send() after the transport had closed. Its rejected promise was unhandled, so Node exited with Error: Not connected.

The proxy now records the failed notification delivery while keeping the transport lifecycle running. The disconnected client still receives no message, but the Inspector process remains available for subsequent connections.

Closes #1014.

Testing

  • npm run test-server
  • cd client && npm test -- --runInBand
  • npm run build
  • npx prettier --check package.json server/package.json server/src/index.ts server/test/stdio-sse-close.test.ts

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.

SSE transport crashes with "Not connected" error when multiple connections occur

1 participant