Local stdio MCP server for read-only diagnosis of on-prem Linux VMs and PostgreSQL databases
Project description
infra-mcp
A local stdio MCP server that gives an AI agent read-only visibility into on-premise Linux VMs (SSH + journald) and PostgreSQL databases. The agent can diagnose service failures, retrieve bounded logs, and check DB health without any user terminal interaction.
v0.1 is deliberately read-only. Every remote operation is gated by:
- an SSH command/service allowlist (checked before any network call),
- a SQL
SELECTguard +READ ONLYtransaction, - a directory allowlist for log-file access (with
..traversal blocked),
and every executed remote command is written to an append-only audit log.
Install
uv tool install infra-mcp
# or from source:
uv tool install -e /path/to/infra-probe
(pip install infra-mcp also works.)
Configure
Copy infra-mcp.yaml.example to
~/.infra-mcp/infra-mcp.yaml and edit it. Override the path with --config or
the INFRA_MCP_CONFIG environment variable.
Generate a starter config from your ~/.ssh/config:
infra-mcp generate-config -o ~/.infra-mcp/infra-mcp.yaml
Create the read-only PostgreSQL role(s) (admin password is prompted, never stored):
infra-mcp setup
Check VM reachability:
infra-mcp test
Run
infra-mcp run
# or: python -m infra_mcp run
Register it with your MCP client (Claude Code, Cursor, …) as a stdio server
whose command is infra-mcp run.
Tools
| Tool | Purpose |
|---|---|
list_vms |
All VMs with reachability + watched services (no IPs) |
get_infra_overview |
Service states + DB health for one VM in a single call |
get_service_status |
systemd state, uptime, last 5 log lines |
get_service_logs |
Bounded journald logs, filtered by severity |
get_log_file |
Last N lines of an allowed log file, optional grep |
get_db_status |
Connection counts, waiting locks, long-running query count |
query_db |
Bounded caller-supplied SELECT |
get_audit_log |
Recent entries from the local audit log |
All output is bounded at the source (hard cap 200 log lines, 100 DB rows) and returned as plain text / compact TSV.
Development
uv pip install -e ".[dev]"
pytest
ruff check .
Tests cover output bounding, the SQL guard, and the path/command allowlists — no live VM or database required.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file infra_mcp-0.1.0.tar.gz.
File metadata
- Download URL: infra_mcp-0.1.0.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15e643dd392ba469f33f1c6de3611530388199b400b3e5165491402debcd02be
|
|
| MD5 |
a6cef4cc02d95918fb749ccfe495abe4
|
|
| BLAKE2b-256 |
43bcdf9f2fe43cf1c90f17188545edc1e6b8793371a339cace5d030452a24b25
|
Provenance
The following attestation bundles were made for infra_mcp-0.1.0.tar.gz:
Publisher:
publish.yml on esp4ce/infra-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
infra_mcp-0.1.0.tar.gz -
Subject digest:
15e643dd392ba469f33f1c6de3611530388199b400b3e5165491402debcd02be - Sigstore transparency entry: 1860303805
- Sigstore integration time:
-
Permalink:
esp4ce/infra-mcp@b891e55b7572491bc3220588c5ec692dd74f0072 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/esp4ce
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b891e55b7572491bc3220588c5ec692dd74f0072 -
Trigger Event:
release
-
Statement type:
File details
Details for the file infra_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: infra_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c335c06f1a2b5fb130b7f8767dc115a9c45c197cfb7a1ee1b789a7175beb9aa2
|
|
| MD5 |
3ea2cda82576e54d3afa2cf376ff6460
|
|
| BLAKE2b-256 |
b31b79274281a50568779f609092a2db86f034d81db3f204c70b9ce753e07562
|
Provenance
The following attestation bundles were made for infra_mcp-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on esp4ce/infra-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
infra_mcp-0.1.0-py3-none-any.whl -
Subject digest:
c335c06f1a2b5fb130b7f8767dc115a9c45c197cfb7a1ee1b789a7175beb9aa2 - Sigstore transparency entry: 1860304146
- Sigstore integration time:
-
Permalink:
esp4ce/infra-mcp@b891e55b7572491bc3220588c5ec692dd74f0072 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/esp4ce
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b891e55b7572491bc3220588c5ec692dd74f0072 -
Trigger Event:
release
-
Statement type: