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
{{ message }}
Repository navigation
SSEServerTransport doesn't seem to close properly #321
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();
Hi @nichtsam thanks for reporting - given the age of this I'm wondering whether this is still an issue for you?
Hey, I'm not actively developing mcps at the moment, but I quickly revisited the code and it looks like the issue still exists. Essentially, the close method is never actually called by the class, which can lead to confusing behavior that might take hours to track down.
I believe this might the cause of hangs I am experiencing when running an MCP client on Cloudflare Workers that have a strict 6 open outbound connections cloudflare/agents#538
Activity
reustle commentedon Apr 19, 2025
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!
nichtsam commentedon Apr 19, 2025
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.
TranquilMarmot commentedon May 14, 2025
Running into this as well.
nichtsam commentedon May 14, 2025
It could be two things, one is that the transport itself doesn't close properly,
the other one is that
onclosegets overwritten by protocol class.You're using the client part so I'm not sure if it's the same, but I'm guessing it is.
felixweinberger commentedon Oct 6, 2025
Hi @nichtsam thanks for reporting - given the age of this I'm wondering whether this is still an issue for you?
nichtsam commentedon Oct 6, 2025
Hey, I'm not actively developing mcps at the moment, but I quickly revisited the code and it looks like the issue still exists. Essentially, the close method is never actually called by the class, which can lead to confusing behavior that might take hours to track down.
kamal commentedon Oct 7, 2025
I believe this might the cause of hangs I am experiencing when running an MCP client on Cloudflare Workers that have a strict 6 open outbound connections cloudflare/agents#538
mattzcarey commentedon Oct 8, 2025
Thanks @kamal looking into this :)