You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would you mind please adding some of the symptoms you noticed because of this issue? I'm trying to debug some issues on an MCP server and suspect it could be related to something like this. Thanks!
Would you mind please adding some of the symptoms you noticed because of this issue? I'm trying to debug some issues on an MCP server and suspect it could be related to something like this. Thanks!
The core issue is that these responses never properly close, so they occupy memory until timeout. This can build up and create memory pressure. Not sure if there's any obvious symptoms.
import{Client}from"@modelcontextprotocol/sdk/client/index.js";import{SSEClientTransport}from"@modelcontextprotocol/sdk/client/sse.js";constclient=newClient({name: "mcp-typescript-client",version: "1.0.0",},{capabilities: {},});consttransport=newSSEClientTransport(newURL(".../sse"));asyncfunctionmain(){awaitclient.connect(transport);// ... do stuff with client// these don't seem to do anything - the connection stays open indefinitelyawaitclient.transport?.close();awaitclient.close();}main();
Describe the bug
While reviewing the source code, I noticed that the
close
method is never actually called, which meansres.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 whenclose
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
http://localhost:3001/sse
Expected behavior
res.end
should be called via theclose
method to cleanly terminate the SSE connection.The text was updated successfully, but these errors were encountered: