Skip to main content
Glama

utm-mcp

MCP server that lets an LLM drive UTM virtual machines on macOS: lifecycle, guest commands with real output, fast file transfer, screenshots, keyboard and mouse.

Tool

What it does

Needs

vm_list, vm_start, vm_stop, vm_ip

lifecycle, wait for the guest agent

—

vm_exec

run a program in the guest, get exit_code, stdout, stderr

guest agent

vm_push, vm_pull

copy files over HTTP on the VM network (~30 MB/s+)

guest agent, curl in guest

vm_snapshot

list / create / restore / delete

—

vm_screenshot

guest screen as PNG; with the helper also one window (hwnd) and max_width

Windows helper, or QMP + Full Disk Access + a non-GL display

vm_key, vm_type, vm_click, vm_scroll

keyboard and absolute mouse; vm_type follows the guest's layout

QMP

vm_layout

detect the guest's keyboard layout

guest agent

vm_paste, vm_clipboard

put any text on the user's clipboard (and Ctrl+V), or read it

Windows helper; QMP for paste

vm_run_user

start a program as the user, an elevated admin (as_="admin", no prompt) or SYSTEM (GUI apps too), optionally wait for its output

Windows helper

vm_uac

inspect / allow / deny a UAC prompt on the secure desktop; QMP keys as fallback

Windows helper (QMP fallback)

vm_windows, vm_window

list top-level windows; focus / minimize / maximize / restore / close one

Windows helper

vm_ui_tree, vm_ui_act

read a window's UI Automation tree; invoke / set value / toggle / select a control by name

Windows helper

vm_wait

wait for a window, its absence, foreground, a process exit, a UAC prompt or the screen to settle

Windows helper

vm_ready

wait until the agent answers and, on Windows, the helper reports an unlocked, logged-in desktop; ready:false + missing on timeout

guest agent (+ Windows helper)

vm_job_start, vm_job_log, vm_job_stop, vm_jobs

long commands that outlive a call: output kept in a log you stream with next_offset (wait=N blocks for new text), stop kills the tree

Windows helper

vm_ps, vm_kill

process list (name / user filter, memory order, optional CPU sampling), kill one or its tree

Windows helper

vm_events

Windows event log as JSON (log, provider, level, time window, text filter)

guest agent

vm_tail

last lines of a guest text file (Windows or Linux), capped at 256 KB

guest agent

vm_close

close windows by hwnd / pid / process, answering "save changes?" prompts ("Don't save" by default), killing what stays open

Windows helper

vm_info

user, session (active/locked/uac), desktop, screens and scale, keyboard layout, foreground window

Windows helper

vm_helper_install

install (or update) of the in-session helper

Windows guest agent, scripts/build_helper.sh run once

vm_enable_qmp

add the QMP argument to a stopped VM

—

Everything past lifecycle and snapshots needs a QEMU-backend VM. Apple Virtualization VMs have no guest agent or QEMU monitor.

