chrome-agent-bridge **Universal Chrome control for AI coding agents.** OpenCode · Codex CLI · Claude Code · Aider · Cursor — *if it has a shell, it gets a browser.* [![CI](https://github.com/Zuhair-01/chrome-agent-bridge/actions/workflows/ci.yml/badge.svg)](https://github.com/Zuhair-01/chrome-agent-bridge/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/chrome-agent-bridge?color=6d8bff)](https://www.npmjs.com/package/chrome-agent-bridge) [![node](https://img.shields.io/badge/node-%E2%89%A518-3ddc97)](https://nodejs.org) [![license](https://img.shields.io/badge/license-MIT-ffc861)](LICENSE) [![deps](https://img.shields.io/badge/runtime%20deps-1-9b6dff)](#why-it-exists) **[Landing page & live demo →](https://zuhair-01.github.io/chrome-agent-bridge/)**
--- ## Why it exists AI agents already write code — but they can't *see* what it does in a real browser. Existing bridges fix that for **one** tool (usually via a Claude-only extension with a single-master lock). This project makes browser control a **plain CLI**: no extension, no MCP host requirement, no vendor coupling. ``` any agent shell ──► cab ──► raw CDP over WebSocket ──► your Chrome/Edge ``` ## Quickstart ```bash npm i -g chrome-agent-bridge cab launch # headed Chrome + debug port + session file cab goto https://example.com cab tree # every clickable element as ref_N cab click ref_1 # real mouse events at the ref's center cab see # screenshot -> saved path ``` Headless / CI: ```bash cab launch --headless && cab open https://your-app.dev && cab find "sign in" ``` ## Verbs | Area | Verbs | |---|---| | Setup | `launch [--headless] [--port] [--profile name]` | | Tabs | `open ` · `tabs` · `switch ` · `close` | | Navigate | `goto ` | | Inspect | `tree` · `find ""` · `read` | | Act | `click ` · `type ` · `press Enter` · `hover ` · `scroll ` | | Wait | `waitfor "" [--timeout s]` | | Capture | `see` (screenshot path) | | Debug | `js ""` · `net [filter]` · `console` | Every command is hard-bounded by `CAB_TIMEOUT` (default 45s) so an agent's turn can never hang on a stuck page. ## Agent setup The binary is the same everywhere — only where you teach your agent differs: | Agent | How | |---|---| | **OpenCode** | `cp skills/opencode/SKILL.md ~/.config/opencode/skills/chrome-agent-bridge/` | | **Codex CLI** | append `skills/codex/AGENTS-snippet.md` to `~/.codex/AGENTS.md` | | **Claude Code** | `cp skills/claude/SKILL.md ~/.claude/skills/chrome-agent-bridge/` | | **Anything else** | it's just shell — hand it `cab help` | Skill files encode the full playbook: when to `tree` vs `find`, ref hygiene after navigation, verify-with-`see` loops, and the timeout discipline. ## Design notes - **Refs, not coordinates.** Injected annotation tags interactive elements with stable `data-cab-ref`s; clicks dispatch *real* mouse events (`Input.dispatchMouseEvent`), so React/Vue handlers fire exactly like human clicks. - **Text-first output.** Models reason over text; screenshots are for final visual verification, not as the only channel. - **Stateless CLI.** Each invocation is a fresh process; active port/tab persist in a session file (project-local `.cab-session.json`, global fallback), enabling parallel agents via distinct `--port`/`--profile` combos. - **One runtime dependency** (`ws`). No bundled browsers, no postinstall downloads. ## Comparison vs alternatives | | chrome-agent-bridge | Extension bridges | Playwright MCP | |---|---|---|---| | Codex / OpenCode / any agent | ✅ | ❌ Claude-only | ⚠️ needs MCP host | | No extension install | ✅ | ❌ | ✅ | | Your real logged-in profile | ✅ profiles | ✅ | ❌ fresh context | | CI / headless | ✅ | ❌ | ✅ | | Parallel agents | ✅ ports+profiles | ❌ single master | ⚠️ per-host config | | Bundle size | ~1 MB | extension + host | ~50 MB browsers | ## Development ```bash git clone https://github.com/Zuhair-01/chrome-agent-bridge cd chrome-agent-bridge && npm install npm run build # tsc -> dist/ node dist/cli.js # or: npm link -> cab ``` ## License MIT — see [LICENSE](LICENSE).