Qubes MCP Server - Giving an AI agent Admin API access without giving it dom0
AI agents are being handed real machine capability — spawn a VM, run a command as
root, move a file — by tooling whose only boundary is a prompt. That is the wrong
layer to enforce anything. Qubes already has the primitives to make the boundary
structural rather than behavioural.
qubes-mcp is an MCP server that gives an untrusted AI principal a tag-scoped
slice of the Admin API. It can create, run, clone, network, and destroy qubes
carrying the ai-managed tag, and it cannot see, touch, or learn the existence of
anything else. Every state-changing call goes through a small dom0 wrapper that
enforces the invariants before qubesd is reached, and tagging stays in the
operator's hands.
I'll walk the trust model, the parts of Qubes that made it work (qrexec @tag:
selectors and where they stop, wrapped reads that hide existence, forced tagging on
every create path), the four boundary breaks a self-audit found in code I had
already shipped — almost all of them read surfaces, not policy — and the qubesd
cache-invalidation bug this shook out, now fixed upstream.
Why this talk
The MCP ecosystem's answer to "the agent can be talked into things" currently lives
in the software layer: description scanners, wrapping proxies, gateway policy. Those
help, and they all run at the same privilege as the thing they are policing. Qubes
can put the boundary somewhere the agent has no argument with it, and doing that
turns out to exercise the Admin API and qrexec policy in ways that are worth
reporting back to the people who maintain them.
What the project is
qubes-mcp is a FastMCP server that runs inside a dedicated qube, mcp-control,
and treats that qube as the untrusted principal. Within the set of qubes tagged
ai-managed it can do real work: lifecycle, spawn, clone, disposables, root command
execution, inter-qube file copy, per-qube firewall rules, device attach/detach, a
filtered event stream, and a disk budget. Outside that set it has nothing. It cannot
reach a dom0 shell, cannot set or remove tags, and cannot distinguish "that qube is
not tagged" from "that qube does not exist".
Every state-changing call is a small Python service in dom0's /etc/qubes-rpc/ that
enforces the invariants — force-tag on create, cross-reference validation on
template/netvm/default_dispvm, opaque errors — before qubesd is touched. The
operator applies the tag by hand in dom0. That is the whole trust story: the tag is
the boundary, and the AI cannot move it.
Outline (~30 min)
- Threat model (4 min) — what "an agent with capability" concretely means, and
why a control that shares the agent's privilege level is not a boundary. - The build, in Qubes primitives (10 min) — qrexec
@tag:selectors and where
they stop (they do not reachklass=DispVMtargets, which forced a dom0 lifecycle
wrapper); wrapped reads that return an indistinguishable "not found"; forced
tagging on every create path, includingclone_vmandCreateDisposable, which
otherwise propagate the source's tags; a single-egress network qube whose upstream
only the operator can set; a cap on the sandbox's persistent footprint enforced
before the create call rather than reported after it. - Auditing my own boundary (10 min) — a July 2026 architecture review found four
reachable breaks in already-shipped code, and none of them were in the policy file.
A property read on the AI's own network qube returned the names of upstream qubes
that a direct lookup denies. Device enumeration exposed backend qube names.
provides_networkwas writable, so the sandbox could mint its own egress. The
generalisable lesson: if you build an existence boundary, every value your read
surfaces return is part of that boundary, and "visibility is not capability" only
holds if you go and audit the visibility. - The upstream bug (3 min) — chasing whether
@tag:matching reaches DispVMs
ended in instrumentingSystemInfoCachein qubesd:on_domain_addregistered
event handlers but never invalidated the cache, so a freshly created VM was
invisible to the policy resolver until the next invalidating event and the qrexec
target silently fell back to@default. Filed as qubes-issues#10911, fixed by a
two-line patch, qubes-core-admin#825, merged 2026-06-15. - What's next, and where I'm stuck (3 min) — graduated authority inside the
boundary: capability tiers layered on the tag, and an operator-consent gate in
dom0 for destructive calls. Plus the open questions I would most like this room to
break.
State of the work
Stages A–F3 and the Stage I Wave-1 sub-stages (I-0..I-5) are tested on Qubes
R4.3-era hardware. The G0 gateway hardening shipped after the July review. The
consent gate (I-6) is shipped inert, pending enforcement. mcp-control host hardening
and remote reach are designed and deferred. The talk presents what is deployed and
tested at the time of the event — not the roadmap.
Who it's for
Anyone being asked to let an AI agent touch a machine they care about; anyone who
works on Admin API or qrexec policy internals; anyone who wants a worked example of
pushing an existence boundary all the way through the Qubes stack. No AI or ML
background needed. Familiarity with qrexec policy helps but is not assumed.
Links
- Repo: https://github.com/alex-schose/qubes-mcp
- Design review on qubes-devel: https://groups.google.com/g/qubes-devel/c/4NuSqL64DVE
- Forum thread: https://forum.qubes-os.org/t/41387
- Upstream: https://github.com/QubesOS/qubes-issues/issues/10911 ·
https://github.com/QubesOS/qubes-core-admin/pull/825 - Background write-up:
https://alexschose.com/writing/mcp-trust-boundaries-belong-below-the-protocol.html
Independent security consultant. I review MCP servers and AI-agent products for trust-boundary failures, and build the isolation layer underneath them when the review concludes there was never a boundary to begin with.
Author of qubes-mcp — an MCP server that hands an untrusted AI principal a tag-scoped slice of the Qubes Admin API and nothing else. Building it turned up a qubesd cache-invalidation bug (qubes-issues#10911, fixed in qubes-core-admin#825) and a documentation PR still open against qubes-doc.
Fully remote, no fixed office. https://alexschose.com · https://github.com/alex-schose