AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Mcp Reap

skill-jerry0022-dotclaude-mcp-reap · by Jerry0022

Reclaims orphaned Claude Desktop MCP server processes leaked by previously-closed sessions, in the background, without a restart.

No reviews yet
0 installs
0 views
view→install

Install

$ agentstack add skill-jerry0022-dotclaude-mcp-reap

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-jerry0022-dotclaude-mcp-reap)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
today

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Mcp Reap? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

MCP Reap

Reclaims orphaned Claude Desktop MCP server child processes — leftovers from previously-closed sessions that were never reliably terminated and linger, accumulating RAM. Driven by two hooks so it runs both once per session and periodically thereafter, without requiring a restart:

  • hooks/session-start/ss.mcp.reap.js — fires once, every SessionStart.
  • hooks/stop/stop.mcp.reap.js — fires on Stop (end of a response

turn), gated by a ~20-minute per-worktree cooldown so it doesn't scan every turn. The cooldown marker uses the same atomic write-temp-then- rename pattern as self-calibration, keyed to an md5 hash of process.cwd() in os.tmpdir().

Both hooks spawn scripts/mcp-reap.js --apply --json detached, fire-and-forget, windowless ({ detached: true, stdio: 'ignore', windowsHide: true } + .unref()) and exit immediately — reaping never delays a session start or a response turn.

Safety model

The scan-and-kill logic lives in hooks/lib/mcp-reaper.js (fully unit tested, 46/46 in mcp-reaper.test.js) and is Windows-only — the dead-parent-PID orphan signal only means anything on Windows, so the module is a documented no-op on macOS/Linux. A process is only ever a reap candidate when it matches an MCP-server launcher signature, its parent PID is confirmed dead, AND it falls outside the live-Claude census (every currently-live claude/claude.exe process plus its full descendant subtree) and the caller's own process subtree — an empty/unbuildable census means "protection unknown" and refuses to produce any candidates at all. Every candidate is re-validated against a fresh process snapshot immediately before both the SIGTERM and any SIGKILL escalation (TOCTOU-safe), so a pid reused for something else between scan and kill is skipped, never touched. The reap() module itself defaults to dry-run — nothing is ever terminated unless a caller explicitly passes --apply; both hooks opt into it deliberately, on the reasoning that a leaked orphan is safe to reclaim automatically once the safety net above holds. Any enumeration or kill failure fails safe (skip, never throw).

Run manually

node scripts/mcp-reap.js               # dry-run, human summary
node scripts/mcp-reap.js --json        # dry-run, JSON output
node scripts/mcp-reap.js --apply       # reclaim now — sofort ohne Neustart
node scripts/mcp-reap.js --apply --json

Every run — including the detached ones spawned by the hooks — persists its result to dotclaude-mcp-reap-status.json in os.tmpdir(), so "what did it reap (or not)?" is inspectable after the fact even though the hooks discard stdout (stdio: 'ignore').

Constraints

  • Silent unless it reaps — no console noise on a clean scan, no window ever

(windowless spawn on both the hook side and inside the reaper's own powershell.exe/wmic process-enumeration calls).

  • Never blocks session start or a response turn — both hooks are wrapped in

try/catch and always exit 0, even if spawning the detached CLI fails.

  • Non-Windows platforms: both hooks Windows-gate cheaply before spawning

anything (the reaper is a no-op there anyway).

  • Cooldown degrades safely: if os.tmpdir() is unwritable, the Stop hook's

marker write fails silently and the hook simply fires every turn instead of crashing.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.