Get the FREE Ultimate OpenClaw Setup Guide →

docker_mcp_server

Model Context Protocol MCP Server for Docker Commands. Provides Docker and Docker Swarm commands as MCP Tools.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio makbn-docker_mcp_server java -jar docker-mcp-server.jar --docker-host=tcp://localhost:2376 --tls-verify --cert-path=/etc/docker/certs --server-name=docker_mcp_server --server-version=1.0.0.0 --max-connections=150 --docker-config=/custom/docker/config \
  --env DOCKER_MCP_LOG_FILE="Path to log output file" \
  --env DOCKER_MCP_LOG_LEVEL="Logging level (TRACE, DEBUG, INFO, etc.)"

How to use

This MCP server exposes existing Docker commands as MCP Tools using the MCP Mediator framework. It automatically generates MCP Tools from the Docker client/service methods, so you can discover and invoke Docker operations through MCP tooling without writing separate API clients. The server is configured to connect to a Docker daemon (via --docker-host) and then presents a suite of tools such as docker_start_container, docker_stop_container, docker_list_containers, docker_pull_image, docker_inspect_container, docker_remove_image, and many more. Tools can be discovered by your MCP client UI or runtime and invoked with parameters that map to Docker CLI options or API fields. When non-annotated methods are enabled, the mediator can generate tools from method signatures, class names, and package structure, expanding the available tool set beyond explicitly annotated commands.

To run, provide the Java runtime and the docker-mcp-server.jar along with the necessary Docker and server configuration options (host, TLS settings, server name/version, and Docker config path). The server then exposes the generated MCP Tools for consuming clients to use in automation, dashboards, or CLI workflows.

How to install

Prerequisites:

  • Java Development Kit (JDK) 11 or newer
  • Maven (for building from source) if you plan to compile the project
  • Access to a Docker daemon (or a remote Docker host) configured for MCP usage

Installation steps:

  1. Clone the repository (and its submodules): git clone --recurse-submodules https://github.com/makbn/docker_mcp_server.git cd docker_mcp_server

  2. Build the project (via Maven): mvn clean package // This will produce a JAR, for example: target/mcp-mediator-implementation-docker-[version].jar

  3. Run the MCP server: java -jar docker-mcp-server.jar --docker-host=tcp://localhost:2376
    --tls-verify
    --cert-path=/etc/docker/certs
    --server-name=docker_mcp_server
    --server-version=1.0.0.0
    --max-connections=150
    --docker-config=/custom/docker/config

  4. Optional: Build a native image (GraalingVM) if you need a standalone executable: mvn clean package native-image -jar mcp-mediator-implementation-docker-[version].jar // Run the resulting executable directly

  5. Validate discovery and usage from a client or CLI tool configured to query MCP tools from the server.

Additional notes

Tips and common considerations:

  • Ensure the Docker daemon is reachable from the MCP server host (check --docker-host and network ACLs).
  • If using TLS, provide the correct certificate path via --cert-path and ensure TLS verification aligns with your setup (--tls-verify).
  • The MCP server uses environment variables DOCKER_MCP_LOG_LEVEL and DOCKER_MCP_LOG_FILE to control logging behavior; adjust as needed for debugging and production parity.
  • The tool set can expand automatically if createForNonAnnotatedMethods(true) is enabled in the MCP Mediator configuration, enabling tools derived from non-annotated Docker service methods.
  • When upgrading the server or mediator, re-run the build to regenerate the executable and ensure compatibility with the Docker API version in use.
  • If a tool is not appearing in discovery, verify that the underlying Docker command is exposed by the mediator and that any required method annotations or naming conventions are satisfied.

Related MCP Servers

Sponsor this space

Reach thousands of developers