docker_mcp_server
https://github.com/makbn/docker_mcp_server
claude mcp add --transport stdio masx200-docker_mcp_server docker run -d -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock --name docker-mcp-server docker-mcp-server \ --env DOCKER_HOST="unix:///var/run/docker.sock (or other Docker daemon host URL)"
How to use
This MCP server exposes a set of Docker commands as MCP tools by wrapping the existing Docker CLI behind the MCP Mediator framework. The server runs inside a Docker container and exposes an HTTP bridge, a WebSocket endpoint, and an SSE feed to interact with Docker commands as MCP tools. Typical usage involves configuring an MCP client (e.g., Claude Desktop or another MCP-enabled client) to connect to the HTTP or WebSocket endpoints and invoking tools such as starting, stopping, inspecting, or managing containers and images. The server leverages automatic server generation to present Docker operations as MCP tools, making it easy to discover commands without writing custom tool definitions.
Tools available include typical Docker operations such as starting and stopping containers, inspecting containers and volumes, and managing images. For example, you can start a container by ID, stop a container, inspect a container or volume, build images from a Dockerfile, and more. The MCP server automatically exposes these capabilities so you can construct MCP requests that map to Docker CLI actions through the broker.
How to install
Prerequisites:
- Docker installed on the host where you deploy the MCP server
- Basic familiarity with Docker commands
Step 1: Pull the Docker image
- docker pull docker-mcp-server
Step 2: Run the MCP server container
-
Basic run with default port mapping: docker run -d -p 3000:3000 --name docker-mcp-server docker-mcp-server
-
Run with access to the Docker daemon (required for Docker operations): docker run -d -p 3000:3000
-v /var/run/docker.sock:/var/run/docker.sock
--name docker-mcp-server docker-mcp-server -
Run with a custom Docker host (if using a non-default Docker host): docker run -d -p 8080:3000
-v /var/run/docker.sock:/var/run/docker.sock
-e DOCKER_HOST=unix:///var/run/docker.sock
--name docker-mcp-server docker-mcp-server
Step 3: Verify the server is running
- Visit http://localhost:3000/mcp/docker or the WebSocket equivalent to confirm connectivity. You can also check logs: docker logs -f docker-mcp-server
Step 4: Optional configuration with docker-compose (example)
- Use the provided docker-compose.yml to simplify deployment. Run: docker-compose up -d docker-compose logs -f
Note: The MCP server relies on the MCP Mediator core. If you modify the image locally, ensure the container is started with access to the Docker daemon (via /var/run/docker.sock) to enable Docker command execution.
Additional notes
Environment variables can customize logging and behavior. Common options include DOCKER_HOST to point to the Docker daemon, DOCKER_MCP_LOG_LEVEL to control verbosity, and DOCKER_MCP_LOG_FILE to designate a log file path. If running behind TLS or proxies, ensure the HTTP/WebSocket/SSE endpoints are reachable by your MCP clients. The MCP Tools are generated from Docker methods; if you extend or customize the underlying Docker service, the Mediator can automatically pick up non-annotated methods as tools when configured. If you encounter connectivity issues, verify that the container has access to the Docker daemon (check /var/run/docker.sock mounting) and that the host firewall allows traffic on the exposed ports (default 3000).