Skip to main content
Glama
README.md
# proxmox-guard-mcp

A small, security-first MCP server and skill set for running a Proxmox VE homelab or small
production cluster: VM management, security auditing, and the network edge (nginx, firewalls)
in front of it.

> Status: early. `pve_search`, `pve_get` and `host_check` (all read-only) exist. They pass
> their tests but have not yet been run against a live cluster or host. Writes are not built.

## Try it

Create an API token for a user with the `PVEAuditor` role, copy `/etc/pve/pve-root-ca.pem`
from a node, then add the server to your MCP client:

```json
{
  "mcpServers": {
    "proxmox-guard": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/proxmox-guard-mcp", "proxmox-guard-mcp"],
      "env": {
        "PVE_HOST": "pve1.example.lan",
        "PVE_TOKEN_ID": "audit@pve!mcp",
        "PVE_TOKEN_SECRET_CMD": "security find-generic-password -w -s proxmox-guard-mcp",
        "PVE_CA_FILE": "/path/to/pve-root-ca.pem"
      }
    }
  }
}
```

`PVE_TOKEN_SECRET_CMD` reads the secret from a keychain or password manager so it never sits
in a config file; `PVE_TOKEN_SECRET` is accepted too. TLS verification can't be turned off.

## Goals

- **Light.** A handful of tools instead of one tool per API endpoint. The Proxmox API is
  reached through search + call tools driven by the official API schema; procedures live in
  skills, which cost no context until used.
- **Safe by construction.** No free-form shell tool. Host and guest checks are named,
  predefined, read-only commands, enforced on the target host as well as in this server.
- **Changes need a human.** Reads are free. Every write (Proxmox API, nginx, firewall) is
  shown as a proposal and applied only after the user approves that specific change.
- **Beyond Proxmox.** Audits what is actually exposed: port forwards, reverse proxy config,
  TLS, firewall rules, SSH settings, pending updates.

## Host checks

`host_check` looks inside the Proxmox host, VMs and containers: listening ports, firewall
rules, `nginx -T`, `sshd -T`, pending updates, failed services, login users, fail2ban.

It is not a shell. On each target (Debian, Ubuntu, Proxmox), as root:

```sh
ssh-keygen -t ed25519 -f ~/.ssh/mcp-audit -C mcp-audit      # once, on your machine
cd host && ./install.sh "$(cat mcp-audit.pub)" 192.0.2.10   # on the target; the IP is optional
```

That creates user `mcp-audit`. Its key can run one program, `/usr/local/sbin/mcp-check`, which
accepts only the exact check names and runs fixed commands; sudoers allows exactly the
root command lines those checks need. sshd and sudo enforce this on the target, so a
compromised MCP server or a stolen key can run those read-only checks and nothing else.

On your machine, list the hosts and record their host keys:

```sh
mkdir -p ~/.config/proxmox-guard-mcp && cd ~/.config/proxmox-guard-mcp
echo '{"edge": {"address": "10.0.0.5"}, "pve1": {"address": "10.0.0.2"}}' > hosts.json
ssh-keyscan 10.0.0.5 10.0.0.2 >> known_hosts    # compare fingerprints before trusting
```

and add `"GUARD_SSH_KEY": "/Users/you/.ssh/mcp-audit"` to the server's `env`. Callers choose
a host by name from `hosts.json`; no other address can be reached.

Note that `nginx_config` output goes to the model. Keep secrets out of nginx config comments
and inline values, or don't run that check on hosts where they are.

## Planned tools

| Tool | Purpose |
| --- | --- |
| `pve_search` | Find an endpoint in the Proxmox VE API schema |
| `pve_get` | Read call, with field selection to keep results small |
| `pve_write` | Write call: guarded, user-approved, audit-logged |
| `host_check` | Run a named read-only check on a host or guest |
| `task_wait` | Wait for a long-running task |

## Planned skills

`infra-audit`, `exposure-map`, `nginx-review`, `vm-safe-change`

## Security model

- stdio only; the server opens no network listener.
- Separate Proxmox API tokens for reading (`PVEAuditor`) and writing (narrow ACL).
  Proxmox's own permissions are the real boundary; server-side guards are a second layer.
- TLS verification on by default; fails closed.
- Tool output is untrusted input (logs, VM names and config comments can carry text written
  by an attacker), so no write runs on the model's decision alone.
- Secrets come from the OS keychain or environment, never from the repository.

## License

MIT