infra-mcp
Allows reloading Caddy in-place to apply configuration changes.
Provides tools for monitoring and managing Docker Compose services, including status, logs, disk usage, and restarting services.
Enables viewing recent GitHub Actions workflow runs for configured repositories.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@infra-mcp Show me the infrastructure status."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
infra-mcp
MCP server that wraps Docker / Caddy / GitHub Actions ops on a remote VPS. Lets Claude take read-then-write-with-confirmation infra actions over SSH, with a service allowlist and audit-trail-friendly responses.
MCP · FastMCP · Claude Code · Claude Desktop · Docker Compose · Caddy · GitHub Actions · Pydantic v2 · httpx · pytest-asyncio
Tool | Read/Write | What it does |
| R |
|
| R | tail logs from one service with |
| R |
|
| R | last N GitHub Actions runs per configured repo |
| R | resolves |
| W | restart a compose service ( |
| W | reload Caddy in-place ( |
Why this exists
I spent a full afternoon on a single deploy SSH'ing to a VPS, running docker compose logs ..., scrolling, restarting things, re-SSH'ing. Every one of those steps is a tool call this server exposes. Now: "what's broken on <service> in the last 20 minutes?" in Claude Code — done.
This is also the canonical interview answer for "build us an MCP server for internal team operations": an ops surface wrapped as MCP, with three safety layers (allowlist, confirm gate, structured responses).
Related MCP server: Railway Guardrail MCP
Safety model
Read vs write split. Status/logs/disk/deploys/url are always callable. Restart/reload require an explicit
confirm: trueparameter so the model can't trip into a production bounce by accident.Service allowlist. Write tools cross-check against
INFRA_ALLOWED_SERVICESfrom.env. Anything not listed is rejected even withconfirm=true. Editing the allowlist is a deliberate human action.No shell injection. Tool inputs are typed (
tail: int,since: strvalidated against a\d+[smhd]shape,grepstrings quoted with single-quote escaping). Commands are assembled from typed params on the server, never from raw MCP-client strings.Bounded outputs. Logs are clamped to
INFRA_MAX_LOG_LINES(500 by default) so a tool call can't dump 50 MB into the model context.Hard timeouts. Every SSH invocation runs under
asyncio.wait_forand aConnectTimeout. A wedged container or unreachable box returns an error, not a hang.
Install
git clone https://github.com/odanree/infra-mcp
cd infra-mcp
python -m venv .venv
.venv/Scripts/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
cp .env.example .env # edit ssh host + allowlist + (optional) GH tokenRequires the ssh binary on PATH and SSH-key auth already configured for the target host (your normal ~/.ssh/config works).
Register with Claude Code (user-scope)
claude mcp add infra -s user -- "/abs/path/to/infra-mcp/.venv/Scripts/python.exe" -m server.main
claude mcp list # confirms "infra" connectedRestart Claude Code, then try:
"Show me the infra status. Anything not running?"
"Tail logs for the api service since 10m and grep for 'Error'."
"Restart the api service — confirm=true."
Tests
pytest
# SSH is patched at the run() boundary — no network in the test suite.Roadmap
infra_logsLangfuse export: when a service has Langfuse-traced calls, return a list of recent trace IDs alongside log lines so you can jump straight from a 500 to the trace.service_url+ cert expiry: when the HTTP probe succeeds, also surface days-until-cert-expiry from Caddy's storage.Per-tool audit-log file on the target so any write action has a permanent local record independent of Claude's chat log.
License
MIT
Available Tools
8 toolscaddy_reload_toolA
Reload Caddy after a Caddyfile change. Requires confirm=true.
Inputs: confirm. Returns: object
infra_deploys_toolC
Recent GitHub Actions runs across the configured deploy repos.
Inputs: limit_per_repo. Returns: result
infra_disk_toolA
VPS disk + docker storage summary. Use before heavy rebuilds.
Inputs: no named parameters. Returns: object
infra_logs_toolB
Tail logs from one compose service. since accepts 10m / 1h / 2d. grep is plain text.
stack picks which compose project (multi-stack mode); omit for default.
Inputs: service (required), grep, tail, since, +1 more. Returns: object
infra_prune_toolA
Reclaim docker disk space. Requires confirm=true.
target: 'build_cache' (safest), 'dangling_images', 'stopped_containers', 'all_images' (riskier — removes any image not used by a running container).
Inputs: target, confirm. Returns: object
infra_restart_toolA
Restart a compose service. Requires confirm=true AND service in INFRA_ALLOWED_SERVICES.
stack picks which compose project (multi-stack mode); omit for default.
Inputs: service (required), stack, confirm. Returns: object
infra_status_toolA
List every container in the compose stack with state + status string.
stack picks which compose project when the box hosts several
(multi-stack mode). Omit for the operator's configured default.
Names come from INFRA_STACKS keys.
Inputs: stack. Returns: object
service_url_toolA
Resolve .<INFRA_PUBLIC_DOMAIN> and probe its HTTP status. Quick liveness check.
Inputs: service (required), scheme. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a distinct infrastructure operation: container status, logs, disk usage, URL probing, deployment history, service restart, Caddy reload, and disk pruning. There is no functional overlap, and the descriptions clearly differentiate their purposes.
Most tools follow an `infra_*_tool` pattern, but `service_url_tool` and `caddy_reload_tool` break the prefix convention. Additionally, the middle portion mixes nouns (logs, disk, deploys) and verbs (restart, prune, reload), making the naming pattern less predictable.
With 8 tools, the set is well-scoped for an infrastructure management server. Each tool covers a meaningful aspect (monitoring, logs, disk, service control, deploys, Caddy config, cleanup) without redundancy or bloat.
The toolset provides solid coverage for common infrastructure tasks: status, logs, disk, restart, pruning, URL checks, deploy visibility, and Caddy reload. Minor gaps like explicit start/stop or triggering deploys are noticeable but not critical since restart and deploy history cover most needs.
Maintenance
Related MCP Connectors
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Hosted YouTube MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Termalin's hosted MCP server. Claude, ChatGPT or any MCP client runs commands, moves files over SFTP, queries databases and reads server metrics and monitoring alerts on your servers, keylessly through Termalin Connectors: no SSH key is handed over and no inbound port is opened. Per-host command policy and an audit log. Needs a termal.in Pro or Team account (new accounts start with a 14-day Pro trial).
Hosted X (Twitter) MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseBqualityDmaintenanceA comprehensive MCP server that provides Claude with direct access to Docker, DigitalOcean, and CloudFlare APIs for infrastructure management and automation.211MIT
- FlicenseNot gradedqualityDmaintenanceA team-wide, remote MCP server that lets Claude operate Railway projects through natural language, with safety guardrails to prevent irreversible actions without human approval.-
- 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.-
- AlicenseBqualityBmaintenanceSelf-hosted MCP server that lets Claude, ChatGPT and other AI assistants operate a Linux server safely: read-only by default, every change previewed and confirmed, secrets masked, full local audit log.18AGPL 3.0