docker-mcp
Docker MCP Server (docker-mcp)
Model Context Protocol (MCP) 服务器,为检查、编排和排查 Docker Engine 与 Docker Compose 环境提供高杠杆工具。
构建于 @thargy/mcp-server-core 之上,遵循 John Ousterhout 的 Deep Module 哲学(A Philosophy of Software Design)。
1. 架构愿景:Deep Module 与工具膨胀
传统 MCP 服务器与 Docker CLI 动词一一映射,产生的 25+ 个浅层工具使 LLM 上下文窗口变得臃肿(每轮消耗 4,000+ 提示 token),并增加幻觉。
docker-mcp 仅暴露 6 个整合、高杠杆的工具,配合多态类型化动作判别器,总消耗 少于 1,000 个 token:
graph LR
subgraph Clients ["MCP Clients"]
Claude["Claude Desktop (Stdio)"]
Agent["Antigravity / Coding Agents"]
Gateway["mcp-gateway (SSE / Streamable HTTP)"]
end
subgraph DeepModule ["docker-mcp (Deep Module)"]
T1["docker_containers"]
T2["docker_compose"]
T3["docker_images"]
T4["docker_volumes"]
T5["docker_networks"]
T6["docker_system"]
Seam["IDockerClient Seam"]
Engine["DockerodeClient / InMemoryDockerClient"]
end
subgraph Host ["Docker Infrastructure"]
Socket["/var/run/docker.sock"]
RemoteTCP["tcp://remote-host:2376"]
RemoteSSH["ssh://user@remote-host"]
end
Clients --> DeepModule
DeepModule --> Seam
Seam --> Engine
Engine --> Host2. 整合后的 MCP 工具一览
工具 | 操作 | 能力与亮点 |
|
| 按名称/状态正则过滤、实时 CPU/RAM 计算、多路 stdout/stderr 日志提取、容器内命令执行、安全超时。 |
|
| 通过标签/目录发现多容器栈、生命周期编排、healthcheck 就绪状态验证。 |
|
| 镜像清单、虚拟大小格式化、标签解析、悬空镜像清理。 |
|
| 持久卷目录、驱动检查、孤立卷清理。 |
|
| Bridge、overlay 与 macvlan 网络拓扑检查,以及子网解析。 |
|
| Docker 守护进程健康检查、引擎版本、磁盘占用明细、系统级回收清理。 |
3. 快速开始与配置
环境变量
变量 | 默认值 | 说明 |
|
| HTTP / SSE 监听端口 |
|
| 绑定地址 |
| 可选 | 用于 HTTP / SSE Bearer 认证的密钥令牌 |
|
| 本机 Unix Docker Socket 路径 |
| 可选 | 远程 Docker TCP 地址(例如 |
| 可选 | 是否启用 TLS 证书校验( |
| 可选 | 客户端 TLS 证书路径( |
使用 Stdio 运行(Claude Desktop / 本地 CLI)
{
"mcpServers": {
"docker": {
"command": "node",
"args": ["/Users/craigdean/Repos/docker-mcp/dist/src/index.js"],
"env": {
"DOCKER_SOCKET": "/var/run/docker.sock"
}
}
}
}使用 Docker Compose 与 mcp-gateway 运行
docker compose up -d --build通过 http://localhost:3008/docker/mcp 或 http://localhost:3008/docker/sse 访问 HTTP SSE。
4. 测试与代码质量
100% 的单元测试均基于 InMemoryDockerClient 执行,无需访问实际运行的 Docker socket。
# Run unit tests
npm test
# Run test coverage (>85% required)
npm run test:coverage
# TypeScript compile check
npm run types:check许可证
MIT © 2026 Craig Dean
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 Connectors
Free MCP tools: the only MCP linter, health checks, cost estimation, and trust evaluation.
Official Sevalla MCP — full PaaS API access through just 2 tools.
34 production API tools over one hosted MCP endpoint.
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/thargy/docker-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server