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
Connections reset when Claude Desktop launches two imcp-server instances simultaneously #217
Claude Desktop: Claude 2.110.0 (dfb2ba) 2026-09-15T05:50:55.000Z
Problem
iMCP fails to connect whenever Claude Desktop starts. Claude shows "Server disconnected" and "Couldn't start for Cowork and Code sessions. Error: Connection closed." Running imcp-server manually in Terminal works fine.
Findings
Claude Desktop launches two imcp-server processes at the same time (one for regular chats, one for Cowork/Code sessions).
In a log stream capture, the iMCP app logged ~200 "Handling new connection" / "Connection successfully established" events in about 2 seconds, driven by the two bridge processes reconnecting in a loop.
Newly launched bridges resolve the _mcp._tcp Bonjour service and connect, then receive "Connection reset by peer" within ~5 ms.
The bridge logs Network handler failed: connectionClosed followed by Connection closed, terminating....
The iMCP app logs no errors on its side, and the approval prompt never appeared while this was happening.
Workaround
A wrapper script that adds a random 0–6 second delay before execing imcp-server resolves it. With the startups staggered, the approval prompt appears and both connections work.
Expected
iMCP should handle two clients connecting at the same moment, and the bridge should back off instead of reconnecting in a tight loop.
Hi @andrewvlahopoulos. Thanks for the careful writeup, the log stream capture especially.
Two bugs are stacked here. On 1.4.1, imcp-server reconnects immediately whenever its connection drops, so the two bridges Claude Desktop now launches end up in the loop you captured. 1.5.0 makes the bridge exit instead and lets Claude Desktop relaunch it (#208). The reset within a few milliseconds is the app's side: it held its half of every dropped connection for about a minute, so under that loop they piled up against the file descriptor limit and new connections got refused (#178). 1.5.0 closes those right away (#225).
Could you try 1.5.0 without the wrapper script? I'm closing this as fixed; please reopen if it still fails, and lsof -p $(pgrep -x iMCP) | grep -c CLOSE_WAIT after a Claude Desktop launch would tell us whether anything is still piling up.
@mattt Updated to 1.5.0 and removed the wrapper script. Connects reliably on Claude Desktop launch, and lsof -p $(pgrep -x iMCP) | grep -c CLOSE_WAIT returns 0 after launch. Thanks for the quick fix.
Activity
mattt commentedon Sep 17, 2026
Hi @andrewvlahopoulos. Thanks for the careful writeup, the
log streamcapture especially.Two bugs are stacked here. On 1.4.1,
imcp-serverreconnects immediately whenever its connection drops, so the two bridges Claude Desktop now launches end up in the loop you captured. 1.5.0 makes the bridge exit instead and lets Claude Desktop relaunch it (#208). The reset within a few milliseconds is the app's side: it held its half of every dropped connection for about a minute, so under that loop they piled up against the file descriptor limit and new connections got refused (#178). 1.5.0 closes those right away (#225).Could you try 1.5.0 without the wrapper script? I'm closing this as fixed; please reopen if it still fails, and
lsof -p $(pgrep -x iMCP) | grep -c CLOSE_WAITafter a Claude Desktop launch would tell us whether anything is still piling up.andrewvlahopoulos commentedon Sep 17, 2026
@mattt Updated to 1.5.0 and removed the wrapper script. Connects reliably on Claude Desktop launch, and lsof -p $(pgrep -x iMCP) | grep -c CLOSE_WAIT returns 0 after launch. Thanks for the quick fix.