[Bug] MCP Server Shutdown Failure on /exit Command in v1.0.63+
Status Closed — not planned
Maintainer reply None cached
Activity 11 comments · opened Aug 10, 2025 · closed Feb 7, 2026
Bug Description
I use the Claude Code CLI (npm @anthropic-ai/claude-code) v1.0.72 with a single local MCP Server. When I enter the /exit command, I get an error message in the terminal that "1 MCP server failed - see /mcp for more info". I downgraded to previous versions of Claude Code CLI and found that the MCP server failed messages started to appear in v1.0.63. It does not happen in v1.0.62 and has not been fixed as of v1.0.72
Environment Info
- Platform: darwin
- Terminal: iTerm.app
- Version: 1.0.72
- Feedback ID: eec1424d-b0be-4877-be73-bade01f7783a
Errors
<img width="1726" height="160" alt="Image" src="https://github.com/user-attachments/assets/2457b09c-29e4-411d-bdcd-fd9368d6f1e6" />
11 Comments
Found 1 possible duplicate issue:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
+1 experiencing this same bug consistently across multiple MCP server implementations.
Environment Details:
Affected MCP Servers:
This bug occurs with every MCP server I've tested, regardless of implementation language:
Key Observations:
/exitcommandImpact:
Beyond being a false positive, the lack of any error logging means users cannot distinguish between:
At minimum, Claude Code should log WHY it thinks servers are failing. The current state leaves users guessing about what might be wrong, making MCP server development unnecessarily difficult.
This bug has been present since v1.0.63 (over a month) and affects all platforms and all MCP server implementations. Given that MCP is a core feature of Claude Code, proper shutdown handling and error logging deserve attention.
+1 to this. I use the Zen MCP server (just one MCP) one a number of projects and also see the error message. Thinking that there must be something wrong, I've checked, using the
/mcpcommand, but everything looks clean. Sessions often delegate to Zen, which works cleanly, but I always see the error message. In fact, I can even launch a fresh session, do/mcpand see that Zen is connected, then do/exitand get the message.One could perhaps get some insight into this issue by setting up a dummy MCP server that frequently logs its state, or at least logs whenever core MCP functions are invoked, or OS-level signals sent, from Claude Code.
I think we could remove the
macostag here -- @Brandtweary indicated that he's on Linux.This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Yes, this issue still exists in v2.0.75.
Still an issue in 2.0.76
Additional Evidence from #16744
We did extensive debugging on this issue and can confirm:
Root Cause
Claude Code sends
SIGKILLdirectly to MCP server processes without first:SIGTERMto allow graceful shutdownProof: Official Anthropic MCP Server Also Fails
We tested with
@modelcontextprotocol/server-filesystem(Anthropic's official reference server) and it also reports failure on/exit.This confirms the bug is in Claude Code's shutdown logic, not in any specific MCP server implementation.
Debugging Attempts (all failed)
We added comprehensive shutdown handlers:
SIGTERM,SIGINT,SIGHUPsignal handlersend/close/errorevent listenersstdin.readablepolling (every 100ms)beforeExit,uncaughtException,unhandledRejectionhandlersNone of these handlers ever fire - the process is killed instantly with SIGKILL.
MCP Protocol Spec Reference
Claude Code appears to skip SIGTERM entirely.
---
Closing #16744 as duplicate. 👍 on this issue.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.