Skip to main content
Glama

virtualization-mcp (mcp-virtualbox)

Serveur FastMCP 3.2+ et interface web FastAPI + React (Vite) dédié au pilotage d'Oracle VirtualBox (VMs, snapshots, réseaux, disques, ISOs et console hybride SSH/noVNC) depuis un assistant IA (Claude Desktop, Cursor, VS Code, etc.) ou directement depuis votre navigateur.

Origine & Crédits : Projet initialement créé par sandraschi/virtualization-mcp, puis adapté et retransformé par EverosCall pour son utilisation personnelle.


Sommaire


Related MCP server: QVMConsole MCP Server

Fonctionnalités principales

  • Cycle de vie complet des VMs : création (avec templates ubuntu-dev, minimal-linux, win11-pro, test-template), démarrage, arrêt, redémarrage, pause, clonage et suppression.

  • Snapshots : création, restauration, liste et suppression de points de sauvegarde.

  • Réseau & Stockage : gestion des modes NAT, bridged, host-only et intnet, redirections de ports, contrôleurs de stockage et disques .vdi/.vmdk.

  • Exécution isolée (Sandbox) : support optionnel de Docker Sandbox pour l'exécution de code isolée.

  • Interface Web moderne : tableau de bord React/Vite + API FastAPI avec classement par projets, téléchargement asynchrone d'ISOs et console hybride (terminal SSH interactif via WebSocket avec bascule automatique vers noVNC).

  • Double transport MCP : stdio (par défaut pour Claude Desktop / Cursor) et http (MCP_TRANSPORT=http).


Prérequis

Outil

Requis pour

Installation rapide

Python 3.12+

Backend & serveur MCP

python.org

uv

Gestionnaire de dépendances Python

winget install astral-sh.uv (Windows) / curl -LsSf https://astral.sh/uv/install.sh | sh (Linux/macOS)

Oracle VirtualBox 7+

Gestion des VMs (VBoxManage dans le PATH)

virtualbox.org

Git

Cloner le dépôt

winget install Git.Git / sudo apt install git

Node.js 18+ / npm

Interface web (frontend React)

winget install OpenJS.NodeJS / nodejs.org

just (optionnel)

Raccourcis développeur (just serve, just test)

winget install Casey.Just

Note (Console graphique VNC) : sous Linux, installez l'Extension Pack VirtualBox / VBoxVNC pour activer la console graphique noVNC dans le navigateur.


Installation

1. Cloner le dépôt

git clone https://github.com/EverosCall/mcp-virtualbox.git
cd mcp-virtualbox

2. Installer les dépendances Python

uv sync --all-extras

(Pour le développement avec les outils de test et de lint : uv sync --group dev)

3. Compiler le frontend Web (optionnel, requis pour le Dashboard)

cd webapp/frontend
npm install
npm run build
cd ../..

4. Vérifier l'installation

uv run virtualization-mcp --help
VBoxManage --version

Configuration

Fichier .env et variables d'environnement

Copiez le fichier d'exemple .env.example vers .env à la racine du projet :

cp .env.example .env

Principales variables à adapter selon votre machine :

Variable

Description

Valeur par défaut

VBOXMANAGE_PATH / VBOX_MANAGE_PATH

Chemin vers l'exécutable VBoxManage

VBoxManage (ou C:\Program Files\Oracle\VirtualBox\VBoxManage.exe sous Windows)

MCP_TRANSPORT

Transport du serveur MCP (stdio ou http)

stdio

MCP_PORT

Port du serveur MCP en mode HTTP

10702

DEBUG

Active les logs détaillés (true / false)

false

LOG_LEVEL

Niveau de log (DEBUG, INFO, WARNING, ERROR)

INFO

DEFAULT_MEMORY_MB

RAM par défaut pour les nouvelles VMs

2048

DEFAULT_DISK_GB

Taille disque par défaut (Go)

20

DEFAULT_NETWORK

Mode réseau par défaut

NAT

REQUIRE_DELETE_CONFIRMATION

Sécurité avant suppression de VM

true

Authentification de l'interface web

Au premier démarrage du serveur web, un fichier ~/.local/share/virtualization-mcp/auth.json (chmod 600 sous Linux) est généré automatiquement avec :

  • Identifiant par défaut : admin

  • Mot de passe par défaut : changeme (haché en PBKDF2-HMAC-SHA256)

  • Jeton MCP HTTP (mcp_token) : généré aléatoirement pour l'en-tête Authorization: Bearer <mcp_token>

