cuop
Enables AI agents to observe and control macOS applications through the Accessibility API, reading the element tree, acting on elements by reference, and returning only changed UI lines after each action.
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., "@cuop click the 7 button in Calculator, then show me what changed"
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.
ComputerUseOptimizer (CUOP)
Computer use for AI agents that reads the macOS accessibility tree instead of screenshots — and sends only what changed.
A screenshot agent pays for a full image of the screen at every step, then guesses pixel coordinates to click.
CUOP gives the agent a compact text list of the elements on screen, lets it act on an element by reference
(click @s1:e14), and after each action returns only the lines that changed.

Same task (Calculator 7 + 5 =). Left: the screenshot agent receives a new image every step and clicks guessed coordinates. Right: CUOP sends the element list once (264 tokens), then only the changed lines — 391 tokens in total instead of 2,500.
Results
All numbers below come from real runs on one MacBook (macOS 26), with the same model and the same prompt for both
agents. Tokens are counted with tiktoken (o200k); screenshots are scaled the way the API scales them.
12 real desktop tasks × 3 runs each

CUOP | Screenshot agent | Difference | |
Tasks completed | 36 / 36 | 33 / 36 | +3 |
Cumulative input tokens | 3.44 M | 4.67 M | −26.3% |
Cost (API prices) | $1.95 | $3.48 | −43.9% |
Where it saves the most
The longer the task, the larger the saving: a screenshot agent re-sends a full image at every step, while CUOP sends a small diff.

Task (3 runs each) | Input tokens saved | Cost saved |
Fill a multi-step web order form (Chromium) | −70% (413k → 123k) | −73% |
Menu-bar battery panel¹ | −67% | −68% |
Copy data between two apps | −54% (363k → 167k) | −66% |
Edit a document in TextEdit | −43% (240k → 136k) | −44% |
Edit a file in VS Code (Electron) | −33% | −46% |
Scientific calculator | −11% | −56% |
¹ The screenshot agent failed this task 3/3 (another window covered the menu-bar item it tried to click), so the saving is measured against failed runs.
Cost is lower in 10 of the 12 tasks. Short tasks (2–5 steps: Calculator, Clock, Activity Monitor) use more input
tokens with CUOP, because the tool definitions are re-read every turn and outweigh the small screen; the core
toolset (24 tools) cuts that fixed cost from 10.4k to 3.0k tokens. A canvas page has no tree content, so CUOP falls
back to a screenshot there.
One look at one window

