Repository navigation
Description
MacBook Pro, 14-inch, Nov 2024
Chip: Apple M4 Pro
Memory: 24 GB
MacOS: 26.5.1 (25F80)
Issue: Anthropic issues lots of Claude Desktop App updates. Every time one is issues, there is a message on the bottom left saying "reboot Claude to install the latest update" (or something to that effect. When I click that, Claude Desktop shuts down and reboots. I get a message that states something about claude desktop being unable to attach to iMCP server.
Notes: Chasing this down with Claude to help:
This log tells a clear story. Here is what it shows, extracted directly from the log:
What is working correctly:
The path /Applications/iMCP.app/Contents/MacOS/imcp-server is being used consistently from 2026-06-28T15:51:59 onward. The AppTranslocation path problem has been resolved.
The pattern causing your failures:
Every failure instance in this log follows the same sequence, extracted directly:
Initializing server... → Server started and connected successfully
Then immediately: [imcp_server] Network handler failed: connectionClosed followed by [imcp_server] Stdin handler failed: CancellationError() followed by [imcp_server] Connection closed, terminating...
Then: Server transport closed unexpectedly, this is likely due to the process exiting early
Then: Server disconnected
The critical observation:
The iMCP server side logs Connection closed, terminating... as a critical level event — and it terminates itself immediately upon startup in the failure cases. This is the iMCP process choosing to exit, not Claude Desktop failing to connect.
What distinguishes successful sessions from failed ones:
In every successful session in this log, the startup sequence completes through initialize, notifications/initialized, and tools/list message exchanges before any disconnect occurs. In every failed session, the iMCP server process terminates before the initialize handshake completes — within milliseconds of startup.
What this points to:
The iMCP server process itself is terminating on startup in these cases. The most common cause of this pattern — where a process starts and immediately exits with CancellationError on stdin — is that the iMCP background service (the macOS-side component) is not running or is in a bad state when Claude Desktop tries to connect to it.
Suggested next step:
After a Claude Desktop update triggers the failure, check whether the iMCP app itself is running as a background process. Open Activity Monitor and search for imcp. If it is not running, try launching iMCP.app manually from /Applications before restarting Claude Desktop, then see if the connection succeeds.
This is the most actionable diagnostic step I can identify from the log. Whether this fully resolves the issue depends on iMCP's internal behavior, which I cannot determine from this log alone.
Inferred: Based on the log pattern showing the iMCP server terminating itself within milliseconds of startup specifically after Claude Desktop restarts, not during normal operation.
Your manual workaround sequence would be:
Quit Claude Desktop
Force quit the iMCP process in Activity Monitor (or quit iMCP.app if it has a menu bar icon)
Relaunch iMCP.app to get a fresh instance
Then launch Claude Desktop
That sequence should give Claude Desktop a clean iMCP process to connect to each time.
Whether there is a cleaner fix — such as iMCP handling reconnection gracefully — would be a question for the iMCP developer. The root cause appears to be on iMCP's side, not Claude Desktop's, since iMCP is the one issuing the terminating... critical event.
Activity
pdazero commentedon Aug 18, 2026
Same symptom here, and I traced it to a root cause: iMCP.app runs out of file descriptors. It never closes its side of a client socket, so every
imcp-serverthat disconnects leaks one descriptor permanently.Environment: iMCP 1.4.1, macOS 26.5, Claude Desktop.
Evidence
lsofon the app process: 247 sockets stuck inCLOSE_WAIT, highest fd 255.launchctl limit maxfiles→ soft limit 256. So the app tolerates ~248 client connections over its entire lifetime, then stops serving.Too many open files(from CoreUI, which could no longer open a resource file — the process was simply out of fds).Socket SO_ERROR [54: Connection reset by peer]within 30 ms of connecting, which surfaces as exactly the lines in this issue:Minimal reproduction of the leak (no MCP client needed)
lsof -nP -p $(pgrep -x iMCP) -a -i— note the app's fds and its listening port.lsof. The app's descriptor for that connection is still there, now inCLOSE_WAIT, and it never goes away.I verified both directions: before restarting the app, a fresh connection got an immediate RST and produced no fd on the app side at all; after restarting, the same connection was accepted (fd
ESTABLISHED) — and when I closed it, that fd went straight toCLOSE_WAITand stayed there. One descriptor lost per connection.Why it looks random, and why it's getting worse now
The counter only resets when the app restarts, so the failure depends on how many connections have happened since launch, not on any particular action. That's also why the "quit iMCP → relaunch → works every time, but the bug returns within hours/days" workaround in #24 behaves the way it does.
It got much more visible recently because Claude Desktop now starts a separate copy of the server for its Cowork and Code sessions, which multiplies the connection count. The failure is asymmetric and that's the tell: the normal chat session keeps working because its connection was established before exhaustion, while the new sessions report:
The accelerant: orphaned servers
Orphaned
imcp-serverprocesses (PPID 1) that outlive the MCP client retry forever. I found 7 of them stuck inSYN_SENT, 18 hours after Claude Desktop had closed them. This looks like the inverted exit paths described in grlee#1:stdinEOF falls into the reconnect loop instead of terminating.The moment the app relaunches and publishes its Bonjour service, that pile of retrying orphans burns all ~248 descriptors in under a second — my app log shows connections
C24→C248all opening within 0.7 s, five seconds after launch. The app was dead on arrival, andToo many open filesappeared a minute later.Workaround — the order matters
Restarting the app alone does not hold, because the surviving orphans re-exhaust it within seconds. Kill them first:
pgrep -fl imcp-server, thenps -o pid,ppid,command -p <pids>— target the ones with PPID 1. Leave alone the one parented by Claude'sdisclaimer --pgrouphelper; that one is managed and exits on its own.killthe orphans.osascript -e 'quit app "iMCP"', thenopen -a /Applications/iMCP.app.After that, the app came back with a single fd in
LISTENand zero inCLOSE_WAIT.Where the fix belongs
In the app, not the CLI: the accepted connection needs to be cancelled/closed when the peer disconnects, so the descriptor is released. Worth noting that grlee#1 fixes the orphan side but not this one, and on its own its 1-second reconnect loop would exhaust the leaking app in ~4 minutes whenever the app is unreachable for a while. #151 touches
removeConnectionbut only to make it idempotent — it doesn't release the socket either.This is a different bug from #174 (that one leaks unix sockets from the helper into
mDNSResponder, taking down system-wide DNS) — same family, different process.Rus925 commentedon Sep 14, 2026
Confirming the fd leak on a second setup, with one update: with current Claude Desktop, the restart workaround no longer works. The app is exhausted during Claude's startup, so a freshly launched iMCP is already dead by the time the handshake would complete. Raising
maxfilesis what actually recovers it.Environment: iMCP 1.4.1, macOS 26.6.2, Mac mini M4, Claude 1.52386.6 (612f3f) 2026-09-13T00:45:40.000Z.
Exhaustion is now immediate, not gradual
Three measurements, in order:
CLOSE_WAIT, one fd inLISTEN. Clean.CLOSE_WAIT.Workaround that finally worked for me
mattt commentedon Sep 17, 2026
Thanks @pdazero for the
CLOSE_WAITdiagnosis and @Rus925 for the measurements, which matched what I saw in code. Two things were going on. On 1.4.1 the bridge reconnected in a tight loop after Claude Desktop closed it, which is where the hundreds of connections in a few seconds came from (#208 stops that). And the app kept its half of each dropped connection open until a 30-second health check noticed, so under that loop they piled up against the 256 descriptor limit (#225 closes them right away).Both are in 1.5.0. You shouldn't need the
maxfileschange any more; iflsof -p $(pgrep -x iMCP) | grep -c CLOSE_WAITstill climbs after a Claude Desktop launch, please reopen with the number.