Vous pouvez personnaliser ces identifiants via variables d'environnement avant le démarrage :

export VM_AUTH_USER="mon_utilisateur"
export VM_AUTH_PASSWORD="mon_mot_de_passe_robuste"
export VM_MCP_TOKEN="mon_token_mcp_secret"
export VM_VNC_PASSWORD="virtualbox"

Ou changer le mot de passe à chaud via l'API authentifiée :

POST /api/v1/auth/change-password
{"current_password": "changeme", "new_password": "nouveau_mot_de_passe"}

Intégration Claude Desktop / Cursor / Clients MCP

Claude Desktop (mode stdio)

Éditez le fichier de configuration de Claude Desktop :

  • Windows : %APPDATA%\Claude\claude_desktop_config.json

  • macOS : ~/Library/Application Support/Claude/claude_desktop_config.json

  • Linux : ~/.config/Claude/claude_desktop_config.json

Ajoutez l'entrée suivante (adaptez le chemin vers votre dossier mcp-virtualbox) :

{
  "mcpServers": {
    "virtualization-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "C:\\chemin\\vers\\mcp-virtualbox",
        "run",
        "virtualization-mcp"
      ],
      "env": {
        "PYTHONUNBUFFERED": "1",
        "VBOX_MANAGE_PATH": "C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe"
      }
    }
  }
}

Sous Linux/macOS, utilisez "VBOX_MANAGE_PATH": "VBoxManage" (ou /usr/bin/VBoxManage) et un chemin Unix pour --directory. Redémarrez ensuite Claude Desktop.

Client MCP distant (mode http)

Si vous lancez le serveur MCP en mode HTTP (port 10702 par défaut) :

  • URL MCP : http://127.0.0.1:10702/mcp

  • Healthcheck : http://127.0.0.1:10702/health


Tutoriel d'utilisation

1. Lancer le serveur MCP (stdio ou HTTP)

Mode stdio (utilisé par les clients MCP locaux) :

uv run virtualization-mcp

Mode http (utile pour les clients distants ou le débogage) :

uv run virtualization-mcp --http --host 127.0.0.1 --port 10702

Ou via variable d'environnement :

# PowerShell
$env:MCP_TRANSPORT = "http"
$env:MCP_PORT = "10702"
uv run virtualization-mcp

2. Lancer l'interface web (Dashboard)

Sous Linux (manage.sh)

Le script unifié manage.sh gère la compilation du frontend, les PIDs, les logs et le healthcheck :

./manage.sh start     # Compile dist/ si absent, démarre le serveur sur :10700
./manage.sh status    # Vérifie l'état du service
./manage.sh restart   # Redémarre proprement
./manage.sh stop      # Arrête le service
./manage.sh logs      # Suit logs/backend.log

Accès Linux :

  • Interface Web & API : http://localhost:10700/

  • Documentation Swagger : http://localhost:10700/docs

  • Endpoint MCP HTTP intégré : http://localhost:10700/mcp

Sous Windows (start.ps1 ou just)

.\webapp\start.ps1
# ou avec just :
just serve

Accès Windows :

  • Frontend : http://localhost:10700

  • Backend API : http://localhost:10701

3. Piloter vos VMs par prompt (exemples)

Une fois virtualization-mcp connecté à Claude Desktop, Cursor ou votre client MCP, vous pouvez lui demander en langage naturel :

  • Découvrir l'environnement :

    « Liste toutes mes VMs VirtualBox et affiche les informations système de l'hôte. »

  • Créer et démarrer une VM :

    « Crée une VM nommée lab-ubuntu avec le template ubuntu-dev, 4 Go de RAM, 2 CPUs et démarre-la en mode headless. »

  • Sauvegarder avant une manipulation risquée :

    « Prends un snapshot nommé avant-maj sur la VM lab-ubuntu. »

  • Restaurer un état :

    « Restaure le snapshot avant-maj sur lab-ubuntu. »

  • Configurer le réseau :

    « Crée un réseau host-only et attache l'adaptateur 2 de lab-ubuntu dessus. »

4. Utiliser la console hybride SSH / noVNC

Depuis l'onglet VirtualBox de l'interface web :

  1. Cliquez sur une VM pour ouvrir ses détails et sa console.

  2. Pour une VM Linux, le backend teste automatiquement l'accès SSH (/api/v1/vms/{name}/ssh-check) :

    • Si SSH répond, un terminal PTY interactif s'ouvre directement dans le navigateur (WS /api/v1/vms/{name}/ssh).

    • Sinon, la console bascule automatiquement sur noVNC (WS /api/v1/vms/{name}/vnc, embarqué localement sans dépendance CDN).

  3. Utilisez le bouton Coller pour envoyer le presse-papiers et Ctrl+Alt+Del si besoin.

