Skip to main content
Glama

janitor-mcp

Linux system health, orphan-process sweeper and transient cache cleaner for agentic workspaces, exposed as a local MCP server (stdio, no network).

Reports RAM/swap//tmp tmpfs pressure, detects orphaned development workers (headless browsers, dead agent runners, detached compilers), sweeps them behind an immutable protected denylist (SIGTERM → 3s → SIGKILL, dry_run by default) and removes age-gated stale sockets and scratch caches.

Run

python3 -m venv .venv && .venv/bin/pip install -e .
.venv/bin/python3 -m janitor.server   # stdio MCP (same as the `janitor` script)

Related MCP server: sweep-mcp

Test

.venv/bin/pip install -e . pytest
.venv/bin/python3 -m pytest tests/ -q
bash scripts/check-file-size.sh

Installed console shim

~/.local/bin/janitor points at the isolated runtime ~/.local/share/janitor-mcp/runtime, independent of this checkout. It is registered as janitor in ~/.orquestra/mcps.json; orquestra --mcp-deploy compiles it into every harness config.

Storage rule

Never create files in /tmp/ (it is RAM-backed tmpfs here); all scratch must live under /var/tmp/testing/.

License

MIT — see LICENSE.

Available Tools

5 tools
janitor_clean_cachesA

Clean transient caches. targets: sockets (dead ~/.orquestra/*.sock), staging (.codex marketplace staging), testing_scratch (/var/tmp/testing). older_than_hours=6 gates every removal; dry_run=true (default) only reports.

Inputs: dry_run, targets, older_than_hours. Returns: object

janitor_oom_inspectA

Inspect oom_score and oom_score_adj for active agent runners to show kernel sacrifice priority under memory pressure, with recommendations.

Inputs: no named parameters. Returns: object

janitor_scan_orphansA

Scan this user's processes for suspected orphaned development workers (PPID=1, dead parent, zombie): headless browsers, agent runners, detached compilers and python sub-workers.

Inputs: no named parameters. Returns: result

janitor_sweep_processesA

Terminate processes safely. Provide explicit pids and/or target_type='orphans'|'browsers'|'compilers'. dry_run=true (default) only reports; force=true allows SIGKILL after a 3s SIGTERM grace. systemd, compositors, sshd, shells and OrquestraAI are always refused.

Inputs: pids, force, dry_run, target_type. Returns: object

janitor_system_healthA

RAM/swap/tmpfs health: used/free RAM and swap, /tmp tmpfs utilization, CPU load and the top-5 processes by resident memory. alert=true past 85% RAM or 80% /tmp.

Inputs: no named parameters. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 5 tools

    Disambiguation4/5

    Each tool has a fairly distinct role: health monitoring, orphan scanning, process termination, cache cleaning, and OOM inspection. The only mild overlap is between janitor_scan_orphans (read) and janitor_sweep_processes with target_type='orphans' (write), but the descriptions make the scan-vs-act split clear.

    Naming Consistency5/5

    All five tools use a uniform janitor_ prefix followed by a snake_case verb_noun pattern (system_health, scan_orphans, sweep_processes, clean_caches, oom_inspect). The convention is consistent throughout with no style deviations.

    Tool Count5/5

    Five tools is well-scoped for a system janitor: monitor, scan, terminate, clean, and inspect. Each tool earns its place with no redundant or filler operations.

    Completeness4/5

    The surface covers the core janitor lifecycle: observe health, find orphans, kill processes, clean caches, and assess OOM priority. Minor gaps exist, such as no general disk-usage reporting beyond tmpfs/swap or a way to list configured cache targets, but core workflows are covered.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables LLM agents to safely reclaim disk space by deleting build artifact directories like node_modules, .venv, and target, with strong guardrails to prevent accidental or malicious deletion.
      MIT
    • F
      license
      B
      quality
      D
      maintenance
      Enables safe scanning and cleaning of macOS developer caches and temporary files, with dry-run support and strict refusal to delete non-whitelisted locations.
      3
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables agents to capture task-scoped residue evidence during test and build workflows, exposing files, directories, processes, and ports for user-authorized cleanup and post-cleanup verification without deleting or modifying anything itself.
      Apache 2.0