VPS Docker MCP (Advanced)
VPS Docker MCP — Erweitert
MCP-Server für Claude Code, der eine sichere VPS-Diagnose und Docker/Docker Compose-Verwaltung über SSH bietet.
Architektur
Claude Code
|
| MCP / stdio
v
Local Python MCP server
|
| SSH / AsyncSSH
v
VPS
|
+-- systemd
+-- Docker
+-- Docker ComposeDer MCP-Server läuft lokal. Auf dem VPS muss nichts lauschen.
Modulaufbau
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
Sicherheitsmodell
Dieses Projekt setzt bewusst keine willkürliche Shell-Ausführung frei.
Es gibt kein:
ssh(command)
execute(command)
bash(command)Stattdessen ist jeder Vorgang ein vordefiniertes MCP-Werkzeug.
Argumente wie Container- und Dienstnamen werden mit einem restriktiven Allow-List-Muster validiert und vor dem Einfügen in Befehle shell-quotiert.
Die SSH-Host-Key-Prüfung ist über VPS_KNOWN_HOSTS aktiviert.
Verwenden Sie ein dediziertes Nicht-Root-SSH-Konto, z. B. deploy, mit Docker-Zugriff.
Anforderungen
Python 3.11+
uvSSH-Zugriff
Docker auf dem VPS
Docker Compose v2, wenn Compose-Werkzeuge verwendet werden
deploy-Benutzer mit Berechtigung zum Ausführen von Docker
Installation
uv syncKonfigurieren:
cp .env.example .envBeispiel:
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 unabhängig testen:
ssh -i ~/.ssh/vps_mcp deploy@YOUR_VPS_IP docker psMCP testen:
uv run vps-docker-mcpEs wartet auf MCP-Stdio-Eingabe. Das ist erwartet.
Claude Code-Konfiguration
Kopieren Sie .mcp.json.example in die projektweite .mcp.json, die von Claude Code verwendet wird, und ersetzen Sie den absoluten Pfad.
Beispiel:
{
"mcpServers": {
"vps-docker": {
"type": "stdio",
"command": "uv",
"args": [
"--directory",
"/home/me/projects/vps-docker-mcp-advanced",
"run",
"vps-docker-mcp"
]
}
}
}Starten/Neustarten Sie dann Claude Code und überprüfen Sie den MCP-Status mit:
/mcpJe nach Claude Code-Version können MCP-Server auch mit der Claude Code-CLI verwaltet werden.
Werkzeuggruppen
VPS-Diagnose
system_infodisk_usagetop_processesnetwork_infosystemd_failedjournal_errorsdiagnose_vps
Docker (schreibgeschützt)
docker_psdocker_logsdocker_inspectdocker_statsdocker_healthdocker_imagesdocker_volumesdocker_networksdocker_disk_usage
Docker-Änderungen
docker_restartdocker_startdocker_stop
Docker Compose
Schreibgeschützt:
docker_compose_psdocker_compose_configdocker_compose_logs
Ändernd:
docker_compose_restartdocker_compose_pulldocker_compose_up
Eingeschränkte Diagnose
diagnostic_command erlaubt nur eine feste Liste:
pwd
whoami
date
df
free
uptime
docker_version
docker_info
Es akzeptiert keine beliebige Shell-Syntax.
Beispielhafte Claude Code-Anfragen
Check the VPS health.Claude kann verwenden:
diagnose_vpsFür einen defekten Container:
Find out why news-bot is unhealthy.Eine nützliche Diagnosesequenz ist:
docker_health
docker_ps
docker_logs
docker_stats
docker_inspectFür ein allgemeines Ressourcenproblem:
Check whether the VPS is running out of RAM or disk space.Claude kann inspizieren:
system_info
disk_usage
top_processes
docker_stats
docker_disk_usageDann:
Restart news-bot if the diagnosis indicates that a restart is appropriate.Der Neustartvorgang ist ein separates änderndes Werkzeug.
Wichtige Produktionsempfehlung
Behalten Sie den eigenen Berechtigungs-/Genehmigungsmechanismus von Claude Code für ändernde Vorgänge aktiviert.
Der MCP-Server kennzeichnet ändernde Werkzeuge absichtlich in ihren Beschreibungen, aber MCP selbst sollte nicht als Autorisierungsgrenze behandelt werden.
Fügen Sie für einen Produktions-VPS keine willkürliche Shell-Ausführung hinzu, es sei denn, Sie akzeptieren das Risiko bewusst.
Zukünftige Verbesserungen
Gute nächste Erweiterungen wären:
anwendungsspezifische Gesundheitschecks
Docker-Container-Neustartschleifenerkennung
OOM-Erkennung
Festplattenwachstumserkennung
systemd-Dienst-Neustartwerkzeuge
konfigurierbare Allow-Liste von Compose-Projekten
Audit-Logging
Befehlsausführungs-Timeouts pro Werkzeug
separate Lese- und Schreib-SSH-Anmeldeinformationen
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