VPS Docker MCP (Advanced)
Enables safe VPS diagnostics and Docker/Docker Compose management over SSH, providing predefined read-only and mutating tools for system monitoring, container inspection, and Compose orchestration without exposing arbitrary shell execution.
README
VPS Docker MCP — Advanced
MCP server for Claude Code that provides safe VPS diagnostics and Docker/Docker Compose management over SSH.
Architecture
Claude Code
|
| MCP / stdio
v
Local Python MCP server
|
| SSH / AsyncSSH
v
VPS
|
+-- systemd
+-- Docker
+-- Docker Compose
The MCP server runs locally. Nothing needs to listen on the VPS.
Module layout
src/vps_docker_mcp/
├── server.py # MCP instance, wires modules together
├── ssh.py # SSH config, run_ssh/run_many helpers
├── docker.py # Docker and Docker Compose tools
└── infrastructure.py # VPS diagnostics tools
Security model
This project intentionally does not expose arbitrary shell execution.
There is no:
ssh(command)
execute(command)
bash(command)
Instead, every operation is a predefined MCP tool.
Arguments such as container and service names are validated with a restrictive allow-list pattern and shell-quoted before being inserted into commands.
SSH host key checking is enabled through VPS_KNOWN_HOSTS.
Use a dedicated non-root SSH account, e.g. deploy, with Docker access.
Requirements
- Python 3.11+
uv- SSH access
- Docker on VPS
- Docker Compose v2 if Compose tools are used
deployuser with permission to run Docker
Installation
uv sync
Configure:
cp .env.example .env
Example:
VPS_HOST=YOUR_VPS_IP
VPS_PORT=22
VPS_USER=deploy
VPS_SSH_KEY=~/.ssh/vps_mcp
VPS_KNOWN_HOSTS=~/.ssh/known_hosts
DOCKER_COMPOSE_DIR=/opt/news-bot
MAX_OUTPUT_CHARS=20000
Test SSH independently:
ssh -i ~/.ssh/vps_mcp deploy@YOUR_VPS_IP docker ps
Test MCP:
uv run vps-docker-mcp
It will wait for MCP stdio input. That is expected.
Claude Code configuration
Copy .mcp.json.example to the project-level .mcp.json used by Claude Code and replace the absolute path.
Example:
{
"mcpServers": {
"vps-docker": {
"type": "stdio",
"command": "uv",
"args": [
"--directory",
"/home/me/projects/vps-docker-mcp-advanced",
"run",
"vps-docker-mcp"
]
}
}
}
Then start/restart Claude Code and inspect MCP status with:
/mcp
Depending on the Claude Code version, MCP servers can also be managed with the Claude Code CLI.
Tool groups
VPS diagnostics
system_infodisk_usagetop_processesnetwork_infosystemd_failedjournal_errorsdiagnose_vps
Docker read-only
docker_psdocker_logsdocker_inspectdocker_statsdocker_healthdocker_imagesdocker_volumesdocker_networksdocker_disk_usage
Docker mutations
docker_restartdocker_startdocker_stop
Docker Compose
Read-only:
docker_compose_psdocker_compose_configdocker_compose_logs
Mutating:
docker_compose_restartdocker_compose_pulldocker_compose_up
Restricted diagnostics
diagnostic_command only permits a fixed list:
- pwd
- whoami
- date
- df
- free
- uptime
- docker_version
- docker_info
It does not accept arbitrary shell syntax.
Example Claude Code requests
Check the VPS health.
Claude can use:
diagnose_vps
For a broken container:
Find out why news-bot is unhealthy.
A useful diagnostic sequence is:
docker_health
docker_ps
docker_logs
docker_stats
docker_inspect
For a general resource problem:
Check whether the VPS is running out of RAM or disk space.
Claude can inspect:
system_info
disk_usage
top_processes
docker_stats
docker_disk_usage
Then:
Restart news-bot if the diagnosis indicates that a restart is appropriate.
The restart operation is a separate mutating tool.
Important production recommendation
Keep Claude Code's own permission/approval mechanism enabled for mutating operations.
The MCP server intentionally labels mutating tools in their descriptions, but MCP itself should not be treated as an authorization boundary.
For a production VPS, do not add arbitrary shell execution unless you deliberately accept the risk.
Future improvements
Good next additions would be:
- application-specific health checks
- Docker container restart-loop detection
- OOM detection
- disk growth detection
- systemd service restart tools
- configurable allow-list of Compose projects
- audit logging
- command execution timeouts per tool
- separate read-only and write SSH credentials
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。