FrenshGeek/claude-docker-mcp_controler
If you are the rightful owner of claude-docker-mcp_controler and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A comprehensive MCP server for managing Docker Desktop through Claude Desktop, offering full Docker management capabilities.
Claude Desktop Docker MCP Integration
A comprehensive, clean MCP (Model Context Protocol) server for controlling Docker Desktop through Claude Desktop. This implementation provides full Docker management capabilities with both custom server and Docker Gateway compatibility.
๐ฏ Features
Complete Docker Control
- Containers: Start, stop, restart, logs, stats, exec commands
- Images: List, pull, push, remove, build, inspect
- Networks: Create, list, remove, inspect
- Volumes: Create, list, remove, inspect
- System: Info, version, disk usage, cleanup/prune
Dual Integration Modes
- Custom MCP Server: Full-featured Python implementation
- Docker Gateway: Official Docker MCP integration
- Both: Run both servers simultaneously for maximum compatibility
Production Ready
- Comprehensive error handling
- Security validation of Docker commands
- Structured JSON responses
- Full MCP protocol compliance
- Zero external dependencies (Python stdlib only)
๐ Quick Setup
Prerequisites
- Docker Desktop installed and running
- Python 3.7+ (for custom server)
- Claude Desktop application
Automatic Setup
cd Claude_modifcation
python3 setup_claude_desktop.py
Choose option 3 (Both servers) for maximum compatibility.
Manual Setup
Option 1: Custom MCP Server
Copy claude_desktop_config.json
content to your Claude Desktop config:
cp claude_desktop_config.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
Option 2: Docker Gateway Only
Copy claude_desktop_config_gateway.json
instead:
cp claude_desktop_config_gateway.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
Restart Claude Desktop
Close and restart Claude Desktop completely for changes to take effect.
๐งช Testing
Test MCP Server
python3 test_mcp_server.py
Test Docker Integration
# Test Docker availability
docker --version
# Test Docker Gateway (if using)
docker mcp gateway --help
Test in Claude Desktop
Try these commands in Claude Desktop:
"List all my Docker containers"
"Show Docker system information"
"Pull the hello-world image"
"Show me my Docker images"
"Start container named jupyter_embedded_dd_vm"
๐ Available Tools
Container Management
docker_ps
- List containers (running or all)docker_start
- Start containersdocker_stop
- Stop containersdocker_restart
- Restart containersdocker_logs
- Get container logsdocker_stats
- Show resource usagedocker_exec
- Execute commands in containersdocker_inspect
- Inspect containers
Image Management
docker_images
- List imagesdocker_pull
- Pull images from registrydocker_push
- Push images to registrydocker_rmi
- Remove imagesdocker_build
- Build images from Dockerfile
Network Management
docker_network_ls
- List networksdocker_network_create
- Create networksdocker_network_rm
- Remove networks
Volume Management
docker_volume_ls
- List volumesdocker_volume_create
- Create volumesdocker_volume_rm
- Remove volumes
System Management
docker_info
- System informationdocker_version
- Version informationdocker_system_df
- Disk usagedocker_system_prune
- Cleanup unused objects
Container Operations
docker_run
- Run new containers with full configuration
๐ง Configuration Details
Custom MCP Server Config
{
"mcpServers": {
"docker-desktop-mcp": {
"command": "python3",
"args": ["/path/to/docker_mcp_server.py"],
"env": {
"PYTHONPATH": "/path/to/Claude_modifcation"
}
}
}
}
Docker Gateway Config
{
"mcpServers": {
"MCP_DOCKER_GATEWAY": {
"command": "docker",
"args": ["mcp", "gateway", "run"]
}
}
}
Combined Configuration
The setup script can configure both servers simultaneously, providing redundancy and maximum feature coverage.
๐ก๏ธ Security Features
- Command Validation: All Docker commands are validated and sanitized
- Argument Escaping: Shell injection protection via
shlex.quote()
- Timeout Protection: Commands timeout after 30 seconds by default
- Error Isolation: Failures are contained and reported safely
- No Privileges: Server runs with user permissions only
๐ Troubleshooting
MCP Server Not Starting
- Check Python path in configuration
- Verify script permissions:
chmod +x docker_mcp_server.py
- Test manually:
python3 docker_mcp_server.py
Docker Commands Failing
- Verify Docker Desktop is running
- Test Docker CLI:
docker ps
- Check Docker permissions
Claude Desktop Not Recognizing Server
- Verify configuration file location
- Restart Claude Desktop completely
- Check Claude Desktop logs for MCP errors
Docker Gateway Issues
- Update Docker Desktop to latest version
- Test gateway:
docker mcp gateway --help
- Try custom server as fallback
๐ File Structure
Claude_modifcation/
โโโ docker_mcp_server.py # Main MCP server implementation
โโโ claude_desktop_config.json # Custom server configuration
โโโ claude_desktop_config_gateway.json # Docker Gateway configuration
โโโ setup_claude_desktop.py # Automatic setup script
โโโ test_mcp_server.py # Test suite
โโโ requirements.txt # Dependencies (none required)
โโโ README.md # This documentation
๐จ Example Usage
Basic Container Management
Claude: "Show me all my Docker containers"
> Lists all containers with status
Claude: "Start the container named web-server"
> Starts the specified container
Claude: "Get the logs for my nginx container"
> Retrieves and displays container logs
System Management
Claude: "Show Docker system information and disk usage"
> Displays comprehensive system info
Claude: "Clean up unused Docker objects to free space"
> Performs system cleanup
Development Workflow
Claude: "Pull the latest Ubuntu image"
> Downloads Ubuntu image
Claude: "Run a temporary Ubuntu container with bash"
> Creates and starts interactive container
Claude: "Build a Docker image from the current directory"
> Builds image using local Dockerfile
๐ Integration with Docker Gateway
This implementation is designed to be compatible with Docker's official MCP Gateway:
- Follows MCP protocol specifications
- Uses standard Docker CLI commands
- Provides structured JSON responses
- Maintains compatibility with Docker Gateway tools
You can run both the custom server and Docker Gateway simultaneously for maximum coverage and redundancy.
๐ค Contributing
The server is designed to be easily extensible:
- Add new tools to
get_available_tools()
- Implement tool handlers in
handle_tool_call()
- Follow the existing pattern for error handling
- Test with the provided test suite
๐ License
This implementation uses only Python standard library and Docker CLI, ensuring compatibility and minimal dependencies.