Let AI assistants debug your Docker containers safely: logs, stats, health, events, and compose projects, read-only by default, with secrets redacted.
# Add to your Claude Code skills
git clone https://github.com/SivaSaiKrishnaSuryadevara/docker-mcp-guardianGuides for using ai agents skills like docker-mcp-guardian.
Last scanned: 12/4/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-12-04T05:33:09.442Z",
"npmAuditRan": true,
"pipAuditRan": true,
"promptInjectionRan": true
}docker-mcp-guardian is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by SivaSaiKrishnaSuryadevara. Let AI assistants debug your Docker containers safely: logs, stats, health, events, and compose projects, read-only by default, with secrets redacted. It has 100 GitHub stars.
Yes. docker-mcp-guardian passed AgentsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/SivaSaiKrishnaSuryadevara/docker-mcp-guardian" and add it to your Claude Code skills directory (see the Installation section above).
docker-mcp-guardian is primarily written in Python. It is open-source under SivaSaiKrishnaSuryadevara on GitHub, so you can review or fork the full source.
Yes. AgentsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh docker-mcp-guardian against similar tools.
No comments yet. Be the first to share your thoughts!
A security-hardened Model Context Protocol (MCP) server written in Python with FastMCP that connects local LLM agents (Claude Desktop, Claude Code) to the Docker daemon with strict zero-trust boundaries.

