Skip to content

SSEServerTransport doesn't seem to close properly #321

Open
@nichtsam

Description

@nichtsam

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:

  1. npm run start
  2. npx @modelcontextprotocol/inspector
  3. connect to http://localhost:3001/sse
  4. disconnect

Expected behavior
res.end should be called via the close method to cleanly terminate the SSE connection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions