Skip to main content
Glama

agy-cua-desktop

Fast, Background-First Computer Use MCP Server & Google Antigravity Plugin

Version CI GitHub Stars Node.js >= 20 Runtime Dependencies: 0 Platforms MIT License

English · 简体中文 · Why Computer Use? · Use Cases · Quick Start · Tool Catalog · Security Model · Star History

agy-cua-desktop brings fast, safe Computer Use (desktop GUI + logged-in browser automation on Windows, macOS, and Linux) to Google Antigravity, Claude Code, Cursor, OpenAI Codex CLI, Windsurf, Cline, and Gemini CLI via official Cua Driver. Instead of hijacking your physical mouse and burning tokens on slow full-screen screenshot loops, it pairs zero-screenshot COM introspection (desktop_fast_context), compact 2-tier MCP curation, isolated subagent execution (cua-operator), and built-in PreToolUse safety guardrails—operating desktop apps in the background while you keep typing uninterrupted.

Eager Schema Footprint

Main-Session Screenshots

Explorer / Office Lookup

Turbo-Mode Guardrails

7 Eager (158–326 chars)Fixes get_window_state 4,096-char drop

0Isolated inside cua-operator (flash)

<150 ms COMZero UIA walk via desktop_fast_context

Zero Manual UI RulesPreToolUse force_ask + Self/Vault deny

Why Rethink Computer Use?

Dimension

Traditional Screenshot-Loop Computer Use (3–8 s/step)

agy-cua-desktop (Script-First, Background-First)

Mouse & Focus

Hijacks physical cursor & active window — you must stop typing

Headless background UIA/AX delivery + 120 ms cursor-collision deferral so you keep working uninterrupted

Speed & Token Cost

Repeated full-screen PNGs bloat context & break prompt cache

<150 ms desktop_fast_context COM (0 screenshots) + run_script / run_steps batching 1..64 UI actions in 1 turn

Web + Native Apps

Isolated browser profiles lose SSO/2FA logins & miss native GUIs

Drives tabs inside your already-logged-in Chrome / Edge (browser_*) alongside Win32 / WPF / WinUI / Electron / macOS / Linux apps

Autonomous Safety

Unfiltered clicks risk password leaks or accidental checkout/delete

Dual-layer guardrails: hard-blocks 1Password / Bitwarden / KeePass / UAC & self-targeting, redacts [REDACTED_PASSWORD], prompts confirmation on kill_app / payment / delete

Related MCP server: Hands

Real-World Computer Use Scenarios

  • Explorer + Office → Desktop App Pipelines: Inspect highlighted File Explorer selections & active Excel/Word/PowerPoint documents in <150 ms (0 screenshots) and batch-fill ERP, finance, or legacy desktop forms in the background.

  • Logged-In Browser ↔ Desktop Bridge: Pull live data from internal dashboards in your already-authenticated Chrome/Edge tabs and drive native desktop apps without re-login or anti-bot hurdles.

  • Uninterrupted Multi-Step GUI Batching: Execute 20–60 clicks, form entries, menu invocations, and hotkeys inside a single run_steps or run_script call while you keep coding in your editor.

  • Desktop App E2E Playtesting & Visual QA: Launch and verify Electron, Tauri, WPF, Qt, or SwiftUI builds using deterministic verify_state assertions plus targeted zoom grounding for Canvas/WebGL views.

  • Safe Autonomous ("Turbo") Desktop Assistant: Delegate repetitive GUI chores confidently with built-in password-vault isolation, self-targeting prevention, and native confirmation gates on irreversible actions.

Quick Start

Requirements: Node.js >= 20 + official Cua Driver (--with-driver installs it automatically).

Option A: Google Antigravity Native Plugin (Desktop 2.0, CLI agy, IDE)

Unlocks the full bundle: 2-tier MCP server + cua-operator isolated subagent + PreToolUse Turbo confirmation hooks + 5-tier routing rules.

Windows (PowerShell):

# Plugin only
irm https://raw.githubusercontent.com/Nodifferentiable/agy-cua-desktop/main/install.ps1 | iex

# Plugin + official Cua Driver (with Windows background autostart)
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/Nodifferentiable/agy-cua-desktop/main/install.ps1))) --with-driver