5. Télécharger des ISOs et organiser par projets

  • ISOs : la page VirtualBox → Download ISOs scanne assets/vbox/, ~/Downloads, ~/Téléchargements et permet de télécharger des images (Ubuntu, Debian, Alpine, IPFire...) en tâche de fond depuis le catalogue config/iso_categories.json.

  • Projets : classez vos VMs par projet et stockez vos mémos / identifiants SSH dans ~/virtualization-mcp/vm_projects.json via l'interface ou l'API /api/v1/projects.


Référence des outils MCP

Le serveur expose des outils consolidés (portmanteau pattern avec paramètre operation) pour garder une interface claire dans les clients IA :

Outil MCP

Rôle principal

vm_management

Lister, créer, configurer, démarrer, arrêter, mettre en pause, cloner et supprimer des VMs

snapshot_management

Lister, créer, restaurer et supprimer des snapshots

network_management

Gérer les réseaux Host-Only, NAT, ponts et redirections de ports

storage_management

Gérer les contrôleurs de stockage, disques virtuels et lecteurs optiques/ISO

system_management

Informations hôte VirtualBox, version et types d'OS supportés

discovery_management

Découvrir les VMs et l'aide contextuelle

sandbox_management

Exécution de code isolée via Docker Sandbox

virtualization_shutdown

Arrêt propre du serveur MCP


Développement et tests

Lancer la suite de tests (utilisant des mocks, sans nécessiter VirtualBox actif) :

uv run pytest tests/ -q

Commandes utiles via just (voir justfile) :

just install       # Installe les dépendances Python (dev) + frontend npm
just test          # Lance pytest sur tests/
just lint          # Vérifie le formatage / lint (ruff, mypy)
just fix           # Corrige le formatage automatiquement
just certify       # Lint + tests complets
just build         # Build frontend de production

Dépannage

  • VBoxManage introuvable : Vérifiez que VirtualBox est installé et ajoutez son dossier au PATH, ou renseignez VBOX_MANAGE_PATH / VBOXMANAGE_PATH dans .env et dans claude_desktop_config.json.

    • Windows par défaut : C:\Program Files\Oracle\VirtualBox\VBoxManage.exe

    • Linux par défaut : /usr/bin/VBoxManage

  • Le port 10700, 10701 ou 10702 est déjà utilisé : Arrêtez l'instance précédente (./manage.sh stop sous Linux ou .\webapp\stop.ps1 sous Windows) ou changez le port via WEB_PORT / MCP_PORT.

  • Écran noir ou connexion refusée sur noVNC : Vérifiez que l'Extension Pack VirtualBox (VBoxVNC) est installé et que VRDE/VNC est activé sur la VM (les VMs créées via l'API l'activent automatiquement).

  • Erreur d'authentification sur l'interface web : Identifiants initiaux : admin / changeme. En cas d'oubli, supprimez ~/.local/share/virtualization-mcp/auth.json et redémarrez le serveur pour régénérer un fichier neuf.


Structure du projet

mcp-virtualbox/
├── manage.sh                        # Lanceur Linux unifié (start/stop/restart/status/logs)
├── justfile                         # Recettes développeur (test, lint, serve, build)
├── pyproject.toml                   # Configuration Python, dépendances et entrypoint CLI
├── .env.example                     # Modèle de configuration d'environnement
├── config/
│   └── iso_categories.json          # Catalogue d'ISOs téléchargeables
├── assets/vbox/                     # Dossier local des ISOs
├── src/virtualization_mcp/
│   ├── all_tools_server.py          # Point d'entrée FastMCP (stdio / http)
│   ├── vbox_compat.py               # Couche VBoxManage parallèle + cache
│   ├── vbox/vm_operations.py        # Opérations VMs, disques, réseau, ISO, VRDE/VNC
│   ├── tools/portmanteau/           # Outils MCP consolidés par domaine
│   └── web/app.py                   # Point d'entrée web Uvicorn
├── webapp/
│   ├── backend/                     # API FastAPI, auth, proxy WebSocket SSH/noVNC
│   └── frontend/                    # Interface React + TypeScript + Vite
└── tests/                           # Suite de tests pytest

Licence

Ce projet est distribué sous licence MIT. Voir le fichier LICENSE pour plus de détails.

Available Tools

12 tools
info_toolsA