How it works

  • UTM's AppleScript API handles lifecycle, snapshots and configuration, and runs guest commands with execute … with output capturing plus get result. utmctl exec throws the output and exit code away.

  • QMP over loopback TCP handles screenshots and input. UTM keeps its own QMP connection inside SPICE, so each VM gets an extra -qmp tcp:127.0.0.1:<port>,server,nowait.

    • The port is derived from the VM's UUID.

    • QEMU's sandbox refuses Unix sockets outside its container, which is why it's TCP.

    • QMP has no authentication, so it never listens on anything but 127.0.0.1.

  • Screenshots use screendump. QEMU can only write inside the QEMUHelper container (~/Library/Containers/com.utmapp.QEMUHelper/Data/Documents/utm-mcp), and macOS protects that folder from other apps. The app hosting this server (terminal, Claude, T3 Code…) therefore needs Full Disk Access.

    • UTM's QEMU has no libpng, so screendump is asked for PPM and re-encoded to PNG on the host.

    • With a GPU-accelerated display (virtio-ramfb-gl, what the Windows 11 VM here uses) QEMU can't read the scanout and the dump is solid black. Use the helper's screenshots there; the QMP path (and so the vm_uac fallback's screenshot) only works with a non-GL display device (untested here).

  • File transfer runs a one-shot HTTP server on the host's VM-facing address with a random path; the guest runs curl through vm_exec. The guest-agent file channel manages only a few hundred KB/s.

  • The Windows helper (helper/, Rust, utm-helper.exe) runs as SYSTEM inside the logged-in user's session (the SYSTEM guest agent sits in session 0 and can't see the desktop) and serves JSON over HTTP on port 47123 of the VM network. vm_helper_install pushes it, writes a random token, starts it from a boot-time SYSTEM scheduled task and opens the firewall for the local subnet. The host calls it with Authorization: Bearer <token>. Endpoints, process model and security notes: helper/README.md. The OS work is the public crate desktop-kit (git tag v0.2.0), which helper/ fetches from GitHub at build time.

    • The task runs utm-helper.exe --supervise (session 0), which keeps a --session child alive in the console user's session and respawns it when it dies or the session changes.

    • Each request thread attaches to the current input desktop, so the helper also sees the lock screen and the UAC prompt (both on the secure "Winlogon" desktop), and elevated windows.

    • Coordinates are physical pixels, the same space as QEMU's framebuffer.

    • Screenshots use GDI, so they need no QMP and no Full Disk Access.

    • Build both architectures from macOS with scripts/build_helper.sh (needs cargo-xwin, the two *-pc-windows-msvc rustup targets, brew llvm and lld).

The QMP and QEMUHelper-container findings come from vintage-utm-mcp.

Related MCP server: TCLLM

