Skip to main content
Glama

qemu-mcp

Let your AI agent boot an operating system and drive it.

qemu-mcp is an MCP server that gives AI agents (Claude Code, or any MCP client) hands on a QEMU virtual machine: boot an ISO or a raw kernel, press keys, take screenshots, read the serial console, and wait for boot markers — all headless, with zero cooperation from the guest. No SSH, no guest agent, no network. If it boots in QEMU, an agent can drive it.

This screenshot was taken by an AI agent: it booted MORT OS (a hobby kernel with no SSH, no agent, no TCP required) headless, pressed Esc, typed help, and captured the framebuffer — four tool calls.

Who this is for

OS developers and hobby kernel hackers. The osdev inner loop is: edit kernel → build → boot in QEMU → look at the screen → type something → read serial → repeat. An AI agent can already do the edit and build steps; qemu-mcp gives it the rest of the loop, so it can boot-test its own kernel changes and actually see the triple fault.

It's equally useful for anyone who needs an agent to poke at a VM below the OS level: bootloaders, installers, BIOS/UEFI menus, recovery consoles, firmware.

Related MCP server: mcp-incus-vm

Why another QEMU MCP server?

The existing ones assume a full, running guest OS — they exec commands over SSH or a guest agent. That's useless when your guest is a 40 KB kernel you wrote yourself, an installer ISO, or anything pre-boot. qemu-mcp is built for the boot-test loop instead:

  • Serial console capture — continuously logged to a file, readable at any time (qemu_serial), and writable too (qemu_serial_send)

  • qemu_wait_serial — block until "kernel ready" (or "login:", or your panic string) appears, the reliable way to sequence an automated boot test

  • -kernel boot — boot a multiboot/bzImage kernel directly, with append/initrd

  • Screenshots of the VGA framebuffer — works headless, shows exactly what a monitor would

  • Raw QMP escape hatch — the full QEMU Machine Protocol when you need memsave, system_reset, device_add…

Tools

Tool

What it does

qemu_boot

Boot a VM headless from iso, kernel (+append/initrd), and/or disk. Any arch QEMU supports (x86_64, i386, aarch64, riscv64…), an optional machine (QEMU -M, required on some archs), an optional smp (QEMU -smp, number of virtual CPUs, for testing SMP-aware guest code) plus optional smp_cores/smp_threads/smp_sockets/smp_maxcpus (QEMU -smp topology qualifiers cores=/threads=/sockets=/maxcpus= combined onto the same flag, for shaping a guest's CPU topology rather than just its total count), an optional accel (QEMU -accel, e.g. "kvm:tcg"/"hvf:tcg"/"whpx:tcg", to opt into hardware acceleration), an optional cpu (QEMU -cpu, e.g. "qemu64,+avx"/"max"/"host", to select or customize the emulated CPU model for testing a specific feature set), an optional hostfwd (QEMU's hostfwd rule, e.g. "tcp::2222-:22", to reach a guest service like SSH from the host without needing QEMU's own NIC/chipset flags), no_reboot/no_shutdown (QEMU's -no-reboot/-no-shutdown, to freeze the VM on a guest crash/reboot/poweroff instead of losing the crash screen to a restart or exit), arbitrary extra QEMU args (networking, devices…), and overridable qmp_connect_timeout_s/qmp_read_timeout_s for slow hosts or long-running QMP commands

qemu_version

Report the installed qemu-system-<arch> --version output, without booting a VM

qemu_machines

Report qemu-system-<arch> -M help output: every valid qemu_boot machine value for that arch, without booting a VM

qemu_cpu_models

Report qemu-system-<arch> -cpu help output: every valid qemu_boot cpu value for that arch, without booting a VM

qemu_disk_create

Create a fresh disk image via qemu-img create (format "qcow2"/"raw", size like "10G"), ready for qemu_boot's disk param — qemu_boot never creates one itself

qemu_screenshot

PNG of the guest's display, straight from the framebuffer

qemu_type

Type text as keyboard input (\n = Enter, shifted symbols handled, tunable keystroke delay)

qemu_key

Press a key or chord: enter, esc, f12, ctrl-alt-f2…

qemu_mouse

Move the absolute pointer (fractions of screen width/height) and optionally click left/right/middle, scroll with wheel-up/wheel-down/wheel-left/wheel-right, or press a 5-button mouse's side/extra buttons

