VPS Docker MCP (Advanced)
VPS Docker MCP — 高度な
Claude Code用のMCPサーバーで、SSH経由で安全なVPS診断とDocker/Docker Compose管理を提供します。
アーキテクチャ
Claude Code
|
| MCP / stdio
v
Local Python MCP server
|
| SSH / AsyncSSH
v
VPS
|
+-- systemd
+-- Docker
+-- Docker ComposeMCPサーバーはローカルで実行されます。VPS上で待ち受ける必要はありません。
モジュール構成
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 toolsRelated MCP server: Docker/Hetzner MCP Server
セキュリティモデル
このプロジェクトは意図的に任意のシェル実行を公開しません。
以下はありません:
ssh(command)
execute(command)
bash(command)代わりに、すべての操作は事前定義されたMCPツールです。
コンテナ名やサービス名などの引数は、制限的な許可リストパターンで検証され、コマンドに挿入される前にシェルクォートされます。
SSHホストキーの確認はVPS_KNOWN_HOSTSを通じて有効になります。
Dockerアクセス権を持つ専用の非root SSHアカウント(例:deploy)を使用してください。
必要条件
Python 3.11+
uvSSHアクセス
VPS上のDocker
Composeツールを使用する場合はDocker Compose v2
Dockerを実行する権限を持つ
deployユーザー
インストール
uv sync設定:
cp .env.example .env例:
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=20000SSHを個別にテスト:
ssh -i ~/.ssh/vps_mcp deploy@YOUR_VPS_IP docker psMCPをテスト:
uv run vps-docker-mcpMCPのstdio入力を待機します。これは想定された動作です。
Claude Codeの設定
.mcp.json.exampleをClaude Codeが使用するプロジェクトレベルの.mcp.jsonにコピーし、絶対パスを置き換えてください。
例:
{
"mcpServers": {
"vps-docker": {
"type": "stdio",
"command": "uv",
"args": [
"--directory",
"/home/me/projects/vps-docker-mcp-advanced",
"run",
"vps-docker-mcp"
]
}
}
}その後、Claude Codeを起動/再起動し、次のコマンドでMCPステータスを確認します:
/mcpClaude Codeのバージョンによっては、MCPサーバーはClaude Code CLIでも管理できます。
ツールグループ
VPS診断
system_infodisk_usagetop_processesnetwork_infosystemd_failedjournal_errorsdiagnose_vps
Docker読み取り専用
docker_psdocker_logsdocker_inspectdocker_statsdocker_healthdocker_imagesdocker_volumesdocker_networksdocker_disk_usage
Docker変更操作
docker_restartdocker_startdocker_stop
Docker Compose
読み取り専用:
docker_compose_psdocker_compose_configdocker_compose_logs
変更操作:
docker_compose_restartdocker_compose_pulldocker_compose_up
制限付き診断
diagnostic_commandは固定リストのみ許可します:
pwd
whoami
date
df
free
uptime
docker_version
docker_info
任意のシェル構文は受け付けません。
Claude Codeリクエストの例
Check the VPS health.Claudeは以下を使用できます:
diagnose_vps壊れたコンテナの場合:
Find out why news-bot is unhealthy.有用な診断シーケンスは次のとおりです:
docker_health
docker_ps
docker_logs
docker_stats
docker_inspect一般的なリソース問題の場合:
Check whether the VPS is running out of RAM or disk space.Claudeは以下を検査できます:
system_info
disk_usage
top_processes
docker_stats
docker_disk_usage次に:
Restart news-bot if the diagnosis indicates that a restart is appropriate.再起動操作は別の変更ツールです。
本番環境での重要な推奨事項
変更操作については、Claude Code自身の許可/承認メカニズムを有効にしておいてください。
MCPサーバーは変更ツールの説明に意図的にラベルを付けていますが、MCP自体を認証境界として扱うべきではありません。
本番VPSでは、意図的にリスクを受け入れない限り、任意のシェル実行を追加しないでください。
今後の改善点
次に追加すると良いもの:
アプリケーション固有のヘルスチェック
Dockerコンテナの再起動ループ検出
OOM検出
ディスク増加検出
systemdサービス再起動ツール
Composeプロジェクトの設定可能な許可リスト
監査ログ
ツールごとのコマンド実行タイムアウト
読み取り専用と書き込み用のSSH認証情報の分離
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
- AlicenseAqualityCmaintenanceEnables AI assistants to securely execute remote SSH commands, perform file transfers, and monitor system status through a standardized interface. It features robust security controls including command whitelisting, blacklisting, and credential isolation to prevent unauthorized operations.1022MIT
- Alicense-quality-maintenanceProvides tools for managing Docker containers, Compose stacks, and system resources on Hetzner servers via SSH. It also includes capabilities for reloading Caddy configurations and managing Cloudflare DNS records.
- Alicense-qualityDmaintenanceEnables LLMs to securely manage Virtual Private Servers via SSH, with features including command execution, file operations, system monitoring, and service management.MIT
- AlicenseAqualityAmaintenanceEnables AI assistants to perform controlled Linux system administration tasks like reading logs, managing services, cron jobs, WordPress, and executing sandboxed Python code, with strict security constraints.292GPL 2.0
Related MCP Connectors
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Execute PowerShell commands securely with controlled timeouts and input validation. Retrieve syste…
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/mordanov/vps_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server