Stop MCP processes eating memory on a Mac
Every Claude Code, Cursor or Codex session starts its own copy of each MCP server it uses. When the session ends, some of those servers keep running. Open a few agents a day and they add up: on November 12, my Mac had 229 MCP processes and 1,296 processes in all, and memory and swap were full.
Check by hand
This lists MCP processes with their memory use (in MB) and how long they have been running:
ps -axo pid,ppid,rss,etime,command | awk 'tolower($0) ~ /mcp/ && !/awk/ {printf "%s %s %d MB %s %s\n", $1, $2, $3/1024, $4, $5}'
A server whose parent ID (the second column) is 1 lost its session and is a leftover. Be careful with the rest: killing a server an agent is still using breaks that session.
Let the Mac do it
The free Mac YOLO Safeguards menu bar app shows CPU, memory, swap and disk with the biggest users named, and stops leftover MCP servers and helpers when you click. It never quits apps, and never touches terminal sessions (tmux, herdr) or an agent session you are still using.
Pro Guard, $29 once, does it automatically every minute when memory gets tight or the disk runs low, so an overnight agent run doesn't freeze the Mac. Full refund within 30 days.