infra-mcp
This server provides read-only MCP tools to monitor on-premises Linux VMs and PostgreSQL databases over SSH.
VM & Service Management
list_vms— Discover all configured VMs with reachability status and watched service namesget_service_status— Check systemd state, uptime, and last 5 log lines for a serviceget_service_logs— Retrieve bounded journald logs filtered by severity level and line countget_log_file— Fetch the last N lines of an allowed log file, with optional grep filteringget_infra_overview— Combined snapshot of service statuses and database health for a VM in one call
Database Inspection
get_db_status— View connection counts, waiting locks, and long-running queries for a PostgreSQL databasequery_db— Execute caller-suppliedSELECTstatements (read-only, row-limited)list_tables— List all tables (schema + name) in a database, with optional cache refreshdescribe_table— Inspect a table's columns, types, primary key, and foreign keys
Auditing
get_audit_log— View recent entries from the local append-only audit log of all remote operations
Safety & Security
All DB queries run in a
READ ONLYtransaction; SSH commands are checked against per-VM allowlistsLog file access is restricted to an allowed directory list (path traversal blocked)
All output is bounded server-side (200 log lines, 100 DB rows, 200 tables max) with truncation flagged
Provides read-only access to PostgreSQL databases over SSH, allowing agents to query tables, describe schemas, list tables, and check database health metrics such as connection counts and locks.
infra-mcp
Read-only MCP access to on-prem Linux VMs and PostgreSQL databases over SSH.
agent ──stdio──▶ infra-mcp ──SSH──▶ VMs (journald · log files)
└──▶ DBs (read-only PostgreSQL)An agent can check service health, retrieve bounded logs, inspect DB state, and explore table schemas — without terminal access. Every remote operation is allowlist-gated and written to an append-only audit log.
Install
uv tool install infra-mcp
# or
pip install infra-mcpRelated MCP server: mcp-infra-readonly
Configure
Copy infra-mcp.yaml.example to ~/.infra-mcp/infra-mcp.yaml and edit it.
# Generate a starter config from ~/.ssh/config
infra-mcp generate-config -o ~/.infra-mcp/infra-mcp.yaml
# Create the read-only PostgreSQL role(s)
infra-mcp setup
# Check VM reachability
infra-mcp test
# Refresh discovered services, log dirs, and databases (updates config in place)
infra-mcp discover --in-placeOverride the config path with --config or INFRA_MCP_CONFIG.
Run
infra-mcp runRegister as a stdio MCP server in your client (Claude Code, Cursor, …) with command infra-mcp run.
Updates
infra-mcp checks PyPI for a newer release once a day and, when one exists, prints a
one-line hint to stderr telling you how to upgrade:
uv tool upgrade infra-mcp # or: pip install --upgrade infra-mcpThe check runs in the background, never blocks startup, and never touches stdout. Print
the installed version with infra-mcp --version. Disable the check entirely by setting
INFRA_MCP_NO_UPDATE_CHECK=1.
Tools
VM & services
Tool | Purpose |
| All VMs with reachability and watched services |
| Service states + DB health for one VM in a single call |
| systemd state, uptime, last 5 log lines |
| Bounded journald logs, filtered by severity |
| Last N lines of an allowed log file, optional grep |
Databases
Tool | Purpose |
| Connection counts, waiting locks, long-running query count |
| Bounded caller-supplied |
| Tables in a database (schema + name), capped at 200 |
| Columns, types, primary key, foreign keys for one table |
Meta
Tool | Purpose |
| Recent entries from the local audit log |
All output is bounded server-side (200 log lines, 100 DB rows, 200 tables/columns max). Truncation is always flagged with a -- TRUNCATED: marker. list_tables and describe_table cache results in memory (TTL: schema_cache_ttl_hours, default 24 h); pass refresh: true to force a live re-read.
Security model
SSH commands and systemd services are checked against a per-VM allowlist before any network call.
All DB queries run as a read-only role inside a
READ ONLYtransaction.Log file paths are resolved against a per-VM directory allowlist (
..traversal blocked).Every remote operation is appended to a local JSONL audit log.
Available Tools
10 toolsdescribe_tableA
Describes one named table — its columns and types, primary key, and foreign-key relationships — scoped to just that table, so you can author a correct (possibly multi-table) query directly. Indexes and comments are not included. Set refresh=true to force a live re-read.
Inputs: db (required), table (required), refresh. Returns: result
get_audit_logB
Returns recent entries from the local audit log (oldest first).
Inputs: lines. Returns: result
get_db_statusA
Returns health metrics for a configured database: connection counts, waiting locks, and long-running query count.
Inputs: db (required). Returns: result
get_infra_overviewA
Returns service statuses and database health for a named VM in a single call. Call this first when diagnosing any VM-level issue. Unreachable services or databases are listed with an error note rather than failing the whole call.
Inputs: vm (required). Returns: result
get_log_fileA
Returns the last N lines of a log file on a VM, with optional grep pattern. Both grep and line-capping execute on the VM before any data is transmitted.
Inputs: vm (required), path (required), lines, pattern. Returns: result
get_service_logsA
Returns bounded journald logs for a service, filtered by severity level. Filtering and line-capping execute on the VM before transmission.
Inputs: vm (required), service (required), level, lines. Returns: result
get_service_statusA
Returns systemd state, uptime, and last 5 log lines for a service on a VM. Use for a quick health check before requesting full logs.
Inputs: vm (required), service (required). Returns: result
list_tablesA
Lists the tables of a configured database with their schema/namespace, in one bounded call — no column detail. Call this first to decide which tables are relevant before describing them. Set refresh=true to force a live re-read.
Inputs: db (required), refresh. Returns: result
list_vmsA
Returns all configured VMs with reachability status and watched service names. Call this first in any session to discover available infrastructure.
Inputs: no named parameters. Returns: result
query_dbA
Executes a caller-supplied SELECT statement against a configured database, bounded by row limit. Only SELECT is permitted.
Inputs: db (required), sql (required), limit. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool targets a distinct resource or action: tables (list, describe, query), VMs (list, overview), services (status, logs), logs (file, service), database health, audit log. No overlap in purpose.
All tool names follow a consistent verb_noun pattern (describe_table, get_audit_log, list_vms, etc.), making it easy to infer functionality.
10 tools is appropriate for infrastructure diagnostics, covering VMs, databases, services, logs, and audit without being excessive or sparse.
The tool set provides complete coverage for read-only infrastructure diagnosis: discovering VMs, checking health, exploring database schemas, querying data, and retrieving logs. No obvious gaps for its diagnostic purpose.
Maintenance
Related MCP Connectors
Read-only MCP access to a documented IT fleet: state, changes, posture. 15 tools.
Hosted MCP server for PostgreSQL diagnostics: slow queries, missing indexes, connection pressure.
Linux server administration over OAuth MCP: shell, Docker, systemd, files and monitoring.
Read-only server insight: why a Linux server or K8s cluster is slow, failing or changed.
Related MCP Servers
- AlicenseAqualityNot gradedmaintenanceEnables browser automation through Playwright using accessibility tree snapshots instead of screenshots. Supports web scraping, form interactions, testing, and connecting to existing browser sessions with logged-in accounts.238,154 npm5-
- FlicenseNot gradedqualityBmaintenanceA read-only MCP server that gives Claude Code secure, non-invasive access to infrastructure logs, service status, metrics, Ansible facts, and Docker state via SSH, with a strict command allowlist and no write operations.-
- AlicenseAqualityDmaintenanceA secure, read-only MCP server for AI-powered system monitoring. It provides real-time OS metrics, config discovery, and safe log tailing to enable autonomous infrastructure audits without shell access risks.41ISC
- AlicenseNot gradedqualityDmaintenancePostgreSQL administration MCP server for read-only inspection, monitoring, and non-destructive maintenance, enabling safe database interaction via assistants like Claude without data modification.MIT