Skip to main content
Glama

Blender Computer-Use 隔离虚拟机与 MCP 服务器

一个隔离的、带 GPU 分区的本地 Windows 11 虚拟机环境,通过 Model Context Protocol (MCP) 连接,专为 AI 编程智能体设计,用于执行自动化 Blender UI 测试、用户故事验证和 Computer-Use 工作流,且不干扰宿主机桌面。


1. 系统架构

+---------------------------------------------------------------------------------------------+
|                          Coding Agents (Claude Code / OMP / Codex)                          |
+---------------------------------------------------------------------------------------------+
                                              │
                                              │ (MCP JSON-RPC via stdio)
                                              ▼
+─────────────────────────────────────────────────────────────────────────────────────────────+
|                         Host Layer: `blender-cu-vm-mcp` Server                             |
|  - MCP Tool Handler (Computer Use, Analytical Inspection, Blender Telemetry, File Staging)   |
|  - VM Lifecycle Manager (Hyper-V Socket / PowerShell WMI / Sub-2s Snapshot Reset)           |
+─────────────────────────────────────────────────────────────────────────────────────────────+
                                              │
                      ┌───────────────────────┴───────────────────────┐
                      │ Hyper-V Socket (HV-SOCK) / Internal VMSwitch  │
                      ▼                                               ▼
+───────────────────────────────────────────────+   +─────────────────────────────────────────+
|      Windows 11 Guest VM (Hyper-V)            |   |   Secondary (Fast CI): WSL2 Container   |
|  - NVIDIA GPU-PV (RTX 4080 Super vGPU: 8GB)   |   |   - Mesa / Direct3D 12 GPU Accel        |
|  - Virtual Display Driver (1080p Fixed 60Hz)  |   |   - Virtual X11 Display (Xvfb/Weston)   |
|  - Guest Agent Daemon (FastAPI / gRPC)        |   |   - Guest Agent Daemon (Linux)          |
|  - In-Process Blender Telemetry Bridge (bpy)  |   |   - Blender bpy IPC Bridge              |
+───────────────────────────────────────────────+   +─────────────────────────────────────────+

Related MCP server: WindowsPC-MCP

2. 核心特性

  • 零宿主机干扰: 合成的鼠标移动、拖拽、点击和键盘输入仅在客户机操作系统内部执行,真实光标和窗口焦点完全不受影响。

  • 硬件加速 GPU 渲染: NVIDIA GPU-PV 为客户虚拟机提供近乎原生的宿主机 RTX 4080 Super 访问能力(DirectX 12、Vulkan、OpenGL 和 CUDA/OptiX)。

  • 确定性 1080p 显示: 开源虚拟显示驱动(IddSampleDriver)将虚拟屏幕锁定为 1920×1080 @ 60Hz、100%(96 DPI)缩放,防止坐标漂移和显示器休眠。

  • 混合多模态反馈: 智能体可接收:

    1. 视觉: 带可选坐标网格的帧缓冲截图。

    2. 分析: Windows UI Automation 树、边界框和窗口响应性。

    3. 深度遥测: Blender bpy 状态、活动修改器、节点树连接以及实时 stdout/stderr 日志。

  • 两秒内状态回滚: 快速的 Hyper-V 快照恢复功能可在破坏性或实验性运行后,将虚拟机重置为干净的黄金基线状态。


3. 目录结构

