Skip to main content
Glama

mcp-utm

用于通过 AppleScript 在 macOS 上管理 UTM 虚拟机的 MCP 服务器。

提供 22 种工具用于克隆、配置和控制 UTM 虚拟机,包括针对 Apple 虚拟化框架克隆的正确 MAC 地址随机化功能,从而实现具有唯一网络标识的并发虚拟机。

安装

# PyPI
uvx mcp-utm

# Or install globally
uv tool install mcp-utm
pip install mcp-utm

Related MCP server: Discord Server Setup MCP

Claude Code 配置

{
  "mcpServers": {
    "utm": {
      "command": "uvx",
      "args": ["mcp-utm"]
    }
  }
}

要求

  • macOS (使用 AppleScript / osascript)

  • UTM 4.6+ (下载 或 brew install --cask utm)

  • Python 3.11+

工具

生命周期

工具

描述

list_vms

列出所有已注册的虚拟机及其状态

get_vm

获取虚拟机的状态和配置

clone_vm

使用唯一的随机 MAC 地址克隆模板

start_vm

启动已停止或挂起的虚拟机

stop_vm

停止正在运行的虚拟机(优雅或强制)

delete_vm

永久删除虚拟机

状态

工具

描述

suspend_vm

将正在运行的虚拟机挂起到内存

wait_for_vm

轮询直到虚拟机达到目标状态

网络

工具

描述

get_vm_ip

通过 ARP 表发现虚拟机 IP

set_vm_network

更新 MAC 地址或网络模式

配置

工具

描述

set_vm_resources

更新内存和 CPU 核心数

rename_vm

重命名虚拟机

set_vm_display

切换动态分辨率

目录共享 (VirtioFS)

工具

描述

list_vm_shares

列出共享目录

add_vm_share

添加主机目录共享

remove_vm_share

移除目录共享

set_vm_shares

替换所有共享

驱动器

工具

描述

list_vm_drives

列出已挂载的驱动器

attach_drive

挂载 ISO 或磁盘镜像

可移植性

工具

描述

export_vm

将虚拟机导出为 .utm 文件

import_vm

从 .utm 文件导入虚拟机

控制台

工具

描述

get_serial_port

获取用于控制台访问的串口地址

MAC 随机化工作原理

Apple 的虚拟化框架会忽略直接写入 config.plist 的 MacAddress 更改,因为 UTM 会将配置缓存在内存中。本服务器使用 AppleScript 的 update configuration 命令,该命令可以正确更新 UTM 的内部状态,从而为每个克隆分配一个唯一的 MAC 地址,进而使其在 192.168.64.0/24 子网上拥有唯一的 IP。

许可证

MIT

Available Tools

22 tools
add_vm_shareA

Add a host directory as a VirtioFS share on a VM.

Creates a security-scoped bookmark so the share persists across boots and works with Apple VF clones. The directory appears inside the guest at /Volumes/My Shared Files/.

Args: name: VM name (must be stopped) path: Host directory path to share (e.g. "/Users/you/project")

Inputs: name (required), path (required).

attach_driveA

Attach an ISO or disk image to a removable drive.

Args: name: VM name (must be stopped) drive_id: Drive ID (from list_vm_drives) source_path: Path to ISO or disk image file

Inputs: name (required), drive_id (required), source_path (required).

clone_vmA

Clone a UTM template VM with a unique random MAC address.

Args: template: Name of the template VM to clone name: Name for the new VM randomize_mac: Assign a random MAC so clones get unique IPs (default: True)

Inputs: template (required), name (required), randomize_mac.

delete_vmC

Delete a VM permanently. Cannot be undone.

Inputs: name (required).

export_vmB

Export a VM to a .utm file.

Args: name: VM name path: Destination file path (e.g. "/tmp/my-vm.utm")

Inputs: name (required), path (required).

get_serial_portA

Get the serial port address of a VM.

Returns the ptty path (for Apple VF) or TCP address/port (for QEMU) that can be used for direct console access without SSH.

Args: name: VM name

Inputs: name (required).

get_vmA

