oVirt MCP Server
MCP server for oVirt/RHV virtualization management. 186 tools covering the full infrastructure lifecycle.
Version: 0.1.0 | License: MIT | Author: Joey Ma (@imjoey)
Quick Start
Install
pip install ovirt-engine-mcp-server
Or from source:
git clone https://github.com/imjoey/ovirt-engine-mcp-server.git
cd ovirt-engine-mcp-server
pip install -e .
Configure
Environment variables (recommended):
export OVIRT_ENGINE_URL="https://ovirt-engine.example.com"
export OVIRT_ENGINE_USER="admin@internal"
export OVIRT_ENGINE_PASSWORD="your-password"
Or create a config.yaml:
OVIRT_ENGINE_URL: https://ovirt-engine.example.com
OVIRT_ENGINE_USER: admin@internal
# OVIRT_ENGINE_PASSWORD should be set via environment variable
Run
ovirt-engine-mcp
Claude Desktop / OpenClaw Integration
{
"mcpServers": {
"ovirt": {
"command": "ovirt-engine-mcp",
"env": {
"OVIRT_ENGINE_URL": "https://ovirt-engine.example.com",
"OVIRT_ENGINE_USER": "admin@internal",
"OVIRT_ENGINE_PASSWORD": "your-password"
}
}
}
}
Docker
docker build -t ovirt-engine-mcp-server .
docker run -e OVIRT_ENGINE_URL=... -e OVIRT_ENGINE_USER=... -e OVIRT_ENGINE_PASSWORD=... ovirt-engine-mcp-server
Architecture
MCP Client (Claude / OpenClaw / etc.)
│ stdio (JSON-RPC)
▼
MCP Server (server.py)
┌─────────────────────────────┐
│ OvirtMCP (ovirt_mcp.py) │ ← Core SDK wrapper (ovirtsdk4)
│ 186 methods │
├─────────────────────────────┤
│ Extension Modules: │
│ NetworkMCP · ClusterMCP │
│ TemplateMCP · DataCenterMCP│
│ HostExtendedMCP │
│ StorageExtendedMCP │
│ DiskExtendedMCP │
│ EventsMCP · AffinityMCP │
│ RbacMCP · VmExtendedMCP │
│ TemplateExtendedMCP │
│ QuotaMCP · SystemMCP │
└─────────────────────────────┘
│
▼
oVirt Engine REST API
Error Handling
All errors return structured JSON with error code, message, and retry guidance:
| Code |
Retryable |
Description |
CONNECTION_ERROR |
✅ |
Failed to connect to oVirt Engine |
NOT_FOUND |
❌ |
Requested resource not found |
PERMISSION_DENIED |
❌ |
Insufficient permissions |
VALIDATION_ERROR |
❌ |
Invalid input parameters |
TIMEOUT |
✅ |
Operation timed out |
SDK_ERROR |
✅ |
oVirt SDK internal error |
Retry strategy: Only retry on retryable: true errors. Use exponential backoff (1s → 2s → 4s). NOT_FOUND and PERMISSION_DENIED require user intervention.
Available Tools
186 tools across 27 categories. Each reference file is self-contained with its own index:
| File |
Tools |
Covers |
| vm.md |
35 |
VM lifecycle, pools, checkpoints, snapshots |
| host.md |
19 |
Host management, fencing, iSCSI |
| cluster.md |
11 |
Clusters, CPU profiles |
| datacenter.md |
5 |
Data centers |
| instance-types.md |
2 |
Instance types |
| storage.md |
16 |
Storage domains, connections, iSCSI bonds |
| disk.md |
13 |
Disk lifecycle, snapshots, move, resize |
| network.md |
16 |
Networks, VNIC profiles, QoS, MAC pools |
| template.md |
8 |
Template lifecycle, disk/NIC lists |
| system.md |
6 |
System info, jobs |
| events.md |
11 |
Events, bookmarks, alerts |
| rbac.md |
24 |
Users, groups, roles, permissions, tags, filters |
| quota.md |
7 |
Data center quotas |
| affinity.md |
13 |
Affinity groups and labels |
Quick Category Reference
| Category |
Count |
Key Tools |
| VM Core |
9 |
vm_list, vm_create, vm_start, vm_stop, vm_delete |
| VM Extended |
16 |
vm_migrate, vm_console, vm_cdrom_*, vm_watchdog_*, vm_pin_to_host |
| VM Pools |
5 |
vm_pool_list, vm_pool_create, vm_pool_update, vm_pool_delete |
| VM Checkpoints |
4 |
vm_checkpoint_list/create/restore/delete |
| Snapshots |
4 |
snapshot_list/create/restore/delete |
| Disks Core |
3 |
disk_list, disk_create, disk_attach |
| Disks Extended |
9 |
disk_get, disk_resize, disk_move, disk_sparsify, disk_export |
| Networks |
9 |
network_list/create/update/delete, nic_list/add/remove |
| VNIC Profiles |
5 |
vnic_profile_list/create/update/delete/get |
| Network Filters & QoS |
3 |
network_filter_list, mac_pool_list, qos_list |
| Hosts Core |
3 |
host_list, host_activate, host_deactivate |
| Hosts Extended |
16 |
host_add, host_fence, host_iscsi_*, host_install, host_nic_* |
| Clusters |
10 |
cluster_list/create/update/delete, cluster_cpu_load, cluster_memory_usage |
| CPU Profiles |
2 |
cpu_profile_list, cpu_profile_get |
| Data Centers |
5 |
datacenter_list/create/update/delete/get |
| Storage Core |
8 |
storage_list/create/delete/attach/detach/stats |
| Storage Extended |
10 |
storage_refresh, storage_import_vm, storage_files, iscsi_bond_list |
| Templates Core |
2 |
template_list, template_vm_create |
| Templates Extended |
6 |
template_get/create/delete/update, template_disk_list, template_nic_list |
| Instance Types |
2 |
instance_type_list, instance_type_get |
| Affinity Groups |
7 |
affinity_group_list/create/update/delete/add_vm/remove_vm |
| Affinity Labels |
6 |
affinity_label_list/create/delete/assign/unassign |
| Events |
11 |
event_list, event_search, event_alerts/errors/warnings, event_summary |
| RBAC |
24 |
user_*, group_*, role_*, permission_*, tag_*, filter_list |
| Quotas |
7 |
quota_list/create/update/delete, quota_*_limit_list |
| System & Jobs |
6 |
system_get, job_list, job_cancel, system_statistics |
Common Workflows
Create VM from Template
1. template_list → find template ID
2. cluster_list → find cluster ID
3. template_vm_create(name, template, cluster, ...)
4. vm_start(name_or_id)
Migrate VM
1. vm_list(status="up") → find running VM
2. host_list() → find target host
3. vm_migrate(name_or_id, target_host)
Create Snapshot & Restore
1. snapshot_create(name_or_id, description="before-patch")
2. ... perform changes ...
3. snapshot_restore(name_or_id, snapshot_id) # if needed
Storage Health Check
1. storage_list → list all domains
2. storage_stats(name_or_id) → check each domain
3. event_errors → check for storage-related errors
RBAC Audit
1. permission_list(resource_type="cluster", resource_id="...") → list perms
2. user_list → list users
3. tag_list → list tags
Requirements
- Python >= 3.10
- oVirt Engine 4.4+
- Dependencies:
mcp>=1.0.0, ovirtsdk4>=4.6.0, pyyaml>=6.0, requests>=2.31.0, colorlog>=6.8.0
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Lint
ruff check src/ tests/
Related Projects
1---2name: ovirt-mcp3description: Manage oVirt/RHV virtualization infrastructure via MCP. Provides 186 tools for VMs, hosts, clusters, networks, storage, templates, snapshots, disks, events, RBAC, quotas, and more. Use when the user asks to manage oVirt virtual machines, create/delete/modify VMs, check host status, manage storage domains, handle templates, configure networks, manage user permissions, view events/alerts, or any oVirt/RHV infrastructure operations. Triggers on "oVirt", "RHV", "virtual machine", "VM management", "storage domain", "cluster", "host management".4---56# oVirt MCP Server78MCP server for oVirt/RHV virtualization management. 186 tools covering the full infrastructure lifecycle.910**Version**: 0.1.0 | **License**: MIT | **Author**: Joey Ma (@imjoey)1112## Quick Start1314### Install1516```bash17pip install ovirt-engine-mcp-server18```1920Or from source:2122```bash23git clone https://github.com/imjoey/ovirt-engine-mcp-server.git24cd ovirt-engine-mcp-server25pip install -e .26```2728### Configure2930Environment variables (recommended):3132```bash33export OVIRT_ENGINE_URL="https://ovirt-engine.example.com"34export OVIRT_ENGINE_USER="admin@internal"35export OVIRT_ENGINE_PASSWORD="your-password"36```3738Or create a `config.yaml`:3940```yaml41OVIRT_ENGINE_URL: https://ovirt-engine.example.com42OVIRT_ENGINE_USER: admin@internal43# OVIRT_ENGINE_PASSWORD should be set via environment variable44```4546### Run4748```bash49ovirt-engine-mcp50```5152### Claude Desktop / OpenClaw Integration5354```json55{56 "mcpServers": {57 "ovirt": {58 "command": "ovirt-engine-mcp",59 "env": {60 "OVIRT_ENGINE_URL": "https://ovirt-engine.example.com",61 "OVIRT_ENGINE_USER": "admin@internal",62 "OVIRT_ENGINE_PASSWORD": "your-password"63 }64 }65 }66}67```6869### Docker7071```bash72docker build -t ovirt-engine-mcp-server .73docker run -e OVIRT_ENGINE_URL=... -e OVIRT_ENGINE_USER=... -e OVIRT_ENGINE_PASSWORD=... ovirt-engine-mcp-server74```7576## Architecture7778```79MCP Client (Claude / OpenClaw / etc.)80 │ stdio (JSON-RPC)81 ▼82 MCP Server (server.py)83 ┌─────────────────────────────┐84 │ OvirtMCP (ovirt_mcp.py) │ ← Core SDK wrapper (ovirtsdk4)85 │ 186 methods │86 ├─────────────────────────────┤87 │ Extension Modules: │88 │ NetworkMCP · ClusterMCP │89 │ TemplateMCP · DataCenterMCP│90 │ HostExtendedMCP │91 │ StorageExtendedMCP │92 │ DiskExtendedMCP │93 │ EventsMCP · AffinityMCP │94 │ RbacMCP · VmExtendedMCP │95 │ TemplateExtendedMCP │96 │ QuotaMCP · SystemMCP │97 └─────────────────────────────┘98 │99 ▼100 oVirt Engine REST API101```102103## Error Handling104105All errors return structured JSON with error code, message, and retry guidance:106107| Code | Retryable | Description |108|------|-----------|-------------|109| `CONNECTION_ERROR` | ✅ | Failed to connect to oVirt Engine |110| `NOT_FOUND` | ❌ | Requested resource not found |111| `PERMISSION_DENIED` | ❌ | Insufficient permissions |112| `VALIDATION_ERROR` | ❌ | Invalid input parameters |113| `TIMEOUT` | ✅ | Operation timed out |114| `SDK_ERROR` | ✅ | oVirt SDK internal error |115116**Retry strategy**: Only retry on `retryable: true` errors. Use exponential backoff (1s → 2s → 4s). `NOT_FOUND` and `PERMISSION_DENIED` require user intervention.117118## Available Tools119120186 tools across 27 categories. Each reference file is self-contained with its own index:121122| File | Tools | Covers |123|------|-------|--------|124| [vm.md](references/vm.md) | 35 | VM lifecycle, pools, checkpoints, snapshots |125| [host.md](references/host.md) | 19 | Host management, fencing, iSCSI |126| [cluster.md](references/cluster.md) | 11 | Clusters, CPU profiles |127| [datacenter.md](references/datacenter.md) | 5 | Data centers |128| [instance-types.md](references/instance-types.md) | 2 | Instance types |129| [storage.md](references/storage.md) | 16 | Storage domains, connections, iSCSI bonds |130| [disk.md](references/disk.md) | 13 | Disk lifecycle, snapshots, move, resize |131| [network.md](references/network.md) | 16 | Networks, VNIC profiles, QoS, MAC pools |132| [template.md](references/template.md) | 8 | Template lifecycle, disk/NIC lists |133| [system.md](references/system.md) | 6 | System info, jobs |134| [events.md](references/events.md) | 11 | Events, bookmarks, alerts |135| [rbac.md](references/rbac.md) | 24 | Users, groups, roles, permissions, tags, filters |136| [quota.md](references/quota.md) | 7 | Data center quotas |137| [affinity.md](references/affinity.md) | 13 | Affinity groups and labels |138139### Quick Category Reference140141| Category | Count | Key Tools |142|----------|-------|-----------|143| VM Core | 9 | `vm_list`, `vm_create`, `vm_start`, `vm_stop`, `vm_delete` |144| VM Extended | 16 | `vm_migrate`, `vm_console`, `vm_cdrom_*`, `vm_watchdog_*`, `vm_pin_to_host` |145| VM Pools | 5 | `vm_pool_list`, `vm_pool_create`, `vm_pool_update`, `vm_pool_delete` |146| VM Checkpoints | 4 | `vm_checkpoint_list/create/restore/delete` |147| Snapshots | 4 | `snapshot_list/create/restore/delete` |148| Disks Core | 3 | `disk_list`, `disk_create`, `disk_attach` |149| Disks Extended | 9 | `disk_get`, `disk_resize`, `disk_move`, `disk_sparsify`, `disk_export` |150| Networks | 9 | `network_list/create/update/delete`, `nic_list/add/remove` |151| VNIC Profiles | 5 | `vnic_profile_list/create/update/delete/get` |152| Network Filters & QoS | 3 | `network_filter_list`, `mac_pool_list`, `qos_list` |153| Hosts Core | 3 | `host_list`, `host_activate`, `host_deactivate` |154| Hosts Extended | 16 | `host_add`, `host_fence`, `host_iscsi_*`, `host_install`, `host_nic_*` |155| Clusters | 10 | `cluster_list/create/update/delete`, `cluster_cpu_load`, `cluster_memory_usage` |156| CPU Profiles | 2 | `cpu_profile_list`, `cpu_profile_get` |157| Data Centers | 5 | `datacenter_list/create/update/delete/get` |158| Storage Core | 8 | `storage_list/create/delete/attach/detach/stats` |159| Storage Extended | 10 | `storage_refresh`, `storage_import_vm`, `storage_files`, `iscsi_bond_list` |160| Templates Core | 2 | `template_list`, `template_vm_create` |161| Templates Extended | 6 | `template_get/create/delete/update`, `template_disk_list`, `template_nic_list` |162| Instance Types | 2 | `instance_type_list`, `instance_type_get` |163| Affinity Groups | 7 | `affinity_group_list/create/update/delete/add_vm/remove_vm` |164| Affinity Labels | 6 | `affinity_label_list/create/delete/assign/unassign` |165| Events | 11 | `event_list`, `event_search`, `event_alerts/errors/warnings`, `event_summary` |166| RBAC | 24 | `user_*`, `group_*`, `role_*`, `permission_*`, `tag_*`, `filter_list` |167| Quotas | 7 | `quota_list/create/update/delete`, `quota_*_limit_list` |168| System & Jobs | 6 | `system_get`, `job_list`, `job_cancel`, `system_statistics` |169170## Common Workflows171172### Create VM from Template173174```1751. template_list → find template ID1762. cluster_list → find cluster ID1773. template_vm_create(name, template, cluster, ...)1784. vm_start(name_or_id)179```180181### Migrate VM182183```1841. vm_list(status="up") → find running VM1852. host_list() → find target host1863. vm_migrate(name_or_id, target_host)187```188189### Create Snapshot & Restore190191```1921. snapshot_create(name_or_id, description="before-patch")1932. ... perform changes ...1943. snapshot_restore(name_or_id, snapshot_id) # if needed195```196197### Storage Health Check198199```2001. storage_list → list all domains2012. storage_stats(name_or_id) → check each domain2023. event_errors → check for storage-related errors203```204205### RBAC Audit206207```2081. permission_list(resource_type="cluster", resource_id="...") → list perms2092. user_list → list users2103. tag_list → list tags211```212213## Requirements214215- Python >= 3.10216- oVirt Engine 4.4+217- Dependencies: `mcp>=1.0.0`, `ovirtsdk4>=4.6.0`, `pyyaml>=6.0`, `requests>=2.31.0`, `colorlog>=6.8.0`218219## Development220221```bash222# Install dev dependencies223pip install -e ".[dev]"224225# Run tests226pytest tests/ -v227228# Lint229ruff check src/ tests/230```231232## Related Projects233234- [oVirt](https://www.ovirt.org/) — Open-source virtualization management235- [ovirtsdk4](https://github.com/oVirt/ovirt-engine-sdk-python) — Official oVirt Python SDK236- [Model Context Protocol](https://modelcontextprotocol.io/) — The MCP specification