Gotchas

  • vm_exec runs as the guest agent's user: SYSTEM on Windows (session 0, no desktop), root on Linux. To start a GUI app as the logged-in Windows user, use vm_run_user (after vm_helper_install).

  • vm_window focus can fail while a shell flyout (Start, Search) is open; it reports ok: false.

  • Admin apps: vm_run_user(as_="admin") runs them elevated with no UAC prompt. To test the real prompt, start Start-Process <exe> -Verb RunAs as the user, vm_wait(for_="uac"), then vm_uac (inspect, then allow / deny). Credential prompts (a non-admin user) are refused.

  • Lock screen: vm_info reports session locked and screenshots show it. To unlock, invoke the Lock Screen pane (id=InvokableLockContentControl), then set_value the Password edit (id=PasswordField_2) and invoke SubmitButton with vm_ui_act.

  • vm_ui_act / vm_ui_tree only see what the app exposes through UI Automation; some apps (games, custom-drawn UIs) expose nothing, then use vm_screenshot + vm_click.

  • A screenshot with hwnd or max_width is not in screen pixels: the tool's text note gives origin and scale, screen = origin + image / scale. vm_click takes screen pixels.

  • vm_key / vm_type return once the keys are queued in QEMU, then wait a fixed ~60 ms per key press for the guest to take them (it lags behind otherwise), so a slower guest may still trail.

  • vm_type detects the guest layout (cached for a minute) and presses the keys that produce each character there, dead keys included. Tables cover 27 standard layouts, generated from Unicode CLDR by scripts/gen_layouts.py (adapted from cometdesk). Variants like Dvorak fall back to en-us, and the result says so.

    • Windows: the focused window's layout via the helper, else the user's default from the registry.

    • Linux: localectl / /etc/default/keyboard.

  • Jobs (vm_job_start) are owned by the helper's --session child. If the supervisor restarts it (session change, crash), running jobs lose their pipes (the program may die on its next write) and report running: false with no exit code. Logs live in C:\ProgramData\utm-mcp\jobs, capped at 64 MB each, and are deleted after 7 days; vm_tail reads them too.

  • vm_close finds a save prompt through UI Automation: a prompt drawn inside the window (WinUI ContentDialog, Win11 Notepad) or a window of its own (Win32 MessageBox / TaskDialog), and clicks "Don't save" by AutomationId (SecondaryButton, CommandButton_7), then by name (Don't save, Nicht speichern, No). Windows 11 Notepad by default restores unsaved tabs and closes with no prompt; to get the prompt, switch Settings → "When Notepad starts" to "Start new session and discard unsaved changes". A killed Notepad restores its tabs on the next start.

  • vm_events / vm_tail pass every value to PowerShell as a single-quoted literal inside -EncodedCommand, and log / provider only accept letters, digits, space and _ . - /.

  • The helper's folder C:\ProgramData\utm-mcp is readable and writable only by SYSTEM and Administrators. The helper itself is SYSTEM: anyone on the VM subnet who has the token can run programs as SYSTEM, or as the user's elevated token, with no prompt. Meant for test VMs only. Clipboard on Linux guests isn't supported.

  • On Windows, use curl.exe rather than Invoke-WebRequest. In Windows PowerShell 5.1 the latter is around 10× slower and can hang.

Setup

Needs macOS with UTM, uv, and the QEMU guest agent in each guest (UTM guest tools on Windows, qemu-guest-agent on Linux).

git clone https://github.com/AnisAbdellatif/utm-mcp.git ~/dev/utm-mcp
cd ~/dev/utm-mcp && uv sync
claude mcp add --scope user utm -- uv --directory ~/dev/utm-mcp run utm-mcp

Then, once per VM: stop it, call vm_enable_qmp, and start it again.

For Windows guests, build the helper once (needs Rust and cargo-xwin; it depends on desktop-kit): scripts/build_helper.sh, then call vm_helper_install.

Security

The helper runs as SYSTEM in the guest: it can start elevated programs and answer UAC prompts, and so can anyone holding its token. The token is random per install, readable only by SYSTEM and Administrators (C:\ProgramData\utm-mcp), and the firewall rule admits only the local subnet (UTM's VM network). Use it on test VMs you control. Credential prompts (UAC asking for a password) can only be denied; a password is never typed.

Develop

uv run pytest
(cd helper && cargo test)   # pure parts run on the Mac
scripts/build_helper.sh     # cross-builds src/utm_mcp/bin/utm-helper-{arm64,x64}.exe

License

MIT, see LICENSE. Keyboard layout data in src/utm_mcp/layouts.json is generated from Unicode CLDR (see src/utm_mcp/CLDR-LICENSE).

Available Tools

36 tools
vm_clickA

Clicks at (x, y) in the latest screenshot's pixels. button: left, right or middle. Needs an absolute pointer in the guest (UTM's default USB tablet).

Inputs: x (required), y (required), vm (required), button, +1 more. Returns: result

vm_clipboardA

Reads the logged-in user's clipboard, or sets it when text is given (no paste). Windows guests, needs vm_helper_install once.

Inputs: vm (required), text. Returns: result

vm_closeA

Closes windows the polite way and handles their "save changes?" prompts, instead of vm_window close plus finding and clicking the prompt yourself. Give exactly one of hwnd, pid or process (e.g. "notepad.exe"). Sends WM_CLOSE, then for up to timeout seconds answers any save prompt: discard=True clicks "Don't save" (found by AutomationId, so any language); discard=False reports the prompt and leaves it open. After the timeout, kill=True ends the process of windows still open. Returns {closed: [hwnd], dialogs: [{hwnd, title, clicked}], killed: [pid], left: [hwnd]}. Note: killing an app skips its own cleanup, e.g. Notepad restores killed tabs. Windows guests, needs the helper.

Inputs: vm (required), pid, hwnd, kill, +3 more.

vm_enable_qmpA

Adds the loopback QMP argument that screenshots and input need. The VM must be stopped; start it again afterwards.

Inputs: vm (required). Returns: result

vm_eventsA

Reads a Windows event log (newest first) as compact JSON [{time (UTC), level, provider, id, message (first 500 chars)}]; [] when nothing matches. log: System, Application, Security or a channel such as Microsoft-Windows-Kernel-Power/Thermal-Operational. level: critical, error, warning or info (that level only). provider filters by event source; contains is a case-insensitive text match on the message. Runs through the guest agent, no helper needed.

Inputs: vm (required), log, max, level, +3 more. Returns: result

vm_execA

Runs a program in the guest and returns exit_code, stdout and stderr. argv[0] is the executable (full path or on PATH), e.g. ["cmd.exe", "/c", "dir C:\"] or ["/bin/sh", "-c", "uname -a"]. Runs as the guest agent's user (SYSTEM on Windows, root on Linux) without a desktop, so GUI programs started here are invisible. If it outlives timeout seconds it keeps running and timed_out is true.

Inputs: vm (required), argv (required), timeout.

vm_helper_installA

Installs (or updates) and starts the helper, utm-helper.exe, in the Windows guest: a SYSTEM scheduled task (at boot) that keeps a SYSTEM process in the logged-in user's session, serving HTTP on the VM network behind a random token. It powers vm_run_user, vm_windows, vm_window, vm_ui_tree, vm_ui_act, vm_wait, vm_info, vm_uac, vm_clipboard/vm_paste, helper screenshots and the live keyboard layout for vm_type.

Inputs: vm (required). Returns: result

vm_infoB

The helper's view of the desktop: user, session (active / locked / uac), desktop (Default, or Winlogon for the lock screen and UAC), screens (x, y, width, height, primary, scale_percent), virtual screen, keyboard layout hkl, foreground window.

Inputs: vm (required).

vm_ipA

The guest's IP addresses, IPv4 first (asks the guest agent).

Inputs: vm (required). Returns: result

vm_job_logA

Reads a job's output from byte offset: {id, pid, running, exit_code (once it ended), size, offset, next_offset, text, truncated}. To follow a job, pass next_offset back as offset each time; with wait=N seconds the call returns as soon as there is new text or the job ends, else after N seconds (polls every second). Use it for builds and installs instead of long vm_exec timeouts. truncated: the log hit its 64 MB cap and stops growing.

Inputs: id (required), vm (required), wait, offset, +1 more.

vm_jobsC

Lists jobs, newest first, as compact JSON: id, pid, running, exit_code, size (log bytes), argv0. Jobs and their logs are deleted after 7 days.

Inputs: vm (required). Returns: result

vm_job_startA

Starts a long-running program in the guest that outlives this call (a build, an installer, a server) and returns {id, pid}. Output (stdout and stderr, interleaved) is kept in a log you read with vm_job_log. Use jobs, not vm_exec with a long timeout, for anything that takes more than a minute. argv[0] is the executable, no shell: ["cmd.exe", "/c", "..."] for shell syntax. as_: user (default), admin or system, as for vm_run_user. Windows guests, needs the helper.

Inputs: vm (required), argv (required), as_, cwd, +1 more.

vm_job_stopB

Kills a job and its child processes. Returns {ok, id, running, exit_code}; a killed job's exit_code is -1.

Inputs: id (required), vm (required).

vm_keyA

Presses key combos in order. Each combo is QEMU qcodes joined by '-': 'ret', 'esc', 'tab', 'f5', 'up', 'ctrl-c', 'alt-f4', 'meta_l-r' (Win+R), 'ctrl-alt-delete', 'shift-tab'.

Inputs: vm (required), combos (required). Returns: result

vm_killA

Kills a guest process (tree=True: its children too, children first). 404 if it is gone; the helper refuses pid 0 and 4, itself and its supervisor. Windows guests, needs the helper.

Inputs: vm (required), pid (required), tree.

vm_layoutA

Re-detects the guest's keyboard layout (vm_type caches it for a minute).

Inputs: vm (required). Returns: result

vm_listA

All UTM VMs with id, name, status (stopped/started/paused/...) and backend (qemu/apple).

Inputs: no named parameters. Returns: result

vm_pasteA

Puts text (any Unicode, any length) on the logged-in user's clipboard and presses Ctrl+V in the focused window. Windows guests, needs vm_helper_install once.

Inputs: vm (required), text (required). Returns: result

vm_psA

Lists guest processes, biggest memory first, as compact JSON: pid, ppid, name, cmdline, session, user, cpu_s (CPU seconds so far), memory_mb, started (unix seconds); unreadable fields are left out. name / user: case-insensitive substrings. sample_ms (0-5000) measures twice that far apart and adds cpu_percent (share of all CPUs). Windows guests, needs the helper.

Inputs: vm (required), name, user, sample_ms. Returns: result

vm_pullC

Copies a guest file to the host (same mechanism as vm_push).

Inputs: vm (required), guest_path (required), local_path (required). Returns: result

vm_pushB

Copies a host file into the guest (over HTTP on the VM network; needs curl in the guest, built into Windows 10+). guest_path is the full destination file path.

Inputs: vm (required), guest_path (required), local_path (required). Returns: result

vm_readyA

Waits until the VM can be driven: the guest agent answers and, on Windows with need_helper, the helper reports a logged-in user, an active session and the Default desktop (not locked, not on the lock screen or a UAC prompt). Use it after vm_start, a reboot or a QMP change. Returns {ready, agent, helper, user, session, desktop, waited_s}; on timeout ready is false and missing says what never came up (no exception). Linux guests: only the agent counts.

Inputs: vm (required), timeout, need_helper.

vm_run_userA

Runs a program in the guest's desktop session (unlike vm_exec, which has no desktop). Use it to open GUI apps: argv ["notepad.exe"], wait=False. With wait=True returns pid, exit_code, stdout, stderr, timed_out (a program that outlives timeout seconds keeps running); with wait=False only the pid. show=False hides the console window. argv[0] is the executable, no shell: use ["cmd.exe", "/c", "..."] for shell syntax. as_ picks the identity: "user" (default) the logged-in user, normal rights; "admin" the same user elevated (no UAC prompt appears; fails with 403 if they are not an administrator); "system" NT AUTHORITY\SYSTEM. Admin apps can be driven by vm_window / vm_ui_act too.

Inputs: vm (required), argv (required), as_, show, +2 more.

vm_screenshotA

The guest's screen as a PNG at native resolution; vm_click coordinates refer to a full-screen shot. On Windows guests with the helper (vm_helper_install) it needs no QMP and takes hwnd (one window, from vm_windows) and max_width (downscale to save tokens; a text note then gives the origin and scale to map image pixels back to screen pixels). Without the helper: QMP, full screen.

Inputs: vm (required), hwnd, max_width.

vm_scrollB

Scrolls the wheel at (x, y); positive clicks scroll down, negative up.

Inputs: x (required), y (required), vm (required), clicks (required). Returns: result

vm_snapshotA

Snapshots: action list | create | restore | delete. A running QEMU VM is saved with its running state. delete has no confirmation.

Inputs: vm (required), action (required), name. Returns: result

vm_startB

Starts (or resumes) a VM by name or UUID. With wait_for_agent, returns once the guest agent answers, i.e. once vm_exec will work.

Inputs: vm (required), timeout, wait_for_agent. Returns: result

vm_stopA

Stops a VM. method: request (guest shutdown), force (power off), kill (kill QEMU).

Inputs: vm (required), method. Returns: result

vm_tailA

The last lines lines of a guest text file (a job log, a service log, /var/log/syslog), at most 256 KB. Windows reads it as UTF-8. Runs through the guest agent, no helper needed.

Inputs: vm (required), path (required), lines. Returns: result

vm_typeA

Types text (newline = Enter) as keystrokes on the guest's keyboard layout, detected automatically (or pass e.g. layout="de"). For long text or characters the layout lacks, use vm_paste.

Inputs: vm (required), text (required), layout. Returns: result

vm_uacA

Answers a UAC consent prompt (the secure desktop that screenshots and ordinary windows can't reach). Waits up to timeout seconds for one. inspect: the dialog's program, publisher, file, prompt_kind (consent / credentials), buttons and every text, plus a screenshot of it. allow / deny: clicks Yes / No and waits for the desktop to come back. Credential prompts (a non-admin user) can only be denied; allow is refused. To test the flow, start an elevation as the user, e.g. vm_run_user(["powershell.exe", "-Command", "Start-Process cmd.exe -Verb RunAs"], wait=False), then vm_wait(for_="uac"). Without the helper (or when it errors with 5xx) it falls back to QMP keys / screenshot and says so; for admin programs without any prompt use as_="admin".

Inputs: vm (required), action, timeout. Returns: result

vm_ui_actA

Finds the nth element (depth-first) of a window (default: foreground) whose name (exact, case-insensitive), role (e.g. Button, Edit) and id (AutomationId) match the given ones, and acts on it through UI Automation, with no coordinates. action: invoke (click a button or menu item), set_value (needs value; text boxes), toggle, select, expand, collapse, focus. If nothing matches, the error lists candidate elements.

Inputs: vm (required), action (required), id, nth, +4 more.

vm_ui_treeA

The UI Automation tree of a window (default: the foreground one) as compact JSON: role, name, id (AutomationId), class, x, y, width, height, enabled, focused, offscreen, value, children. Empty fields are left out; truncated=true at the root means max_nodes was hit. Read controls and their text exactly this way instead of screenshots when possible.

Inputs: vm (required), hwnd, max_depth, max_nodes. Returns: result

vm_waitA

Waits (polling every 200 ms) instead of sleeping. for_: window (a visible window whose title contains title and/or whose process is process, e.g. "notepad.exe" appears), window_gone, foreground (that window is in front), process_exit (needs pid), screen_change (the screen changed, then stayed still), uac (a UAC consent prompt is showing). Returns ok, waited_ms and the window if any; ok=false on timeout.

Inputs: vm (required), for_ (required), pid, title, +2 more.

vm_windowA

Acts on a window from vm_windows. action: focus (restores it first, then brings it to the front; ok=false if Windows refuses), minimize, maximize, restore, close (polite WM_CLOSE: an app may ask to save first).

Inputs: vm (required), hwnd (required), action (required).

vm_windowsA

Lists the visible top-level windows, front first: hwnd, title, class, pid, process, x, y, width, height, focused, minimized, maximized (physical screen pixels). Use the hwnd with vm_window, vm_ui_tree, vm_ui_act and vm_screenshot.

Inputs: vm (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 36 tools

    Disambiguation4/5

    Most tools are sharply distinguished by target resource and action, and the descriptions explicitly call out the tricky boundaries (vm_exec has no desktop vs vm_run_user in the user session vs vm_job_start for long-running work; vm_window close vs vm_close's prompt handling; vm_kill vs vm_job_stop vs vm_stop). A few clusters still need careful reading to pick correctly—the three exec-family tools, and vm_wait vs vm_ready—but the descriptions do carry the weight.

    Naming Consistency4/5

    Everything is uniformly vm_-prefixed snake_case, so the family is predictable. The only deviation is that some tools are nouns describing a resource read (vm_ip, vm_info, vm_jobs, vm_events, vm_layout, vm_clipboard, vm_screenshot) while others are verb_noun (vm_run_user, vm_job_log, vm_helper_install), giving a slightly mixed verb/noun convention within an otherwise consistent scheme.

    Tool Count3/5

    36 tools is well above the comfortable 3-15 band and forces the agent to scan a large surface before acting. The breadth is defensible—the domain genuinely spans QEMU control, guest agent, and a Windows helper—but several capabilities are split into many small tools (job_start/job_log/job_stop/jobs, windows/window/ui_tree/ui_ui_act/close) that could be consolidated.

    Completeness4/5

    Coverage is unusually deep: VM lifecycle, exec, file push/pull, input, screenshots, UI Automation, snapshots, QMP setup, jobs, process inspection, event logs and file tailing are all present with no dead ends in the driving workflow. The notable gap is VM provisioning—there is no create/clone/delete/configure tool, so a VM must pre-exist and be created elsewhere.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables an LLM agent to control a Windows guest in VMware Workstation, including power and snapshot management, kernel debugging via KDNET or serial, real-time terminal access, file transfer, and console screenshots, with synchronized state across tools.
      33
      2
      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
    • F
      license
      Not graded
      quality
      A
      maintenance
      Lets AI agents manage local virtual machines: create macOS and Linux VMs on Apple silicon and WSL distros on Windows, start/stop, clone, back up, and run commands inside them.
      4,073
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to create, drive, checkpoint, reset and delete resettable Windows and Ubuntu desktop VMs on Apple Silicon Macs, giving them real desktops to click, type and screenshot in plus shell commands, file transfer and port forwarding. All processing is local, so agents can work in isolated guests without leaving the Mac.
      4
      MIT