xenmcp-docker-agent
Provides read-only visibility into a Docker host and its containers, including Docker info, container listing and inspection, container logs, live resource stats, and recent container events, without starting, stopping, or modifying containers.
XenMCP Docker agent
A small, read-only MCP server for the containers on one Docker host. Run it next to your containers, put it behind your reverse proxy, and connect it to Claude, Cursor or VS Code through XenMCP: every person signs in on their own (OAuth), access can be revoked at any time, and every call is in the journal.
It can see, never change:
Tool | What it does |
| Docker version, OS, CPUs, memory, number of containers and images |
| Name, image, state, uptime, ports, compose project |
| State, exit code, OOM kill, restarts, health check, limits, log driver, mounts, networks — never environment variables or command arguments |
| Last lines, a time window ( |
| CPU, memory, network, processes right now |
| start, stop, die (with exit code), kill, OOM, restart, health status — up to 7 days |
There is no tool that starts, stops, restarts, removes, execs, builds or pulls. The agent sends Docker only a short list of GET requests (lib.mjs, allowedPath) and refuses everything else before it leaves the process.
Install
In the XenMCP panel: Add server → Docker agent. It shows a key and the command below with the key filled in.
On your Docker host:
docker run -d --name xenmcp-docker-agent --restart unless-stopped \
--read-only --cap-drop ALL --security-opt no-new-privileges --memory 128m \
--group-add "$(stat -c %g /var/run/docker.sock)" \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
-e XENMCP_AGENT_KEY=<the key from the panel> \
-p 127.0.0.1:8090:8080 \
ghcr.io/xenmcp/docker-agent:1.0Make it reachable over HTTPS through your reverse proxy (below), e.g.
https://docker-agent.example.com/mcp.In the panel: enter that address and press Check and save.
Or with Docker Compose:
services:
xenmcp-docker-agent:
image: ghcr.io/xenmcp/docker-agent:1.0
restart: unless-stopped
read_only: true
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
mem_limit: 128m
group_add: ["${DOCKER_GID}"] # stat -c %g /var/run/docker.sock
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
XENMCP_AGENT_KEY: ${XENMCP_AGENT_KEY}
ports:
- 127.0.0.1:8090:8080Related MCP server: dockhand-readonly-mcp
Reverse proxy
The agent listens on plain HTTP; your proxy adds HTTPS. It must pass X-Forwarded-For (all three below do).
Caddy
docker-agent.example.com {
reverse_proxy 127.0.0.1:8090
}nginx
server {
listen 443 ssl;
server_name docker-agent.example.com;
# ssl_certificate …; ssl_certificate_key …;
location /mcp {
allow 46.225.57.217; # XenMCP
deny all;
proxy_pass http://127.0.0.1:8090;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off;
proxy_read_timeout 120s;
}
}Traefik (labels on the agent container, without ports)
labels:
- traefik.enable=true
- traefik.http.routers.xenmcp-agent.rule=Host(`docker-agent.example.com`) && PathPrefix(`/mcp`)
- traefik.http.routers.xenmcp-agent.tls.certresolver=letsencrypt
- traefik.http.services.xenmcp-agent.loadbalancer.server.port=8080Without XenMCP
The agent is a plain MCP server (Streamable HTTP at /mcp), so any client that can send a header works. Set XENMCP_ALLOW_IPS to the addresses that may call it (* for any, only behind your own proxy or firewall) and send the key as Authorization: Bearer <key>. Without XenMCP there is no per-person sign-in and no journal: everyone with the key has the same access.
Over stdio, for a local client
Started with --stdio, the agent talks MCP over stdin/stdout instead of HTTP: no key, no port, no address list – whoever starts it already has the Docker socket. For Claude Desktop, Cursor or VS Code on the Docker host itself:
{
"mcpServers": {
"docker": {
"command": "docker",
"args": ["run", "-i", "--rm", "--no-healthcheck", "--read-only", "--cap-drop", "ALL", "--security-opt", "no-new-privileges",
"--group-add", "<stat -c %g /var/run/docker.sock>",
"-v", "/var/run/docker.sock:/var/run/docker.sock:ro",
"ghcr.io/xenmcp/docker-agent:1.0", "node", "server.mjs", "--stdio"]
}
}
}Or from a checkout: node server.mjs --stdio. The same six read-only tools; XENMCP_CONTAINERS and the xenmcp.hide label apply.
It is listed in the official MCP Registry as com.xenmcp/docker-agent (server.json in this repository).
Settings
Variable | Default | |
| — | Required over HTTP, at least 32 characters; XenMCP sends it as |
|
| Who may call, comma-separated, CIDR allowed. Behind a proxy on a private address the last |
| all | Only these containers, comma-separated, |
|
| How much log one search or stream filter reads at most. |
|
|
Hide single containers with the label xenmcp.hide=true: they are left out of every answer.
Good to know
Logs are what Docker keeps: with the default
json-filedriver everything since the container was created, unless you setmax-size/max-file. A recreated container starts with an empty log. For history beyond that, use Grafana + Loki.Logs can contain personal data and secrets. What a tool returns goes to the AI client you connect (for Claude: Anthropic). Hide containers you do not want to share.
The socket is mounted read-only, but Docker's API does not know read-only mounts — the limit is the agent's own allow-list, which is why it is small, open source and tested (
npm test,npm run e2e).
Develop
npm ci
npm test # unit tests and stdio (no Docker needed)
npm run e2e # against your local Docker (starts and removes three busybox containers)Questions and feedback
Ask in the XenMCP community on Discord (forum #help, tag docker-agent) or open an issue here. Security issues: security@xenmcp.com, not in public.
Available Tools
6 toolscontainer_logsARead-only
Log lines of one container with timestamps, newest last: the last N lines, a time window (since/until: 15m, 6h, 2d or an ISO time), stdout or stderr only, and a text search (contains; regex with regex: true). At most 500 lines per call; page back with until.
Inputs: container (required), tail, regex, since, +3 more.
container_statsARead-only
CPU (% of one core), memory, network and processes right now: one container, or all running ones (at most 30).
Inputs: container.
docker_infoBRead-only
Docker version, operating system, CPUs, memory and the number of containers and images.
Inputs: no named parameters.
inspect_containerBRead-only
State, exit code, OOM kill, restart count and policy, health check, limits, log driver, mounts and networks of one container. Never its environment variables.
Inputs: container (required).
list_containersARead-only
Containers with image, state, status (uptime), ports and compose project. Stopped ones too unless running_only.
Inputs: running_only.
recent_eventsARead-only
Container events (start, stop, die with exit code, kill, oom, restart, health status) in a window, default the last 24 hours, at most 7 days and 300 events.
Inputs: since, container.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct slice: host summary (docker_info), inventory (list_containers), live resource usage (container_stats), static config/state (inspect_container), logs (container_logs) and events (recent_events). The only mild overlap is container_stats vs inspect_container, both of which report container state/health, but the descriptions draw a clear line between real-time metrics and configuration/state details.
Names are readable but follow mixed conventions: verb_noun (list_containers, inspect_container) alongside noun_noun (container_stats, container_logs, docker_info) and an adjectival form (recent_events). There is a loose container_* grouping, yet the verb-first and scope-first styles are interleaved without a predictable rule.
Six tools is a tight, well-scoped surface for a read-only Docker diagnostic agent, and no two tools look redundant. Each one covers a distinct inspection need (host, inventory, metrics, config, logs, events) without filler.
The read-only monitoring domain is mostly covered, but docker_info advertises image counts while there is no list_images or image inspection tool, and there is no disk-usage/df or process-level (top) view. There are also no lifecycle or exec operations, so the surface is deliberately diagnostic-only and has notable gaps for anything beyond observation.
Maintenance
Related MCP Connectors
Linux server administration over OAuth MCP: shell, Docker, systemd, files and monitoring.
Read-only MCP server for The Quiet Protocol's engines, benchmarks, proof, and business data.
Read-only MCP server for repository context: context packs, graph impact analysis, and validation.
Read-only MCP server: verify credentials and browse escrows on the Stellar testnet contract.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA read-only MCP server that exposes your Docker daemon, allowing AI assistants to list containers, inspect their details, and fetch logs without write access.-
- FlicenseAqualityDmaintenanceRead-only MCP adapter for the Dockhand REST API, enabling secure querying of container environments, networks, stacks, and runtime status via STDIO or authenticated HTTP.81-
- AlicenseNot gradedqualityDmaintenanceRead-only MCP server to inspect allowlisted Docker containers, systemd services, JSONL logs, and HTTP health endpoints without arbitrary shell access.MIT
- FlicenseNot gradedqualityDmaintenanceA read-only MCP server for observing registered local and SSH hosts, providing system, service, container, Git, and GPU status/log inspection through a closed-world registry without arbitrary shell access.-