The Creation of Adam — two hands nearly touching, a spark between them

# chrome-bridge **English** | [中文](README.zh-CN.md) [![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Node ≥ 18](https://img.shields.io/badge/node-%E2%89%A5%2018-339933)](https://nodejs.org) [![zero dependencies](https://img.shields.io/badge/dependencies-0-brightgreen)](package.json) **Your AI agent works in the Chrome you already use.** Open tabs, logged-in accounts, SSO. No second browser, no debugging port, no logging in again. - **One extension and a local Node CLI** for any agent that can run a shell command, on any model: Claude Code, another coding agent, your own script. - **Works where [Claude's own Chrome integration](https://code.claude.com/docs/en/chrome) doesn't:** Claude Code on Amazon Bedrock, Google Cloud (Vertex), Microsoft Foundry or an API key. - **Each step shows in a 🟣 pill on the tab.** One click on it takes the tab back. It reaches only the Chrome profiles that have the extension. Try: "I'm signed in to staging. Save fails: check the console and network, and tell me why." **[Install from the Chrome Web Store](https://chromewebstore.google.com/detail/chrome-bridge/kmhjlnokjigmnimgjjmiahlinjbcebkg)**, then paste its setup prompt to your agent. [How it compares](#pick-this-when) · [Claude.ai instead?](#cloud-bridge-preview) ![a driven tab in motion — the 🟣 pill narrates each action, a purple frame lights up while a command runs, the pointer flashes where the agent clicks](docs/demo.gif) On your computer the connection is local and nothing goes to chrome-bridge's developer; **your agent may send what it reads from a page to its model provider**. With Claude.ai connected through Cloud Bridge (off until you connect it), what the AI app reads and does in your Chrome also passes through the Cloud Bridge server: [PRIVACY.md](PRIVACY.md) says what it keeps. ## Quick start Needs macOS or Linux (Git Bash on Windows), Chrome ≥ 117 and Node ≥ 18. **Chrome Web Store (easiest).** Install the extension, click its toolbar button, choose **Copy setup prompt**, and paste the prompt to your agent (Claude Code, Cursor, …). The agent downloads the bridge, starts it, checks the connection and reports back. When it's done, the popup's title has a green dot and reads **Ready for your AI agent**. **From source.** Tell your agent: ```text read https://raw.githubusercontent.com/siropkin/chrome-bridge/master/docs/agent-setup.md and do what it says ``` It clones the repo, starts the bridge and sets up its own integration. Then it asks you for the one step Chrome won't let a script do: open `chrome://extensions`, turn on Developer mode, click **Load unpacked** and pick the `extension/` folder. Skip that step if you installed from the Web Store. Loading both copies makes every command ask for `--profile`.
Agent can't open URLs? Paste this prompt instead ````text Set up chrome-bridge — the bridge that lets you drive my real, logged-in Chrome — and install your end of it. Do every step yourself and tell me the result of each. The only thing I do is the one-time extension load in Chrome (step 3). 1. Pick the repo root ``: - if your working directory is already a chrome-bridge checkout (it contains `cli.mjs` and `AGENTS.md`), use it; - else if `~/chrome-bridge/cli.mjs` exists, run `git -C ~/chrome-bridge pull --ff-only` (if the pull fails, show me the error and keep the existing copy) and use `~/chrome-bridge`; - else if `~/.chrome-bridge/cli.mjs` exists (an npm install), update and use it the same way (`git -C ~/.chrome-bridge pull --ff-only`, then `~/.chrome-bridge`); - else clone it and use `~/chrome-bridge`: ``` git clone https://github.com/siropkin/chrome-bridge.git ~/chrome-bridge ``` (if the clone fails — e.g. `~/chrome-bridge` exists with other content — show me the error and stop; don't delete or move anything) Substitute `` with the real path everywhere below. 2. Bring the bridge up on this checkout's code (needs Node ≥ 18 — if Node is missing or older, install it: macOS `brew install node`, Linux your package manager, Windows nodejs.org; if installing needs a password or fails, tell me and stop): ``` node /cli.mjs stop node /cli.mjs start node /cli.mjs health ``` (`stop` reporting "nothing was running" is fine; the stop-then-start pair guarantees the server runs the code you just fetched, not some older copy from another location — a loaded extension reconnects on its own.) - health prints a ⚠ line saying the bridge and the extension differ → the line names the fix. `update` (a Chrome Web Store extension): step 4 runs it, go on. `extreload` (an unpacked one): run `node /cli.mjs extreload` (reloads the extension from disk), then re-run health; if the warning persists, ask me to reload the extension at `chrome://extensions`. - health reports `"extension":true` → jump to step 4. - health reports `"extension":false` → step 3. But if the extension was connected before your restart, wait ~10s and re-run health once first — it reconnects on its own after a server restart. - `stop` or `start` refuses and its message ends with `Next: see who holds the port …` → a program the bridge can't check holds the port, usually a bridge server left running from before an update. Run the command from that message: on macOS and Linux it lists the one program that holds the port (on Windows it names `netstat`: take the line marked `LISTENING`). Look at that process's command line (macOS and Linux: `ps -p -o command=`). If it is `node` running `server.mjs`, it is an old chrome-bridge server: quit that process, run `start` and `health` again and go on. If it is another program, or nothing is listed, tell me what you found and stop. - server won't start for another reason → show me the error and the last lines of `/server.log` (if it exists), then stop. 3. The one click only I can do — unless I installed Chrome Bridge from the [Chrome Web Store](https://chromewebstore.google.com/detail/chrome-bridge/kmhjlnokjigmnimgjjmiahlinjbcebkg), in which case skip this step entirely: the store copy connects on its own, and loading the unpacked folder too creates a second profile seat that makes every command demand `--profile`. Otherwise: ask me to open `chrome://extensions`, enable Developer mode, click Load unpacked, and select the `/extension` folder. On macOS you may run `open -a "Google Chrome" "chrome://extensions"` first. Then poll `node /cli.mjs health` every 5s (up to ~90s) until it reports `"extension":true`; if it doesn't, tell me what's still missing and stop — don't keep polling. 4. Match the bridge to the extension Chrome runs: `node /cli.mjs update` — a Chrome Web Store extension gets the release that matches it (the latest code can be ahead of the store), an unpacked one follows the branch; the bridge restarts if anything changed. If it refuses (local edits or commits in ``), leave the copy as is and say so in your final report. 5. Install your integration — pick the ONE that applies to you: - Claude Code or GitHub Copilot in VS Code (both load skills from `~/.claude/skills`) — link the skill so it auto-loads on browser tasks in every project and tracks every repo update (use `./.claude/skills/` instead of `~/.claude/skills/` only if I told you to scope it to this project): ``` rm -rf ~/.claude/skills/chrome-bridge && mkdir -p ~/.claude/skills && ln -s /.claude/skills/chrome-bridge ~/.claude/skills/chrome-bridge ``` (without the trailing slash, `rm -rf` removes only an old symlink or copy, never the repo. On Windows / Git Bash without symlink rights, fall back to `cp -r /.claude/skills/chrome-bridge ~/.claude/skills/` — and re-copy after every update, a copy goes stale) - any other agent (Cursor, Qwen, GLM, Kimi, …) — append this line to the instructions file you read at session start (`CLAUDE.md`, `AGENTS.md`, `.cursorrules`, …; create it in the project you're working in if none exists), but only if it's not already there. If your instructions live somewhere you can't edit, print the line and tell me to paste it there: ``` To drive my Chrome browser (real logged-in tabs), read /.claude/skills/chrome-bridge/SKILL.md and run `node /cli.mjs `. If the health check fails, run `node /cli.mjs start`; it waits briefly for an already-loaded extension to reconnect. If health still reports the extension disconnected afterward, tell me to reload it. ``` 6. Tell me the bridge is up. From the next session your integration auto-loads; in this one, read `/.claude/skills/chrome-bridge/SKILL.md` when a browser task comes up. Later updates are one command: `node /cli.mjs update` — it brings the checkout to the code matching my extension (the branch for an unpacked build, the matching release for a Chrome Web Store one) and restarts the bridge; run it whenever health warns that the bridge and the extension are out of step. ````
**By hand.** ```bash git clone https://github.com/siropkin/chrome-bridge && cd chrome-bridge && ./install.sh ``` Load the `extension/` folder as described above, then connect your agent the way `install.sh` prints: link the skill (Claude Code, Copilot in VS Code), or point any other agent at [SKILL.md](.claude/skills/chrome-bridge/SKILL.md), the operating manual. Check that it worked: `node cli.mjs health` should print a line that starts `{"ok":true,"extension":true`. You won't see anything in Chrome until the agent sends its first command; that's normal. To point the agent at one exact tab, use **Copy tab ID for my agent** in the toolbar popup and paste what it gives you (`id:… --profile `). The popup's header (*Chrome Bridge · poplar profile*) shows the name the agent uses for the profile you're in, so you can answer when it asks which profile to use. ## Pick this when - **The agent should work in the Chrome you have open**, not in a second browser or a copied profile ([a copy loses its logins since Chrome 136](#chrome-136-broke-copying-or-reusing-your-chrome-profile)). - **Your agent runs shell commands**, whatever model is behind it. That includes Claude Code on Bedrock, Vertex, Foundry or an API key, where [Claude's own Chrome integration is off](#claude-in-chrome-requires-a-claudeai-subscription). - **You want to see each step on the tab** and take a tab back in one click, with several Chrome profiles told apart by name. - **You want few moving parts**: one extension, a local Node server and CLI with no third-party dependencies, MIT. Pick something else when: - **You need repeatable regression tests in CI.** That is [Playwright Test](https://playwright.dev/docs/intro); chrome-bridge's interactive checks don't replace a test runner. - **You want an MCP server on your computer, not shell commands.** The Playwright extension, Chrome DevTools MCP and Browser MCP are in the table below. (chrome-bridge's MCP side is [Cloud Bridge](#cloud-bridge-preview), a hosted relay.) - **You want to approve each connection and pick the tabs.** Playwright's extension asks; a local chrome-bridge agent can use any tab in a connected profile without asking first. - **You only use Claude Code on a direct Anthropic plan, or the ChatGPT desktop app.** Their own integrations are in the table too. ### How it compares Based on the linked official documentation, checked 2026-11-30. These are workflow trade-offs, not a ranking or a benchmark. | Option | Where it fits | |---|---| | **Chrome Bridge** | A small, MIT-licensed extension plus local Node server/CLI with no third-party runtime dependencies. Designed around existing Chrome tabs, shell commands, scoped/diff snapshots, in-page action narration, and explicit profile routing. A local agent can use any tab in a connected profile without asking first; you see it on the tab and can take the tab back. | | **[Playwright extension + MCP](https://github.com/microsoft/playwright/tree/main/packages/extension#readme)** | Also connects to existing logged-in tabs. Its documented controls include connection approval, per-client tab groups and disconnection. It is a valid alternative for an MCP-based workflow. | | **[Playwright CLI + skills](https://github.com/microsoft/playwright-cli)** | Shell commands for coding agents, without MCP. `playwright-cli attach --extension=chrome` connects to your running Chrome through the Playwright extension: you approve the connection and pick the tabs, and each session gets its own tab group. `playwright-cli show` opens a dashboard to watch and control sessions. Works with any agent that can run a shell command. Open source (Apache-2.0). | | **[Chrome DevTools MCP](https://github.com/ChromeDevTools/chrome-devtools-mcp)** | The Chrome DevTools team's MCP server, with a `chrome-devtools` CLI and skills. With `--autoConnect` it attaches to the Chrome you have running (Chrome 144 or newer) after you switch on remote debugging at `chrome://inspect/#remote-debugging`. Chrome asks for permission for each debugging session and shows a banner. With several profiles open it connects to the default one. Open source (Apache-2.0). | | **[Browser MCP](https://browsermcp.io)** | An extension and a local MCP server for Claude Code, Cursor, Codex and other MCP apps. You allow it once with a six-digit code; agents then work in tab groups of their own, and you drag a tab in to hand it over. **Stop** in its popup pauses every agent. Its MCP server is open source (Apache-2.0). | | **[ChatGPT browser extension](https://learn.chatgpt.com/docs/chrome-extension)** | Lets the ChatGPT desktop app read and act in Chrome, Edge, Brave, Opera or Vivaldi on sites where you are signed in. ChatGPT asks per website (Allow once, Allow for this site, Allow for all sites, Decline) and keeps an allowlist and a blocklist. ChatGPT only, and it needs the desktop app. | | **[Claude in Chrome + Claude Code](https://code.claude.com/docs/en/chrome)** | Integrates browser testing, form filling and debugging into Claude Code, including its VS Code extension, and shares browser login state. It needs a direct Anthropic plan (Pro, Max, Ultra, Team or Enterprise) and a claude.ai sign-in ([more below](#claude-in-chrome-requires-a-claudeai-subscription)). | Working with any agent is a difference from Anthropic's and OpenAI's own integrations, not from Playwright, Chrome DevTools MCP or Browser MCP. chrome-bridge still needs an extension, Node and a local server, and some sites or commands need you or a visible tab. There is no published head-to-head benchmark establishing that Chrome Bridge is faster, safer, more reliable or more token-efficient than these alternatives. The demos show capabilities on specific pages, not superiority or universal website compatibility. ### "Claude in Chrome requires a claude.ai subscription" That is the message Claude Code users on API billing report from `claude --chrome` ([anthropics/claude-code#17656](https://github.com/anthropics/claude-code/issues/17656)). [Claude's documentation](https://code.claude.com/docs/en/chrome) says its Chrome integration is not available through Amazon Bedrock, Google Cloud's Agent Platform (Vertex) or Microsoft Foundry, stays off when you sign in with an API key or a long-lived token, and is not available to organizations with Zero Data Retention. chrome-bridge has no sign-in of its own: it works with any agent that can run a shell command, however that agent reaches its model. The local link sends nothing to chrome-bridge's developer; what the agent reads from a page goes to the model provider you already chose. Playwright CLI and Chrome DevTools MCP, in the table above, don't depend on a Claude plan either. ### Chrome 136 broke copying (or reusing) your Chrome profile Since Chrome 136 (May 2025), Chrome ignores `--remote-debugging-port` on your default profile, and a copied profile loses its logins ("Failed to decrypt", "Chrome is already in use"). chrome-bridge runs inside the Chrome you already have open, so none of that applies: no debugging port, no profile copy, no relaunch. Since Chrome 144 there is a built-in way back: switch on remote debugging at `chrome://inspect/#remote-debugging`, and a tool such as Chrome DevTools MCP (`--autoConnect`) can attach to the Chrome you have running. Chrome asks you to allow each new debugging session and, with several profiles open, connects to the default one; chrome-bridge is allowed once, when you install it, and you name the profile. ## How it works The extension connects to a small local server on `127.0.0.1:9333`. Your agent drives it through the CLI: ```bash node cli.mjs snap localhost:8082 # the page as a compact tree with element refs node cli.mjs snap localhost:8082 --text # the page's visible text: articles, messages, tables node cli.mjs click localhost:8082 @e4 # click by ref node cli.mjs fill localhost:8082 @e2 "hello@example.com" node cli.mjs shot localhost:8082 out.png # screenshot, only when pixels matter node cli.mjs shot localhost:8082 pr.png --max 0 # full-res screenshot for a PR or chat node cli.mjs shot localhost:8082 pr.png --max 0 --box @e4 --label "New button" # the same, with a numbered red box around what changed ``` It works in the background: reading a page and most actions don't switch your tab or window ([which ones need a page in front](.claude/skills/chrome-bridge/reference/recipes.md#minimize-focus-changes)). A few steps need real key or mouse input, or a file picker. For such a step in a background tab the bridge tells that one page it is in front, with your tab and window left alone, and says so to the agent: the page may then mark what it shows as read, as it would if you had looked at it. A `snap` shows the page as a short text tree. The agent can limit it to one part of the page or get only what changed since the last snap, and it acts on the `@e` refs instead of guessing pixel coordinates. The tree holds controls and headings, not paragraphs: `snap --text` prints the text a person sees on the page (or on one part of it), 20,000 characters at a time. A dialog that blocks the page, such as a cookie-consent banner, always shows up in it, even when the page is too big to list in full: ``` table "Hacker News new | past | comments | ask | show | jobs | submit" @e1 link "Hacker News" @e5 link "new" @e6 link "submit" @e12 table "1. Playa Phone (playaphone.com) 122 poin… hide | 41 comments" @e14 link "Playa Phone" @e16 link "41 comments" @e21 ``` Writing your own agent loop? Skip the CLI and send JSON to `POST http://127.0.0.1:9333/cmd`, for example `{"type": "snap", "urlMatch": "…"}`, signed with your account's local key (unsigned requests get `401`). From Node: `import { bridgeFetch } from '/localauth.mjs'`, then `bridgeFetch('http://127.0.0.1:9333', '/cmd', { method: 'POST', body: JSON.stringify({ type: 'snap', urlMatch: '…' }) })`. `bridgeFetch` dials `http://127.0.0.1:` only: it refuses `localhost` and every other host, where another program may answer, and it follows no redirect. From another language, the two-step protocol is described at the top of [`localauth.mjs`](localauth.mjs). ## Example workflows - "Check my dashboard every morning and post the change to Slack." A cron-launched agent uses the tab that's already logged in. If a login wall shows up, `wait --human` hands the tab to you. - Fill a CMS from a CSV without logging in again. - Compare a staging build against the Figma mockup. [The mockup-comparison recipe](.claude/skills/chrome-bridge/reference/recipes.md#compare-implementation-vs-mockup) is the checklist, and there's an 8px alignment grid overlay. - Go back or forward in a tab, as its Back button does: `nav --back`, `nav --forward`. - See a tab's cookies, also the ones scripts cannot read (debugging a login): `cookies `, and one whole by its name: `cookies ` (the command line only). - Time a page load (first paint, the largest picture, layout jumps, the slowest files): `perf --load` (it reloads the page). - Find the file a click downloaded: `downloads` lists the newest files in the downloads folder with their full paths. - Read what a page's Copy button put on the clipboard: `clipboard` (the command line only, never a cloud AI app). - Click a point of a canvas, a map or a chart, or a field inside another website's frame: `click --at 640,380 --trusted`. - Save a page as a PDF, as it is now in the tab: `shot page.pdf`. - Show a person or a pull request what the agent did: `record start`, the steps, then `record stop clip.png` saves one animated PNG with a picture after each step and the step written under it (the command line only). - Select a word in an editor, then press the page's Bold: `select "ready"`, then `click`. - Right-click something to open the page's own menu: `click --right` (add `--trusted` for a real right click). - See a page in a mobile view without resizing your window: `emulate 390 844 mobile`. - See a page in dark mode, offline, on a slow network or in another city, for that tab only: `emulate dark`, `emulate offline`, `emulate slow`, `emulate geo 38.72 -9.14`; `unemulate ` ends it. - Work in an existing authenticated session, including SSO and internal dashboards behind a VPN. This does not bypass login challenges or anti-bot restrictions. A real run, checked live on GitHub: [recipes/github.com.md](recipes/github.com.md) sets a repo's social preview image. If chrome-bridge works for you, a [★ rating on the Chrome Web Store](https://chromewebstore.google.com/detail/chrome-bridge/kmhjlnokjigmnimgjjmiahlinjbcebkg/reviews) helps other people find it. ## You stay in control - **A local agent can reach every tab in the Chrome profiles where the extension is installed**, signed in as you: your email, your bank, your work consoles. There is no per-site block list for local agents (Cloud Bridge has one for cloud AI apps). The fence is a separate Chrome profile: install the extension only in the profile you want agents to use, and chrome-bridge gives them no way into your other profiles. What an agent reads from a page, it may send to its model provider. - **Every tab the agent touches wears a 🟣 pill**, including tabs it only reads. The pill shows what's happening right now (`🟣 taking screenshot…`) and keeps a history of past actions. Driven tabs also join a 🟣 tab group, which a page can't fake. - **⏏ on the pill disconnects the agent from that tab.** The bridge refuses subsequent commands until an explicit `mark`; the agent is instructed to ask you before reclaiming it. An action already running may still finish. This is a workflow control, not a security boundary against a malicious local agent. - **The toolbar popup hands a tab back in one click**: while the agent works in the tab you're on, **⏏ Release this tab** gives it back — the same as the ⏏ on the page's pill, and it also works on pages that can't show the pill (chrome://, PDF, the Web Store). - **Switch a profile off for local agents**: popup → ⚙ → **Local AI agents** (on by default). Off, that Chrome profile disconnects from the helper on your computer — agents there can't see or use it, and any tab they were driving is handed back. Cloud AI apps aren't affected. - **Be asked before an agent starts**: popup → ⚙ → under **Local AI agents**, **Ask me before an agent starts working here** (off by default). On, an agent on your computer gets nothing from that profile until you say yes: its commands are refused, the toolbar icon shows **?**, and the popup's first screen asks, with the time it asked: **Allow** or **Not now**. After a yes the agent runs its command again; the yes lasts until Chrome restarts or the extension updates. No window opens over your other apps. **Stop allowing** in the popup takes a yes back; a step already running may still finish. Cloud AI apps have their own Ask rules. - **`node cli.mjs watch`** prints every command live in your terminal. ![Actual on-page action history and release control, enlarged from a local test session](docs/store/screenshot-5-controls.png) ## Cloud Bridge (preview) No terminal? Cloud Bridge connects Claude.ai to the same Chrome, with nothing else to install. It is a relay between the AI app and this extension, and it is off until you connect it: 1. [Install the extension](https://chromewebstore.google.com/detail/chrome-bridge/kmhjlnokjigmnimgjjmiahlinjbcebkg) and click its toolbar button. On the first screen click **Using Claude.ai in your browser? Connect it here**, then **Connect**. (That line shows while no agent on your computer is connected. Otherwise: ⚙ Settings → **Cloud AI apps** → **Connect**.) 2. A tab opens on Cloud Bridge: sign in with GitHub (a free account works; it is only your sign-in) and click **Connect**. 3. That page gives you a link and the steps to add it to Claude as a custom connector. Then start a new chat and type: "Use Cloud Bridge to list my open tabs." - **Who runs it.** The public Cloud Bridge (`https://cloud-bridge.ivan-seredkin.workers.dev`) is run by the chrome-bridge developer. While it is on, what the AI app reads and does in your Chrome passes through it: [PRIVACY.md](PRIVACY.md) says what it keeps. It is open source ([siropkin/cloud-bridge](https://github.com/siropkin/cloud-bridge)), and you can deploy your own. - **You set the rules.** On your Cloud Bridge page every kind of step is **Allow**, **Ask** or **Off** for each Chrome profile, and **Websites AI apps can't use** lists the sites they may not read or act on. Cloud AI apps can't read files on your computer and are refused at addresses on your computer or home network (a public web name that points into your network isn't caught). A network capture (`net`) gives them no cookies and nothing a page sent, since a sign-in form sends the password; the command line's `net` on your computer shows both. Local agents aren't affected. - **Off again in one switch.** Popup → ⚙ Settings → **Cloud AI apps** off signs this browser out of Cloud Bridge at once. - **Other AI apps.** Any app that can add a remote MCP server with sign-in (OAuth) can add the same link (ChatGPT on the plans that allow custom connectors). Everything else is in [the cloud-bridge README](https://github.com/siropkin/cloud-bridge#using-it-with-chrome-bridge): your Cloud Bridge page, the rules and the question window, the tools an AI app gets, and what a local agent sees while both links are on. ## Security You're giving an agent your logged-in browser, so the design assumes you want to watch it work. - **Local by default.** The server listens on `127.0.0.1` and rejects requests that come from web pages, so a site you visit can't drive it. Commands must also be signed with a key only your user account can read, created automatically when the server first starts (see *Local key* under Install detail). So a program run by **another user account** on the same computer can't send commands, and the CLI won't send yours to a program on port 9333 that can't prove it holds the same key. The extension proves itself to the server with the same key on every connection, and only after the server proved it first, so another account can neither pose as the server to your extension nor as your extension to the server. Programs you run yourself can always drive the bridge. An extension that can't prove itself gets no connection. [Cloud Bridge](#cloud-bridge-preview) is a separate link, off until you pair a profile: while it is on, commands and their results pass through a hub (the developer's, or your own). - **Readable code.** The extension is four unminified scripts (`background.js`, `commands.js`, `popup.js`, `ask.js`), two pages (`popup.html`, `ask.html`) and a manifest, all in [`extension/`](extension), with no build step. The Web Store build is those files, zipped from the release tag. To check, run this in your chrome-bridge folder: ```sh d=$(mktemp -d) && curl -sL -o "$d/cb.crx" 'https://clients2.google.com/service/update2/crx?response=redirect&acceptformat=crx3&prodversion=999.0&x=id%3Dkmhjlnokjigmnimgjjmiahlinjbcebkg%26uc' unzip -q "$d/cb.crx" -d "$d/store" # unzip warns about extra bytes at the start (the store's signature header): expected mkdir "$d/tag" && git fetch -q --tags && git archive "v$(sed -n 's/.*"version": "\(.*\)".*/\1/p' "$d/store/manifest.json")" extension | tar -x -C "$d/tag" diff -r "$d/store" "$d/tag/extension" ``` The only differences are what the store adds: an `update_url` line in `manifest.json` and a `_metadata/` folder (its signatures). - **Page content is untrusted.** Anything the bridge returns may contain prompt injection; the rules agents follow are in [the skill](.claude/skills/chrome-bridge/SKILL.md). Be careful with `upload`: it reads any local file the agent names into the page. Never let a page decide what gets attached. - **Found a hole?** Report it privately: [SECURITY.md](SECURITY.md) has the form, and what is and isn't protected. - **Exported history leaves out secrets.** `history --batch` comments out typed and pasted text, dialog answers and upload paths, so the file is a draft to edit, not a script to run: its first two lines say so. - **Some commands attach Chrome's debugger.** `net`, `emulate`, `shot`, `upload` and `dialog` do, and so do `--trusted` steps, `scroll --until` on a background tab, a `drag` of something the page lets you drag with the browser's own drag and drop, and a Cloud AI app's `nav --back` or `--forward` (to read where the tab's history goes before it goes there). While they run, Chrome shows its "started debugging this browser" bar, which goes away when the command finishes. A `dialog` given before the page asks keeps it until the next step ends (60 seconds at most); on a background tab the page is told it is in front for that time. Pages can detect the debugger, and anti-bot systems may flag the session. `snap`, `click`, `fill`, `eval` and the other commands don't attach it — except on sites whose security policy forbids page scripts from evaluating code (GitHub, Hacker News, MDN…), where each command attaches it for a moment. `snap --text` never attaches it, on those sites either. ## Commands Commands that work on a tab take a ``: part of the tab's URL or title, or an exact `id:`. `node cli.mjs help ` prints one command's usage. The full reference, with every flag, is in [reference/commands.md](.claude/skills/chrome-bridge/reference/commands.md); gotchas are in [reference/recipes.md](.claude/skills/chrome-bridge/reference/recipes.md#gotchas). - **Read:** `snap` · `shot` · `record` · `measure` · `perf` · `console` · `net` · `fetch` · `eval` · `ask` - **Act:** `click` · `fill` · `type` · `paste` · `press` · `hover` · `drag` · `scroll` · `upload` · `clear` · `dialog` - **Tabs:** `tabs` · `open` · `nav` · `close` · `activate` · `wait` (`--js` polls a page condition, `--human` hands a tab to you) - **Device view:** `emulate` · `unemulate` · `resize` · `grid` - **Housekeeping:** `mark` · `release` · `note` · `watch` · `history` · `doctor` · `batch` - **Server:** `start` · `stop` · `health` · `profiles` · `extreload` · `swlogs` ## Local Diagnostic Logging For a later review of failures, retry loops, and missing features, open the extension popup's ⚙ Settings and turn on **Diagnostic logs**. It is **off by default**, local only, and shared across connected profiles. Choose a rolling size limit (1-100 MiB, default 10 MiB); view usage or delete the logs in the same panel. The JSONL files in `.diagnostics/` record correlated command outcomes, timings, error categories, and privacy-preserving fingerprints, not raw page content, input values, or eval code. The existing `watch`/`history` feed stays in memory; command activity is not written to `server.log`. See [collection, privacy, and week-later analysis](docs/diagnostics.md). ## Install detail
Upgrades, port, Windows, several Chrome profiles **Upgrading.** One command updates the checkout and restarts the server on the new code: ```bash node cli.mjs update node cli.mjs extreload # unpacked install only, when health asks for it ``` `update` matches the checkout to your extension. An unpacked build follows the branch; a Web Store build gets the release that matches the extension Chrome installed, since the latest code can be ahead of the store. It never moves local edits or commits, and `update --check` shows the plan first. `health` warns about anything out of step: a server still running old code after a pull, an extension older or newer than the checkout. **Web Store install.** Chrome updates the extension by itself, but not your bridge download. The extension takes an update between tasks, never while a command runs or a tab is driven. When they differ, `health` (and every command on that profile) says so, and the popup shows a banner with a **Copy update prompt** button for your agent. The fix is `node cli.mjs update`. **Server stopped.** If the server dies or the machine reboots, the agent's health check fails and the agent restarts it with `node cli.mjs start`. **Local key.** The server creates a random key the first time it starts, readable only by your user account: `~/Library/Application Support/chrome-bridge/` on macOS, `~/.config/chrome-bridge/` on Linux (`$XDG_CONFIG_HOME` if set), `%LOCALAPPDATA%\chrome-bridge\` on Windows. The CLI signs every command with it, and you never handle it. A key other accounts could read is replaced on the next command, and a deleted one comes back. If a command says the program on the port *couldn't prove it is this OS user's chrome-bridge server*, something else holds the port (often a bridge server from before an update), and the message ends with the step: see who holds the port, quit it, then run `node cli.mjs start`. `stop` can't do it: the same check refuses it. The check is tied to the port: a program that passes requests on to your bridge server from another port is refused in the same words (by a server started on 1.36.61 or later: `update` restarts it). A program that takes the connection and never answers gets five seconds, and one that hangs up or is not a web server is named too: both get the same step (the message says it *holds the port and does not answer*), and `start` starts nothing onto that port. A command run where local connections are blocked (an agent's sandbox) says *this program is not allowed to connect to 127.0.0.1:9333*: the bridge was not asked and may be running, so run the command where they are allowed (inside the sandbox `start` starts nothing and `stop` stops nothing). `health`, `start` and `profiles` make the same check and say whether the program answers like a bridge server, and `update` never moves your copy back to an older release on the word of such a program. The extension reads the key through Chrome's native messaging: the server registers a small helper (`native-host.sh`, or `native-host.cmd` on Windows, in that folder) in each installed Chromium browser's folder (on Windows, in the registry) and in the `--user-data-dir` of running Chromes. The Web Store update to 1.34 asks you once to accept the new "communicate with cooperating native applications" permission; Chrome pauses the extension until you do. If the popup says this browser can't reach Chrome Bridge, its **Copy fix prompt** gives your agent the fix. The prompts the popup copies name your bridge folder only as your own server told the extension, over the link it checked with the key; otherwise they say where the folder usually is, whatever the program on the port answers. **Port.** Everything uses `127.0.0.1:9333`. `BRIDGE_PORT` moves the server and CLI, but the extension always connects to 9333, so you'd have to edit `extension/background.js` too. A `BRIDGE_PORT` that is no port number (1 to 65535) is refused by every command and by the server itself, in those words; spaces around the number are dropped (cmd.exe's `set BRIDGE_PORT=9333 && …` leaves one). A port your account may not listen on (below 1024 on most systems) ends the server with one line that says so, and `start` prints it at once. A port that Node, like a browser, refuses to connect to (6000 and 10080 are two) is refused by every command and by the server itself, with a line that says so and gives the step; `start` starts nothing there. If `server.log` says 9333 `is already taken`, the same line says who holds it, by the check every command makes: your own bridge server (use it), or another program, with the step. It's often an old server from another checkout; `node /cli.mjs stop` frees it. To look yourself: `lsof -nP -iTCP:9333 -sTCP:LISTEN` (on Windows: `netstat -ano | findstr :9333`). It lists the program that listens on the port, not the ones connected to it; where it says only `node`, `ps -p -o command=` shows what it runs. If `lsof` lists nothing, the program has just quit (run `start` again) or another account's program holds the port, and that account or an admin has to quit it. **Windows.** `install.sh` needs bash (Git Bash works). The bridge itself is plain Node, so `node server.mjs` and every `cli.mjs` command work anywhere. **Several Chrome profiles.** Load the extension in each one; agents can drive them in parallel. If a tab match exists in more than one profile, the command is refused until the agent names one with `--profile ` (`cli.mjs profiles` lists them), or with `BRIDGE_PROFILE=` in the environment for a whole job. That way the agent never clicks in your personal browser when it meant the work one. Don't load the Web Store build and the unpacked folder in the same profile; the bridge refuses that too and tells you to remove one. **AI features.** `ask`, `snap --find` and `console --ask` use Chrome's built-in Gemini Nano and need Chrome ≥ 148 (they run in the page, where the Prompt API arrived later than in extensions). They use the model once Chrome has it and don't start its download (several GB; `await LanguageModel.create()` in the DevTools console of any page does). Chrome offers it only on a desktop computer with at least 22 GB free on the disk that holds the Chrome profile, and either more than 4 GB of video memory or 16 GB of RAM with 4 CPU cores ([Chrome's requirements](https://developer.chrome.com/docs/ai/prompt-api)); without it, every other command works the same.
## Uninstall Toolbar popup → ⚙ → **Remove Chrome Bridge**: 1. **Copy uninstall prompt** and paste it into your AI agent. It runs `node cli.mjs uninstall`, shows you what it would remove (the local server, the agent skill in `~/.claude/skills`, the bridge folder with its logs and settings, and the local key folder with Chrome's pointers to its helper unless another bridge folder still uses them), and removes it once you agree (`uninstall --yes`). Nothing of yours is deleted: a git checkout with local edits, untracked files, a stash, other worktrees or commits origin doesn't have (on any branch, tag or a detached HEAD) is kept and listed, and so is a bridge folder inside another git project or a submodule. From a download without git, your saved `recipes/` are moved next to it first. 2. **Remove extension**: Chrome asks you to confirm. This also deletes everything the extension stored, including a Cloud Bridge sign-in. ## Development `node test/selftest.mjs` runs an end-to-end check against a fake extension (no Chrome needed). CI runs it on every push. Sending a fix or reporting a problem: [CONTRIBUTING.md](CONTRIBUTING.md). The maintainer's own rules (version bumps, tags, style) are in the *Developing* section of [AGENTS.md](AGENTS.md). The npm package is [`@siropkin/chrome-bridge`](https://www.npmjs.com/package/@siropkin/chrome-bridge): `npx @siropkin/chrome-bridge` clones this repo into `~/.chrome-bridge` and starts it. The unscoped `chrome-bridge` package on npm is an unrelated project. To pin a version, check out a tag (`git tag -l`). Use [skills.sh](https://skills.sh)? `npx skills add siropkin/chrome-bridge -g` adds only the agent's manual (the skill), not the bridge or the extension. That tool needs Node 22.20 or newer (the bridge itself runs on Node 18) and sends anonymous usage data (`DISABLE_TELEMETRY=1` turns that off). The first time you ask your agent to use your browser, it walks you through installing the rest. ## License MIT