Skip to main content

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 SELECT guard + READ ONLY transaction,
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infra_mcp-0.1.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

infra_mcp-0.1.0-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

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

Hashes for infra_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 15e643dd392ba469f33f1c6de3611530388199b400b3e5165491402debcd02be
MD5 a6cef4cc02d95918fb749ccfe495abe4
BLAKE2b-256 43bcdf9f2fe43cf1c90f17188545edc1e6b8793371a339cace5d030452a24b25

See more details on using hashes here.

Provenance

The following attestation bundles were made for infra_mcp-0.1.0.tar.gz:

Publisher: publish.yml on esp4ce/infra-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for infra_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c335c06f1a2b5fb130b7f8767dc115a9c45c197cfb7a1ee1b789a7175beb9aa2
MD5 3ea2cda82576e54d3afa2cf376ff6460
BLAKE2b-256 b31b79274281a50568779f609092a2db86f034d81db3f204c70b9ce753e07562

See more details on using hashes here.

Provenance

The following attestation bundles were made for infra_mcp-0.1.0-py3-none-any.whl:

Publisher: publish.yml on esp4ce/infra-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page