A Model Context Protocol server that provides tools for interacting with Docker images, containers, and registries, enabling AI assistants to search, analyze, and manage Docker resources through a standardized interface.
Docker Explorer is a powerful Model Context Protocol (MCP) server that provides tools and resources for interacting with Docker images, containers, and registries. This server enables AI assistants like Claude to search for, analyze, and interact with Docker resources through a standardized interface, making container management and exploration more accessible.
requests
, pydantic
git clone https://github.com/yourusername/docker-mcp-server.git cd docker-mcp-server
python -m venv .venv310 source .venv310/bin/activate # On Windows: .venv310\Scripts\activate
pip install -r requirements.txt
Or install individual packages:
pip install anthropic-mcp requests pydantic
You can run the server directly from the command line:
python docker_explorer.py
This will start the MCP server on the default port (5000).
To use the Docker Explorer MCP server with Claude Desktop:
claude_desktop_config.json
file in your Claude Desktop configuration directory{ "mcp_servers": [ { "name": "docker-explorer", "command": ["python", "/path/to/mcpIS421/docker_explorer.py"], "cwd": "/path/to/mcpIS421" } ] }
Once integrated with Claude Desktop, you can use the Docker Explorer tools by asking Claude questions like:
Search for Docker images:
Can you search for Python Docker images?
Get image details:
What are the details of the python:3.11-slim image?
Find available tags:
What tags are available for the nginx image?
Security Scanner:
Scan the security of the nginx image
Image Size Optimizer:
How can I reduce the size of my python:3.9 image?
Docker Compose Generator:
Generate a docker-compose file for nginx with port 8080:80
Container Runtime Analyzer:
Analyze the runtime behavior of mysql:5.7 as a database
docker-explorer-mcp/
āāā docker_explorer.py # Main server implementation with all tools
āāā requirements.txt # Project dependencies
āāā .gitignore # Git ignore file
āāā docs/ # Documentation
āāā server_guide.md # Guide for setting up and using the server
āāā new_tools_suggestions.md # Ideas for additional tools
āāā docker_mcp_server_project.md # Project overview
To add a new tool to the Docker Explorer MCP server:
docker_explorer.py
using the MCP tool decorator:@mcp.tool() def my_new_tool( param1: str = Field(description="Description of param1"), param2: int = Field(default=10, description="Description of param2") ) -> str: """Description of what your tool does""" try: # Implementation logic here result = f"Your formatted result" return result except Exception as e: return f"Error in my_new_tool: {str(e)}"
Manual Testing:
python docker_explorer.py
Debugging:
search_images
query
(string): Search query for Docker imageslimit
(integer, default=10): Maximum number of results to returnsearch_tags
image_name
(string): Name of the Docker imagetag_pattern
(string, default=""): Pattern to match tags againstlimit
(integer, default=25): Maximum number of results to returnget_image_details
image_name
(string): Name of the Docker imagetag
(string, default="latest"): Tag of the Docker imagescan_security
image_name
(string): Name of the Docker imagetag
(string, default="latest"): Tag of the Docker image to scanoptimize_image_size
repository_url
(string): Full URL to a Docker Hub repositorytag
(string, default="latest"): Tag of the Docker image to analyzegenerate_docker_compose
repository_url
(string): Full URL to a Docker Hub repositorytag
(string, default="latest"): Tag of the Docker imageport_mapping
(string, default=""): Optional port mapping (e.g., '8080:80')environment_variables
(string, default=""): Optional environment variablesinclude_db
(boolean, default=false): Whether to include a database serviceanalyze_runtime
image_name
(string): Name of the Docker imagetag
(string, default="latest"): Tag of the Docker imageapp_type
(string, default="web"): Application type (web, database, cache, api, batch)compare_images
image1
(string): First Docker image to compare (e.g., 'nginx:1.21' or 'user/repo:tag')image2
(string): Second Docker image to compare (e.g., 'nginx:1.22' or 'user/repo:tag')generate_dockerfile
app_description
(string): Description of the application to containerize (e.g., 'Python Flask web app with Redis')app_type
(string, default="web"): Application type (web, api, database, worker, static)base_image
(string, default=""): Optional base image to use (e.g., 'python:3.9-alpine')include_comments
(boolean, default=true): Whether to include explanatory comments in the DockerfileThe Docker Explorer MCP server is designed for educational and development purposes. When using it:
MIT
Contributions are welcome! Please feel free to submit a Pull Request with new tools or improvements to existing functionality.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!