Comprehensive tool discovery and help portmanteau tool.

App-specific help and introspection (separate from MCP protocol's native tools/list — clients get schemas automatically; this is for users).

Return Format

Dict with success (bool), human-readable message, the action performed, and per-action data (tools+count, info, help). Failures carry a human-readable error.

Examples

await info_tools(action="list_tools")
await info_tools(action="list_tools", category="vm")
await info_tools(action="tool_info", tool_name="vm_management")
await info_tools(action="tool_schema", tool_name="snapshot_management")
await info_tools(action="help")

Inputs: action (required), search, category, tool_name. Returns: object

network_managementA

Comprehensive network management portmanteau tool.

Consolidates all network operations into a single interface. Use the action parameter to specify which operation to perform.

Return Format

Dict with success (bool), human-readable message, the action performed, and operation data (networks, adapters, result). Failures carry a human-readable error.

Examples

await network_management(action="list_networks")
await network_management(action="create_network", network_name="MyNetwork", ip_address="192.168.56.1", netmask="255.255.255.0")
await network_management(action="list_adapters", vm_name="MyVM")
await network_management(action="configure_adapter", vm_name="MyVM", adapter_slot=0, network_type="hostonly", network_name="MyNetwork")
await network_management(action="remove_network", network_name="MyNetwork")

Inputs: action (required), limit, offset, netmask, +5 more. Returns: object

sandbox_managementB

Docker and Windows Sandbox code execution and bringup tool.

Ephemeral containers, stateful sessions, Windows Sandbox launch/status, and automated naked-install testing for fleet repos.

Return Format

Dict with success (bool), human-readable message, the action performed, and operation data (result, sessions, job). Failures carry a human-readable error.

Examples

await sandbox_management(action="execute_code", code="print('hi')", language="python")
await sandbox_management(action="session_create", sandbox_name="dev")
await sandbox_management(action="win_sandbox_status")
await sandbox_management(action="win_sandbox_naked_test", repo="plex-mcp")

Inputs: action (required), code, repo, image, +16 more. Returns: object

show_hypervisor_health_cardA

Display an interactive Prefab UI dashboard card for hypervisor host health and VM inventory.

Return Format

Structured Prefab UI dashboard payload with host CPU/RAM utilization and VM counts. Error states carry status: "error" plus error.

Examples

await show_hypervisor_health_card()

Inputs: no named parameters. Returns: object

show_sandbox_status_cardA

Display an interactive Prefab UI card for Docker and Windows Sandbox status.

Return Format

Structured Prefab UI sandbox status card payload.

Examples

await show_sandbox_status_card()

Inputs: no named parameters. Returns: object

show_vm_cardB

Display an interactive Prefab UI card for a single Virtual Machine.

Return Format

Structured Prefab UI card payload with status badge, hardware specs, and quick lifecycle actions. Error states carry status: "error" plus error.

Examples

await show_vm_card("Ubuntu-Dev")

Inputs: vm_name (required). Returns: object

snapshot_managementA

Comprehensive snapshot management portmanteau tool.

Consolidates all VM snapshot operations into a single interface. All actions require vm_name; create/restore/delete also require snapshot_name.

Return Format

Dict with success (bool), human-readable message, the action performed, vm_name, snapshot_name, and operation data. Failures carry a human-readable error.

Examples

await snapshot_management(action="list", vm_name="MyVM")
await snapshot_management(action="create", vm_name="MyVM", snapshot_name="BeforeUpdate", description="Before system update")
await snapshot_management(action="restore", vm_name="MyVM", snapshot_name="BeforeUpdate")
await snapshot_management(action="delete", vm_name="MyVM", snapshot_name="BeforeUpdate")

Inputs: action (required), vm_name (required), limit, offset, +2 more. Returns: object

storage_managementB

Comprehensive storage management portmanteau tool.

Consolidates all storage operations into a single interface. Use the action parameter to specify which operation to perform.

Return Format

Dict with success (bool), human-readable message, the action performed, and operation data (controllers, disks, result). Failures carry a human-readable error.

Examples

await storage_management(action="list_controllers", vm_name="MyVM")
await storage_management(action="create_controller", vm_name="MyVM", controller_name="SATA Controller", controller_type="sata")
await storage_management(action="create_disk", disk_name="MyDisk.vdi", disk_size_gb=50)
await storage_management(action="attach_disk", vm_name="MyVM", disk_path="/path/to/MyDisk.vdi")
await storage_management(action="remove_controller", vm_name="MyVM", controller_name="SATA Controller")

Inputs: action (required), limit, offset, vm_name, +5 more. Returns: object

system_managementC

Comprehensive system management portmanteau tool.

Consolidates system information and diagnostics operations into a single interface. Most actions need no vm_name.

Return Format

Dict with success (bool), human-readable message, the action performed, and operation data (system info, version, OS types, metrics, screenshot path). Failures carry a human-readable error.

Examples

await system_management(action="host_info")
await system_management(action="vbox_version")
await system_management(action="ostypes")
await system_management(action="metrics", vm_name="MyVM")
await system_management(action="screenshot", vm_name="MyVM")

Inputs: action (required), width, height, vm_name, +1 more. Returns: object

virtualization_shutdownA

Shut down the virtualization-mcp server gracefully.

Lets an agent stop the server (e.g. before upgrades or restarts) without killing the process from the outside.

Return Format

Dict with success, human-readable message, and the shutdown reason. The process exits after responding.

Examples

await virtualization_shutdown(reason="upgrading to 1.7.0")

Inputs: reason. Returns: object

vm_agentic_workflowB

Sampling-backed agentic operations for virtualization.

  • suggest_config: VirtualBox VM settings for a use case via LLM sampling.

  • sandbox_workflow: spin-up → work → snapshot → tear-down safety plan.

  • workflow: autonomous multi-step VM orchestration goal. All actions use ctx.sample() when available, else sensible defaults.

Return Format

Dict with success (bool), human-readable message or error, the action performed, and operation data (suggestion, plan, steps).

Examples

await vm_agentic_workflow(action="suggest_config", use_case="CI runner")
await vm_agentic_workflow(action="sandbox_workflow", goal="test unsigned installer")
await vm_agentic_workflow(action="workflow", goal="clone base, snapshot, update, verify")

Inputs: action (required), goal, vm_name, use_case. Returns: object

vm_managementA

Virtual machine lifecycle management.

Actions: list, create, start, stop, delete, clone, reset, pause, resume, info. For LLM config suggestions or sandbox workflow planning use vm_agentic_workflow.

Return Format

Dict with success (bool), human-readable message, the action performed, and operation data (vms, vm_info, result). Failures carry a human-readable error.

Examples

await vm_management(action="list")
await vm_management(action="info", vm_name="Ubuntu-Dev")
await vm_management(action="create", vm_name="NewVM", os_type="Ubuntu_64", memory_mb=4096, disk_size_gb=40)
await vm_management(action="start", vm_name="NewVM")

Inputs: action (required), limit, offset, os_type, +6 more. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 12 tools

    Disambiguation4/5

    The six `*_management` portmanteaus cleanly partition the domain by resource (VM, network, snapshot, storage, system, sandbox), so an agent can pick the right one from the resource alone. Minor overlap exists: health/status information is reachable both via `system_management` actions (`host_info`, `metrics`) and via `show_hypervisor_health_card`/`show_sandbox_status_card`, and sandbox planning lives in both `sandbox_management` and `vm_agentic_workflow(action="sandbox_workflow")`, so a few intents have two valid entry points.

    Naming Consistency4/5

    The dominant pattern is `<domain>_management` with an action parameter, applied consistently across vm/network/snapshot/storage/system/sandbox. The `show_*_card` family is a coherent secondary group, but `info_tools`, `vm_agentic_workflow`, and `virtualization_shutdown` break the noun_management convention and mix verb-less and verb-first styles.

    Tool Count5/5

    Twelve tools is well within the sweet spot, and the portmanteau design keeps the surface small by folding dozens of operations (clone, reset, pause, controller/disk wiring, sandbox sessions) into action parameters. Each tool maps to a real subsystem, and the three UI card tools plus shutdown/help are justified supporting utilities.

    Completeness4/5

    Coverage is strong: full VM lifecycle, snapshot create/restore/delete, network and adapter configuration, storage controllers/disks, host diagnostics and screenshots, plus sandbox execution and LLM-assisted planning. Gaps are minor and workaroundable — no obvious export/import or appliance operations, and disk detach/media/guest-additions actions are not evidenced in the described action sets.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables AI assistants to manage virtual machines, sandboxes, and dev environments through VirtualBox, Hyper-V, and Windows Sandbox, supporting VM lifecycle, ISO downloads, networking, and unattended installs.
      9
      20
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables LLMs to remotely control VirtualBox VMs and Playwright browsers on Windows, including VM lifecycle actions, in-guest commands, browser automation, window management, and service monitoring via REST API and MCP.
      MIT