qemu_pause

Pause the VM's execution (QMP stop) without exiting QEMU — RAM/device state stay frozen until qemu_resume. Useful for inspecting a VM without guest time advancing, or for a guaranteed-consistent qemu_snapshot_save

qemu_resume

Resume a VM previously paused with qemu_pause (QMP cont)

qemu_snapshot_save

Save a full RAM+device snapshot under a tag (needs a qcow2 disk). Reports failure if QEMU's savevm rejects it (e.g. a raw disk) instead of claiming success

qemu_snapshot_load

Restore a VM to a previously saved snapshot tag. Reports failure if QEMU's loadvm rejects it (e.g. an unknown tag) instead of claiming success

qemu_snapshot_delete

Delete a previously saved snapshot tag, freeing its space in the qcow2 disk. Reports failure if QEMU's delvm rejects it (e.g. an unknown tag) instead of claiming success

qemu_snapshot_list

List snapshot tags saved on the VM's qcow2 disk (raw info snapshots output), so you can see what's available before loading or deleting one

qemu_change_media

Swap the medium in a removable drive (e.g. a CD-ROM) without rebooting. device is the block backend's id/QOM path, found via qemu_qmp(name, "query-block") — not guessable, since it depends on the machine type/QEMU version

qemu_serial

Tail the serial console (COM1) output — works after the VM has exited too, to see what it printed right before dying

qemu_serial_send

Write text to the serial console (COM1)

qemu_inspect

Show the exact QEMU command line used to boot the VM, plus a tail of QEMU's own stdout/stderr log (not the guest's — that's qemu_serial). Works after the VM has exited too

qemu_wait_serial

Block until given text appears on serial, or timeout. Each wait only searches output after the previous match, so waiting for a prompt after a command finds the new one (from_start=True searches the whole log)

qemu_wait_screen

Block until the display stops changing (for VGA-only guests with no serial output), or timeout. A blinking text cursor counts as settled (max_changed_pixels, default 64)

qemu_list

All managed VMs with state, arch, machine, hostfwd, pid, uptime. A VM paused via qemu_pause shows as running (paused)

qemu_stop

Graceful ACPI powerdown, or force=true to kill. graceful_timeout_s/kill_timeout_s override the default 10s/3s waits

qemu_qmp

Run any raw QMP command on the VM

Multiple named VMs can run at once.

Every tool declares all four MCP behaviour hints, so your client knows which calls to confirm with you. Only the waiting and reading tools (qemu_screenshot, qemu_serial, qemu_inspect, qemu_wait_serial, qemu_wait_screen, qemu_snapshot_list, qemu_version, qemu_machines, qemu_cpu_models) are read-only. qemu_boot and qemu_list are marked destructive because they clean up VMs that exited on their own, deleting their serial logs; read a crashed guest's output with qemu_serial first. qemu_boot and qemu_qmp are open-world: extra_args and raw QMP can reach anything QEMU can.

Install

Requirements: Python 3.10+, and QEMU on your PATH (on Windows, C:\Program Files\qemu is found automatically, or set QEMU_DIR).

pip install qemu-mcp

Claude Code:

claude mcp add qemu -- qemu-mcp

Any other MCP client (stdio transport):

{
  "mcpServers": {
    "qemu": {
      "command": "qemu-mcp"
    }
  }
}

Or without installing, via uv: claude mcp add qemu -- uvx qemu-mcp

Example session

you: boot build/os.iso and check the shell works

agent: qemu_boot(name="test", iso="build/os.iso", arch="i386") → booted qemu_wait_serial(name="test", text="boot ok") → FOUND qemu_type(name="test", text="help\n") qemu_screenshot(name="test") → sees the help output rendered qemu_stop(name="test", force=true) "Your ISO boots, the shell responds to help, and the new command is listed. Screenshot attached."

A typical kernel test the agent can run by itself:

qemu_boot(name="k", kernel="build/kernel.elf", arch="i386",
          extra_args="-device rtl8139,netdev=n0 -netdev user,id=n0")
qemu_wait_serial(name="k", text="MORTNET READY", timeout_s=20)
qemu_serial_send(name="k", text="net\n")  # guest has no keyboard driver, only a serial shell
qemu_serial(name="k")          # did DHCP bind?
qemu_screenshot(name="k")      # what does the console show?

