mcp-server-docker
mcp-server-docker
通过你的 AI 编程助手控制 Docker 容器、镜像和服务。列出、启动、停止、读取日志、在容器内运行命令以及检查资源使用情况。
npx mcp-docker-server兼容 Claude Desktop、Cursor、VS Code Copilot 以及任何兼容 MCP 的客户端。无需 API 密钥。自动连接到你的本地 Docker 套接字。

演示由 remotion-readme-kit 构建
为什么
如果你每天使用 Docker,你熟悉这样的流程:切换到终端,输入 docker ps,滚动查看日志,复制容器 ID,重启服务。这些操作累加起来很耗时。这个 MCP 服务器让你的 AI 助手为你处理这些任务,而你专注于代码。你可以让它检查哪些容器在运行、拉取失败服务的日志,或重启卡住的服务。它通过本地套接字与 Docker 的 API 通信,因此无需配置,也无需管理凭据。
Related MCP server: Docker Manager MCP
工具
工具 | 功能 |
| 列出正在运行(或所有)容器及其状态、端口和镜像信息 |
| 获取容器的最新日志 |
| 启动已停止的容器 |
| 停止正在运行的容器 |
| 重启容器 |
| 删除容器(可选择强制删除) |
| 在运行中的容器内执行命令 |
| 获取实时的 CPU、内存和网络统计信息 |
| 列出主机上的所有 Docker 镜像 |
| 删除 Docker 镜像 |
快速开始
Cursor
添加到 .cursor/mcp.json:
{
"mcpServers": {
"docker": {
"command": "npx",
"args": ["-y", "mcp-docker-server"]
}
}
}Claude Desktop
添加到 claude_desktop_config.json:
{
"mcpServers": {
"docker": {
"command": "npx",
"args": ["-y", "mcp-docker-server"]
}
}
}VS Code
添加到用户设置或 .vscode/mcp.json:
{
"mcp": {
"servers": {
"docker": {
"command": "npx",
"args": ["-y", "mcp-docker-server"]
}
}
}
}示例
列出所有正在运行的 Docker 容器
显示 nginx 容器的日志
重启 api-server 容器
我的 postgres 容器的 CPU 和内存使用情况如何?
在 web 容器内执行
ls -la /app列出所有 Docker 镜像及其大小
停止所有使用旧镜像的容器
前提条件
Docker 必须在你的机器上运行
服务器连接到位于
/var/run/docker.sock(Linux/macOS)或 Windows 上的命名管道的 Docker 套接字无需 API 密钥或令牌
Agent Plugins
此仓库是一个 Agent Plugins 1.0.0 包:plugin.json、可移植的 mcp.json 和 skills/ 与 MCP 服务器一起发布。
对于 Cursor,克隆仓库并将其复制或符号链接到 ~/.cursor/plugins/local/mcp-server-docker,然后重新加载窗口。Skills 和 MCP 会出现在 Customize > Plugins 下。
上方的 Cursor 和 VS Code 安装按钮仍然有效:它们会添加与手动 JSON 相同的 npx -y mcp-docker-server stdio 服务器。
常见问题
什么是 mcp-docker-server?
这是此 MCP 服务器的 npm 包(仓库名为 mcp-server-docker)。它通过本地 Docker 套接字列出容器、跟踪日志、执行命令和管理镜像。
我需要运行 Docker Desktop 吗?
是的。守护进程必须处于运行状态,且 MCP 进程必须能够访问 docker.sock(或 Windows 命名管道)。
这对生产容器安全吗?
请将停止/删除/重启视为破坏性操作。在更改生产工作负载之前,请与用户确认。
我可以将它作为 Agent Plugin 安装在 Cursor 中吗?
可以。使用 ~/.cursor/plugins/local/mcp-server-docker,这样捆绑的 docker-management 技能会随 MCP 配置一起加载。
我需要 API 密钥吗?
不需要。只需要本地 Docker 访问权限。
开发
git clone https://github.com/ofershap/mcp-server-docker.git
cd mcp-server-docker
npm install
npm test
npm run build另请参阅
在我的 作品集 上查看更多 MCP 服务器和开发者工具。
作者
README 由 README Builder 构建
许可证
MIT © 2026 Ofer Shapira
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
- AlicenseBqualityDmaintenanceEnables natural language interaction with Docker commands and operations. Supports container management, image operations, system information, and Docker Compose through conversational requests.141631MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Docker containers, deploy stacks, and monitor services across multiple Docker hosts from one centralized location. Supports container lifecycle management, Docker Compose operations, and infrastructure orchestration through natural language commands.6MIT
- 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.1352MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Docker containers, images, networks, volumes, and Docker Compose services through the Model Context Protocol.163MIT
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Build, validate, and deploy multi-agent AI solutions from any AI environment.
Create and manage AI agents that collaborate and solve problems through natural language interacti…
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/ofershap/mcp-server-docker'
If you have feedback or need assistance with the MCP directory API, please join our Discord server