Get the FREE Ultimate OpenClaw Setup Guide →

kvm

An MCP server for KVM hypervisors

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio steveydevey-kvm-mcp python kvm_mcp_server.py

How to use

The KVM MCP Server exposes a single JSON-RPC interface for managing KVM virtual machines. It provides lifecycle controls (create, start, stop, reboot, list), networking via a bridging setup (default bridge brforvms), storage management for VM disks, display access through VNC, and installation workflows for OS images. The server is designed to centralize VM operations, enabling remote orchestration and automation through a consistent API. To get started, run the server with Python and then issue JSON-RPC requests to perform common tasks such as creating a VM, booting it, attaching disks, configuring networking, and retrieving status information. The README indicates there are example scripts (e.g., create_vm.sh) to help craft typical sequences of operations, making it straightforward to script common workflows.

How to install

Prerequisites:

  • Python 3.6 or higher
  • KVM and libvirt installed on the host
  • A configured network bridge (default: brforvms)
  • A VM storage directory (default: /vm/)
  • Sufficient system resources for your VM workload

Installation steps:

  1. Clone the repository:
    git clone https://github.com/yourusername/kvm-mcp.git
    cd kvm-mcp
    
  2. Create and activate a virtual environment:
    python3 -m venv .venv
    source .venv/bin/activate
    
  3. Install Python dependencies:
    pip install -r requirements.txt
    
  4. Prepare configuration:
    • Edit config.json to match your environment (paths, bridge, and defaults)
    • Ensure required directories exist and network bridge is correctly configured
  5. Run the MCP server:
    python3 kvm_mcp_server.py
    
  6. Verify operation by sending JSON-RPC requests to the running server (e.g., via curl or a client script).

Additional notes

Configuration is centralized in config.json. You can override defaults via environment variables as shown in the README (e.g., VM_DISK_PATH, VM_DEFAULT_NETWORK). The server emphasizes performance optimizations such as connection pooling, caching, and asynchronous processing. If you encounter issues with libvirt connections, check that the host user has the necessary permissions and that the libvirt daemon is active. For networking, ensure the brforvms bridge exists and is properly configured. Logs are designed to be structured for diagnostics; enable higher verbosity if troubleshooting connection or VM state recovery issues. When upgrading, review changes to the default VM template parameters (disk_path, default_iso, default_master_image) to avoid overwriting your environment-specific values.

Related MCP Servers

Sponsor this space

Reach thousands of developers