Control Virtual Machines with LLMs
An experimental MCP server for libvirt, driven by mcp-cli and a local Ollama model for VM management via Claude.
Why it matters
Enable Large Language Models to interact with libvirt for managing virtual machines. Automate the creation, deletion, and listing of VMs using natural language commands.
Outcomes
What it gets done
Create virtual machines via libvirt using LLM prompts.
Delete virtual machines on demand through LLM interaction.
List existing virtual machines on the system via LLM queries.
Integrate with ollama and granite models for LLM capabilities.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-libvirt-mcp | bash Overview
libvirt-mcp MCP Server
An experimental MCP server for libvirt, paired with mcp-cli and a local Ollama model for chat-driven VM management. Use when experimenting with MCP-driven libvirt host control backed by a local, self-hosted LLM.
What it does
This is an experimental MCP server for libvirt, meant to be used through mcp-cli with a local Ollama model. The setup runs mcp-cli as the client, Ollama serving the granite3.2:8b-instruct-q8_0 model as the provider, and the libvirt-mcp server itself configured via server_config.json pointing at its own path, launched with the bundled run.sh script. A demo GIF hosted on the project's wiki shows it driving libvirt actions through a Claude-style chat interface.
When to use - and when NOT to
Use it when you want to control or query a libvirt-managed virtualization host (VMs, domains) through an MCP-compatible chat client backed by a local Ollama model. It is explicitly labeled experimental, so treat it as early-stage tooling rather than a production management interface. For debugging the server itself, it also supports being run under the standard mcp dev setup.py inspector flow once mcp and npm are installed.
Capabilities
Provides MCP access to a libvirt host, paired specifically with mcp-cli as the client and Ollama's granite3.2:8b-instruct-q8_0 as the local model provider - no cloud API key required for the model itself. Inputs are natural-language requests via mcp-cli; outputs are libvirt operations carried out through the MCP server against a running Ollama instance serving that model.
curl -fsSL https://ollama.com/install.sh | sh
ollama serve >/dev/null 2>&1 &
ollama pull granite3.2:8b-instruct-q8_0
How to install
Clone and install mcp-cli (git clone https://github.com/chrishayuk/mcp-cli then pip3.11 install -e ".[cli,dev]"), install Ollama and pull the granite3.2 model, install uv (pip install uv), install the libvirt Python bindings (dnf install -y libvirt-devel python3-devel), then inside the libvirt-mcp directory run uv sync, edit server_config.json to point at the server's path, and run run.sh. For debugging, additionally install npm and the mcp package, then run mcp dev setup.py.
Who it's for
Developers experimenting with MCP-driven libvirt/VM management using a local, self-hosted LLM rather than a cloud provider.
Source README
libvirt-mcp
This is an experimental mcp server for libvirt. The
following lines explain how to use it with mcp-cli and ollama.
First, install mcp-cli:
git clone https://github.com/chrishayuk/mcp-cli
pip3.11 install -e ".[cli,dev]"
Then, install ollama:
curl -fsSL https://ollama.com/install.sh | sh
ollama serve >/dev/null 2>&1 &
ollama pull granite3.2:8b-instruct-q8_0
You need also uv:
pip install uv
You need the following python bindings:
dnf install -y libvirt-devel python3-devel
Then, in the libvirt-mcp directory, first install the dependencies by running:
uv sync
Then, edit server_config.json and set up the correct path to the libvirt-mcp
server. Finally, execute run.sh, that uses ollama as provider and granite
as model.

For debugging, you can install mcp:
dnf install -y npm
pip install mcp
And then, run:
mcp dev setup.py
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.