Non-x86 archs

x86_64 and i386 boot with no machine argument. Other archs have no default machine in QEMU and need -M set explicitly, or they'll fail to boot:

qemu_boot(name="a", kernel="build/kernel-aarch64.elf", arch="aarch64", machine="virt")
qemu_boot(name="r", kernel="build/kernel-riscv64.elf", arch="riscv64", machine="virt")

Run qemu_machines(arch="aarch64") for the full list of machines an arch supports — it reports qemu-system-<arch> -M help's own output without needing a shell.

virt has no default display device — unlike the PC-family boards x86_64/ i386 boot with, it doesn't wire up VGA on its own. qemu_screenshot/ qemu_wait_screen against a virt VM will see an empty/black framebuffer (or a QMP error, depending on QEMU version) unless the guest itself sets one up, which most bare-metal aarch64/riscv64 kernels don't. Add a display device explicitly if you need screenshots:

qemu_boot(name="a", kernel="build/kernel-aarch64.elf", arch="aarch64",
          machine="virt", extra_args="-device virtio-gpu-pci")

(This is documented QEMU virt-board behavior, not verified against a real boot in this environment — no QEMU available here.)

Hardware acceleration

qemu_boot defaults to TCG (QEMU's software emulator) with no accel given - correct on any host, but a real slowdown for anything beyond a trivial kernel. Opt into your host's accelerator with accel, falling back to TCG if it's unavailable so the boot doesn't hard-fail on a host without it:

qemu_boot(name="fast", kernel="build/kernel.elf", accel="kvm:tcg")   # Linux
qemu_boot(name="fast", kernel="build/kernel.elf", accel="hvf:tcg")   # macOS
qemu_boot(name="fast", kernel="build/kernel.elf", accel="whpx:tcg")  # Windows

If the requested accelerator genuinely isn't usable on the host (no /dev/kvm permission, virtualization disabled in firmware, etc.) QEMU itself reports why QEMU exited, and qemu_boot surfaces that in the error it raises.

CPU model

qemu_boot defaults to QEMU's own default CPU model for the arch/machine. Pass cpu (QEMU -cpu) to test guest code against a specific model or feature set instead:

qemu_boot(name="k", kernel="build/kernel.elf", cpu="qemu64,+avx")  # base model + one extra feature
qemu_boot(name="k", kernel="build/kernel.elf", cpu="max")          # every feature QEMU/TCG can emulate
qemu_boot(name="k", kernel="build/kernel.elf", accel="kvm", cpu="host")  # pass the host CPU through under KVM

Run qemu_cpu_models(arch="x86_64") for the full list of models/features an arch supports — it reports qemu-system-<arch> -cpu help's own output without needing a shell.

CPU topology

smp alone sets a flat vCPU count. For guest code that cares about the socket/core/thread shape (ACPI MADT entries, CPUID topology leaves, per-socket vs. per-core scheduling), pass smp_cores/smp_threads/ smp_sockets/smp_maxcpus too - they're combined onto the same -smp flag:

qemu_boot(name="k", kernel="build/kernel.elf",
          smp=8, smp_cores=4, smp_threads=2, smp_sockets=1)
# -> -smp 8,cores=4,threads=2,sockets=1

smp itself is optional when the topology params are given - QEMU can infer the total CPU count from cores/threads/sockets.

Host port forwarding

To reach a guest service (SSH, a web server under test) from the host without needing QEMU's NIC/chipset flags, pass hostfwd (QEMU's hostfwd rule):

qemu_boot(name="k", disk="build/linux.qcow2", hostfwd="tcp::2222-:22")
# host:2222 -> guest:22, e.g. ssh -p 2222 user@localhost

This adds -netdev user,id=net0,hostfwd=... and -device e1000,netdev=net0 for you - the guest needs its own e1000 driver, which most general-purpose OSes (Linux included) already have built in. For a bare-metal kernel with its own NIC driver (like the rtl8139 example above), use extra_args instead - hostfwd is for forwarding a port to a guest that already has working networking, not for picking which NIC a from-scratch kernel talks to.

