41fred

MCP Orphan Monitor — AI skill for Claude Code

AI community

Detect and kill orphaned MCP server processes that survive after AI coding tool sessions crash or close uncleanly.

How to install MCP Orphan Monitor

This entry records only its repository, not the path inside it, so there is no exact command to give. Open 41fred/mcp-orphan-monitor and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What MCP Orphan Monitor does

Detect and kill orphaned MCP server processes that survive after AI coding tool sessions crash or close uncleanly. macOS LaunchAgent + optional menu bar app.

Alternatives in AI

  • Agency Agents — A complete AI agency at your fingertips - From frontend wizards to Reddit community ninjas, from whimsy inject 148k ★
  • Sentrux — Real-time architectural sensor that helps AI agents close the feedback loop, enabling recursive self-improveme 2.9k ★
  • Session Kit — Close the terminal windows, not the AI coding sessions 649 ★

README

mcp-orphan-monitor

Detect and kill orphaned MCP servers and dev servers that survive after AI coding tool sessions crash or close uncleanly.

If you use Claude Code, Cursor, or any MCP-based AI tool, you probably have zombie node processes running right now:

ps aux | grep mcp-server | grep -v grep

The problem

MCP (Model Context Protocol) servers run as child node processes — one per configured server, per session. When a session ends cleanly, they get killed. When it doesn't (crash, force-quit, closed terminal), they survive as orphans stuck in event loops with no parent.

Each orphan pegs a CPU core at ~50% doing nothing useful. We found 11 orphaned `mcp-server-cloudflare` processes running simultaneously — 550% combined CPU, the oldest burning cycles for 48+ hours.

This is a [known Claude Code issue](https://github.com/anthropics/claude-code/issues/1935) — open since June 2025, still unresolved. Users have reported it with Cloudflare, Todoist, Heroku, Azure DevOps, and ESP-IDF MCP servers. One user found 40+ orphaned processes.

How it works

A small bash script that runs every 10 minutes via macOS LaunchAgent. It scans two classes of process and applies deliberately different rules to each.

**MCP class** — `mcp-server-*`, `mcp-remote`, `workspace-mcp`. Killed on **any** of three signatures:

  1. Direct orphan — the parent is PID 1 (reparented to launchd/init). The classic crash case: the session process vanished.
  2. Wedged / spinning — the server is pinning CPU above MCP_CPU_THRESHOLD (default 60%) and has been alive longer than MCP_MIN_WEDGE_AGE (default 300s). A healthy MCP server sits near 0% when idle, so sustained high CPU means it's stuck in a spin loop — the signature that cooks a laptop 24/7. The age floor keeps a server's noisy startup burst from tripping the rule.
  3. Second-level orphan — the parent is an AI-tool session (claude/cursor/…) that is itself orphaned (that parent's PPID is 1)