macOS / Linux:

# Plugin only
curl -fsSL https://raw.githubusercontent.com/Nodifferentiable/agy-cua-desktop/main/install.sh | sh

# Plugin + official Cua Driver
curl -fsSL https://raw.githubusercontent.com/Nodifferentiable/agy-cua-desktop/main/install.sh | sh -s -- --with-driver

Any OS (via GitHub npx):

npx -y github:Nodifferentiable/agy-cua-desktop install --with-driver

Option B: Universal Computer Use MCP Server (Claude Code, Cursor, Codex, Windsurf, Cline)

  1. Install Cua Driver once (irm https://cua.ai/driver/install.ps1 | iex on Windows, or /bin/bash -c "$(curl -fsSL https://cua.ai/driver/install.sh)" on macOS/Linux).

  2. Add the stdio MCP server to your client:

# Claude Code one-liner
claude mcp add agy-cua-desktop -- npx -y github:Nodifferentiable/agy-cua-desktop mcp
{
  "mcpServers": {
    "agy-cua-desktop": {
      "command": "npx",
      "args": ["-y", "github:Nodifferentiable/agy-cua-desktop", "mcp"]
    }
  }
}

(Run npx -y github:Nodifferentiable/agy-cua-desktop mcp-config to print copyable JSON snippets.)

TIP

Using Antigravity Desktop Turbo Mode? Zero manual setup in Settings → General → Tool permissions is needed! Built-in hooks.json (PreToolUse) + policy.ts allow routine desktop work automatically while popping native confirmation prompts on kill_app and financial/permanent-delete actions.

Local Clone (Any OS)

git clone https://github.com/Nodifferentiable/agy-cua-desktop.git
cd agy-cua-desktop
node scripts/install.mjs install --with-driver

Per-Repository Installation (Team Sharing)

Install only into <repo>/.agents/plugins/agy-cua-desktop:

node scripts/install.mjs install --project /path/to/your-repo

Standalone Pure MCP Server (Claude Code, Codex, Cursor)

{
  "mcpServers": {
    "agy-cua-desktop": {
      "command": "npx",
      "args": ["-y", "github:Nodifferentiable/agy-cua-desktop", "mcp"]
    }
  }
}

Run npx -y github:Nodifferentiable/agy-cua-desktop mcp-config to print ready-to-paste JSON configs.

Native Antigravity CLI (agy)

agy plugin install /path/to/agy-cua-desktop
agy plugin enable agy-cua-desktop

Ask Antigravity Directly

Clone https://github.com/Nodifferentiable/agy-cua-desktop.git to ~/.gemini/config/plugins/agy-cua-desktop, run `node ~/.gemini/config/plugins/agy-cua-desktop/scripts/install.mjs install --with-driver`, and confirm status with `doctor`.

Architecture

Why Not Raw cua-driver mcp or Custom SDK Scripts?

Capability

Raw cua-driver mcp

Custom SDK Loop (Python/TS)

agy-cua-desktop v0.2.0

Underlying Engine

Official cua-driver

Official cua-driver

Same official cua-driver

Eager get_window_state

4,656 chars (dropped if >4,096 limit)

Manual code only

305 chars (compacted & always active)

Full Desktop Actions

50+ mixed tools in flat list

Hardcoded ~12 tools (misses double-click/drag/zoom)

7 Eager + 45 Lazy (100% desktop + local browser_)*

Explorer / Office Lookup

Slow UIA walk + screenshot

Slow UIA walk + screenshot

<150 ms desktop_fast_context COM probe

Windows Session Pipe

Bare mcp can see 0 windows in sandboxes

Requires separate terminal

Auto-attaches to \\.\pipe\cua-driver daemon

Main-Session Cache

Screenshots bloat main context

Separate process + extra API bill

Isolated in cua-operator (flash), 0 extra API cost

Turbo Mode Safety

Unfiltered clicks & self-targeting risk

Manual prompt rules only

Built-in PreToolUse force_ask + Self/Vault deny

5-Tier Script-First Workflow

rules/AGENTS.md and skills/cua-desktop/SKILL.md guide Antigravity to always solve tasks at the fastest tier:

Tier

Latency

Approach

When to Use

Tier 0

<20 ms

Direct read_file / agy-fast / SQLite / OpenXML

Reading/editing files, configs, .xlsx, .docx, or databases

Tier 1

<150 ms

desktop_fast_context + PowerShell COM / CLI

Resolving visible windows with self/vault flags (all OS), plus open File Explorer paths, highlighted selectedItems, active Excel/Word/PowerPoint docs, and clipboard formats (COM fast path is Windows-native; macOS/Linux use Tier 2/3 AX/AT-SPI)

Tier 2

0 screenshots

run_script (app.query) & run_steps

Batching multi-field forms, conditional UI loops, and target-by-name UIA actions in 1 round trip

Tier 3

0 screenshots

get_window_state (include_screenshot: false, since: "latest")

Refreshing element_token handles or reading filtered UIA subtrees (`query: "kw1

Tier 4

Fallback

zoom + foreground_fallback: true / lazy browser_*

Custom Canvas/WebGL views, apps refusing background input, or tabs inside your logged-in Chrome/Edge

Security Model

Built for Turbo + elevated Windows RunLevel=Highest daemons without losing safety—see SECURITY.md for the 2-minute supply-chain audit:

  1. Self-Targeting Block: Mutating, pointer, keyboard, menu, and kill_app calls targeting Antigravity or cua-driver processes are denied at both PreToolUse and bridge layers.

  2. Vault & UAC Isolation: Both read (get_window_state, zoom) and input calls targeting 1Password, Bitwarden, KeePass, consent.exe (UAC), or CredentialUIBroker are hard-denied; is_password: true UIA fields are redacted to [REDACTED_PASSWORD].

  3. Irreversible Action Confirmation (force_ask): PreToolUse pops a native confirmation prompt on kill_app and UI labels matching financial or destructive actions (Pay, Transfer, Checkout, Delete Forever, Format Disk), even in Turbo mode.

  4. Visual Prompt-Injection Isolation: cua-operator runs with commandExecutionPolicy: off, preventing untrusted text seen on screen from executing arbitrary shell commands.

  5. Collision Guard, Panic Stop & Audit: Foreground escalations sample get_cursor_position over 120 ms and defer (user_cursor_active_deferred) if your physical mouse is moving; desktop_panic_stop halts all sessions immediately (cua-driver revoke --all); metadata-only logs write to ${PLUGIN_DATA}/audit.jsonl (512 KB cap).

CLI & Configuration

# Inspect status, daemon pipe, hooks, and active policy
node ~/.gemini/config/plugins/agy-cua-desktop/scripts/install.mjs doctor

# View or adjust policy overrides (~/.gemini/config/agy-cua-desktop.json)
node ~/.gemini/config/plugins/agy-cua-desktop/scripts/install.mjs config --show
node ~/.gemini/config/plugins/agy-cua-desktop/scripts/install.mjs config --mode strict-background --browser off
node ~/.gemini/config/plugins/agy-cua-desktop/scripts/install.mjs config --reset

# Emergency stop all active Cua Driver sessions
node ~/.gemini/config/plugins/agy-cua-desktop/scripts/install.mjs panic

Config Key (agy-cua-desktop.json)

Env Override

Default

Values

policyMode

AGY_CUA_POLICY_MODE

"smart"

"smart" · "strict-background" · "unrestricted"

enableBrowserTools

AGY_CUA_ENABLE_BROWSER_TOOLS

true (in smart)

true · false

textOnly

AGY_CUA_TEXT_ONLY

false

true · false

maxTextBytes

AGY_CUA_MAX_TEXT_BYTES

28672

2048..262144

collisionCheckMs

AGY_CUA_COLLISION_CHECK_MS

120

0..1000

socket

AGY_CUA_SOCKET

Auto-detected

e.g. \\.\pipe\cua-driver

Example Prompts

  • "Check what folder and files I currently have selected in File Explorer and summarize them (use desktop_fast_context, no screenshots)."

  • "Use cua-operator to fill out the open desktop app form in the background while I keep typing here."

  • "In my already-logged-in Chrome window, inspect the active tab and export the report without opening a new browser profile."

Tool Catalog

When connected to cua-driver, agy-cua-desktop exposes 7 compact Eager tools + 45 on-demand Lazy tools (filtered by OS and safety policy; shell_execute and install_extension are always blocked):

Tool / Group

Tier

Purpose

desktop_doctor

Eager

Diagnose cua-driver binary, daemon pipe/autostart, hooks, and active policy

desktop_fast_context

Eager

Zero-screenshot window list (self/vault tags) + Windows Explorer/Office/Clipboard COM probe

list_windows

Eager

Enumerate open windows (pid, window_id, app_name, title, bounds)

get_window_state

Eager

Compact UIA tree (since:"latest" diff, query:"a|b", optional screenshot; 305-char schema)

run_steps

Eager

Batch 1..64 desktop actions (wait_for, expect, observe, foreground_fallback)

run_script

Eager

Run headless JavaScript (cua.getApp, app.query) in Cua Driver's sandbox

verify_state

Eager

Assert 1..8 deterministic window or element predicates

Pointer, Keyboard & Window Controls

Lazy

click, double_click, right_click, drag, set_value, type_text, press_key, hotkey, scroll, invoke_menu, launch_app, kill_app, set_window_frame, etc.

Local Logged-In Browser (browser_*)

Lazy

Drive tabs in your already-open Chrome/Edge (browser_prepare, get_browser_state, browser_click, browser_type, browser_navigate, browser_download, etc.)

Visual Grounding & Session Lifecycle

Lazy

zoom, parse_visual_regions, get_accessibility_tree, start_session/end_session, get_guide

desktop_panic_stop

Lazy

Emergency kill-switch: runs cua-driver revoke --all and resets bridge state

Project Layout & Platform Troubleshooting

agy-cua-desktop/
├── plugin.json                # Antigravity plugin manifest
├── mcp_config.json            # 2-tier MCP server config (7 Eager tools)
├── hooks.json                 # Turbo-ready PreToolUse multi-path hook loader
├── src/ & dist/               # TypeScript source -> zero-dep ESM bundles
├── rules/AGENTS.md            # Always-on 5-tier script-first routing rules
├── agents/cua-operator.md     # Flash multimodal-isolated subagent (commandExecutionPolicy: off)
├── skills/cua-desktop/        # On-demand skill & optional native YAML policy reference
├── scripts/install.mjs        # CLI (install, update, uninstall, doctor, config, panic, mcp)
└── install.ps1 / install.sh   # Cross-platform one-command installers
  • Windows (cua-driver sees 0 windows or pipe unavailable): Run cua-driver autostart enable ; cua-driver autostart kick, then run node ~/.gemini/config/plugins/agy-cua-desktop/scripts/install.mjs doctor to verify \\.\pipe\cua-driver.

  • macOS (missing Accessibility tree or screenshots): Run cua-driver permissions grant and enable Accessibility & Screen Recording for your terminal / Cua Driver.

  • Linux (headless or Wayland issues): Ensure cua-driver serve is started inside an active X11/XWayland desktop session.

  • Updating & Uninstalling: Run node ~/.gemini/config/plugins/agy-cua-desktop/scripts/install.mjs update (preserves your custom rules/AGENTS.local.md) or uninstall to remove cleanly.

Contributing, Security & License

Star History

If agy-cua-desktop powers up your Computer Use workflows, please give it a ⭐ Star on GitHub so more developers can discover it!

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to autonomously control Windows 11 and 10 desktops via sub-10ms screen capture, native UI Automation element inspection, and zero-lag keyboard and mouse input. Combines a visual plane with a semantic plane and stall detection so agents can operate real applications reliably without vision-only guessing.
      764 npm
      262 PyPI
      7
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to inspect and operate Windows desktop applications and Chrome tabs in the background while the user retains mouse, keyboard, and window control. It provides consent prompts, hard deny lists, visible activity indicators, and an emergency stop for safer computer use.
      1
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to observe and drive Windows desktop applications in the background through UI Automation and Win32 messages, without taking over the user's mouse, keyboard, or foreground window. Every action is read back and verified, and outward actions are held for explicit confirmation.
      6
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI clients to automate Windows desktop applications through protocol-first, background-safe window inspection, screenshots, clicks, typing, scrolling, browser CDP control, batch pipelines, and built-in safety guardrails without hijacking the physical mouse or focus.
      MIT