Docker MCP is a server that allows you to manage Docker containers using natural language instructions. It enables you to create, configure, and manage Docker containers through conversational interfaces, making Docker more accessible to users without extensive command-line experience.
You'll need to modify the Claude Desktop configuration file to integrate the Docker MCP server:
Edit this file: ~/Library/Application\ Support/Claude/claude_desktop_config.json
Edit this file: %APPDATA%/Claude/claude_desktop_config.json
First install uv
by following the instructions at the official documentation
Add the following to your MCP servers configuration file:
"mcpServers": {
"mcp-server-docker": {
"command": "uvx",
"args": [
"mcp-server-docker"
]
}
}
docker build -t mcp-server-docker .
"mcpServers": {
"mcp-server-docker": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"/var/run/docker.sock:/var/run/docker.sock",
"mcp-server-docker:latest"
]
}
}
Note: The Docker socket is mounted as a volume to allow the MCP server to interact with your local Docker daemon.
The docker_compose
prompt allows you to create and manage Docker containers using natural language descriptions.
You can deploy containers with simple instructions like:
name: nginx, containers: "deploy an nginx container exposing it on port 9000"
name: wordpress, containers: "deploy a WordPress container and a supporting MySQL container, exposing Wordpress on port 9000"
When starting a new chat with the docker_compose
prompt, the system will retrieve the status of any containers, volumes, and networks associated with your project name, allowing you to manage or clean up resources from previous sessions.
The server provides these resources for container management:
list_containers
create_container
run_container
recreate_container
start_container
fetch_container_logs
stop_container
remove_container
list_images
pull_image
push_image
build_image
remove_image
list_networks
create_network
remove_network
list_volumes
create_volume
remove_volume
Important: Do not configure containers with sensitive data like API keys or database passwords. Any sensitive information exchanged with the LLM may be compromised unless the LLM is running locally.
Always review the containers created by the system. Docker containers can potentially impact your host machine, so verify configurations before applying them.
For safety, this MCP server doesn't support potentially dangerous Docker options like --privileged
or --cap-add/--cap-drop
.
This server uses the Python Docker SDK's from_env
method. See the official documentation for configuration details.
To connect to a remote Docker daemon over SSH, set the DOCKER_HOST
environment variable in your MCP server definition:
"mcpServers": {
"mcp-server-docker": {
"command": "uvx",
"args": [
"mcp-server-docker"
],
"env": {
"DOCKER_HOST": "ssh://[email protected]"
}
}
}
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.