Governed XCP-ng ops via Xen Orchestra β 27 MCP tools with audit, budget, undo guards.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
Disclaimer: Community-maintained open-source project. Not affiliated with, endorsed by, or sponsored by Vates, the XCP-ng project, or the Xen Orchestra project. "XCP-ng", "Xen Orchestra", and "Xen" are trademarks of their owners. MIT licensed.
AI-powered XCP-ng operations via Xen Orchestra's REST API with a
built-in governance harness β unified audit log, policy engine,
token/runaway budget guard, undo-token recording, and descriptive risk
tiers. Built for homelabs and small/self-hosted XCP-ng fleets that want an AI
agent to triage VM health, storage pressure, backup failures, and patch
posture β with every write audited, previewable, and (where honest)
reversible. Self-contained: no dependencies beyond httpx and the MCP SDK.
Requires a Xen Orchestra instance (XO from sources or the Xen Orchestra Appliance, 5.x with
/rest/v0). XO is the management plane this tool talks to β direct per-host XAPI access is out of scope for v0.1. Do NOT use for Proxmox VE β use proxmox-aiops.
xcpng-aiops ...): init, overview, vm list/get/stats/health-rca/start/stop/reboot/migrate, host list/get/missing-patches, pool list/get/posture, sr list/get/vdis/usage-rca/rescan, snapshot list/create/delete/revert, backup jobs/logs/failure-rca, task list, secret set/list/rm/migrate/rotate-password, doctor, mcp.xcpng-aiops mcp or xcpng-aiops-mcp): 29 tools (19 read, 8 write, 2 undo), every one wrapped with the bundled @governed_tool harness.~/.xcpng-aiops/secrets.enc (Fernet + scrypt) β never plaintext on disk. Unlock with a master password from XCPNG_AIOPS_MASTER_PASSWORD (MCP/CI) or an interactive prompt (CLI).vm_start β vm_stop record each other as inverses; vm_migrate captures the REAL source host before moving and records "migrate back"; snapshot_create captures the created snapshot's REAL id from the XO response and records "delete THAT snapshot". Irreversible ops (snapshot_delete, snapshot_revert, vm_reboot) capture prior state for the audit record and honestly declare no undo.--dry-run; every write MCP tool takes a dry_run preview (no write call, no undo recorded).vm_start can then no longer be sent, so recovery needs hypervisor console access (xe vm-start). Set xo_self_vm_uuid on the target (xcpng-aiops init asks) and vm_stop refuses exactly that uuid β on --dry-run as well, since a preview that green-lights a call the tool will then refuse is reporting the wrong outcome. If you do not set it there is no protection at all: XO's REST API exposes no self endpoint and its token carries no claims, so the tool cannot discover which VM it runs on, and it fails open rather than guess. The dry_run preview adds a weaker selfVmHint when a VM's reported IP matches the configured XO host β that is a coincidence worth checking, not a finding, and it never blocks (it sees nothing without the guest agent and fires on every VM behind a shared proxy).| Domain | Tools | Count | R/W |
|---|---|---|---|
| Overview | overview | 1 | read |
| VMs | vm_list, vm_get, vm_stats, vm_health_rca | 4 | read |
vm_start, vm_stop, vm_reboot, vm_migrate | 4 | write (medium) | |
| Hosts | host_list, host_get | 2 | read |
| Pools | pool_list, pool_get, pool_patch_ha_posture | 3 | read |
| SRs / VDIs | sr_list, sr_get, vdi_list, sr_usage_rca | 4 | read |
sr_rescan | 1 | write (medium) | |
| Snapshots | snapshot_list | 1 | read |
snapshot_create (medium), snapshot_delete (high), snapshot_revert (high) | 3 | write | |
| Backups | backup_job_list, backup_log_list, backup_failure_rca | 3 | read |
| Tasks | task_list | 1 | read |
| Undo | undo_list, undo_apply | 2 | read + replay |
vm_health_rca β VMs halted unexpectedly (auto-poweron / HA restart priority set), paused/suspended VMs, running VMs without guest tools, CPU/memory pressure from RRD stats β cause + action per finding.sr_usage_rca β SRs ranked by physical fullness (near-full β₯ 85%, critical β₯ 95%), thin-provision overcommit (virtual allocation > capacity), orphaned VDIs (attached to no VM) with reclaimable bytes per SR.backup_failure_rca β failed/skipped/interrupted XO backup runs classified: vdi-chain (coalesce not finished), quiesce (guest VSS), transport (remote unreachable), storage-full, unknown β with per-job counts and sample messages.pool_patch_ha_posture β hosts missing patches, hosts pending reboot, version skew across a pool's hosts (breaks live migration / rolling updates), multi-host pools without HA.It delivers XCP-ng operations β reads and writes β accurately and efficiently, and records every one of them. It does not decide whether a write is allowed to happen. That is the agent's judgement, or the permission of the Xen Orchestra account whose token you connect it with: give that XO user a read-only ACL, or scope its token down, and the writes fail at Xen Orchestra β the place that actually owns the permission.
So there is no read-only switch, no policy file, no approval gate to configure.
The one thing the tool guarantees is that nothing is silent: every call, over
MCP and over the CLI alike, lands an audit row in ~/.xcpng-aiops/audit.db,
and reversible writes still capture their before-state and record an inverse.
Each tool declares a
risk_level, kept in agreement with its[READ]/[WRITE]documentation tag by a test, and carried into the audit row as a descriptive tier β so a reviewer can see at a glance that a row was a high-risk snapshot delete. It is a label, not a gate.
Running a smaller / local model? See agent-guardrails.md β it lists the guardrails this tool now enforces for you (so you don't spend prompt budget restating them) and gives a ready-made system prompt for what's left.
init writes ~/.xcpng-aiops/config.yaml (non-secret connection details) and
stores the XO token encrypted in ~/.xcpng-aiops/secrets.enc. Example
config it produces:
Create the token in the XO UI (user menu β Personal tokens) or with
xo-cli --createToken. For non-interactive use (MCP server, CI, cron) export
the master password so the store can be unlocked without a prompt:
Env-block caveat: MCP clients launch the server with a minimal environment β your shell profile's exports are not inherited. Put
XCPNG_AIOPS_MASTER_PASSWORD(and, if you use them,XCPNG_AIOPS_HOME/XCPNG_AIOPS_CONFIG/XCPNG_AUDIT_APPROVED_BY) in theenvblock above, or the encrypted store cannot be unlocked and every tool returns a teaching error.
A legacy plaintext env var XCPNG_<TARGET_NAME_UPPER>_TOKEN is still honoured
as a fallback with a deprecation warning (migrate with xcpng-aiops secret migrate).
Every MCP tool β and every CLI write, which routes through the same governed
functions β passes through @governed_tool. It records; it does not authorize
(see above).
~/.xcpng-aiops/audit.db (relocate with XCPNG_AIOPS_HOME). The CLI writes the same row the MCP path does β there is no unaudited entry point.XCPNG_MAX_TOOL_CALLS, XCPNG_MAX_TOOL_SECONDS, XCPNG_RUNAWAY_MAX) stop a stuck agent from burning unbounded calls/time.~/.xcpng-aiops/undo.db and return an _undo_id; irreversible writes record prior state only.risk_level; it gates nothing.| Area | Read | Write (governed) |
|---|---|---|
| VMs | list / get / RRD stats / health RCA | start, stop (clean/hard), reboot (clean/hard), migrate |
| Hosts | list / get / missing patches | β |
| Pools | list / get / patch & HA posture RCA | β |
| SRs / VDIs | list / get / VDI list (orphan filter) / usage RCA | rescan |
| Snapshots | list | create, delete, revert |
| Backups | jobs / logs / failure RCA | β |
| Tasks | list | β |
ηΌΊεθ½οΌ(Missing something?) Coverage is intentionally focused. Open an issue or PR at github.com/AIops-tools/XCPng-AIops β feature requests, contributions, and comments are all welcome.
xcpng-aiops doctor is the fastest live check β see
docs/VERIFICATION.md for the full checklist./vms/<id>/actions/snapshot, /vm-snapshots/<id>,
/srs/<id>/actions/rescan, /hosts/<id>/missing_patches, /backup/logs)
are modelled against the documented XO REST /rest/v0 API and need live
verification β action names may differ across XO releases.snapshot_delete / snapshot_revert discard state, and both are
high risk + double-confirmed.Other hypervisors or VM platforms (use their own ops tools β e.g. Proxmox VE β proxmox-aiops), NAS/storage appliances, backup software suites, container clusters, or network devices β those are out of scope for this tool.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/xcp-ng-aiops)<a href="https://allmcps.com/mcp/xcp-ng-aiops"><img src="https://allmcps.com/api/badge/xcp-ng-aiops?style=directory" alt="XCP Ng AIops on AllMCPs" /></a>