blender-cu-vm/
├── host/                     # Host MCP Server & Hyper-V Controller
│   ├── mcp_server.py         # Stdio JSON-RPC MCP server with 14 tools
│   ├── hv_transport.py       # Hyper-V Socket (AF_HYPERV) & HTTP transport
│   ├── vm_controller.py      # PowerShell WMI lifecycle & snapshot manager
│   └── asset_sync.py         # Bi-directional file and addon staging
├── guest/                    # Guest Agent Daemon (runs inside VM)
│   ├── guest_daemon.py       # FastAPI HTTP/HV-SOCK unified server
│   ├── screen_capture.py     # DXGI Desktop Duplication & visual diffs
│   ├── input_controller.py   # Win32 SendInput (clicks, drags, typing)
│   ├── ui_automation.py      # Windows UI Automation tree inspector
│   └── video_recorder.py     # Hardware-accelerated NVENC MP4 recorder
├── blender/                  # Blender Embedded Runtime Bridge
│   ├── cu_telemetry_bridge.py # Non-blocking TCP telemetry server
│   ├── crash_interceptor.py  # C-level stdout/stderr stream tee
│   └── state_inspector.py    # Declarative scene invariant checker
├── scripts/                  # Automated Setup & Provisioning
│   ├── setup_vm_gpupv.ps1    # Automated Hyper-V Gen2 VM creator
│   ├── stage_gpupv_drivers.ps1 # NVIDIA GPU-PV driver packaging & injection
│   ├── setup_virtual_display.ps1 # Virtual display & autologon configuration
│   └── manage_golden_snapshot.ps1 # Instant snapshot creation & rollback
├── tests/                    # Verification & E2E Test Suite
│   ├── test_blender_user_story.py # 12-stage automated test suite
│   └── verify_isolation.py   # Zero host disturbance verification
├── mcp-config.json           # Registration snippet for Claude Code / OMP
└── README.md

4. 设置与安装指南

Step 1:在宿主机上配置最优(以管理员身份运行 PowerShell)

cd C:\tmp\blender-cu-vm\scripts
.\setup_vm_gpupv.ps1 -VMName "Blender-CU-VM" -MemoryBytes 8GB -ProcessorCount 8

Step 2:暂存 NVIDIA GPU-PV 驱动

.\stage_gpupv_drivers.ps1 -VMName "Blender-CU-VM" -Mode "Stage"

Step 3:安装客户机操作系统并运行环境配置

在客户机虚拟机内(以管理员身份运行 PowerShell):

# 1. Install GPU-PV drivers from staged directory
C:\Temp\NvidiaDrivers\install_gpupv_guest.bat

# 2. Configure Virtual Display & Auto-Logon
.\setup_virtual_display.ps1 -TargetWidth 1920 -TargetHeight 1080

# 3. Start Guest Daemon on boot
python C:\blender-cu-vm\guest\guest_daemon.py

Step 4:创建黄金基线快照

.\manage_golden_snapshot.ps1 -VMName "Blender-CU-VM" -SnapshotName "golden_base" -Action "Create"

5. 通过 MCP 连接 AI 编程智能体

将以下配置添加到你的 ~/.claude.json 或 ~/.omp/agent/config.yml 中:

{
  "mcpServers": {
    "blender-cu-vm": {
      "command": "python",
      "args": [
        "C:\\tmp\\blender-cu-vm\\host\\mcp_server.py"
      ],
      "env": {
        "BLENDER_VM_NAME": "Blender-CU-VM",
        "BLENDER_GUEST_URL": "http://192.168.122.100:8000"
      }
    }
  }
}

6. 运行验证测试

要验证所有子系统并运行模拟的 Blender 用户故事:

python blender-cu-vm/tests/test_blender_user_story.py
python blender-cu-vm/tests/verify_isolation.py

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables autonomous desktop automation by delegating tasks to vision-based agents operating within cloud-based virtual machine sandboxes. It allows users to manage VMs, execute complex computer tasks, and receive text-based screen summaries across Linux, Windows, and macOS environments.
    2
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to safely test and debug PowerShell, CMD/BAT scripts, and system utilities inside isolated Hyper-V virtual machines, with snapshot rollback, host-to-guest file transfer, PowerShell Direct execution, and autonomous self-correction on failures.
    1
    Apache 2.0
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables an AI agent to operate Windows applications through vision-driven UI Automation and record polished demo videos with pre-click camera zoom, narration, and cinematic effects.
    MIT