The install buttons add the signed container with the Docker socket mounted; that works with Docker Desktop and rootful Docker on Linux. For uvx or rootless Docker, see Quickstart.
| Tool | What it returns | Writes? |
|---|---|---|
list_containers |
Name, image, status, health and restart count for each container | No |
inspect_container |
State, ports, mounts, labels and restart policy; environment variable keys only | No |
get_container_logs |
Recent log lines, with an optional time-bounded anomaly scan | No |
get_container_stats |
One sample of CPU %, memory, network and block I/O, and PIDs (like docker stats --no-stream) |
No |
get_container_health |
Health-check status, failing streak and the last 5 probe results (output truncated) | No |
list_images |
Local images with tags, size and creation time (up to 500) | No |
list_compose_projects |
Containers grouped by Compose project and service, with status counts | No |
get_container_events |
Recent container events (start, die, OOM, health changes), newest first; exec events report the action only, never the command | No |
safe_restart_container |
Restarts a container only when GUARDIAN_ALLOW_WRITE=true and the name passes the deny/allow lists |
Yes, gated |
Ways to let an agent see Docker, and what each one allows. This is what each option is for, not a scoreboard.
| Raw socket or Docker CLI server | docker-socket-proxy | Docker MCP Guardian | |
|---|---|---|---|
| What it is | The agent runs any docker command or API call |
A proxy that allows or blocks Docker API endpoint groups | An MCP server with nine fixed tools |
| Can the agent start, stop, exec or delete? | Yes, anything the socket allows | Only the endpoint groups you enable | No. Only a gated restart, off by default |
| Environment variable values | Returned in full by inspect |
Returned in full | Keys only; values withheld |
| Exec command lines in events | Returned | Returned | Action name only |
| Protected containers | No | No | Deny and allow lists on the daemon-resolved name |
| Best for | Trusted, interactive use | A hard API boundary for any client | Giving an agent visibility without handing it control |
The two can be combined: point DOCKER_HOST at a socket proxy that allows only the container and image endpoints, and Guardian's limits apply on top of the proxy's.
safe_restart_container) reject calls before touching the Docker socket unless GUARDIAN_ALLOW_WRITE=true is explicitly set.inspect_container strips all environment variable values, returning only variable keys to prevent LLM prompt leakage.GUARDIAN_DOCKER_TIMEOUT (default 5s), so a wedged or missing daemon returns a structured daemon_unavailable error instead of hanging the session.uvx downloads and runs the latest release from PyPI; there is nothing to clone. Set DOCKER_HOST to your Docker socket (see Docker endpoint resolution):
# Claude Code, with Docker Desktop on macOS
claude mcp add docker-guardian -e DOCKER_HOST="unix://$HOME/.docker/run/docker.sock" -- uvx docker-mcp-guardian
# Claude Code, with rootless Docker on Linux
claude mcp add docker-guardian -e DOCKER_HOST="unix://$XDG_RUNTIME_DIR/docker.sock" -- uvx docker-mcp-guardian
Claude Desktop, Cursor and other clients (mcpServers in their JSON config; write the socket path literally):
{
"mcpServers": {
"docker-guardian": {
"command": "uvx",
"args": ["docker-mcp-guardian"],
"env": { "DOCKER_HOST": "unix:///Users/you/.docker/run/docker.sock" }
}
}
}
The signed image from GHCR finds the mounted socket's group on its own:
claude mcp add docker-guardian -- docker run --rm -i \
-v /var/run/docker.sock:/var/run/docker.sock \
-e GUARDIAN_ALLOW_ROOTFUL=true \
ghcr.io/sivasaikrishnasuryadevara/docker-mcp-guardian:latest
git clone https://github.com/SivaSaiKrishnaSuryadevara/docker-mcp-guardian.git
cd docker-mcp-guardian
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pytest tests/ -v
# connect it to Claude Code
claude mcp add docker-guardian -- "$PWD/.venv/bin/python" "$PWD/server.py"
For Claude Desktop, add the same interpreter and script paths (absolute) under mcpServers in claude_desktop_config.json.
| Variable | Default | Purpose |
|---|---|---|
GUARDIAN_ALLOW_WRITE |
false |
Must be true for safe_restart_container to do anything |
GUARDIAN_RESTART_DENY_REGEX |
^(prod|db|kube|vault)-.* |
Containers that can never be restarted (always wins) |
GUARDIAN_RESTART_ALLOW_REGEX |
(unset) | If set, only matching containers can be restarted |
GUARDIAN_ANOMALY_REGEX |
error/exception/fatal/... | Pattern the log scanner flags |
GUARDIAN_REGEX_TIMEOUT |
1 |
Total seconds one log scan may spend matching; slower scans return regex_timeout |
GUARDIAN_DOCKER_TIMEOUT |
5 |
Seconds per Docker API call |
GUARDIAN_LOG_LEVEL |
INFO |
Log level (logs go to stderr only) |
DOCKER_HOST |
(unset) | Docker endpoint to use; always wins when set |
GUARDIAN_ALLOW_ROOTFUL |
false |
Allow falling back to the rootful /var/run/docker.sock |
Guardian picks its Docker endpoint in this order, and logs the choice to stderr:
DOCKER_HOST, if set.$XDG_RUNTIME_DIR/docker.sock, then /run/user/<uid>/docker.sock. The second path covers MCP clients that start servers without XDG_RUNTIME_DIR./var/run/docker.sock, only when GUARDIAN_ALLOW_ROOTFUL=true. Guardian logs a warning, because rootful API access is root-equivalent.If none applies, tools return a docker_socket_unresolved error instead of connecting. The system socket is never used while a rootless socket exists.
Upgrading: earlier versions fell back to
/var/run/docker.socksilently. If you rely on the rootful daemon, setDOCKER_HOST=unix:///var/run/docker.sock(orGUARDIAN_ALLOW_ROOTFUL=true) in your MCP server definition. Docker Desktop and Colima users should setDOCKER_HOSTto their socket, for exampleunix://$HOME/.docker/run/docker.sockorunix://$HOME/.colima/default/docker.sock.
MCP clients (Claude Desktop, Claude Code, Cursor, Cline) start Guardian as a child process, often with a reduced environment that has no XDG_RUNTIME_DIR or DOCKER_HOST. Guardian still checks /run/user/<uid>/docker.sock, but if your rootless runtime directory is elsewhere, or you want the endpoint pinned, set DOCKER_HOST in the server definition:
{
"mcpServers": {
"docker-guardian": {
"command": "/path/to/docker-mcp-guardian/.venv/bin/python",
"args": ["/path/to/docker-mcp-guardian/server.py"],
"env": {
"DOCKER_HOST": "unix:///run/user/1000/docker.sock"
}
}
}
}
Write the path literally: most clients do not expand $XDG_RUNTIME_DIR