[BUG] claude -p leaves stdio MCP server processes (mcp-remote) running after exit

Status Closed — duplicate
Reported on v2.1.288
Maintainer reply None cached
Activity 1 comment · opened Oct 3, 2026 · closed Oct 11, 2026

Summary

claude -p started in a project that has stdio MCP servers (here npx mcp-remote <url> for three remote servers) leaves those mcp-remote node processes running after claude exits. They are re-parented to the user's systemd manager and run until killed. One such set ran for 5 days on our machine.

Version: Claude Code 2.1.288, Ubuntu 24.04.

Steps to reproduce

  1. In a project whose MCP config has stdio servers launched with npx mcp-remote https://..., run claude -p "Reply with the word ok." < /dev/null.
  2. After it prints ok and exits, run pgrep -af mcp-remote.

Result: one leftover node .../mcp-remote https://... per configured server, with parent PID = the user systemd manager. Each further run adds another set (three runs left 9).

Expected

Claude Code stops the stdio MCP server processes it started (including their child processes) when it exits.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