docker-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@docker-mcplist all running containers"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Docker MCP Server
This is a Model Context Protocol (MCP) server that provides tools and resources for interacting with Docker containers and images. It uses the stream HTTP transport method for communication and the Python Docker SDK (docker-py) for Docker operations.
Features
List Docker containers and images
Run, stop, and remove containers
View container logs
Pull Docker images
Inspect container details
Access Docker information as resources
Related MCP server: MCP Python Interpreter with Docker
Prerequisites
Docker
Docker Compose (optional, for easier deployment)
uv (for local development)
Getting Started
Running with Docker Compose
Clone this repository
Build and start the server:
docker-compose up -dRunning with Docker directly
Build the Docker image:
docker build -t mcp-docker-server .Run the container:
# Run server with SSE transport (no authentication)
docker run -d -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock -e MCP_PORT=3000 --name mcp-docker-server mcp-docker-server
# Run server with SSE transport and token authentication
docker run -d -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock -e MCP_PORT=3000 -e MCP_AUTH_TOKEN=your_secret_token --name mcp-docker-server mcp-docker-serverWhen the MCP_PORT environment variable is set, the server will use the SSE transport instead of stdio. Authentication is only applicable when using SSE transport. If the MCP_AUTH_TOKEN environment variable is set, the server will enable token authentication and configure the SSE endpoint to use the format /sse/{token} where {token} must match the value set in MCP_AUTH_TOKEN. If the token doesn't match or is not provided, the connection will be rejected. If no token is set, the server uses the standard /sse endpoint without authentication.
Running locally (development)
Install uv (if not already installed):
curl -sSf https://astral.sh/uv/install.sh | shInstall dependencies using uv:
uv syncRun the server:
# Run with stdio transport (default)
uv run server.py
# Run with SSE transport on port 8000
MCP_PORT=8000 uv run server.py
# Run with SSE transport and token authentication
MCP_PORT=8000 MCP_AUTH_TOKEN=your_secret_token uv run server.pyConfiguration
The server can be configured using environment variables:
MCP_PORT: When set, enables SSE transport mode and specifies the port to listen on (default:8000). If not set, the server will use stdio transport.MCP_AUTH_TOKEN: Secret token for authentication (only applicable when using SSE transport). When set, the SSE endpoint will be/sse/{token}instead of/sseMCP_HOSTNAME: Hostname to use for Docker containers (default:localhost). This can be a domain name or IP address that will be used to access Docker containers after they are created.MCP_AVAILABLE_PORTS: Comma-separated list of ports or port ranges that are available for Docker containers to bind to (e.g.,8000,8080-8090,9000). When specified, the server will validate that requested host ports are in this list.
Using with MCP clients
Should build the docker image first.
{
"mcpServers": {
"docker": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"/var/run/docker.sock:/var/run/docker.sock",
"mcp-docker-server"
]
}
}
}Available Tools
docker_ps: List running containersdocker_images: List available Docker imagesdocker_inspect: Get detailed information about a containerdocker_run: Run a Docker containerdocker_stop: Stop a running containerdocker_rm: Remove a containerdocker_logs: Fetch container logsdocker_pull: Pull a Docker image
Available Resources
docker://containers: Information about all containersdocker://images: Information about all imagesdocker://container/{container_id}: Detailed information about a specific containerdocker://config/hostname: Get the configured hostname for Docker containersdocker://config/available_ports: Get the list of available ports for Docker containers
TODO
Add functionality to query documentation for a specific Docker image
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/xiispace/docker-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server