vercel-labs/agent-desktop returns the tree as JSON. CUOP keeps the same commands and refs but renders the tree as one line per element and trims it to a token budget, so a content-heavy window like the ChatGPT app costs 189 tokens instead of 10,399.
Coverage
84 of the 102 GUI apps installed on the test Mac (82.4%) passed the coverage probe: at least five named, actionable elements reach the model, and the text is cheaper than a screenshot of the same window. The median app costs 0.32× a screenshot.
Related MCP server: mcp-macos-cua
How it works
Claude Code / Codex ──MCP──▶ cuop server ──▶ macOS Accessibility (AXUIElement) / Chrome DevTools ──▶ the app
│
├─ text tree one line per element: e14 button "7"
├─ refs act by reference: click @s1:e14
├─ diff after an action, only changed lines: ~ e9 "7"
├─ filter a `goal` ranks elements relevant to the current step
└─ budget large windows collapse to a skeleton instead of a full dumpagent-desktop compatible. The commands, JSON envelope (
version 2.6), error codes and ref format follow agent-desktop, so--format jsonoutput looks the same.--format textis the token-cheap form.Headless by default. Actions use the accessibility API without moving the user's mouse or stealing focus.
--headedallows real key and mouse input for apps that ignore semantic input.Progress you can watch. An optional click-through overlay shows the current step and target, and a session trace can be exported as an HTML viewer.
Electron / Chromium. Accessibility is switched on automatically (
AXManualAccessibility,AXEnhancedUserInterface).Optional Jev plugin. With a TypeSafe Jev key, a small decision model ranks elements and suggests the route (tree, keys or screenshot) for the first view. Off by default.
Quick start (macOS)
Requires macOS, Python 3.14 and uv. Grant Accessibility (and, for screenshots, Screen Recording) to the terminal that runs it.
git clone https://github.com/csk200387/ComputerUseOptimizer.git
cd ComputerUseOptimizer
uv sync
uv run cuop permissions # check Accessibility / Screen Recording
uv run cuop snapshot --app Calculator --format text
uv run cuop click @<snapshot-id>:e14 --format text # returns the diffUse it from an agent as an MCP server:
# Claude Code
claude mcp add cuop -- uv run --directory /path/to/ComputerUseOptimizer cuop mcp --format text --toolset coreThe agent guide lives in skills/cuop/SKILL.md (cuop skills prints it).
Limitations
macOS only for now. Windows (UI Automation) is planned.
Apps that keep their content out of the tree. Excel's cell grid, PowerPoint's slide canvas and drawing canvases are not in the accessibility tree; there a screenshot agent is still cheaper (Excel: $0.037 vs $0.122 per task).
Short tasks pay the fixed cost of tool definitions; use
--toolset core.Small samples. Each comparison ran 3 times per task; run-to-run variance can reach ±20%.
Status
A university project (2026-2). The command surface is tracked against agent-desktop in
docs/parity/PARITY.md. Tests: uv run pytest -q.
License
Apache License 2.0. The command set and JSON contract follow vercel-labs/agent-desktop (Apache-2.0); see NOTICE.
Available Tools
25 toolsdesktop_checkC
Turn a checkbox / switch / radio on.
Inputs: ref_id (required), headed, timeout_ms.
desktop_clearC
Empty a field.
Inputs: ref_id (required), headed, timeout_ms.
desktop_clickB
Click (press) a ref. Menu items run even in closed menus. Each action returns a diff of the window ((no change) = its accessibility tree did not change); take refs from the newest header — a control whose label changed (AC → C) can need its new ref. Wait for one click's result before the next dependent click.
Inputs: ref_id (required), headed, timeout_ms.
desktop_collapseC
Collapse a disclosure / tree row.
Inputs: ref_id (required), headed, timeout_ms.
desktop_double_clickC
Double-click a ref (needs headed).
Inputs: ref_id (required), headed, timeout_ms.
desktop_expandC
Expand a disclosure / tree row.
Inputs: ref_id (required), headed, timeout_ms.
desktop_findC
Find elements by role / name / text in an app (also closed menus with surface=menubar); returns refs.
Inputs: app, nth, last, name, +14 more.
desktop_focusC
Give a ref keyboard focus (e.g. a document area before pressing keys).
Inputs: ref_id (required), headed, timeout_ms.
desktop_focus_windowC
Bring a window to the front.
Inputs: app, title, window_id.
desktop_getC
Read one property of a ref (value, bounds, states, …).
Inputs: ref_id (required), property.
desktop_launchB
Open an app that is not running (background unless activate); a running app needs no launch.
Inputs: app (required), cdp, cwd, env, +4 more.
desktop_list_windowsC
List an app's windows (ids w-N for window_id).
Inputs: app, timeout_ms.
desktop_mouse_clickC
Click screen point xy=X,Y (points; headed). From a screenshot: origin + pixel / scale_factor.
Inputs: xy (required), count, button, headed, +1 more.
desktop_pressC
Send a key or shortcut (e.g. return, cmd+s) to app / window_id.
Inputs: combo (required), app, force, headed, +1 more.
desktop_right_clickC
Open a ref's context menu.
Inputs: ref_id (required), headed, timeout_ms.
desktop_screenshotC
Capture one window as an image (for canvases and visual questions).
Inputs: app, screen, window_id, output_path.
desktop_scrollC
Scroll a ref's scroll area (direction up|down|left|right, amount).
Inputs: ref_id (required), amount, headed, direction, +1 more.
desktop_selectC
Choose an option by its label in a popup, combo box or list.
Inputs: value (required), ref_id (required), headed, timeout_ms.
desktop_set_valueC
Replace a field's whole value.
Inputs: ref_id (required), value, headed, timeout_ms.
desktop_skills_getC
Read the full usage guide (name=cuop or cuop-macos).
Inputs: full, name, reference.
desktop_snapshotB
Read a window as text: one line per element eN role "name" ="value" [states]; refs are @:eN from the header. goal = words on screen to keep only related elements; root = a ref to drill into; surface = menubar | menu | menu-bar-extras | sheet | popover | alert; diff = only changes since your last view. interactive_only hides read-only text such as a result display. For a menu command use find(surface=menubar, name=…) and click it. ^(…) marks superscript text (2^(10) = 2¹⁰).
Inputs: app, diff, goal, root, +9 more.
desktop_toggleC
Flip a checkbox / switch.
Inputs: ref_id (required), headed, timeout_ms.
desktop_typeC
Insert text at the caret of a ref (headless: accessibility insert; headed: real key presses).
Inputs: ref_id (required), text, headed, timeout_ms, +1 more.
desktop_uncheckC
Turn a checkbox / switch off.
Inputs: ref_id (required), headed, timeout_ms.
desktop_waitC
Wait for ms, an element (role:text), a window, text, a menu or an event.
Inputs: ms, app, menu, text, +11 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 25 tools
Most tools target clearly distinct actions (type vs. set_value vs. clear, press vs. type, snapshot vs. find vs. get). A few pairs need the descriptions to separate them: desktop_click vs. desktop_mouse_click (ref vs. screen point), desktop_focus vs. desktop_focus_window (element focus vs. window raise), and the check/uncheck/toggle trio. The descriptions do resolve these, so boundaries remain workable.
All tools share a uniform snake_case `desktop_` prefix with verb or verb_noun forms, which is highly predictable. Minor deviations like desktop_mouse_click (extra noun) and noun-less names such as desktop_screenshot and desktop_snapshot slightly break the pattern but stay readable.
25 tools sits at the heavy end for a desktop-automation surface, and several are near-redundant: check/uncheck/toggle cover the same control states, and double_click/right_click are variants of click. The breadth is justified by the domain, but some consolidation would tighten the set.
Coverage is strong: snapshots, find, per-ref actions, keyboard/mouse input, window management, screenshots, waiting, and a usage guide cover the core automation lifecycle. Gaps remain for drag-and-drop, clipboard read/write, and window move/resize, which agents may need in real workflows.
Maintenance
Related MCP Connectors
Let your AI agent control real iPhones: screenshots, tap, swipe, type and open apps.
iMessage for AI agents, from your iPhone. No Mac needed, and you choose which chats they read.
AI agents on your own iPhone or Android: run tasks in real apps, read the screen, tap and type.
Visual testing for coding agents: your agent sees every UI change it makes and triages each diff.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to control macOS applications through the Accessibility API, AppleScript, and CGEvents, providing structured text output of UI elements and actions without needing screenshots.MIT
- AlicenseAqualityDmaintenanceEnables AI agents to control macOS desktop apps via screenshots, mouse clicks, keyboard input, accessibility queries, and AppleScript.1111 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to inspect and control macOS apps via accessibility trees, screenshots, OCR, and input simulation, with a visible pointer.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to safely and truthfully control local desktop applications via native accessibility trees, supporting element inspection and automation without proprietary binaries or fake success responses.Apache 2.0