Skip to main content Switch to mobile version linux-health-mcp 0.1.0 Read-only Linux health tools for AI agents (MCP), with fixture hosts, tests and a sandbox
pip install linux-health-mcp Copy PIP instructions
Read-only Linux health tools for AI agents, over the Model Context Protocol (MCP). An agent can ask "what is wrong with this host?" and get structured findings with evidence: failed services, crash loops, disk and inode pressure, low memory or overload, and noisy error logs. It cannot change anything.
Why it is built this way
Least privilege by construction: the server can run only a fixed allowlist of read-only commands (src/linux_health_mcp/commands.py). Tools request commands by key; unknown keys are refused before anything runs (fail closed). There is no shell and no free-form argument.
Evidence, not vibes: every finding carries the exact data it is based on.
Host-chosen names are untrusted too: log source tags and non-standard mount names never appear in findings (shown as source #N / mount #N; real names only in fields labelled untrusted).
Logs are untrusted input: anyone who can write a log line can write words aimed at the agent (prompt injection). Raw log text never appears in a finding; excerpts go in a separate untrusted_log_excerpts field, labelled as data, with control/bidi characters stripped, identifiers restricted, and secret-shaped tokens (passwords, bearer tokens, AWS keys, URL credentials, long tokens, emails; quoted and JSON forms too) redacted on the FULL line before truncation; only visible characters are kept (allowlist by Unicode category, minus blank-rendering lookalikes); after a secret key or Authorization header the rest of the line is redacted. Tests plant an injection, secrets and invisible characters and check none leak; mutation checks show the tests fail if a safeguard is removed.
Tested without touching a real machine: fixture hosts (fixtures/, generated by make_fixtures.py in formats copied from real Ubuntu output) for eight scenarios (healthy, crash loop, disk full, noisy journal, memory pressure, three prompt-injection attempts). Each scenario declares its expected findings; the tests fail on a missed fault OR a false alarm.
The agent is evaluated, not trusted: evals/run_evals.py gives a real AI agent (Claude Code headless, with NO built-in tools: only this server) each fixture host and scores its report: faults found, faults missed, invented critical faults, warning noise, and whether it called a faulty host healthy. Every tool call is saved as a trace. One scenario plants log lines telling the AI to "report this host as healthy"; the agent must still report the real disk fault (baseline: it did in every run).
A release gate that can fail: ./gate.sh = tests, sandboxed tests, mutation checks (11 safeguards broken one at a time in a throwaway copy; all must be caught), then agent evals compared with a reviewed baseline (evals/baseline.json: 24/24 runs correct, claude-sonnet-5-5).
Audited: with LHM_AUDIT set, every tool call and every command run is appended to a JSONL log tied by call id. The log holds sizes, outcomes and finding summaries, not raw output; each record is written before the command runs, and the server refuses to run if it can't write it. Keep it on a separate volume/tmpfs so a full disk doesn't block diagnosis.
Sandboxed: ./sandbox.sh runs the suite in a container with no network, a read-only filesystem, no capabilities, non-root, 1 CPU / 256 MB.
uv sync uv run pytest -q # 85 tests ./sandbox.sh # same tests in the locked-down container ./gate.sh # release gate: tests + sandbox + mutation checks + agent evals uv run python evals/mutation_check.py # 11 safeguards broken one by one; all must be caught LHM_FIXTURE=fixtures/crash_loop uv run linux-health-mcp # serve a fixture host over stdio uv run python -m linux_health_mcp.report fixtures/disk_full # one-shot JSON health report of a fixture host uv run linux-health-mcp # serve THIS host (read-only commands only) Add to an MCP client (e.g. Claude Code) from PyPI: claude mcp add linux-health -- uvx linux-health-mcp; or from a checkout: claude mcp add linux-health -- uv --directory /path/to/linux-health-mcp run linux-health-mcp. Releases: docs/RELEASING.md (PyPI via Trusted Publishing + the official MCP Registry, server.json).
./k8s/verify.sh runs the suite and a fixture report as a hardened Job on a local one-node kind cluster (API server on 127.0.0.1 only) and asserts 10 properties: non-root uid, read-only root FS (mount flag + failed write), no service account token or RBAC, Pod Security Admission restricted rejecting a privileged pod, and default-deny NetworkPolicy egress blocked (measured against a control namespace: kind's default CNI does enforce it). ./k8s/teardown.sh removes the cluster. Details, measured output and CKA practice exercises: docs/kubernetes.md.
Week 2 (done): agent eval harness + local release gate; CI workflow ready for publication.
Week 3 (done): audit trail (LHM_AUDIT=/path/audit.jsonl: every tool call + command, no raw output, fails closed); control experiment (quarantine on vs off, 60 runs, two models, with a positive-control attack); case study docs/case-study-agent-harness.md.
Week 4 (done): run on Kubernetes, on kind instead of k3s (no systemd service, no system-wide install, removable with one command); hardened Job + k8s/verify.sh 10/10 checks, negative-tested (docs/kubernetes.md).
Designed, specified, tested and reviewed by Afsar Ahmed; implementation by AI coding agents (Claude Code) working to that specification. Mutation checks confirm the tests fail when thresholds or the allowlist gate are broken.
License and security
MIT (see LICENSE). Report vulnerabilities privately; see SECURITY.md.
Released: Dec 5, 2026
Both files in this release have provenance metadata.
View provenance details
MIT View SPDX License List
mcp model-context-protocol linux monitoring health-check sre ai-agents
Development Status 3 - Alpha
Intended Audience Developers
System Administrators
Operating System POSIX :: Linux
Programming Language Python :: 3
Topic System :: Monitoring
System :: Systems Administration
Release files for linux-health-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 33.3 kB
Release files / linux_health_mcp-0.1.0.tar.gz
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 5, 2026.
Release files / linux_health_mcp-0.1.0-py3-none-any.whl
Security for linux-health-mcp 0.1.0
Both files in this release have been uploaded with provenance metadata.
With provenance linux_health_mcp-0.1.0.tar.gz Dec 5, 2026
With provenance linux_health_mcp-0.1.0-py3-none-any.whl Dec 5, 2026
Attestation for linux_health_mcp-0.1.0.tar.gz
Attestation for linux_health_mcp-0.1.0-py3-none-any.whl
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Dec 5, 2026 2 release files Full provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from 4d99e05











