Skip to main content

MCP server for Proxmox Backup Server (datastore, snapshot, GC, verify, prune)

Project description

pbs-mcp

MCP server for Proxmox Backup Server. Exposes datastore status, snapshot inventory, garbage collection, verify, and prune over the PBS REST API as 17 LLM-callable tools. Designed for the Model Context Protocol.

Türkçe için → README.tr.md

Why

PBS already has a polished web UI. This server is for the cases where the UI isn't where you are — answering "is anything broken?" from a chat assistant, or wiring PBS state into a homelab agent that schedules verifies and prunes based on real conditions.

Tools (17)

# Tool Mode Notes
1 pbs_health_overview read One-call health report: storage, GC, verify coverage, freshness, failed tasks
2 pbs_list_datastores read Configured datastores + schedules
3 pbs_datastore_status read total / used / available bytes
4 pbs_list_groups read Per-group snapshot count, owner, corruption flag
5 pbs_list_snapshots read Newest-first with limit; summary=true for one row per group
6 pbs_get_task_status read UPID → running / OK / error
7 pbs_get_task_log read Paginate a task log, or tail=true for just the end
8 pbs_list_tasks read Recent tasks; full UPIDs handed out for running/failed ones
9 pbs_gc_status read Last GC stats: bytes referenced, pending, removed
10 pbs_list_verify_jobs read Scheduled verify jobs + re-verify policy
11 pbs_prune_dry_run read Preview which snapshots a retention policy would drop
12 pbs_run_gc write Trigger GC, returns UPID (async)
13 pbs_run_verify write Trigger verify, optional snapshot scope
14 pbs_prune write Apply retention policy
15 pbs_protect_snapshot write Set/clear the protected flag (prune/forget skip protected)
16 pbs_forget_snapshot write Delete one snapshot (corrupt cleanup)
17 pbs_stop_task write Abort a running task (e.g. GC stuck on slow NFS)

Start with pbs_health_overview for any "is PBS okay?" question — it fetches datastore status, GC stats, groups, snapshots, node status, and recent tasks concurrently and condenses them into one verdict, replacing five separate tool calls.

Write tools require both PBS_ALLOW_WRITE=true in the environment and confirm=true in the call itself. Restore is intentionally out of scope — the standard proxmox-mcp already handles restore from PBS via archive= on the Proxmox VE side.

Setup

1. Create an API token in PBS

In a shell on the PBS host (pct enter 205 from Proxmox if PBS lives in an LXC, otherwise just SSH):

# Generate a token under root@pam
proxmox-backup-manager user generate-token root@pam mcp

# Grant it admin on your datastore
proxmox-backup-manager acl update /datastore/<your-datastore> \
  DatastoreAdmin --auth-id 'root@pam!mcp'

The generate-token output includes a value field — that's the secret, shown only once. Save it.

Why DatastoreAdmin? PBS performs an owner check on prune. Either you give the token DatastoreAdmin (this), or you keep moving backup ownership with change-owner after every push. Admin scope is simpler and stays inside one datastore.

2. Configure the MCP server

git clone https://github.com/ahmetem/pbs-mcp.git
cd pbs-mcp
cp .env.example .env
# Edit .env: fill in PBS_HOST, PBS_TOKEN_ID, PBS_TOKEN_SECRET
pip install -e .

3. Register with your MCP client

For Claude Desktop, add to claude_desktop_config.json:

{
  "mcpServers": {
    "pbs": {
      "command": "python",
      "args": ["/absolute/path/to/pbs-mcp/pbs_mcp.py"]
    }
  }
}

Restart the client. The pbs_* tools should appear.

Safety model

  • Read-only by default. Out of the box PBS_ALLOW_WRITE=false, so every state-changing tool refuses regardless of confirm.
  • Two-key requirement on writes. PBS_ALLOW_WRITE=true opens the door; each call still needs confirm=true. Two independent toggles, two intentional actions.
  • Async tasks return UPIDs, not results. run_gc and run_verify kick off work and hand back a UPID immediately. Poll with get_task_status. This prevents the MCP request from blocking for hours.
  • Token scoped to one datastore. ACLs live at /datastore/<name>, not at /. A leaked token can't read PBS user lists or remote sync configs.

Notes / gotchas

  • First-call cache lag: PBS caches ACLs for a few seconds. GET requests retry once automatically after a short delay on 403 / connect errors, so a freshly granted token usually just works. If it still fails, wait a few seconds and retry.
  • Token vs user permissions: PBS API tokens get the intersection of the parent user's ACLs and the token's ACLs. With root@pam!mcp the parent is unrestricted, so only the token's ACL matters in practice.
  • Self-signed cert: PBS ships with a self-signed cert. The default PBS_VERIFY_TLS=false is fine for a LAN setup. For real CAs, set PBS_VERIFY_TLS=true and PBS_CA_BUNDLE to a PEM file.
  • UPIDs are tied to their creator: a UPID created by a now-deleted user becomes unreadable. Don't recycle PBS users while there are pending tasks.

Development

pip install -e .[dev]
pytest

Tests stub the HTTP layer — no PBS instance needed.

License

GPL-3.0-or-later. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pbs_mcp-0.3.0.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pbs_mcp-0.3.0-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file pbs_mcp-0.3.0.tar.gz.

File metadata

  • Download URL: pbs_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for pbs_mcp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8a7ecaf47ea5e7b009b3543d26c95aae20a215a954250ffe61f840ee926469ca
MD5 78decdffbcfc3129791e24bdf289bb76
BLAKE2b-256 3f94dbe34b90226570fb321d609966e65089b3b84d3a8bde850197b974bb766f

See more details on using hashes here.

File details

Details for the file pbs_mcp-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pbs_mcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 30.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for pbs_mcp-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbcbe235b644967cc1c78e7a3930d65789300fb46dcb8a070face9a5720dfa48
MD5 b44e2f584c9bff351c45352e7ce0b11b
BLAKE2b-256 fba25126c074bb7efe73c8abbcb127bfc745f23bb87784760582df69136c6389

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page