claudeers.
// MCP Servers

agent-desktop-router

Three-tier macOS desktop & browser routing with PreToolUse and CoreGraphics safety guards for Claude Code, Codex, and Antigravity

// MCP Servers[ cli ][ api ][ desktop ][ web ][ claude ]#claude#ai-agents#antigravity#claude-code#codex#computer-use#macos#mcp#mcp-servers◷ AGPL-3.0$open-sourceupdated 6 days ago

Install with your AI

Paste into Claude Code, Cursor, or any agent — it reads the repo and wires the tool into your project.

Install and set up agent-desktop-router (git-clone project) into my current project.
Found on https://claudeers.com/agent-desktop-router
Repo: https://github.com/mcncarl/agent-desktop-router
Homepage/docs: —
Detected install method: git-clone → git clone https://github.com/mcncarl/agent-desktop-router
Category: mcp-servers. Platforms: cli, api, desktop, web.
Read the repo's README for exact setup and env vars, then install it and wire it into my project.

Claudeers Health Verdict:
unknown; community-verified: false. Confirm the source before running anything.
// or clone
git clone https://github.com/mcncarl/agent-desktop-router

// compatibility

Platformscli, api, desktop, web
Operating systems—
AI compatibilityclaude
LicenseAGPL-3.0
Pricingopen-source
LanguagePython

Get your FREE $2.50 API credits to access TickAtlas financial data ↗

Agent Desktop & Browser Router (agent-desktop-router)

English | 简体中文

Prefer native APIs over UI clicks, and structured trees over screenshots.

A unified three-tier macOS desktop & browser routing layer — backed by deterministic PreToolUse hooks, a CLI wrapper, and a native CoreGraphics window/coordinate safety guard — for Claude Code, Codex, and Google Antigravity.


Why agent-desktop-router?

Giving an AI coding agent raw Computer Use or desktop access creates three painful problems in daily work:

  1. Everything becomes a slow screenshot loop: Agents click around UIs for tasks that could be done in 50ms via CLI, API, or local file edits.
  2. Your cursor and window focus get hijacked: Traditional GUI automation steals focus and breaks whenever you switch browser tabs.
  3. Prompt-only safety boundaries fail: Telling an agent "never touch WeChat / iMessage / 1Password" in AGENTS.md does not stop an unscoped snapshot, a stale @ref, or an x,y click from landing on a private chat window or Notification Center banner.

agent-desktop-router packages a battle-tested Three-Tier Routing Workflow together with a zero-dependency technical safety gate that works identically across Claude Code, Codex, and Antigravity.


Quick Start

Paste this prompt into Claude Code, Codex, or Google Antigravity:

Clone https://github.com/mcncarl/agent-desktop-router (or update if already cloned),
read docs/INSTALLATION.md, and configure agent-desktop-router for all agents installed
on my Mac. Run scripts/doctor.py afterward and let me know if any macOS Accessibility
permission toggle is needed.

Option B — 2-Line CLI Install

git clone https://github.com/mcncarl/agent-desktop-router.git && cd agent-desktop-router
python3 scripts/install.py --agents auto && python3 scripts/doctor.py

(Use --lang zh to inject Simplified Chinese routing rules into AGENTS.md / CLAUDE.md.)


Architecture: Safety Gate + Three-Tier Escalation

flowchart TD
    Task["Incoming Desktop or Browser Task"] --> Gate["Layer 0: Hard Safety Gate<br/>PreToolUse Hook + CLI Wrapper + Swift CoreGraphics Probe<br/>Blocks private IMs, password managers & Notification Center"]
    Gate --> T1["Tier 1: Native CLI / API / File Edit<br/>ExtendScript · Draft JSON · Local Markdown · Official CLIs<br/>Fastest · Deterministic · Zero UI Touch"]
    T1 -- "Needs live UI or browser" --> WebCheck{"Browser or Desktop App?"}
    WebCheck -- "Codex / Claude (cookie-synced)<br/>or Antigravity (public web)" --> T2A["Tier 2A: Agent Built-in Browser<br/>Zero focus theft, native speed"]
    WebCheck -- "Antigravity (logged-in web)<br/>or Accessible Desktop App" --> T2B["Tier 2B: agent-desktop (Headless Default)<br/>Chrome locked via dedicated --window-id<br/>Obsidian / Electron / Native menu bars<br/>Does NOT move mouse or steal focus"]
    T2A -- "Custom canvas / Visual QA" --> T3["Tier 3: Computer Use Fallback (LCU / Native CUA)<br/>Custom-drawn video timelines · AE dialogs · iPhone Mirroring<br/>Shared local ChatGPT.app CUA engine across all agents"]
    T2B -- "Empty AX tree or headless click ignored" --> T3

Routing Matrix at a Glance

ScenarioSelected TierWhy
Project files, notes, cloud docs, timelines with scriptable APIsTier 1: Native CLI / API / FileMillisecond speed, zero UI flakiness
Web pages in Codex / Claude Code (cookie-synced), or public pages in AntigravityTier 2A: Built-in Agent BrowserFastest web path when the host browser already holds (or doesn't need) cookies
Logged-in web pages in Antigravity (isolated webview) or pure CLI sessionsTier 2B: Chrome Default --new-window + agent-desktop --window-idOpens a clean 1-tab window in your primary Chrome profile (--profile-directory="Default") and locks --window-id so personal multi-tab windows never time out or lose @snapshot:eN refs
Electron & native macOS apps (Obsidian, Finder, menu bars)Tier 2B: agent-desktop (headless)Reads Accessibility tree & clicks in background without moving your cursor
Custom-drawn canvases (CapCut/Jianying, AE modals, FocuSee, iPhone Mirroring)Tier 3: Computer Use (LCU / CUA)Screenshot + vision coordinates handle any pixel-rendered surface
Private IMs, password vaults, macOS Notification CenterBlocked at Layer 0Hard-blocked before tool execution across every agent

Defense-in-Depth Safety Guard (src/guard.py + src/probe.swift)

Unlike prompt-only instructions, agent-desktop-router intercepts calls before execution across all three agent architectures:

  • Claude Code: PreToolUse hook in ~/.claude/settings.json (Bash, mcp__agent-desktop__*, mcp__lcu__*)
  • Google Antigravity: Native Antigravity plugin (~/.gemini/config/plugins/agent-desktop-router/hooks.json)
  • Codex & Terminal: Transparent ~/.local/bin/agent-desktop wrapper invoking guard.py --cli-check

Four Technical Enforcement Checks

  1. Config-Driven App & Compound-Term Filtering: Blocks apps in ~/.config/agent-desktop-router/blocked-apps.json while cleanly honoring allowed_bundles / allowed_terms exemptions (e.g., allowing enterprise work tools like WeCom / 企业微信 and Official Accounts / 微信公众号 while strictly blocking personal WeChat / 微信).
  2. No Blind Frontmost Fallback: Rejects unscoped agent-desktop snapshot, screenshot, find, press, or focus-window calls that would accidentally inspect whichever private window happens to be frontmost.
  3. Live PID, Window & Coordinate Verification (probe.swift):
    • @snapshot:eN → resolves element PID from refmap.json and verifies bundle/owner via NSRunningApplication.
    • --window-id w-1234 → queries CGWindowListCopyWindowInfo to verify the window exists and is not owned by a blocked app.
    • --xy x,y → inspects the full on-screen window stack at (x, y) so coordinate clicks cannot hit a blocked window.
  4. Anti-Bypass & Fail-Closed Design: Blocks agent-desktop batch, xargs, $VAR target interpolation, and wrapper scripts; fails closed if blocked-apps.json is malformed.

Default Protected Surfaces (config/blocked-apps.default.json)

CategoryProtected by DefaultDefault Exemptions (allowed_*)
Private MessengersWeChat (微信, WeChatAppEx, Web WeChat), Apple Messages (iMessage), WhatsApp, Telegram, SignalWeCom (企业微信 / com.tencent.WeWorkMac), WeChat Official Accounts (微信公众号), WeRead (微信读书)
Credentials & Vaults1Password, Bitwarden, macOS Keychain Access (钥匙串访问)—
System SurfacesmacOS Notification Center (block_notification_center: true)dock, menu-bar-extras

Customize ~/.config/agent-desktop-router/blocked-apps.json anytime — changes apply immediately with zero agent restart.


CLI Reference

# Install or update across Claude Code, Codex, and Antigravity (idempotent)
python3 scripts/install.py --agents auto [--lang en|zh] [--no-rules] [--dry-run]

# Check config, native Swift probe, CLI wrapper, Accessibility state & ChatGPT.app signature
python3 scripts/doctor.py [--json]

# Cleanly remove managed hooks, rule blocks & plugin (moves files to macOS ~/.Trash)
python3 scripts/uninstall.py [--purge-config]

# Run the automated test suite
python3 -m unittest discover -s tests -v

See docs/INSTALLATION.md for full setup details, agent-desktop / amontlabs/lcu integration notes, and permission troubleshooting.


Repository Layout

agent-desktop-router/
├── config/blocked-apps.default.json      # Default protected apps & safe work exemptions
├── docs/INSTALLATION.md                  # Human + Agent step-by-step installation runbook
├── scripts/
│   ├── install.py                        # Idempotent multi-agent installer
│   ├── doctor.py                         # Health, Accessibility & bundle diagnostics
│   └── uninstall.py                      # Non-destructive uninstaller (uses ~/.Trash)
├── skills/desktop-browser-routing/       # On-demand operational skill for all 3 agents
├── src/
│   ├── guard.py                          # Zero-dependency Claude / Antigravity / CLI guard
│   └── probe.swift                       # Native CoreGraphics & AppKit window/PID inspector
├── templates/                            # English & Chinese AGENTS.md snippets + plugin assets
└── tests/test_router.py                  # Automated guard, probe & lifecycle tests

Credits & License

// faq

What is agent-desktop-router?

Three-tier macOS desktop & browser routing with PreToolUse and CoreGraphics safety guards for Claude Code, Codex, and Antigravity. It is open-source on GitHub.

Is agent-desktop-router free to use?

agent-desktop-router is open-source under the AGPL-3.0 license, so it is free to use.

What category does agent-desktop-router belong to?

agent-desktop-router is listed under mcp-servers in the Claudeers registry of Claude-compatible tools.

2 views
★ 10 stars
unclaimed
updated 6 days ago

// embed badge

agent-desktop-router on Claudeers
[![Claudeers](https://claudeers.com/api/badge/agent-desktop-router.svg)](https://claudeers.com/agent-desktop-router)

// retro hit counter

agent-desktop-router hit counter
[![Hits](https://claudeers.com/api/counter/agent-desktop-router.svg)](https://claudeers.com/agent-desktop-router)

// reviews

// guestbook

0/500

// related in MCP Servers

🔓

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete…

// mcp-serversf/⟨HTML⟩★ 177,810◷ NOASSERTION[ claude ]
🔓

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io

// mcp-serversfarion1231/⟨Rust⟩★ 155,814◷ MIT[ claude ]
🔓

🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman

// mcp-serversJuliusBrussee/⟨JavaScript⟩★ 121,982◷ MIT[ claude ]
🔓

An open-source AI agent that brings the power of Gemini directly into your terminal.

// mcp-serversgoogle-gemini/⟨TypeScript⟩★ 109,006◷ Apache-2.0[ claude ]
→ see how agent-desktop-router connects across the ecosystem