Get status and configuration of a VM by name.

Inputs: name (required).

get_vm_ipA

Discover the IP address of a running VM via ARP.

Polls the ARP table for the VM's MAC address. Works for Apple VF (macOS) VMs on the 192.168.64.0/24 subnet and bridged QEMU VMs.

Args: name: VM name timeout: Seconds to wait for ARP discovery (default: 60)

Inputs: name (required), timeout.

import_vmC

Import a VM from a .utm file.

Args: path: Path to the .utm file to import

Inputs: path (required).

list_vm_drivesA

List drives attached to a VM with their IDs and sizes.

Args: name: VM name

Inputs: name (required). Returns: result

list_vmsA

List all registered UTM virtual machines with their status.

Inputs: no named parameters. Returns: result

list_vm_sharesC

List shared directories (VirtioFS) registered for a VM.

Args: name: VM name

Inputs: name (required).

remove_vm_shareA

Remove a shared directory from a VM.

Args: name: VM name (must be stopped) path: Host directory path to remove

Inputs: name (required), path (required).

rename_vmA

Rename a stopped VM.

Args: name: Current VM name (must be stopped) new_name: New name for the VM

Inputs: name (required), new_name (required).

set_vm_displayA

Toggle dynamic resolution on the VM display.

Args: name: VM name (must be stopped) dynamic_resolution: Enable or disable dynamic resolution

Inputs: name (required), dynamic_resolution (required).

set_vm_networkA

Update network configuration of a stopped VM.

Args: name: VM name (must be stopped) mac_address: New MAC address (e.g. "aa:bb:cc:dd:ee:ff"), or None to keep current mode: Network mode ("shared" or "bridged"), or None to keep current

Inputs: name (required), mac_address, mode.

set_vm_resourcesA

Update memory and CPU cores of a stopped VM.

Args: name: VM name (must be stopped) memory: Memory in MiB, or None to keep current cpu_cores: Number of CPU cores, or None to keep current

Inputs: name (required), memory, cpu_cores.

set_vm_sharesA

Replace all shared directories on a VM.

Overwrites the entire share list. Use add_vm_share/remove_vm_share for incremental changes.

Args: name: VM name (must be stopped) paths: List of host directory paths to share (empty list clears all)

Inputs: name (required), paths (required).

start_vmB

Start a stopped or suspended VM.

Inputs: name (required).

stop_vmB

Stop a running VM.

Args: name: VM name force: Force stop if graceful shutdown fails

Inputs: name (required), force.

suspend_vmA

Suspend a running VM to memory.

Args: name: VM name (must be running) save: Save VM state to disk for later resume (default: True)

Inputs: name (required), save.

wait_for_vmA

Wait until a VM reaches a target status.

Useful for orchestration — start a VM then wait for it to be ready.

Args: name: VM name target_status: Status to wait for: "stopped", "started", or "paused" timeout: Seconds to wait (default: 120)

Inputs: name (required), target_status, timeout.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 22 tools

    Disambiguation5/5

    Each tool targets a distinct operation: lifecycle (start/stop/suspend/delete/clone/import/export/rename), configuration (resources/network/display/shares/drives), and status (get/ip/serial/list/wait). No functional overlaps.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern in snake_case (e.g., start_vm, set_vm_network). No mixing with camelCase or inconsistent verb styles.

    Tool Count4/5

    22 tools is slightly above the typical 3-15 range but justified by comprehensive VM management—lifecycle, configuration, and diagnostics are all covered without being excessive.

    Completeness4/5

    Covers CRUD, lifecycle, and most configuration aspects. Minor gap: no tool to create a VM from scratch (only clone/import), but core workflows are well-supported.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides programmatic access to Apple's container CLI tool on macOS, enabling users to perform 50+ container operations including creation, management, and system control of Apple Silicon containers.
      83 PyPI
      3
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      An automation tool for macOS that uses AppleScript and JXA to manage Discord server setups through AI assistants. It enables the creation and configuration of servers, channels, roles, and settings using pre-built templates or custom commands.
      19
      35
      MIT