MCP Server
The MCP server is the real unlock. Register claude-guardian as a local MCP server and Claude can self-monitor mid-session — checking health, fixing logs, capturing bundles, and managing concurrency.
Add to your ~/.claude.json:
{ "mcpServers": { "guardian": { "command": "npx", "args": ["claude-guardian", "mcp"] } }}| Tool | What it returns |
|---|---|
guardian_status | Disk, logs, processes, hang risk, budget, attention level |
guardian_preflight_fix | Runs log rotation/trimming, returns before/after report |
guardian_doctor | Creates diagnostics bundle (zip), returns path + summary |
guardian_nudge | Safe auto-remediation: fix logs if bloated, capture bundle if needed |
guardian_budget_get | Current concurrency cap, slots in use, active leases |
guardian_budget_acquire | Request concurrency slots (returns lease ID) |
guardian_budget_release | Release a lease when done with heavy work |
guardian_recovery_plan | Step-by-step recovery plan naming exact tools to call |
How Claude uses it
Section titled “How Claude uses it”With the MCP server registered, Claude can reason about its own health:
- Call
guardian_statusto check current conditions - If attention level is WARN or CRITICAL, call
guardian_nudgefor safe auto-remediation - Use
guardian_budget_acquirebefore launching heavy parallel work - Call
guardian_budget_releasewhen done to free slots - If something goes wrong, call
guardian_doctorto capture evidence
The guardian_recovery_plan tool returns a deterministic step-by-step plan naming exact tools to call. It never auto-restarts or kills processes — it just tells Claude what to do next.
Nudge behavior
Section titled “Nudge behavior”guardian_nudge is the “do the safe things” action:
- If logs/disk thresholds are breached → runs preflight fix
- If warn/critical with no bundle yet → captures diagnostics
- Returns what changed and what to do next
- Never kills processes or restarts anything