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: environment variables named like
KEY,TOKEN,PASSWORD,SECRET,PASSorCREDENTIALare replaced by***REDACTED***(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, 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: claude mcp add docker -- npx -y @zeearth/mcp-server-docker --config <path>.
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.
🏗 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 only looks at environment variable names; review what
docker_inspectfull mode returns before sharing it.
📄 License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
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.
Remote Linux boxes for coding agents: Docker, a browser, screenshots, logs, human takeover.
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.2772 npmMIT
- AlicenseAqualityBmaintenanceEnables AI assistants to manage Docker containers and Compose stacks through natural language, including lifecycle operations, logs, stats, and secure remote access.218 npm3MIT