{No thinking needed}Hand this tutorial to your agent in one click

A key section of this article is locked, and an agent opening the link cannot see it either. Unlock it first, then copy the full text for your agent in one click.

Tutorial/Dec 2, 20266 min

Meet cua-driver: let your AI agent control your desktop

Share

Wire the open-source cua-driver into your AI agent via MCP so it reads OS Accessibility Trees to drive native macOS, Windows, and Linux apps reliably.

Machine translation. Read the original

What you get

Once you wire the open-source cua-driver into your AI agent, it stops being confined to chat text and code files. It can read the windows, buttons, and inputs on your desktop and handle real GUI work—clicking native apps, filling forms, and moving data across programs.

It runs locally on macOS, Windows, and Linux with no cloud VM required, and works with any model or client that supports MCP.

Four-step workflow showing how an AI agent controls a desktop via cua-driver

Why cua-driver beats vision-only pixel clicking

Most early Computer Use setups take a full-screen screenshot every step and ask a vision model to guess pixel coordinates like x=812, y=540. Move a window, switch monitors, or change display scaling, and the click misses. Sending high-res screenshots on every turn is also slow and expensive.

cua-driver reads the operating system's Accessibility Tree first. Instead of raw pixels, get_window_state hands your AI agent structured UI elements with stable element_token handles—so the agent sees "Export button (el_12)" rather than guessing where a rectangle sits.

Comparison between vision-only pixel clicking and cua-driver

It also ships with built-in browser_* tools, so web steps can drive the browser directly without fighting popups or scrollbars via desktop screenshots.

Step 1: Install cua-driver and grant permissions

cua-driver is a native local binary. Run the installer for your OS:

macOS / Linux:

/bin/bash -c "$(curl -fsSL https://cua.ai/driver/install.sh)"

Windows (PowerShell):

irm https://cua.ai/driver/install.ps1 | iex

Next, grant Accessibility and Screen Recording permissions so the driver can read window trees and send input:

cua-driver permissions grant
cua-driver doctor

On macOS, toggle on Accessibility and Screen Recording for CuaDriver in System Settings -> Privacy & Security. On Windows, you can also run cua-driver autostart enable so the background service starts on login. Once cua-driver doctor reports healthy, move to Step 2.

Step 2: Connect cua-driver to your AI agent via MCP

cua-driver includes a config generator for major clients including Claude Code, Codex, Cursor, Antigravity, and OpenClaw.

Copy this prompt and send it to your AI agent to wire the MCP server automatically:

Sign in to unlock this key section

New accounts get 10 free credits, plus 1 more each day you sign in (none on days you don't). Spend 1 credit to unlock and it stays open for you.

If you prefer manual setup, run:

cua-driver mcp-config

Paste the generated cua-driver mcp block into your client's MCP config and restart. Later, you can keep it current with cua-driver check-update and cua-driver update --apply.

Step 3: Run a read-only check before real tasks

Before letting your AI agent click around live apps, run one read-only prompt to confirm it can actually see your screen:

Use cua-driver to list my open windows (list_windows), then read the focused window's UI tree (get_window_state) and summarize its main buttons and input fields. Do not click anything.

Once it accurately lists your window title and buttons, you are ready for real cross-app workflows:

  • Copy records from email or chat into local spreadsheets or web admin forms
  • Drive native design, video, or settings apps through repetitive export steps
  • Combine browser_* tools with native desktop steps—download assets in the browser, then process them in a local app

When to use it—and when not to

  • Use cua-driver for native desktop apps without APIs, repetitive workflows that jump between multiple apps, or mixed browser-plus-desktop tasks.
  • Skip it for pure code or terminal tasks (direct shell tools are faster and safer), or full-screen games and custom-drawn Canvas apps that do not expose an Accessibility Tree.

Watch out for

  • Add a pause before irreversible actions: for payments, file deletions, mass messages, or credential changes, tell your AI agent to stop and ask for confirmation before clicking the final button.
  • Avoid fighting for focus: desktop automation uses your real mouse and keyboard focus, so avoid switching windows mid-run.
  • Revoke anytime: turn off Accessibility permission in system settings whenever you want to cut off desktop access immediately.

References

Done with this one? Mark it to track your path.Sign in
Save it for laterSign in
Questions about this piece?Ask AI about this

Comments (0)

No comments yet. Start the conversation.

Sign in to join the discussion.Sign in