To forward more than one port, give a comma-separated list of rules - QEMU's -netdev user accepts hostfwd= multiple times on one netdev, so both land on the same NIC instead of needing a second one:

qemu_boot(name="k", disk="build/linux.qcow2", hostfwd="tcp::2222-:22,tcp::8080-:80")
# host:2222 -> guest:22 (ssh), host:8080 -> guest:80 (http)

Freezing on a crash

Without -no-reboot/-no-shutdown, a guest kernel panic (triple fault, or an ACPI shutdown) immediately restarts or exits the emulated machine - by the time qemu_wait_serial/qemu_screenshot looks, the crash screen or last serial output is already gone. Pass no_reboot/no_shutdown to freeze QEMU instead, leaving the VM inspectable (qemu_screenshot, qemu_serial) until you stop it yourself:

qemu_boot(name="k", kernel="build/kernel.elf", no_reboot=True, no_shutdown=True)

Debugging the kernel

qemu-mcp lets an agent see a crash. To find out why it happened, pair it with gdbstub-mcp. Boot with QEMU's gdbstub on and an interrupt log:

qemu_boot(name="k", kernel="build/kernel.elf", no_reboot=True,
          extra_args="-s -S -d int,cpu_reset -D int.log")

Then the agent can debug_connect with the kernel ELF, set breakpoints on symbols or file.c:line, read registers and memory, and get backtraces. If the VM triple faults, debug_explain_fault turns int.log into the exception chain and its root cause. No gdb binary is needed.

Tests

CI

Unit tests for the character/key-name -> QMP qcode translation in keys.py, the screen-fraction -> QMP pointer-event translation in mouse.py, the serial chardev args and reconnect logic in serial.py, the framebuffer stability tracker in screen.py, the snapshot tag validation and HMP command-line building in snapshot.py, the QMP client's error handling in qmp.py, the missing-binary error path, the __version__/pyproject.toml version-drift guard in test_version.py, the pinned tool behaviour hints (readOnlyHint/destructiveHint/idempotentHint/openWorldHint) in test_tool_hints.py, and an MCP stdio handshake smoke test all need no QEMU install - this is what CI runs on every push:

pip install -e ".[test]"
ruff check src tests
mypy --strict src
pytest tests/test_keys.py tests/test_mouse.py tests/test_screen.py tests/test_snapshot.py tests/test_serial.py tests/test_qmp.py tests/test_vm.py tests/test_stdio_handshake.py tests/test_tool_hints.py tests/test_version.py

There's also an end-to-end test that boots a real ISO and exercises every tool:

QEMU_MCP_TEST_ISO=path/to/anything-bootable.iso python tests/smoke_test.py

qemu_snapshot_save/qemu_snapshot_load need a qcow2 disk rather than an ISO, so they're only exercised if you also set QEMU_MCP_TEST_QCOW2 to a qcow2 disk image (booted as a second VM alongside the ISO one).

Notes

  • VMs run headless (-display none); screenshots still work because QEMU keeps rendering the VGA framebuffer.

  • Serial output requires the guest to write to COM1 (most hobby kernels and all Linux console=ttyS0 setups do). Guests that only draw to VGA are still fully drivable via screenshots + keys.

  • qemu_stop tries ACPI powerdown first; hobby kernels usually ignore it and get killed after a grace period — use force=true to skip the wait, or raise graceful_timeout_s (default 10s) for a guest that legitimately needs longer to shut down cleanly.

  • qemu_stop waits briefly (up to 5s, best-effort) for any in-flight qemu_wait_serial/qemu_wait_screen/qemu_screenshot/qemu_serial_send/qemu_qmp/qemu_change_media/qemu_type/qemu_key/qemu_mouse/qemu_pause/qemu_resume/qemu_snapshot_save/qemu_snapshot_load/qemu_snapshot_delete/qemu_snapshot_list call against the same VM to finish before closing its QMP/serial connections and removing its temp directory, so a call racing a concurrent stop sees a clean result instead of an error from a handle closed out from under it.

  • This server launches QEMU processes on your machine with files you point it at. extra_args is passed to QEMU verbatim — same trust level as running QEMU yourself.

Changelog

See CHANGELOG.md.

Contributing

See CONTRIBUTING.md for the exact local setup and checks CI runs.

Security

