mcp-server-docker
Provides tools for inspecting and managing Docker environments across one or more hosts. Capabilities include listing configured hosts and containers, retrieving container logs, inspecting containers, getting stats snapshots, and starting, stopping, restarting, or removing containers. Supports local sockets, TCP/TLS, and SSH connections, with read-only modes and secret redaction.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
🐳 mcp-server-docker
A Model Context Protocol (MCP) server that lets AI assistants (Claude Code, Cursor, Claude Desktop) inspect and manage Docker environments, on one machine or on several.
Built with TypeScript and dockerode. It talks to the Docker Engine API directly (no docker CLI needed locally) over a local socket, TCP/TLS or SSH.
✨ Features
Multi-host: drive several Docker daemons (your machine, a NAS, a server) from one server, each with a name.
Safe by design: a global
--read-onlyflag and a per-hostreadOnlyoption. Write tools are not even exposed when no host is writable, and every write is checked again in the service layer.Context-friendly: logs are demultiplexed and size-capped,
docker_inspectreturns a compact view, and every output is truncated with an explicit marker.Secrets masked: values are scanned, not just variable names. Passwords inside connection URLs (
postgres://user:pass@host),--password=arguments, private keys, JWTs, common token formats and long encoded blobs are replaced by***REDACTED***indocker_inspect(environment, command, labels) and in logs. This is best-effort pattern matching: review output before sharing it. Disable with--no-redact.Short, actionable errors: no stack traces, and a failing host never breaks the others.
Related MCP server: Docker MCP Server
🛠 Tools
Tool | Type | Description |
| read | Configured hosts, URL (no credentials) and read-only flag. No connection is made. |
| read | Containers, stopped ones included. Filters: |
| read | Last lines of a container (default 200, max 2000), stdout and stderr separated. Supports |
| read | Compact view: state (exit code, OOM kill, start error, healthcheck detail), memory limit, image, ports, mounts, networks, command, env. |
| read | One-shot CPU, memory, network and process snapshot. |
| write | Start a container. |
| write | Stop a container (optional |
| write | Restart a container. |
| write | Remove one container by name or id. |
Write tools are hidden when every host is read-only. Container references are names or ids, never patterns.
🚀 Quick Start
Single host
Without a configuration file, the server uses DOCKER_HOST (or the local socket /var/run/docker.sock):
{
"mcpServers": {
"docker": {
"command": "npx",
"args": ["-y", "@zeearth/mcp-server-docker", "--read-only"]
}
}
}Several hosts
Create a JSON file outside your repositories, for example ~/.config/mcp-server-docker/hosts.json:
{
"defaultHost": "local",
"hosts": {
"local": { "url": "unix:///var/run/docker.sock" },
"nas": {
"url": "ssh://user@nas.lan:22",
"readOnly": true,
"dockerCommand": "/usr/local/bin/docker",
"identityFile": "~/.ssh/nas-key"
}
}
}Then point the server at it with --config (or the MCP_DOCKER_CONFIG environment variable):
{
"mcpServers": {
"docker": {
"command": "npx",
"args": ["-y", "@zeearth/mcp-server-docker", "--config", "/home/me/.config/mcp-server-docker/hosts.json"]
}
}
}With Claude Code (available in every project):
claude mcp add -s user docker -- npx -y --package=@zeearth/mcp-server-docker@latest mcp-server-docker --config <path>Note: MCP clients start the server from the current project directory. If that directory is itself this package (for example when you work on this repository),
npx -y @zeearth/mcp-server-dockerresolves to the local project and fails withmcp-server-docker: not found. The--package=...@latest mcp-server-dockerform above always downloads the published package and avoids the problem. Keep the@latest(or a version): without it,npxstill resolves the name to the local project.
Host options
Field | Applies to | Description |
| all |
|
| all | Forbid write tools on this host. |
| tcp/https | TLS files, referenced by path (relative paths resolve from the config file). |
| ssh | Docker binary on the remote machine (default |
| ssh | Private key file (not passphrase-protected), if the key is not in your ssh-agent. |
How the host parameter works
Every tool takes a host parameter restricted to the configured names.
With a single host it is optional.
With several hosts, read tools use
defaultHostwhen it is set.Write tools always need an explicit
hostwhen several are configured, so an action never lands on the wrong machine by omission.
SSH hosts
The SSH transport opens a connection, runs <dockerCommand> system dial-stdio on the remote machine and tunnels the Docker API through it.
Port: put it in the URL (
ssh://user@host:2345). Your~/.ssh/configis not read.Authentication: ssh-agent (
SSH_AUTH_SOCK) and/oridentityFile.Host key: checked strictly against
~/.ssh/known_hosts. Connect once with thesshcommand to record a new host; a changed key is refused.Remote docker: the user must be allowed to run docker (e.g.
dockergroup). Non-interactive SSH sessions often lack docker inPATH(Synology:/usr/local/bin/docker), hencedockerCommand.
🧠 Skills
The skills/ folder contains agent skills that teach an assistant how to use these tools well. Copy them to ~/.claude/skills/ (or your project's .claude/skills/) to enable them.
docker-ops: host selection, narrow-then-widen reads, and the rules for write actions (explicit host, confirmation, no
forceorvolumesby default).docker-triage: a step-by-step method to find out why a container stopped, restarts or is unhealthy, with an exit-code table.
docker-health-report: a short multi-host report that puts exceptions first and never blocks on an unreachable host.
docker-cleanup: finds stale stopped containers and removes only an explicitly confirmed list, never with
forceorvolumesby default.docker-setup: writes and debugs the hosts file, with a table mapping each SSH or Docker error to its fix.
🏗 Development
Everything runs in Docker, so nothing is installed on the host:
cp .env.example .env # fill HOST_UID / HOST_GID
docker compose run --rm --no-deps node npm install
docker compose run --rm --no-deps node npm test
docker compose run --rm --no-deps node npm run typecheck
docker compose run --rm --no-deps node npm run buildSee docs/ARCHITECTURE.md for the design and docs/ROADMAP.md for the implementation plan.
🛡️ Security Considerations
Giving an AI agent access to a Docker daemon is equivalent to giving it root-level control of that machine.
Prefer
--read-only, orreadOnly: trueon every host where lifecycle management is not needed.Keep the configuration file and SSH keys outside the repository, readable only by you.
For SSH hosts, use a dedicated account with only the permissions it needs.
Redaction is best-effort: it recognizes common secret formats, but an unusual format can slip through. Treat any container output as potentially sensitive, and do not paste it into shared places.
📄 License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only Linux server and Docker monitoring for AI assistants: CPU, memory, disk, network.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Provides capabilities that let LLM agents perform a range of infrastructure management tasks.
Hosting for AI agents: your AI client deploys Docker apps to live HTTPS URLs over MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Docker containers, deploy stacks, and monitor services across multiple Docker hosts from one centralized location. Supports container lifecycle management, Docker Compose operations, and infrastructure orchestration through natural language commands.6MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to interact with Docker containers through safe, permission-controlled access to inspect, manage, and diagnose containers, images, and compose services with built-in timeouts and AI-powered analysis.-
- AlicenseCqualityDmaintenanceEnables AI assistants to manage Docker containers, images, networks, volumes, and Docker Compose services through the Model Context Protocol.27MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to manage Docker containers and Compose stacks through natural language, including lifecycle operations, logs, stats, and secure remote access.2112 npm3MIT