Open
Description
Describe the bug
While reviewing the source code, I noticed that the close
method is never actually called, which means res.end
is never triggered:
https://github.com/modelcontextprotocol/typescript-sdk/blob/main/src/server/sse.ts
In multiple places, it seems like onclose
is called directly when close
should be used instead, to ensure proper cleanup.
To Reproduce
I created a minimal reproduction here:
https://github.com/nichtsam/transport-issue
Steps to reproduce the behavior:
npm run start
npx @modelcontextprotocol/inspector
- connect to
http://localhost:3001/sse
- disconnect
Expected behavior
res.end
should be called via the close
method to cleanly terminate the SSE connection.