
Docker MCP Server
io.github.hypnosisPublished by GitHub account hypnosisv2.0.1Updated Oct 24, 2026
Docker for AI agents — containers, compose stacks, logs and databases, locally or over SSH.
Overview
A local MCP server that lets an AI assistant inspect and operate Docker Compose stacks — containers, logs, health, databases and disk — on the local machine or,
- What you can do
- Inspect a Compose stack: list containers with state, health and ports, read logs line by line in a time window, read the resolved compose file and its variables, check service healthchecks and server/host status, and see images, volumes, networks and disk usage as numbers. Control services and stack lifecycle, including bringing stacks up or down. Query databases running in containers (PostgreSQL, MySQL/MariaDB, Redis, MongoDB, SQLite), check their status, and take or restore verified dumps. Run commands in a service container. Target a named profile to work on a remote Docker host over SSH instead of the local daemon.
- When to use it
- Useful when a coding agent works on Docker Compose applications and needs to diagnose a deploy, read logs, check health, look inside a containerized database, back it up before a migration, or see what disk Docker is using — locally or on a remote host.
- Requirements
- Node.js 18+ and a reachable Docker daemon (local socket, or a remote host over SSH with a key). Runs via npx as a local stdio process. Optional environment variables: DOCKER_MCP_PROFILES_FILE (path to a JSON profiles file) or DOCKER_PROFILES (inline JSON), DOCKER_MCP_ALLOW_SSH_FALLBACK, LOG_LEVEL. No authentication is declared.
Installation
In SourceWeft
- Open Docker MCP Server in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
Docker MCP Server — Docker tools for AI agents
A Docker MCP server that lets AI agents operate Compose stacks with structured, Docker-native tools — instead of brittle shell commands and terminal-shaped output.
Inspect containers, read logs, check health, query databases, take dumps, and bring stacks up or down — on your laptop or on a server across the world by naming its profile.
It speaks Docker the way you do: your compose files, project names, and service names. Answers come back as named fields with enough context for an agent to act on them, rather than parse an ASCII table and guess.
Works with Claude Code, Codex CLI, Cursor, opencode, Gemini CLI, Qwen Code and other MCP clients.
[MCP Registry] [npm version] [npm downloads] [tests] [License: MIT]
Install · Tools · Setup · Security · Docs · Changelog
Install in 30 seconds
No global installation required. npx downloads the package on first use:
Add it to your MCP client — Claude Code, for example — for every project:
That is the whole setup for the Docker on this machine. No profiles file, no environment variables: the server uses the local Docker socket, and the compose project of your working directory is the project it answers about.
For a Docker host on another machine, add one file with the servers you reach over SSH:
Now every tool takes a profile, and docker_health({ action: "profiles" }) lists what the
server was given.
Codex, Cursor, opencode and other clients are covered in Set up the Docker MCP server.
Install as a plugin
Some clients — Claude Code, for example — can take the whole thing as a plugin instead:
The plugin brings the server up against the Docker on this machine, with no configuration at
all. Point it at other hosts the same way as above, with DOCKER_MCP_PROFILES_FILE.
Requirements
[Node.js] [TypeScript] [MCP SDK]
Node.js 18+ and a Docker daemon you can already reach — the local socket, or a remote host over SSH with a key.
The server starts whether or not Docker is up. A call made while the daemon is down answers "start Docker" and works on the next try, without restarting your MCP client.
Prefer a pinned version, offline work, or one less registry check per launch:
npm install -g @hypnosis/docker-mcp-server, then use docker-mcp-server as the command
instead of npx.
Who this Docker MCP server is for
- AI-assisted developers who build, run, and debug applications with Docker Compose.
- Backend and full-stack developers who need their coding agent to inspect containers, logs, health checks, databases, and Compose services while solving a problem.
- Independent developers and small product teams who deploy Docker applications to their own servers and want one agent workflow for local development and production.
- Platform engineers who maintain Docker environments across development, staging, and production hosts.
- DevOps engineers and SREs using AI coding agents for incident checks, routine container work, and faster investigation of Compose-based services.
- Agencies and technical teams maintaining client applications, where an agent needs to understand an unfamiliar Compose stack before making a change.
- QA and release engineers who need repeatable visibility into test stacks, service health, logs, and databases before a release.
Why use a Docker MCP server instead of raw Docker CLI?
Docker CLI is excellent for a person at a terminal. An AI agent needs something different: Docker and Compose concepts it can query directly, results it can reason about, and clear boundaries between what happened, what was not found, and what could not be checked.
Less context, lower AI cost
docker ps, docker stats, and docker logs are designed to be read on a screen. Their output
mixes labels, values, units, and formatting into text an agent must parse before it can use it.
A Docker MCP tool returns the fields the task needs: service, project, state, health, ports, timestamps, byte counts, exit codes, and log streams. The agent receives less terminal noise, spends fewer tokens interpreting it, and keeps more context for the problem it is solving.
Debug Docker Compose as a system
A Docker application is more than a list of containers. It is a Compose project with services, dependencies, health checks, logs, databases, and resources that affect one another.
The server lets an agent ask about that system in the names you use every day: the project, service, and Compose file. One call can show the state and health of a stack; another can inspect a bounded log window, measure a service, or query the database already running beside it. The agent spends its turns finding the cause, not assembling and decoding shell commands.
Make decisions from explicit results
A shell command can return an empty table, clipped output, or an error printed alongside ordinary text. For an agent, those are different situations — and treating them as the same leads to guesses.
Docker MCP results say what was found, what was not found, what was cut short, and why an action did not run. A missing healthcheck is not a failed healthcheck; an empty list is not a failed read; a command with no exit code never started. That gives the agent a reliable basis for its next step, and gives you fewer confident-looking but wrong fixes.
Manage local and remote Docker hosts over SSH
Use the same Docker MCP tools on the Docker daemon beside you and on a remote server. A remote Docker host is a profile: a stable name, its SSH connection, and the authentication it needs. The agent names that profile in a tool call:
Leave profile out and the default Docker host answers, so local development stays frictionless.
Name a profile the server does not know and the response lists the profiles it does know instead
of quietly sending a request to another machine.
Remote Docker Compose projects are resolved by the labels their containers already carry. Ask for
a project by name wherever it lives on that host — no remote working directory or fixed Compose
path to maintain. For a project that has not run there yet, pass its file explicitly with
compose_path.
Built for the Model Context Protocol
A native Docker MCP server built on the official MCP SDK, with structured tools designed for AI agents rather than terminal automation.
Its behaviour is covered by unit tests and end-to-end tests that run against real Docker containers, not only mocks.
Docker MCP vs Docker CLI: practical examples
The Docker CLI is the right interface when a person is driving the terminal. These examples show what changes when an AI agent needs to inspect a Docker Compose application, understand the result, and choose the next safe step.
Each comparison uses the same real-world task: first the commands and output an agent would have to work through, then the structured Docker MCP result it can use directly.
Diagnose the health of a Docker Compose stack
Situation: A deploy just went out. The site is slow, and you do not know whether a container is down, a healthcheck is failing, or something is eating the memory.
Question: "Is this stack healthy?"
Raw docker CLI
Three commands, three formats, and the last one fails because the worker image declares no healthcheck at all. Nothing is broken — there is simply nothing to read — but the agent now has to tell "no healthcheck" apart from "failing", and a table gives it no help.
Structured MCP result
What changes for the agent
The legend explains only the words this answer used, right next to the fields that used them —
so the meaning of unhealthy is not sitting hundreds of messages back in a tool description.
Need numbers rather than states? docker_container({ action: "stats", service: "postgres" })
returns CPU, memory against its limit, network and disk as numbers, with the answer saying
plainly that it is one instant reading and not an average.
Need the healthchecks themselves? docker_health({ action: "services" }) reports each
service's own verdict, counts its checks and failures, and calls a service with no healthcheck
none rather than counting it as sick.
Investigate container logs without losing context
Situation: The API started returning 502 about ten minutes ago. The container has been running for a week and has written hundreds of thousands of lines.
Question: "What did it print when it broke?"
Raw docker CLI
The first call spent two hundred lines of context on health-check noise. The second found the error but threw away the lines around it, and nothing in either output says whether the stream was stdout or stderr, or whether anything was dropped on the way.
Structured MCP result
What changes for the agent
The day the lines fall on is said once, at the top, and each line then carries only its time — the same stamp repeated on every line is text you would be paying for. Lines spread across more than one day keep their full stamps, and the answer says why.
since also takes a date or a UNIX timestamp, and follow: true waits for lines still to come,
returning what arrived within its own time and size ceiling instead of hanging on an open stream.
Query a database running in Docker
Situation: Orders stopped appearing on the dashboard. You want to look in the database — which is a container, with a client inside it and no port published to your machine.
Question: "What does the table actually hold?"
Raw docker CLI
Every engine needs its own client, its own flags and its own way of naming the user and the database. Get one flag wrong and the shell prints an error the agent has to read as text — the call itself "succeeded".
Structured MCP result
What changes for the agent
status asks the database about itself instead — version, size, uptime, connections — and
format: "csv" lays PostgreSQL rows out for parsing. A statement that would destroy a database
or a whole keyspace does not run until it carries the confirmation marker; see
Destructive command protection for AI agents.
Back up a database before a risky migration
Situation: A migration is about to rewrite a table. You want a dump first — and you want to know the dump is real before the migration touches anything.
Question: "Do I actually have a backup?"
Raw docker CLI
Exit code zero came from gzip, the last command in the pipe — not from pg_dump. Twenty
bytes is an empty archive: the dump failed on a wrong user, the error went to the terminal, and
the shell reported success. A migration now runs on the strength of a backup that does not exist.
Structured MCP result
What changes for the agent
When the file cannot be read back, the answer says so instead of claiming a size: verified
stays false, bytes is null, and message names what stopped it — an unknown size is never
reported as an empty file.
Filling the database back is the same tool: action: "restore". It overwrites what is there,
so it is refused until the call carries the confirmation marker in its confirm field — and the
refusal tells you to take a backup here first.
Understand Docker disk usage before cleaning up
Situation: The server is at 90% disk. Docker is the obvious suspect, but you do not know whether it is images, volumes, stopped containers or build cache — and pruning the wrong one destroys a database.
Question: "What is safe to reclaim?"
Raw docker CLI
The summary is readable by a person and expensive for an agent: percentages in parentheses,
sizes as text with mixed units, and the detail view is several screens long. To compare
"reclaimable volumes" against "reclaimable images" the agent has to parse 64.9GB and
38.1GB (58%) back into numbers.
Structured MCP result
What changes for the agent
images, volumes and networks list what the host holds — volumes with their size and how
many containers hold them. An empty list means asked and found nothing, which is not the same
as never asked.
Built-in destructive command protection for AI agents
An AI agent can generate a valid command that is still the wrong command to run. This server adds a local guard before anything reaches Docker or a database client, so irreversible operations need an explicit confirmation in the call that requests them.
The guard distinguishes between deleting the thing that holds data — a database, volume, or top-level directory — and changing or deleting data inside it. The first category is refused until confirmed. The second can run, but returns a warning that states what changed.
Block irreversible loss, warn about destructive changes
A warning is not a refusal: the operation runs, and what it destroyed is stated as a fact in
the answer's warnings. DELETE FROM orders with a WHERE is not remarked on at all — that is
a normal statement.
Removal reads by where it points. A directory named directly under the root holds all of
something — the application, the data, the system — so rm -rf /srv is refused, while
rm -rf /srv/app/cache is what deleting files is for. A command wrapped in sh -c is unwrapped
and read however many shells it hides behind. The command runs as one argv, so a separator at the
top level is an argument: echo "hi"; rm -rf /data prints a line and removes nothing.
Confirm a deliberate destructive operation
Nothing is forbidden permanently. Three tools take the confirmation, each where the danger is:
The marker is carried inside the call, so it lifts the refusal for that one call and no other. The marker itself never reaches the database or the shell — it is taken out of the statement before it runs.
Every refusal names what would have gone, so it can be read before the call is repeated rather
than stepped over: DROP DATABASE shop destroys the database itself. Add # CONFIRMED-DESTRUCTIVE to the command to run it.
The guard reads one call at a time. It cannot connect a delete in one call with a read in the next, and it knows the tools it knows — a custom binary that wipes a directory is not something it recognizes. It is a seatbelt, not a policy engine: recoverable operations remain your call.
Docker MCP tools for containers, compose and databases
A focused Docker MCP toolkit for the work AI agents do most often: inspect a Compose stack, diagnose a service, control its lifecycle, work with its database, and understand host resources. Full parameters and examples live in docs/tools.md.
Every tool speaks the same Docker Compose vocabulary. profile selects the Docker host;
project selects the Compose project; service selects the service from its Compose file, not
the generated container name. Leave profile out and the default host answers. Leave project
out and the project in the working directory answers. Use compose_path only when Docker cannot
resolve a project because it has not run on that host yet.
Inspect a Docker Compose stack
Control services and stack lifecycle
Work with databases running in Docker
PostgreSQL, MySQL/MariaDB, Redis, MongoDB and SQLite are spoken to through the client the image already carries — nothing is installed into your containers.
Secrets stay hidden by default
Reading a project's variables with docker_compose hides the values whose key names a secret —
anything containing PASSWORD, TOKEN, KEY, SECRET, PRIVATE or CREDENTIALS. Each
variable says whether it was hidden, so a masked value is never mistaken for the real one, and
mask: false returns it when you actually need it.
Run a command when no dedicated tool fits
Safe defaults in MCP clients
Standard MCP annotations tell your client which tools are safe to run without asking. The five
reading tools declare readOnlyHint. The two control tools declare destructiveHint with
idempotentHint — the same call twice leaves the same state. docker_db, docker_db_admin and
docker_exec declare destructiveHint alone: they carry something the server did not write, so
what happens is decided by what you handed in.
Set up the Docker MCP server
For local Docker, add the server to your MCP client and start working. No profile file or Docker endpoint configuration is required: the server uses the Docker socket on this machine.
Configure profiles only when an AI agent needs to reach remote Docker hosts over SSH.
Configure remote Docker hosts
Store the profiles file wherever your MCP client keeps its configuration. Each profile gives the agent a name for a Docker host and the SSH connection details it needs:
A profile with mode: "local" is the Docker on this machine. A remote profile needs host and
username; port defaults to 22. Where the compose projects live on that server is not asked
for: a project is found by the labels its containers carry. default names the profile used
when a call leaves profile out.
Prefer keys. A profile without privateKeyPath uses your SSH agent, which is the better answer
when the key is encrypted.
The host key of the machine is checked: the first connection remembers it in
~/.ssh/known_hosts, and a machine that later answers with a different key is refused instead of
being talked to. knownHostsPath in a profile points at another file when you keep those keys
apart.
Configure Claude Code, Codex, Cursor and other MCP clients
Claude Code — one command; -s user makes the server available in every project:
Codex CLI
Cursor — in ~/.cursor/mcp.json:
opencode — in ~/.config/opencode/opencode.json:
Other MCP clients — Gemini CLI, Qwen Code, Cline, an editor plugin or your own agent work the same way. All they need is a command to run and, for remote hosts, one environment variable.
Verify the connection
Restart your MCP client, then run docker_health({ action: "profiles" }). It lists the Docker
hosts the server received from configuration and identifies any profile it could not read, along
with the field that needs attention.
Docker MCP server configuration
DOCKER_PROFILES_FILE is the deprecated spelling of the first variable. It still works and logs
a line asking you to rename it.
A profile pointing at a key that does not exist is refused by default, with the path and the ways out named — a missing key otherwise turns into a connection attempt that fails much later, somewhere less obvious.
Docker MCP server limitations
The server favours bounded, explicit tool calls over open-ended or implicit behaviour. These are the current limits to keep in mind:
- Log following is bounded.
follow: truereturns what arrived within 10 seconds or 1 MB, whichever comes first. It is a look at a live stream, not a subscription. - The guard reads one call at a time. It cannot connect a delete in one call with a read in the next, and it recognizes the tools it knows — a custom binary that wipes a directory is not one of them.
- Host resources are per host, not per project.
docker_resourceanswers about everything the daemon holds; narrowing to one project isdocker_container. - Windows is not verified. Nothing in the server is written against one platform, but it has not been run end to end on Windows.
Develop and test the Docker MCP server
The end-to-end suite runs against real PostgreSQL, MySQL, MariaDB, MongoDB, Redis, and web service containers. It verifies Docker integration behaviour that unit tests and mocks cannot prove alone. See docs/architecture.md for the project layout.
Support Docker MCP Server
If the tool helps your team, star the project on GitHub. It helps other developers find it too.
Contribute to the Docker MCP server
Issues and pull requests are welcome at github.com/hypnosis/docker-mcp-server.
License
MIT — see LICENSE.
Source: README.md at commit 7a7b52a
Tools
0Version history
1- v2.0.1LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts