Purpose
infra-mcp is a local stdio-mode MCP (Model Context Protocol) server that provides read-only diagnostic access specifically for on-prem Linux virtual machines and PostgreSQL databases. It allows AI agents to connect to remote hosts via SSH to check service health, retrieve bounded logs, view database status, and explore table schemas, without granting the agent terminal access.
Key Capabilities
- Perform read-only diagnostic operations on on-prem Linux VMs via SSH.
- Check systemd service health.
- Retrieve bounded logs (server-side limit of 200 log lines).
- Check PostgreSQL database status.
- Explore database table schemas (up to 200 tables/columns).
- All remote operations are controlled by an allowlist and written to an append-only audit log.
- All output is bounded server-side (200 log lines, 100 database records, 200 tables/columns), and truncation is always indicated with a
-- TRUNCATED:marker. - Results of
list_tablesanddescribe_tableare cached in memory (TTL controlled byschema_cache_ttl_hours, default 24 hours); passingrefresh: trueforces a live re-read. - SSH commands and systemd services are checked against each VM's allowlist before any network call is made.
- All database queries run as a read-only role within a
READ ONLYtransaction. - Log file paths are resolved against each VM's directory allowlist (blocking
..path traversal). - Every remote operation is appended to a local JSONL audit log.
Usage
- Copy
infra-mcp.yaml.exampleto~/.infra-mcp/infra-mcp.yamland edit it. - The config file path can be overridden via
--configor the environment variableINFRA_MCP_CONFIG. - Register it as a stdio MCP server in a client (such as Claude Code, Cursor, etc.) with the command
infra-mcp run. - infra-mcp checks PyPI once a day for a new version; if there is a new version, it prints a one-line notice to stderr telling how to upgrade. This check runs in the background, does not block startup, and does not touch stdout.
- Use
infra-mcp --versionto print the installed version. - Set
INFRA_MCP_NO_UPDATE_CHECK=1to completely disable the update check.
Use Cases
Suitable for scenarios requiring read-only diagnostics of on-prem Linux virtual machines and PostgreSQL databases, such as checking service running status, viewing logs, and verifying database status and table schemas. Suitable for teams that want AI agents to safely perform operational diagnostic tasks without terminal access.
Limitations
- Provides read-only access only; does not support any write or modification operations.
- Remote operations are restricted by an allowlist; commands, services, or paths not on the allowlist cannot be executed or accessed.
- Output results have server-side bounds; anything beyond them is truncated and marked.
- Log file paths are restricted by a directory allowlist; paths outside the allowlist cannot be accessed.
- Specific installation requirements, supported Python versions, dependencies, and license information are not provided in the material.