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: dokku-mcp
보안 모델
이 프로젝트는 의도적으로 임의 셸 실행을 노출하지 않습니다.
다음은 없습니다:
ssh(command)
execute(command)
bash(command)대신, 모든 작업은 사전 정의된 MCP 도구입니다.
컨테이너 및 서비스 이름과 같은 인수는 제한적인 허용 목록 패턴으로 검증되고 명령에 삽입되기 전에 셸 인용 처리됩니다.
SSH 호스트 키 확인은 VPS_KNOWN_HOSTS를 통해 활성화됩니다.
Docker 액세스 권한이 있는 전용 비루트 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 자격 증명
Available Tools
26 toolsdiagnose_vpsA
Run a compact VPS health check covering resources, disk, systemd and Docker.
Inputs: no named parameters. Returns: result
diagnostic_commandB
Run one of a small predefined set of read-only diagnostic commands.
Inputs: command (required). Returns: result
disk_usageB
Show filesystem space and inode usage.
Inputs: no named parameters. Returns: result
docker_compose_configB
Render and validate the Docker Compose configuration.
Inputs: no named parameters. Returns: result
docker_compose_logsB
Show Docker Compose logs, optionally for one service.
Inputs: tail, service. Returns: result
docker_compose_psC
Show Docker Compose services.
Inputs: no named parameters. Returns: result
docker_compose_pullB
Pull Docker Compose images. This changes local Docker image state.
Inputs: no named parameters. Returns: result
docker_compose_restartB
Restart Docker Compose services. This changes server state.
Inputs: service. Returns: result
docker_compose_upA
Start/update the Docker Compose stack with detached mode. This changes server state.
Inputs: no named parameters. Returns: result
docker_disk_usageB
Show Docker disk usage.
Inputs: no named parameters. Returns: result
docker_healthB
Show container state, restart count and health status.
Inputs: container (required). Returns: result
docker_imagesB
List Docker images.
Inputs: no named parameters. Returns: result
docker_inspectC
Inspect a Docker container.
Inputs: container (required). Returns: result
docker_logsC
Show recent logs from a Docker container.
Inputs: container (required), tail. Returns: result
docker_networksB
List Docker networks.
Inputs: no named parameters. Returns: result
docker_psA
List Docker containers. Set all_containers=true to include stopped containers.
Inputs: all_containers. Returns: result
docker_restartB
Restart a Docker container. This changes server state.
Inputs: container (required). Returns: result
docker_startB
Start a Docker container. This changes server state.
Inputs: container (required). Returns: result
docker_statsA
Show current CPU, memory, network and block I/O usage of containers.
Inputs: no named parameters. Returns: result
docker_stopC
Stop a Docker container. This changes server state.
Inputs: container (required). Returns: result
docker_volumesB
List Docker volumes.
Inputs: no named parameters. Returns: result
journal_errorsC
Show recent system journal errors.
Inputs: hours, lines. Returns: result
network_infoB
Show network interfaces, routes and listening TCP/UDP ports.
Inputs: no named parameters. Returns: result
systemd_failedA
Show failed systemd services.
Inputs: no named parameters. Returns: result
system_infoA
Show VPS uptime, OS, CPU, memory, swap, load and kernel information.
Inputs: no named parameters. Returns: result
top_processesC
Show processes consuming the most CPU and memory.
Inputs: limit. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 26 tools
Most tools have clearly distinct purposes (e.g., docker_ps vs docker_inspect, system_info vs disk_usage). However, diagnose_vps overlaps with several individual system tools, and diagnostic_command is vague, creating some ambiguity.
Tools follow snake_case with clear prefixes (docker_, docker_compose_, system_, etc.). Docker tools use verb_noun pattern, but system tools are mostly noun_noun (e.g., system_info, disk_usage). This mix is not fully consistent but still readable.
26 tools is on the higher side but appropriate for the 'Advanced' scope covering Docker, Docker Compose, and VPS diagnostics. The set is well-scoped, though a few tools could be merged (e.g., diagnose_vps and individual checks).
The tool surface covers monitoring and basic state changes for Docker and VPS, but lacks container creation/removal, Docker Compose down, and deeper system management. The diagnostic_command is undefined. Notable gaps exist for a truly 'Advanced' server.
Related MCP Connectors
Linux server administration over OAuth MCP: shell, Docker, systemd, files and monitoring.
- browser-sshDeprecatedcom.browserssh
Scoped, audited SSH exec, sessions, and SFTP on your saved servers without exposing credentials
Manage remote servers, SSH terminals, files, databases and proxies with scoped access and approvals.
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables secure, read-only inspection of a VPS over SSH through approved operations such as system health, disk usage, container logs, and service status, without giving the AI unrestricted shell access.81MIT
- AlicenseAqualityCmaintenanceEnables MCP clients to inspect and manage a Dokku host over SSH with structured tools, read-only defaults, and explicit guardrails for safe operations.10MIT
- FlicenseNot gradedqualityBmaintenanceEnables controlled diagnostics and limited actions on a VPS through safe, auditable tools instead of an unrestricted root terminal, including read-only checks, basic Docker status, allowed-path file reading/searching, and YAML/JSON validation.-
- AlicenseNot gradedqualityBmaintenanceEnables read-only inspection and confirmed mutation operations on a single VPS over SSH, including host health, Docker, Compose, Swarm, firewall, and system debugging tools.36 npm1MIT