VPS Docker MCP (Advanced)

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.

Category
Visit Server

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
  • deploy user 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_info
  • disk_usage
  • top_processes
  • network_info
  • systemd_failed
  • journal_errors
  • diagnose_vps

Docker read-only

  • docker_ps
  • docker_logs
  • docker_inspect
  • docker_stats
  • docker_health
  • docker_images
  • docker_volumes
  • docker_networks
  • docker_disk_usage

Docker mutations

  • docker_restart
  • docker_start
  • docker_stop

Docker Compose

Read-only:

  • docker_compose_ps
  • docker_compose_config
  • docker_compose_logs

Mutating:

  • docker_compose_restart
  • docker_compose_pull
  • docker_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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured