DockerMcpServer
A Docker MCP Server built using the ModelContextProtocol NuGet package
claude mcp add --transport stdio jamesburton-dockermcpserver docker run -i --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/jamesburton/dockermcpserver:latest
How to use
DockerMCPServer exposes full Docker functionality through MCP clients (such as Claude AI, Cursor, or VS Code) by running the server in a container. It provides programmatic access to containers, images, networks, volumes, Docker Compose stacks, and system-level operations. This enables you to create, start, stop, inspect, and remove containers; manage images (pull, build, tag, push, prune); configure networks and volumes; deploy Compose stacks with environment injection; and perform advanced configurations like resource limits, DNS, mounts, and security options via your MCP client.
To use it, deploy the server (commonly via Docker as shown in the installation section) and point your MCP client’s configuration at the docker server endpoint. Through the MCP protocol, you’ll issue structured operations such as creating a container with specific image, port mappings, volumes, and environment variables; deploying a Compose stack; or querying system information and daemon version. The client will serialize these requests and the DockerMCPServer will translate them into Docker API interactions, returning results and statuses that your workflow can consume.
How to install
Prerequisites:
- Docker (or Docker Desktop) installed on the host
- Internet access to pull images
Option A: Run the Docker MCP Server via the official container (recommended)
-
Pull and run the server container, mounting the Docker socket: docker run -d --name docker-mcp-server
-v /var/run/docker.sock:/var/run/docker.sock
ghcr.io/jamesburton/dockermcpserver:latest -
(Optional) Mount a config directory if you want to customize settings: docker run -d --name docker-mcp-server
-v /var/run/docker.sock:/var/run/docker.sock
-v $(pwd)/config:/app/config
ghcr.io/jamesburton/dockermcpserver:latest -
Point your MCP client configuration at the server. Example in Claude/Desktop config: { "mcpServers": { "docker": { "command": "docker", "args": ["run", "-i", "--rm", "-v", "/var/run/docker.sock:/var/run/docker.sock", "ghcr.io/jamesburton/dockermcpserver:latest"], "env": {} } } }
Option B: Run from source (development)
-
Clone the repo and navigate to it: git clone https://github.com/jamesburton/DockerMcpServer.git cd DockerMcpServer
-
Ensure .NET 8 SDK is installed.
-
Restore and run: dotnet restore dotnet run --project DockerMcpServer/DockerMcpServer.csproj
Note: When running in container mode, ensure your host has permission to access the Docker daemon (via /var/run/docker.sock) as shown above.
Additional notes
Environment considerations:
- Ensure the Docker socket is mounted with appropriate permissions. Running as root or a user in the docker group is common.
- If you enable advanced container features (e.g., privileged mode, custom DNS, or APPArmor/SELinux options), verify that your host security policies allow these operations.
- For production, consider configuring TLS, access controls, and network isolation where supported by your MCP client and environment.
- If you encounter connectivity issues between the MCP server and the Docker daemon, verify that the Docker daemon is reachable from the container (or host) and that there are no firewall rules blocking Docker API access.
- When using Docker Compose operations, keep your Compose file versions and service definitions compatible with the server’s capabilities.
Related MCP Servers
mssql
MSSQL Server MCP implementation written in C#
McpDotNet.Extensions.SemanticKernel
Microsoft SemanticKernel integration for the Model Context Protocol (MCP). Enables seamless use of MCP tools as AI functions.
DatabaseMcpServer
MCP server from ttcc666/DatabaseMcpServer
mcp-dataverse
MCP Server for querying Dataverse using SQL
xperience-community
ASP.NET Core MCP server for Xperience by Kentico projects
console-to-http
Example of converting a stdio MCP server to HTTP using ModelContextProtocol.AspNetCore