claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] claude mcp list causes orphaned mcp server processes

Open miguelsorianod opened this issue 2 months ago • 1 comments

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When an MCP server has been configured with Claude CLI, when running the claude mcp list command it triggers the start of the MCP server:

msoriano@localhost$ claude mcp list
Checking MCP server health...

postgres-mcp-pro: make -s crystaldba/postgres-mcp-pro - ✓ Connected

However, after the command is executed the process associated to the mcp server is left orphaned and running.

This is problematic because after, when claude is executed (by running claude) it attempts to start the server again but this time fails because there's already a process running the mcp server. All while the older process is still executing, which is not associated to the claude process.

Aside from that, to discard any issues with enablement/disablement of my own configured mcp server, I also verified that the same configured MCP server process successfully starts and stops when using the MCP server enablement toggle in the claude cli.

My MCP server is an stdio process and it is executed via podman run. The podman run command has the following relevant CLI flags configured

   ...
    --interactive \
    --attach stdin,stdout,stderr \
    --init \
   ...

I suspect that there might be other combinations that cause the same. For example, when running claude mcp get <mcpserver> the same issue occurs.

What Should Happen?

MCP server starts and stops correctly

Error Messages/Logs


Steps to Reproduce

  1. Configure an MCP server where the command runs a container that executes the server. You might need to pass the --interactive, -a stdin,stdout , --init flags depending on the nature of the MCP server
  2. Run claude mcp list. Verify that the output indicates that the connection to the mcp server was successful
  3. Verify that after that there's an orphan process with the mcp server running
  4. Run claude and verify that the mcp server cannot be started because there's another container running it already. Verify that the mcp server process that was created in step 2 is still there and it is fully orphan

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.0.42 (Claude Code)

Platform

Google Vertex AI

Operating System

Other Linux

Terminal/Shell

Other

Additional Information

No response

miguelsorianod avatar Nov 17 '25 11:11 miguelsorianod

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.

github-actions[bot] avatar Dec 18 '25 10:12 github-actions[bot]