qemu-mcp assumes the agent driving it is trusted — it does not sandbox qemu_qmp, extra_args, or hostfwd. See SECURITY.md for the full trust model and how to report a vulnerability.

License

MIT

Available Tools

21 tools
qemu_bootA
Destructive

Boot a QEMU VM headless and register it under name.

name identifies this VM in all later calls (qemu_screenshot, qemu_stop, etc.) - it must be non-empty and contain no "/" or "" (it also names a temp directory and is passed to QEMU's -name flag). Provide at least one of: iso (bootable CD image), kernel (multiboot/bzImage, optionally with append/initrd), or disk (raw or qcow2 disk image, auto-detected; qcow2 is required for qemu_snapshot_save/qemu_snapshot_load). append/initrd require kernel to also be given - QEMU itself rejects -append/-initrd without -kernel, so this is checked up front with a clear ValueError. Each of iso, kernel, initrd, and disk, if given, must already exist on disk - qemu_boot checks with a clear FileNotFoundError naming the param and path before any QEMU process starts, rather than letting a typo surface later as an opaque "QEMU exited immediately" failure; qemu_boot never creates a disk image for you, so disk must point at an existing image file. memory_mb must be positive. arch picks the qemu-system- binary (x86_64, i386, aarch64, riscv64...) and, like name, must contain no "/" or "" and not be "." or "..". machine is passed as QEMU's -M and is required on some archs - aarch64 and riscv64 have no default machine and need e.g. machine="virt". smp sets the number of virtual CPUs (QEMU -smp), for testing SMP-aware guest code; must be positive when given. smp_cores/smp_threads/smp_sockets/smp_maxcpus add QEMU's -smp CPU-topology qualifiers (cores=/threads=/sockets=/maxcpus=) onto the same -smp flag instead of a flat count - for guest code that cares about socket/core/thread shape (ACPI MADT entries, CPUID topology leaves, per-socket vs. per-core scheduling), not just a total vCPU number. Each must be positive when given; any of them (with or without smp itself) causes -smp to be emitted. accel is passed as QEMU's -accel (e.g. "kvm", "kvm:tcg" to fall back to software emulation if KVM isn't available, "hvf"/"hvf:tcg" on macOS, "whpx:tcg" on Windows) to opt into hardware acceleration; left unset, QEMU defaults to TCG (software emulation), which is correct but slow for anything beyond a trivial kernel. There's no host-capability probe for this - if the requested accelerator isn't available, QEMU itself fails immediately and that failure (including QEMU's own explanation) is surfaced the same way any other immediate boot failure is, in the raised error. cpu is passed as QEMU's -cpu (e.g. "qemu64,+avx", "max", "host" when accel="kvm"/"hvf") to select or customize the emulated CPU model - useful for testing guest code against a specific feature set (SSE4, AVX, a particular vendor's quirks) rather than whatever QEMU defaults to for the arch. extra_args is passed to QEMU verbatim, e.g. "-netdev user,id=n0 -device rtl8139,netdev=n0" (must be valid shell-style quoting, e.g. no unbalanced quotes). extra_args may not contain a flag qemu_boot already sets itself: -name, -m, -display, -qmp always; -M/-machine, -cdrom/-boot, -kernel, -append, -initrd, -smp, -accel, -cpu when the corresponding param above is also given (-smp collides when smp or any of the smp_* topology params is given). -drive is exempt from this check even when disk is given - QEMU allows repeated -drive flags, so extra_args can add further disks, e.g. extra_args="-drive file=data.img,format=raw" for a second drive alongside disk (pointing extra_args's -drive at the same file as disk will still fail, but as a QEMU image-locking error at boot, not a pre-flight one). -chardev/-serial are similarly exempt except for the exact chardev qemu_boot's own serial console uses (id=serial0 / chardev:serial0) - extra_args can add an unrelated -chardev or a second -serial (e.g. a COM2 backed by another chardev) freely, but reusing id=serial0 or pointing another -serial at chardev:serial0 is rejected, since that's the pair qemu_serial/qemu_serial_send depend on. hostfwd is a convenience for reaching a guest service (SSH, a web server under test) from the host, without needing QEMU-specific NIC/chipset knowledge: give it QEMU's hostfwd rule, e.g. hostfwd="tcp::2222-:22" to forward host port 2222 to guest port 22, and qemu_boot adds the "-netdev user,id=net0,hostfwd=..." / "-device e1000,netdev=net0" pair for you (the guest needs its own driver for an e1000 NIC - most general-purpose OSes, Linux included, have one built in). Must look like [tcp|udp]:[hostaddr]:hostport-[guestaddr]:guestport. -netdev/-device are similarly exempt from the extra_args conflict check except for the exact netdev hostfwd's own NIC uses (id=net0 / netdev=net0) - extra_args can add an unrelated NIC (e.g. for testing a guest driver) freely, but reusing id=net0 or pointing a -device at netdev=net0 is rejected. hostfwd's host port is probed pre-flight (a bind attempt on that exact port/address) so a collision - two VMs sharing a hostfwd port, or an unrelated process already bound to it - raises a clear ValueError naming the port instead of surfacing as QEMU's own confusing bind-failure output through the generic "QEMU exited immediately" path. qmp_connect_timeout_s bounds how long to retry connecting to QEMU's QMP socket after launch (raise it on a slow/loaded host where QEMU's first launch is slow, e.g. under AV scanning). qmp_read_timeout_s bounds how long any single QMP command (including ones issued by other qemu_* tools for this VM, like qemu_qmp or qemu_snapshot_save) waits for a response - raise it if you expect a command that can legitimately run long. Both timeouts must be positive. The VM keeps running until qemu_stop; serial output is captured continuously.

Inputs: name (required), cpu, iso, smp, +16 more. Returns: result

qemu_change_mediaA
DestructiveIdempotent

Swap the medium in a removable drive (e.g. a CD-ROM) without rebooting.

device is the block backend's id or QOM path, as shown by qemu_qmp(name, "query-block")'s "qdev" field - qemu-mcp can't guess it for you, since it depends on the machine type/QEMU version and whether the drive was given an explicit id (qemu_boot's iso/disk params don't set one). path must already exist. format defaults to auto-probing the new image. force=True ejects even a drive the guest has locked (its tray "closed" on the medium); the default refuses in that case instead of surprising the guest. Wraps QMP blockdev-change-medium.

Inputs: name (required), path (required), device (required), force, +1 more. Returns: result

qemu_disk_createA

Create a fresh disk image via qemu-img create, ready for qemu_boot's disk param.

qemu_boot never creates a disk image itself - disk must already point at an existing file. This closes that gap: create one here, then boot straight into it.

size looks like qemu-img's own size grammar: a number optionally suffixed with k/K/M/G/T/P/E, e.g. "10G" or "512M". format must be "qcow2" (default - needed for qemu_snapshot_save/qemu_snapshot_load) or "raw" - qemu_boot's disk_format() auto-detection only tells these two apart, so any other qemu-img format would silently be treated as raw. Fails if path already exists, rather than overwriting it.

Inputs: path (required), size (required), format. Returns: result

qemu_keyA
Destructive

Press a key or chord: "enter", "esc", "f12", "ctrl-alt-f2", "ctrl-c"...

Parts are joined with "-" and pressed together. A literal "-" key is written "--" (e.g. "ctrl--" for ctrl + minus). Use qemu_type for plain text. "sysrq" sends the Linux Magic SysRq key (e.g. "alt-sysrq-s" to sync disks, "alt-sysrq-c" to force a crash dump on a guest kernel built with CONFIG_MAGIC_SYSRQ).

Inputs: name (required), combo (required). Returns: result

qemu_listA
DestructiveIdempotent

List all VMs managed by this server, with arch, machine, hostfwd, pid, uptime, and state.

A VM that exited on its own (guest panic, or quit via qemu_qmp) is shown here once as exited(...), then reaped - its workdir and handles are freed before this call returns, so it won't reappear next time.

Inputs: no named parameters. Returns: result

qemu_mouseA
Destructive

Move the absolute pointer and optionally click.

x and y are fractions of the screen width/height (0.0 = left/top, 1.0 = right/bottom) - read them off a qemu_screenshot. button is "left", "right", or "middle" for a full click at that position; "wheel-up", "wheel-down", "wheel-left", or "wheel-right" to scroll a scrollable widget under the pointer instead; or "side"/"extra" for a 5-button mouse's extra side buttons (needs the guest's PS/2 mouse driver in IMEX mode to see them). Omit button to just move the pointer. Needs the guest to have an absolute pointer (USB tablet or PS/2 mouse) to track it - most GUIs have one by default.

Inputs: x (required), y (required), name (required), button. Returns: result

qemu_pauseA
Idempotent

Pause the VM's execution (QMP stop) without exiting QEMU.

The guest's CPUs stop running - RAM and device state stay exactly as they are until qemu_resume. Useful for inspecting a VM (qemu_screenshot, qemu_qmp query-*) without guest time advancing while you look, or for pairing with qemu_snapshot_save to get a guaranteed-consistent snapshot instead of one taken mid-instruction. qemu_stop still works on a paused VM.

Inputs: name (required). Returns: result

qemu_qmpB
Destructive

Escape hatch: run a raw QMP command on the VM.

Examples: query-status, system_reset, memsave, device_add. See the QEMU QMP reference for commands and their arguments.

Inputs: name (required), command (required), arguments. Returns: result

qemu_resumeA
Idempotent

Resume a VM previously paused with qemu_pause (QMP cont).

A no-op (still returns success) if the VM wasn't paused.

Inputs: name (required). Returns: result

qemu_screenshotA
Read-onlyIdempotent

Capture the VM's display as a PNG image.

Works headless - the guest's VGA framebuffer is captured via QMP screendump. Use it to see boot screens, kernel panics, GUIs, or a text console that doesn't write to serial. Raises a clear error (instead of an opaque image-decoding failure) if the VM exits while the screendump is in flight.

Inputs: name (required).

qemu_serialA
Read-onlyIdempotent

Read the tail of the VM's serial console output (COM1).

Works even after the VM has exited (guest crash, or quit via qemu_qmp) so you can see what it printed right before dying - the exited VM stays visible here until qemu_list's next call reaps it. tail_lines must be positive.

Inputs: name (required), tail_lines. Returns: result

qemu_serial_sendA
Destructive

Write text to the guest's serial console (COM1).

For guests that only expose a shell over serial (no VGA console, or a kernel with a serial-only debug shell) - the bidirectional counterpart to qemu_serial's read-only tail. Sent exactly as given; include "\n" yourself for Enter. Kept on one persistent connection for the VM's lifetime - disconnecting and reconnecting would hang up the serial line. If the connection drops (e.g. the guest is mid-reboot) this reconnects once automatically; if that also fails, raises with a message saying so

  • retry the call once the guest's serial socket is back up.

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

qemu_snapshot_deleteA
DestructiveIdempotent

Delete a snapshot previously saved with qemu_snapshot_save.

Frees the space it used inside the qcow2 disk. Reports failure if QEMU's delvm rejects it (e.g. an unknown tag) instead of claiming success.

Inputs: tag (required), name (required). Returns: result

qemu_snapshot_listA
Read-onlyIdempotent

List internal snapshots saved on the VM's qcow2 disk.

Wraps QEMU's HMP info snapshots so you can see what tags already exist before calling qemu_snapshot_load or qemu_snapshot_delete, instead of finding out only from a failure afterward. Returns QEMU's raw table output as-is (its exact column layout isn't parsed here).

Inputs: name (required). Returns: result

qemu_snapshot_loadA
DestructiveIdempotent

Restore a VM to a snapshot previously saved with qemu_snapshot_save.

Requires the same qcow2 disk the snapshot was taken on.

Inputs: tag (required), name (required). Returns: result

qemu_snapshot_saveA
Destructive

Save a full VM snapshot (RAM + device state) under tag.

Uses QEMU's internal savevm mechanism, which stores the snapshot inside the disk image itself - the VM's disk must be qcow2 (raw images do not support internal snapshots). Saving again with the same tag overwrites it. tag may only contain letters, digits, '.', '_', '-'.

Inputs: tag (required), name (required). Returns: result

qemu_stopA
DestructiveIdempotent

Stop a VM. Tries graceful ACPI powerdown first; force=True kills it.

Guests without ACPI handling (most hobby kernels) will need force=True or will be killed after the graceful_timeout_s grace period anyway. graceful_timeout_s (default 10 s) bounds how long to wait for the guest to shut down after ACPI powerdown before falling back to a kill; raise it for a guest that legitimately needs longer (large RAM, a slow ACPI handler). kill_timeout_s (default 3 s) bounds how long to wait for the QEMU process to exit after quit/kill before it's force-killed. Both must be positive.

Inputs: name (required), force, kill_timeout_s, graceful_timeout_s. Returns: result

qemu_typeA
Destructive

Type text into the guest as keyboard input. "\n" presses Enter.

Handles US-layout characters including shifted symbols. delay_ms is the gap between keystrokes - raise it (e.g. 80) if the guest drops characters during early boot. Must be non-negative.

Inputs: name (required), text (required), delay_ms. Returns: result

qemu_versionA
Read-onlyIdempotent

Report qemu-system-<arch> --version's own output, without booting a VM.

Useful when a QMP command or machine type behaves unexpectedly and you need to know what's actually installed - arch picks the same qemu-system- binary qemu_boot would use.

Inputs: arch. Returns: result

qemu_wait_screenA
Read-onlyIdempotent

Block until the VM's display stops changing, or time out.

Polls screendumps every poll_interval_s and waits for stable_polls consecutive frames that each differ from the previous one by at most max_changed_pixels pixels (default 64: a blinking text-mode cursor flips about 18, so identical frames never happen on a text console, while boot output changes hundreds; use 0 to require identical frames) - the reliable way to know a VGA-only guest (no serial output) has finished a BIOS splash or boot animation before you screenshot or type. For guests with serial output, prefer qemu_wait_serial - it doesn't need a fixed number of polls to decide. Always polls at least once, even if timeout_s is 0 or negative. poll_interval_s must be positive.

Inputs: name (required), timeout_s, stable_polls, poll_interval_s, +1 more. Returns: result

qemu_wait_serialA
Read-only

Block until text appears on the serial console, or time out.

The reliable way to know a guest reached a boot stage ("login:", "kernel ready", a shell prompt) before typing or screenshotting. Each wait searches only output after the previous successful wait's match, so waiting for "$ " after typing a command finds the NEW prompt, not the one already on screen. The first wait searches from the start of the log (so a marker printed before the call is still found); from_start=True searches the whole log again. Returns the serial tail either way, prefixed FOUND or TIMEOUT. Always checks at least once, even if timeout_s is 0 or negative. poll_interval_s (default 0.25s) must be positive. Each poll reads only the serial log bytes written since the previous poll, not the whole file, so a long wait against a chatty guest doesn't cost ever-more I/O per poll. text must be non-empty.

Inputs: name (required), text (required), timeout_s, from_start, +1 more. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 21 tools

    Disambiguation5/5

    Each tool targets a clearly distinct action: boot/stop/pause/resume lifecycle, input (type/key/mouse), output (serial read/send, screenshot, waits), snapshots (save/load/delete/list), and disk/qmp utilities. The read-vs-write (qemu_serial vs qemu_serial_send) and serial-vs-screen wait pairs are explicitly distinguished in descriptions. qemu_qmp is a documented escape hatch that could overlap with pause/snapshot, but it's positioned as a raw fallback, not a primary path.

    Naming Consistency4/5

    All tools consistently use the qemu_ prefix in snake_case throughout, which is highly predictable. There is minor variation in verb placement—qemu_disk_create is object_verb while most others lead with a verb (qemu_boot, qemu_list), and the snapshot_* group uses a shared object prefix. Still very readable and internally coherent.

    Tool Count4/5

    21 tools is on the heavier side but each maps to a genuine VM-control concern (lifecycle, input, serial, snapshots, disk, version). The breadth is justified by the domain's surface area rather than being redundant. Slightly over the ideal but well-scoped.

    Completeness5/5

    Covers the full VM lifecycle: disk creation, boot, listing, pause/resume, graceful/forced stop, complete snapshot CRUD (save/load/delete/list), display and serial I/O, input injection, media swapping, version probe, and a raw QMP escape hatch. No obvious dead ends for agent-driven VM control.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to control and automate Incus/QEMU virtual machines via SSH, supporting mouse/keyboard, screenshots, commands, and lifecycle management.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI clients to control QEMU virtual machines over QMP and the human monitor, with text-first screen access via OCR text, ASCII rendering, or PNG screenshots. It supports launching and resetting VMs, typing text and sending key sequences, moving the mouse, creating disk images, and reading or building FAT images.
      MIT