XCP-ng AIops

io.github.AIops-tools由 GitHub 账号 AIops-tools 发布v0.11.0更新于 Oct 30, 2026

Governed XCP-ng ops via Xen Orchestra — 29 MCP tools with audit, budget, undo guards.

概览

AI 生成的概览

通过 Xen Orchestra 的 REST API 执行受治理的 XCP-ng 运维,为助手提供 29 个带审计的工具,用于查看和变更虚拟机、主机、存储、快照与备份。

可以做什么
  • 查看集群状态:总览、虚拟机列表/详情/统计、主机与池信息、存储库与虚拟磁盘、备份作业与日志、任务
  • 执行根因分析:虚拟机健康、存储使用率、备份失败、池补丁与高可用状态
  • 变更虚拟机:启动、停止、重启与迁移,均支持 dry-run 预览
  • 管理快照:列出、创建、删除与回滚
  • 重新扫描存储库
  • 查看并重放已记录的可逆写操作撤销条目
适用场景
适用于通过 Xen Orchestra 管理的家庭实验室或小型自建 XCP-ng 集群,希望由助手排查虚拟机健康、存储压力、备份失败与补丁状况,并执行常规虚拟机与快照操作且保留审计记录的场景。
运行要求
本地 Python 环境(PyPI 包,通过 uvx 或 uv tool 运行),以及可访问的 Xen Orchestra 5.x 实例并开放 REST v0 API。需要 XO 个人令牌,保存在本地加密存储中,由环境变量 XCPNG_AIOPS_MASTER_PASSWORD 或交互式提示解锁;MCP 客户端须在 env 块中传入该变量。另有可选变量用于配置目录、配置文件路径、审批人名称及调用/时间预算上限。
安装前请注意
写操作会真实启动、停止、重启、迁移虚拟机和创建快照,快照删除与回滚会丢弃状态且无法撤销。该工具只记录不授权,应缩小 XO 令牌权限或使用只读 XO 账号。自锁保护仅在配置了 xo_self_vm_uuid 时生效,否则停止承载 Xen Orchestra 的虚拟机会切断 API。放在环境变量中的主密码可被其他进程读取并留在 shell 历史中。行为仅针对模拟响应验证,尚未在真实 XO 实例上端到端运行。

安装

在 SourceWeft 中

  1. 打开 控制台中的 XCP-ng AIops,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

XCP-ng AIops

Audit availability: Real writes require a committed pending audit row and stop before contacting the platform if storage is unavailable. Reads and previews may continue with a warning; new audit rows store outcome summaries rather than full responses.

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.

What works

  • CLI (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.
  • MCP server (xcpng-aiops mcp or xcpng-aiops-mcp): 29 tools (19 read, 8 write, 2 undo), every one wrapped with the bundled @governed_tool harness.
  • Four flagship RCA analyses (cause + action structured output): VM health, SR usage, backup-job failures, pool patch & HA posture.
  • Encrypted credentials: the XO authentication token lives in an encrypted store ~/.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).
  • Reversibility: 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.
  • Safety: destructive CLI ops require double confirmation and support --dry-run; every write MCP tool takes a dry_run preview (no write call, no undo recorded).
  • Self-lockout guard (partial — read this): Xen Orchestra is commonly a VM on a pool it manages, and stopping that VM kills the API this tool talks to — 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).

Capability matrix (29 MCP tools)

DomainToolsCountR/W
Overviewoverview1read
VMsvm_list, vm_get, vm_stats, vm_health_rca4read
vm_start, vm_stop, vm_reboot, vm_migrate4write (medium)
Hostshost_list, host_get2read
Poolspool_list, pool_get, pool_patch_ha_posture3read
SRs / VDIssr_list, sr_get, vdi_list, sr_usage_rca4read
sr_rescan1write (medium)
Snapshotssnapshot_list1read
snapshot_create (medium), snapshot_delete (high), snapshot_revert (high)3write
Backupsbackup_job_list, backup_log_list, backup_failure_rca3read
Taskstask_list1read
Undoundo_list, undo_apply2read + replay

Flagship RCAs

  1. 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.
  2. 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.
  3. 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.
  4. 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.

What this tool does, and does not, decide

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.

Quick start

As a Claude Code plugin

One install gives an agent both the skill and the MCP server:

/plugin marketplace add AIops-tools/marketplace/plugin install xcpng-aiops@aiops-tools

