Docker Explorer
🐳 Docker Explorer MCP 服务器
📋 概述
Docker Explorer 是一个强大的模型上下文协议 (MCP) 服务器,提供与 Docker 镜像、容器和镜像仓库交互的工具和资源。该服务器使 Claude 等 AI 助手能够通过标准化界面搜索、分析和与 Docker 资源交互,从而更轻松地管理和探索容器。
Related MCP server: Docker MCP Server
✨ 特点
核心功能
跨注册表搜索 Docker 镜像
搜索 Docker 镜像的特定标签
搜索 Docker Hub 用户/组织
获取有关 Docker 镜像的详细元数据
分析 Dockerfile 内容
比较 Docker 镜像
高级工具
🔒 安全扫描器:分析 Docker 镜像中已知的漏洞和安全问题
📦 图像大小优化器:获取有关减少 Docker 图像大小的建议
📄 Docker Compose Generator :为你的应用程序生成 docker-compose.yml 文件
📊 容器运行时分析器:获取有关容器运行时行为和资源使用情况的见解
🔍 镜像比较工具:比较两个 Docker 镜像并突出显示它们的差异
📜 Dockerfile Generator :根据自然语言应用程序描述创建 Dockerfile
🚀 安装
先决条件
Python 3.10 或更高版本
所需的 Python 包:
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或者安装单独的包:
pip install anthropic-mcp requests pydantic💻 使用方法
运行服务器
您可以直接从命令行运行服务器:
python docker_explorer.py这将在默认端口(5000)上启动 MCP 服务器。
与 Claude Desktop 集成
要将 Docker Explorer MCP 服务器与 Claude Desktop 一起使用:
更新 Claude 桌面配置:
在 Claude Desktop 配置目录中打开或创建
claude_desktop_config.json文件添加 Docker Explorer 服务器配置
{
"mcp_servers": [
{
"name": "docker-explorer",
"command": ["python", "/path/to/mcpIS421/docker_explorer.py"],
"cwd": "/path/to/mcpIS421"
}
]
}重新启动 Claude Desktop以加载新配置
使用工具
与 Claude Desktop 集成后,您可以通过向 Claude 询问以下问题来使用 Docker Explorer 工具:
核心工具
搜索 Docker 镜像:
Can you search for Python Docker images?获取图像详细信息:
What are the details of the python:3.11-slim image?查找可用标签:
What tags are available for the nginx image?
高级工具
安全扫描器:
Scan the security of the nginx image图像尺寸优化器:
How can I reduce the size of my python:3.9 image?Docker Compose 生成器:
Generate a docker-compose file for nginx with port 8080:80容器运行时分析器:
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添加新功能
要向 Docker Explorer MCP 服务器添加新工具:
使用 MCP 工具装饰器实现
docker_explorer.py中的工具功能:
@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)}"请遵循以下工具实施的最佳实践:
保持输出简洁并格式化为 Claude Desktop
优雅地处理异常
提供清晰的参数描述
返回结构良好的结果
测试
手动测试:
运行服务器:
python docker_explorer.py通过询问相关问题使用 Claude Desktop 进行测试
调试:
检查终端输出是否有任何错误
在 Claude Desktop 中验证工具响应
如果 Claude 有容量限制,请调整输出格式
📚 API 文档
核心工具
search_images
描述:跨注册表搜索 Docker 镜像
参数:
query(字符串):Docker 镜像的搜索查询limit(整数,默认值=10):返回的最大结果数
返回:带有元数据的 Docker 镜像列表
search_tags
描述:搜索 Docker 镜像的特定标签
参数:
image_name(字符串):Docker 镜像的名称tag_pattern(字符串,默认值为“”):用于匹配标签的模式limit(整数,默认值=25):返回的最大结果数
返回:匹配标签的列表
get_image_details
描述:获取有关 Docker 镜像的详细信息
参数:
image_name(字符串):Docker 镜像的名称tag(字符串,默认值为“latest”):Docker 镜像的标签
返回:详细的图像信息
高级工具
scan_security
描述:分析 Docker 镜像中已知的漏洞和安全问题
参数:
image_name(字符串):Docker 镜像的名称tag(字符串,默认为“latest”):要扫描的 Docker 镜像的标签
返回:带有建议的证券分析报告
optimize_image_size
描述:分析 Docker 镜像并提出减少其大小的方法
参数:
repository_url(字符串):Docker Hub 存储库的完整 URLtag(字符串,默认值为“latest”):要分析的 Docker 镜像的标签
返回:尺寸优化建议
generate_docker_compose
描述:根据镜像生成docker-compose.yml文件
参数:
repository_url(字符串):Docker Hub 存储库的完整 URLtag(字符串,默认值为“latest”):Docker 镜像的标签port_mapping(字符串,默认值=“”):可选端口映射(例如,'8080:80')environment_variables(字符串,默认值为“”):可选的环境变量include_db(布尔值,默认值=false):是否包含数据库服务
返回:生成的docker-compose.yml内容
analyze_runtime
描述:分析容器在运行时的行为
参数:
image_name(字符串):Docker 镜像的名称tag(字符串,默认值为“latest”):Docker 镜像的标签app_type(string, default="web"): 应用程序类型 (web, database, cache, api, batch)
返回:运行时分析,包括资源使用情况预测和建议
compare_images
描述:比较两个 Docker 镜像并突出显示差异
参数:
image1(字符串):要比较的第一个 Docker 镜像(例如“nginx:1.21”或“user/repo:tag”)image2(字符串):要比较的第二个 Docker 镜像(例如,'nginx:1.22' 或 'user/repo:tag')
返回:详细的比较报告,重点介绍尺寸、层、配置和兼容性方面的差异
generate_dockerfile
描述:根据自然语言描述的应用需求生成Dockerfile
参数:
app_description(字符串):要容器化的应用程序的描述(例如,“带有 Redis 的 Python Flask Web 应用程序”)app_type(string, default="web"): 应用程序类型 (web, api, database, worker, static)base_image(字符串,默认值为“”):可选使用的基础图像(例如,'python:3.9-alpine')include_comments(布尔值,默认值=true):是否在 Dockerfile 中包含解释性注释
返回:生成的 Dockerfile 及使用说明
🔒 安全注意事项
Docker Explorer MCP 服务器专为教育和开发目的而设计。使用时:
不要暴露敏感凭证或 API 密钥
生成和运行 Docker Compose 文件时要小心谨慎
实施前务必审查安全建议
📌 许可证
麻省理工学院
👥 贡献
欢迎贡献!欢迎提交 Pull 请求,添加新工具或改进现有功能。
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.
Related MCP Servers
- FlicenseAqualityFmaintenanceA Model Context Protocol server that enables Docker container management through natural language interactions using a custom GPT interface.715
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants like Claude to manage Docker containers, images, and Docker Compose deployments through the Model Context Protocol. Provides secure container lifecycle management, image operations, and multi-host Docker server connections.194MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Docker containers, images, networks, volumes, and Compose services through the Model Context Protocol. It supports system operations, command execution within containers, and integration with Docker Hub and GitHub Container Registry.1302MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to search, analyze, and manage Docker images on Docker Hub through standardized MCP tools, with features including security scanning, layer analysis, and image comparison.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Find, compare, and audit software for AI agents. Scored registry of tools and MCP servers.
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/jar285/mcp-docker'
If you have feedback or need assistance with the MCP directory API, please join our Discord server