Home › Guides › Claude Code leftover processes

Claude Code and MCP servers left running on Windows

On Windows, a process keeps running when the process that started it exits. So when you close a terminal, or an agent CLI like Claude Code exits, the MCP servers, dev servers and test runners it started can stay alive, holding RAM, CPU and ports. You can find them with Task Manager or PowerShell and end them with taskkill /PID <pid> /T /F after checking what they are.

Why it happens

Windows doesn't end a process when its parent exits. Closing a console window signals the programs attached to that console, but processes started in the background, detached or with their own hidden window get no signal. Agent CLIs and many dev tools start MCP servers, watchers and long commands that way. A child only ends with its parent if the launcher put both in a job object set to end them together, and most dev tools don't. Common ways it happens:

These are known, reported problems. Some public reports, with their status in November 2026:

How to see what's still running

Task Manager

Open Task Manager (Ctrl+Shift+Esc), go to Details, and sort by name. Right-click a column header, choose Select columns and add Command line. Look for node.exe, python.exe, uv.exe, bun.exe or claude.exe rows whose command line names an MCP server, a dev server or a project you closed.

tasklist

tasklist /FI "IMAGENAME eq node.exe"

PowerShell: list orphans

Each process records the ID of its parent. When that parent is gone, the process is an orphan. This lists Node and Python processes whose parent no longer exists, with their command line:

$all = Get-CimInstance Win32_Process
$alive = @{}; foreach ($p in $all) { $alive[$p.ProcessId] = $true }
$all | Where-Object { $_.Name -in 'node.exe','python.exe','uv.exe','bun.exe' -and -not $alive[$_.ParentProcessId] } |
  Select-Object ProcessId, Name, CreationDate, CommandLine | Format-List

Windows reuses process IDs, so a parent ID can point to an unrelated newer process. If a row looks wrong, compare the CreationDate of the parent and the child: a real parent started first.

Which process holds a port

netstat -ano | findstr :3000

The last column is the PID. The port 3000 guide covers this in more detail.

The manual fix

First check what the process is. Ending the wrong node.exe can close an editor's language server or a tool you still use.

Get-CimInstance Win32_Process -Filter "ProcessId = 12345" | Select-Object Name, ParentProcessId, CommandLine

If the command line shows a leftover MCP server or dev server, end it together with its children:

taskkill /PID 12345 /T /F

/T ends the whole tree below that PID and /F forces it. Unsaved state in that process is lost, and there is no undo. Skip processes whose command line points into VS Code, Cursor or another editor's folder, and processes run by pm2 or forever on purpose.

How RigSweep does it

RigSweep is a free, open-source Windows app that does the steps above for you. Its Dev Cleanup tab groups each dev server, build daemon, MCP server and agent CLI with its whole process tree, project folder, age, RAM and listening ports.

CaseWhat RigSweep does
Orphan (its terminal or launcher is gone)Pre-selected, even when it still holds a port
MCP serverTagged as an MCP server; an older copy of a server that also runs under your current session is marked
Idle agent session in an open terminalListed, never pre-selected
pm2 or forever daemon and the apps it runsListed as managed, never pre-selected or auto-ended
Process owned by VS Code, Cursor, JetBrains or Visual StudioLocked, can't be ended from RigSweep
WSL 2 / Docker VMShut down with wsl --shutdown, never pre-selected
After a sweepShows the RAM it got back and CPU before and after, measured

Nothing is ended until you click, and RigSweep checks for PID reuse before every kill. Download RigSweep (Windows 10 and 11, MIT license).

FAQ

Why does Claude Code leave node.exe processes running on Windows?

Windows doesn't end child processes when their parent exits. MCP servers, dev servers and test runners that Claude Code or your terminal started keep running if the CLI or terminal closes before they are stopped.

Is it safe to end all node.exe processes?

No. Some belong to your editor (language servers), to tools you run on purpose with pm2, or to a dev server you still use. Check each command line first, then end only the leftovers with taskkill /PID <pid> /T /F.

How do I find orphaned processes on Windows?

In PowerShell, list processes with Get-CimInstance Win32_Process and keep those whose ParentProcessId no longer exists. Because Windows reuses process IDs, compare creation times when a result looks wrong.

Does RigSweep end processes automatically?

Only if you turn on auto-cleanup in Settings, which is off by default. Even then, agent CLIs, the WSL/Docker VM, editor-owned processes and pm2 or forever apps are never auto-ended.