The MCP server is fetched with uv and pinned to the package version this plugin declares, so an audit row can be traced back to the code that wrote it. Credentials are still configured with xcpng-aiops init — see below.

As an OpenClaw plugin

The same bundle is published on ClawHub, where one install delivers the skill and its MCP server together:

bash
openclaw plugins install clawhub:@zw008/xcpng-aiopsopenclaw skills info xcpng-aiops          # expect: Visible to model: yes

Restart the OpenClaw gateway afterwards so it loads the plugin. The MCP server is fetched with uv, pinned to this exact release, so uvx has to be on PATH — without it the skill still installs but reports Visible to model: no. Credentials are configured exactly as below.

As a CLI or standalone MCP server

bash
uv tool install xcpng-aiopsxcpng-aiops init        # interactive wizard: XO URL + encrypted tokenxcpng-aiops doctor      # verify config, encrypted store, XO reachability + pool countxcpng-aiops overview    # one-shot fleet health summary

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:

yaml
targets:  - name: xo1    url: https://xo.example.com   # the XO web origin (management plane)    verify_ssl: true              # set false only for self-signed lab certs    api_path: /rest/v0

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:

bash
export XCPNG_AIOPS_MASTER_PASSWORD='your-master-password'

Where that password then lives: an exported variable is readable by every process this shell starts and is recorded by shell history. On a shared or long-lived host, prefer the interactive prompt, or inject it from a secret manager for the life of the one command that needs it.

MCP client config

json
{  "mcpServers": {    "xcpng-aiops": {      "command": "uvx",      "args": ["--from", "xcpng-aiops", "xcpng-aiops-mcp"],      "env": { "XCPNG_AIOPS_MASTER_PASSWORD": "your-master-password" }    }  }}

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 the env block above, or the encrypted store cannot be unlocked and every tool returns a teaching error.

Managing secrets

bash
xcpng-aiops secret set xo1              # prompts hidden for the XO tokenxcpng-aiops secret list                 # names only, values never shownxcpng-aiops secret rm xo1xcpng-aiops secret rotate-password      # re-encrypt under a new master passwordxcpng-aiops secret migrate              # import a legacy plaintext .env, then retires it

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).

Governance

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).

  • Audit — every call (tool, params with secrets redacted, result, status, duration, risk tier, and any operator-supplied approver/rationale) lands in ~/.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.
  • Budget / runaway guard — a safety backstop, not an authorization gate: cumulative call and wall-time caps plus a tight-loop circuit breaker (XCPNG_MAX_TOOL_CALLS, XCPNG_MAX_TOOL_SECONDS, XCPNG_RUNAWAY_MAX) stop a stuck agent from burning unbounded calls/time.
  • Undo recording — reversible writes record a replayable inverse descriptor to ~/.xcpng-aiops/undo.db and return an _undo_id; irreversible writes record prior state only.
  • Risk tier — a descriptive label on the audit row derived from risk_level; it gates nothing.
  • Output hygiene — all XO-returned text is sanitized and bounded before it reaches the agent.

支持范围 / Supported scope

AreaReadWrite (governed)
VMslist / get / RRD stats / health RCAstart, stop (clean/hard), reboot (clean/hard), migrate
Hostslist / get / missing patches—
Poolslist / get / patch & HA posture RCA—
SRs / VDIslist / get / VDI list (orphan filter) / usage RCArescan
Snapshotslistcreate, delete, revert
Backupsjobs / logs / failure RCA—
Taskslist—

缺功能?(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.

Scope & caveats

  • Verification status: all behaviour is validated against mocked REST responses; there is no recorded end-to-end run against a live Xen Orchestra instance yet. xcpng-aiops doctor is the fastest live check — see docs/VERIFICATION.md for the full checklist.
  • Endpoint paths (e.g. /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.
  • Management plane only: everything goes through XO. Per-host XAPI, XO server management (adding servers, users), and backup job execution (run/restore) are out of scope for v0.1.
  • Out of scope by design: anything that destroys bulk data (VM/VDI deletion) — only snapshot_delete / snapshot_revert discard state, and both are high risk + double-confirmed.

Not for

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.

License

MIT — github.com/AIops-tools/XCPng-AIops

来源:README.md,提交 738a219

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:服务器未能启动。

版本历史

4
  1. v0.11.0最新Oct 30, 2026
  2. v0.10.0Oct 15, 2026
  3. v0.9.0Oct 15, 2026
  4. v0.8.4Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分