utm-mcp
Supports Linux guests through the QEMU guest agent for command execution, file transfer, keyboard-layout detection, and tailing text files; clipboard operations are not supported.
Controls QEMU-backed VMs over QMP on loopback TCP for screenshots and keyboard/mouse input, and adds the QMP argument to stopped VMs.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@utm-mcp start my Windows 11 VM, wait for the desktop, and take a screenshot"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 |
| lifecycle, wait for the guest agent | — |
| run a program in the guest, get | guest agent |
| copy files over HTTP on the VM network (~30 MB/s+) | guest agent, |
| list / create / restore / delete | — |
| guest screen as PNG; with the helper also one window ( | Windows helper, or QMP + Full Disk Access + a non-GL display |
| keyboard and absolute mouse; | QMP |
| detect the guest's keyboard layout | guest agent |
| put any text on the user's clipboard (and Ctrl+V), or read it | Windows helper; QMP for paste |
| start a program as the user, an elevated admin ( | Windows helper |
| inspect / allow / deny a UAC prompt on the secure desktop; QMP keys as fallback | Windows helper (QMP fallback) |
| list top-level windows; focus / minimize / maximize / restore / close one | Windows helper |
| read a window's UI Automation tree; invoke / set value / toggle / select a control by name | Windows helper |
| wait for a window, its absence, foreground, a process exit, a UAC prompt or the screen to settle | Windows helper |
| wait until the agent answers and, on Windows, the helper reports an unlocked, logged-in desktop; | guest agent (+ Windows helper) |
| long commands that outlive a call: output kept in a log you stream with | Windows helper |
| process list (name / user filter, memory order, optional CPU sampling), kill one or its tree | Windows helper |
| Windows event log as JSON (log, provider, level, time window, text filter) | guest agent |
| last lines of a guest text file (Windows or Linux), capped at 256 KB | guest agent |
| close windows by hwnd / pid / process, answering "save changes?" prompts ("Don't save" by default), killing what stays open | Windows helper |
| user, session (active/locked/uac), desktop, screens and scale, keyboard layout, foreground window | Windows helper |
| install (or update) of the in-session helper | Windows guest agent, |
| 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 capturingplusget result.utmctl execthrows 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
screendumpis 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 thevm_uacfallback'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
curlthroughvm_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_installpushes 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 withAuthorization: Bearer <token>. Endpoints, process model and security notes:helper/README.md. The OS work is the public crate desktop-kit (git tagv0.2.0), whichhelper/fetches from GitHub at build time.The task runs
utm-helper.exe --supervise(session 0), which keeps a--sessionchild 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(needscargo-xwin, the two*-pc-windows-msvcrustup targets, brewllvmandlld).
The QMP and QEMUHelper-container findings come from vintage-utm-mcp.
Related MCP server: TCLLM
Gotchas
vm_execruns 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, usevm_run_user(aftervm_helper_install).vm_window focuscan fail while a shell flyout (Start, Search) is open; it reportsok: false.Admin apps:
vm_run_user(as_="admin")runs them elevated with no UAC prompt. To test the real prompt, startStart-Process <exe> -Verb RunAsas the user,vm_wait(for_="uac"), thenvm_uac(inspect, then allow / deny). Credential prompts (a non-admin user) are refused.Lock screen:
vm_inforeports sessionlockedand screenshots show it. To unlock, invoke theLock Screenpane (id=InvokableLockContentControl), thenset_valuethePasswordedit (id=PasswordField_2) and invokeSubmitButtonwithvm_ui_act.vm_ui_act/vm_ui_treeonly see what the app exposes through UI Automation; some apps (games, custom-drawn UIs) expose nothing, then usevm_screenshot+vm_click.A screenshot with
hwndormax_widthis not in screen pixels: the tool's text note gives origin and scale,screen = origin + image / scale.vm_clicktakes screen pixels.vm_key/vm_typereturn 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_typedetects 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 byscripts/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--sessionchild. If the supervisor restarts it (session change, crash), running jobs lose their pipes (the program may die on its next write) and reportrunning: falsewith no exit code. Logs live inC:\ProgramData\utm-mcp\jobs, capped at 64 MB each, and are deleted after 7 days;vm_tailreads them too.vm_closefinds a save prompt through UI Automation: a prompt drawn inside the window (WinUIContentDialog, 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_tailpass every value to PowerShell as a single-quoted literal inside-EncodedCommand, andlog/provideronly accept letters, digits, space and_ . - /.The helper's folder
C:\ProgramData\utm-mcpis 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.exerather thanInvoke-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-mcpThen, 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}.exeLicense
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 toolsvm_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
Scored across 36 tools
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.
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.
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.
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
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Connect ChatGPT, Claude, Cursor or VS Code to your Windows PC: files, terminal, browser, apps.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables 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.332MIT
- AlicenseNot gradedqualityBmaintenanceEnables 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
- FlicenseNot gradedqualityAmaintenanceLets 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-
- AlicenseNot gradedqualityBmaintenanceEnables 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.4MIT