Skip to main content
Glama
ofershap
by ofershap

mcp-server-docker

npm 版本 npm 下载量 CI TypeScript 许可证:MIT Agent Plugins

通过你的 AI 编程助手控制 Docker 容器、镜像和服务。列出、启动、停止、读取日志、在容器内运行命令以及检查资源使用情况。

npx mcp-docker-server

兼容 Claude Desktop、Cursor、VS Code Copilot 以及任何兼容 MCP 的客户端。无需 API 密钥。自动连接到你的本地 Docker 套接字。

MCP 服务器,用于 Docker 容器、日志和资源监控

演示由 remotion-readme-kit 构建

为什么

如果你每天使用 Docker,你熟悉这样的流程:切换到终端,输入 docker ps,滚动查看日志,复制容器 ID,重启服务。这些操作累加起来很耗时。这个 MCP 服务器让你的 AI 助手为你处理这些任务,而你专注于代码。你可以让它检查哪些容器在运行、拉取失败服务的日志,或重启卡住的服务。它通过本地套接字与 Docker 的 API 通信,因此无需配置,也无需管理凭据。

Related MCP server: Docker Manager MCP

工具

工具

功能

list_containers

列出正在运行(或所有)容器及其状态、端口和镜像信息

container_logs

获取容器的最新日志

start_container

启动已停止的容器

stop_container

停止正在运行的容器

restart_container

重启容器

remove_container

删除容器(可选择强制删除)

exec_command

在运行中的容器内执行命令

container_stats

获取实时的 CPU、内存和网络统计信息

list_images

列出主机上的所有 Docker 镜像

remove_image

删除 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.jsonskills/ 与 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 服务器和开发者工具。

作者

由 ofershap 制作

LinkedIn GitHub


README 由 README Builder 构建

许可证

MIT © 2026 Ofer Shapira

Install Server
A
license - permissive license
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables 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.
    6
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables 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.
    135
    2
    MIT

View all related MCP servers

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…

View all MCP Connectors

Latest Blog Posts

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