VPS-Guardian-MCP
Provides Docker container health monitoring (detecting exited, dead, restarting, or unhealthy containers), container-specific log retrieval, and recovery actions such as cleaning Docker caches.
Monitors Linux VPS system health metrics including CPU usage, load averages, RAM and swap usage, and root disk utilization.
Reads Nginx service logs and supports safely restarting the Nginx web server via systemctl or Docker.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@VPS-Guardian-MCPCheck VPS health and Docker container status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
VPS-Guardian-MCP š”ļø
A secure, open-source Model Context Protocol (MCP) server written in Python. It empowers AI agents (Claude Desktop, Antigravity, Cursor, etc.) to safely monitor Linux VPS health metrics, inspect Docker container states, retrieve service logs, and execute isolated recovery commands without giving full shell or root access.
⨠Features
š Comprehensive System Monitoring (
get_system_health):Real-time CPU load (%), physical & logical core count, and system load averages.
RAM & Swap usage (used/free/available both in human-readable and raw bytes).
Root disk filesystem capacity and utilization.
Docker container health check: detects exited, dead, restarting, or unhealthy containers.
š Safe Service Log Inspection (
read_service_logs):Reads the last $N$ lines of logs for systemd units and Nginx.
Supports container-specific logs (
docker:<container_name>).Injection Prevention: Input validation with strict regex patterns and non-shell execution (
shell=False).
š§ Isolated Emergency Recovery (
execute_recovery):Strict whitelist-only execution policy.
clean_docker_cache: Cleans stopped containers, unused networks, and dangling images.restart_nginx: Restarts the Nginx web server service via systemctl or Docker.Rejects any unauthorized action with a
forbiddenstatus.
š”ļø Robust Error Handling & Permissions:
All operations wrapped in safe exception boundaries.
Clear, informative diagnostic messages for permission issues (e.g. missing access to
/var/run/docker.sockor sudo privileges) without crashing the MCP connection.
Related MCP server: DevOps Dashboard MCP Server
š Project Structure
vps-guardian-mcp/
āāā src/
ā āāā __init__.py # Package initialization
ā āāā server.py # FastMCP server & tool definitions
ā āāā monitor.py # System & Docker metrics collector
ā āāā recover.py # Whitelisted recovery & log inspection
āāā pyproject.toml # Package definition and dependencies
āāā LICENSE # MIT License
āāā .gitignore # Git exclusion rules
āāā README.md # Documentationš Installation & Setup
1. Requirements
Python 3.10+
Linux VPS (Ubuntu/Debian/CentOS/Fedora) with systemd and Docker (optional)
2. Install dependencies
Create a virtual environment and install the package:
git clone https://github.com/murzirius/VPS-Guardian-MCP.git
cd vps-guardian-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -e .3. Grant Required VPS Permissions (Optional but Recommended)
To allow the server to inspect Docker and restart Nginx without full root:
# Allow Docker socket access without sudo
sudo usermod -aG docker $USER
# Allow reading systemd logs
sudo usermod -aG systemd-journal $USER
# Allow passwordless Nginx restart via sudoers (optional for restart_nginx)
echo "$USER ALL=(ALL) NOPASSWD: /bin/systemctl restart nginx" | sudo tee /etc/sudoers.d/vps-guardian-nginx
sudo chmod 0440 /etc/sudoers.d/vps-guardian-nginxāļø MCP Client Configuration
Add VPS-Guardian-MCP to your client configuration file (e.g. claude_desktop_config.json or Antigravity MCP settings):
{
"mcpServers": {
"vps-guardian": {
"command": "/path/to/vps-guardian-mcp/.venv/bin/python",
"args": [
"-m",
"src.server"
]
}
}
}Or when running via uvx / pipx:
{
"mcpServers": {
"vps-guardian": {
"command": "uv",
"args": [
"--directory",
"/path/to/vps-guardian-mcp",
"run",
"vps-guardian-mcp"
]
}
}
}š ļø Available MCP Tools
1. get_system_health
Retrieves CPU, RAM, root disk usage, and unhealthy/failed Docker containers.
Example Agent Output:
{
"system": { "os": "Linux", "platform": "Linux-5.15.0-generic-x86_64", "architecture": "x86_64" },
"cpu": { "status": "ok", "cpu_usage_percent": 18.4, "logical_cores": 4 },
"memory": {
"status": "ok",
"ram": { "total": "15.62 GB", "used": "4.20 GB", "available": "11.42 GB", "used_percent": 26.9 }
},
"disk": {
"status": "ok",
"mount_point": "/",
"total": "98.24 GB",
"free": "64.12 GB",
"used_percent": 34.7
},
"docker": {
"status": "connected",
"total_containers": 5,
"running_containers": 4,
"failed_containers": [
{
"id": "a1b2c3d4e5f6",
"name": "payment-api",
"status": "exited",
"exit_code": 137,
"error": "OOMKilled"
}
]
}
}2. read_service_logs
Fetches the last $N$ lines of logs for Nginx, systemd services, or Docker containers.
Parameters:
service_name(string, required): e.g."nginx","docker:payment-api", or"systemd:redis".lines_count(integer, optional, default: 50): clamped between 1 and 1000.
3. execute_recovery
Executes an isolated, predefined recovery operation.
Parameters:
action_name(string, required):"clean_docker_cache": Runs Docker prune for containers, images, and networks."restart_nginx": Safely restarts Nginx via systemctl or Docker.
š Security Principles
No Arbitrary Command Execution: We deliberately avoid exposing a raw terminal or generic
exectool.Strict Whitelisting: Actions are hard-coded in an immutable lookup table.
No Shell Invocations: All subprocess executions use explicit list arguments (
shell=False), preventing shell meta-character evaluation and command injections.Least Privilege: Designed to run as an unprivileged user with narrowly scoped group memberships (
docker,systemd-journal).
š License
This project is licensed under the MIT License - see the LICENSE file for details.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
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 Connectors
Your org's AI agents, tasks, runs, search, and brain files as MCP tools and resources.
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Hosted MCP with 91 agent tools: X, domains, SEO, Maps, Trends, Search, YouTube, TikTok, and more.
- emisarOAuthdev.emisar
Let AI operate servers without SSH. Choose actions, approve risky changes, and audit every step.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to remotely read/write files and execute commands on Linux servers via MCP protocol.4MIT
- AlicenseAqualityDmaintenanceEnables AI assistants to monitor and manage Linux infrastructure including services, logs, processes, disk, memory, ports, cron, nginx, Docker, and system health checks via the Model Context Protocol.10MIT
- AlicenseAqualityCmaintenanceEnables 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
- AlicenseAqualityCmaintenanceProvides read-only access to host system metrics (CPU, memory, disk), Docker container health/logs, and sandboxed log file analysis via MCP tools, enabling AI agents to monitor enterprise infrastructure safely.3MIT
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/murzirius/VPS-Guardian-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server