Skip to content
wxtskyPublic

About

Bring Your Own Browser — let your AI agent use the Chrome you already have open

Topics

Resources

Contributing

Stars

145 stars

Watchers

1 watching

Forks

Repository files navigation

byob

byob

Bring Your Own Browser — let your AI assistant use the Chrome you already have open.

License: MIT MCP Chrome MV3 v0.7

English · 中文


byob is a local MCP server that lets AI coding tools (Claude Code, Cursor, Cline, Windsurf, etc.) directly control your real Chrome — the one where you're already logged into everything.

"read my Twitter timeline and summarize the top 5 posts"
"google 'mcp protocol spec', click the first result, read the page"
"take a screenshot of example.com"
"grab my GitHub session cookie so I can curl with it"
"open my Gmail tab and tell me how many unread"
"fill in this form with my details and submit it"
WebFetch Headless Puppeteer byob
Sees logged-in pages ❌ ⚠️ manual cookie copy ✅ already logged in
Passes bot detection ❌ ❌ ✅ real human browser
Setup time 0 hours ~5 min
Cloud cost free $$ free

Compared with tools that attach over Chrome's remote-debugging port (DevTools MCP, agent-browser, Playwright --cdp): byob is an extension, so there's no debugging port to open, no "Allow remote debugging?" prompt on every connection, and nothing else on your machine can hijack your logged-in browser through it.


Install

Quick install (recommended)

curl -fsSL https://raw.githubusercontent.com/wxtsky/byob/main/install.sh | bash

On Windows, run the same command from Git Bash or MSYS2. The script checks prerequisites (Node.js ≥ 20, bun, Chrome/Edge/Brave), clones the repo, builds everything, and walks you through MCP registration interactively. If bun is not installed, it offers to install it for you using the native installer for your OS.

Set BYOB_INSTALL_DIR to change the install location (default: ~/byob). Advanced: BYOB_REPO, BYOB_REF, and BYOB_SKIP_SETUP=1 are supported for forks, pinned refs, and CI-style dependency install only.

Manual install

Prefer to do it yourself?

Requires Node.js ≥ 20, bun, Chrome, and any MCP-compatible AI tool.

git clone https://github.com/wxtsky/byob
cd byob
bun install
bun run setup

bun run setup walks through the install interactively:

  1. Pick output language (English / 中文)
  2. Generates a unique extension key for you
  3. Builds the Chrome extension
  4. Installs a self-contained copy of the bridge and MCP server into ~/.byob and writes the config that lets Chrome talk to it. The running setup no longer depends on the repo folder; after git pull, run bun run setup again to upgrade.
  5. Prompts you to multi-select your AI tools. Claude Code gets the bundled plugin (Skill + auto-started MCP); other clients get their MCP config.

After the script finishes, three manual steps remain:

Step 2 — Load extension in Chrome

Open chrome://extensions in Chrome.

  1. Top-right → turn ON Developer mode
  2. Top-left → click Load unpacked
  3. Select the folder printed in your terminal, something like:
    /your/path/to/byob/packages/extension/output/chrome-mv3
    

Step 3 — Restart Chrome

Quit Chrome completely (⌘Q on Mac / close all windows on Windows), then reopen.

Closing a single tab or window is not sufficient — Chrome only reads the Native Messaging config at startup.

Step 4 — Claude Code plugin / manual MCP reference

The setup script registers your selected tools automatically. The block below is for reference only — use it if you skipped the prompt or want to register a different tool later:

Claude Code plugin (recommended)
claude plugin marketplace add wxtsky/byob
claude plugin install byob@byob --scope user

Run /reload-plugins in Claude Code after installing. The plugin includes the /byob:control-chrome Skill and starts its bundled MCP server automatically; do not also register a second byob MCP server.

For local development without installing:

claude --plugin-dir /path/to/byob/plugins/byob
Claude Code manual MCP fallback
claude mcp add byob -s user -- /path/to/node ~/.byob/mcp/byob-mcp.mjs

browser_evaluate is on by default; to turn it off, add -e BYOB_ALLOW_EVAL=0 after -s user.

Codex CLI
codex mcp add byob -- /path/to/node ~/.byob/mcp/byob-mcp.mjs
Cursor

Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):

{
  "mcpServers": {
    "byob": {
      "command": "/path/to/node",
      "args": ["/Users/you/.byob/mcp/byob-mcp.mjs"]
    }
  }
}
Windsurf

Add to ~/.codeium/windsurf/mcp_config.json (same JSON format as Cursor):

{
  "mcpServers": {
    "byob": {
      "command": "/path/to/node",
      "args": ["/Users/you/.byob/mcp/byob-mcp.mjs"]
    }
  }
}
Cline (VS Code)

Open Cline sidebar → MCP Servers → Configure, then add (same JSON format):

{
  "mcpServers": {
    "byob": {
      "command": "/path/to/node",
      "args": ["/Users/you/.byob/mcp/byob-mcp.mjs"]
    }
  }
}

The actual paths are printed by the setup script. The examples above use shortened paths for readability.
To turn browser_evaluate off, add "env": { "BYOB_ALLOW_EVAL": "0" } to the config (or -e BYOB_ALLOW_EVAL=0 for CLI tools).

Step 5 — Wait for setup to confirm the bridge is online

After you finish steps 2 and 3 (load the extension and ⌘Q-restart Chrome), setup auto-detects the bridge coming online and prints ✓ bridge online. The installation is complete — open a new session in your AI tool and try "use byob to read ...".

If you exited setup early with Ctrl+C, or want to check the state later:

bun run doctor

bun run doctor prints actionable fixes under every ✗ (e.g. "⌘Q-restart Chrome", "extension ID mismatch", etc.).


Tools

Elements are targeted by refs from the snapshot ([ref=e12]), a CSS selector, or x/y.

To save context, the agent starts with the everyday tools (~16.5k characters of tool definitions). The ones marked extra below appear when it calls browser_enable_tools (the client is told via tools/list_changed). Set BYOB_TOOLS=full in the MCP server env to list everything from the start — e.g. for a client that doesn't refresh its tool list. In Claude Code's Code Mode everything is listed anyway (below).

Tool What it does
browser_snapshot The page as an accessibility outline with refs — interactive-only, diff, scoped; iframes (even cross-origin) inline
browser_find Find by role+name / text / label / placeholder / testId (also inside iframes), optionally click/fill/check right away
browser_click Click (real mouse events), double/right click, modifiers; auto-waits and reports navigation / new tabs / dialogs
browser_type Fill inputs, textareas, contenteditable (React/Vue-safe); per-key mode; submit
browser_press_key Keys and combos with real key codes (Enter, Shift+Tab, ControlOrMeta+A)
browser_hover / browser_select / browser_scroll / browser_drag Menus, <select>, page or container scrolling, HTML5 drag-and-drop
browser_upload_file Attach local files to <input type=file>, or through a button that opens a file picker (no OS dialog appears)
browser_batch Many steps in one call (fill a whole form and submit)
browser_wait Wait for element state, text, URL, load / network idle — or hand the tab to you (user): log in, solve a CAPTCHA, confirm a payment, then click Done
browser_read Content as text / markdown (reader mode) / html / links / tables, with outline and filter; PDFs (logged-in ones too); several URLs at once
browser_screenshot Viewport / full page / element / clip → image returned to the model; ref labels; visual diff against the previous shot; PDF
browser_navigate Open a URL in a background tab, back / forward / reload
browser_tabs List / open / select / close tabs, search history
browser_console Console messages and page errors, buffered
browser_storage Cookies and local/session storage — get / set / clear; a ready Cookie: header, or a cookies.txt for curl / wget / yt-dlp
browser_dialog Answer alert / confirm / prompt explicitly
browser_evaluate Run JavaScript in the page's main world (page globals visible, promises awaited)
browser_fetch Call a URL / API with the browser's login: status, headers, body (JSON pretty-printed). from:"page" runs inside the tab (same-origin, CSRF headers), from:"extension" reaches any site without CORS; savePath keeps the whole body
browser_enable_tools Turn on the extra tools below
browser_network (extra) Record traffic (summary / JSON / HAR) or intercept: block / mock / modify — cross-site iframes included; wait for an API reply
browser_inspect (extra) Element box / state / styles, Web Vitals
browser_emulate (extra) Device, dark mode, geolocation, timezone, locale, offline, headers
browser_clipboard (extra) Read / write clipboard text
browser_download_images (extra) Save a page's images
browser_downloads (extra) The files a click downloaded: wait for one, get its path (actions also report downloads they start)
browser_record (extra) Record a tab — background tabs too — to a .webm video (start → act → stop)
browser_userscript (extra) Resident scripts: JavaScript Chrome runs on every load of matching pages — every tab, across reloads and restarts (a built-in Tampermonkey). Needs "Allow User Scripts" turned on for byob once

Schemas: shared/src/tools.ts. Upgrading from 0.4? Tool names changed — see the changelog.

Claude Code Code Mode

In Claude Code's Code Mode the model writes JavaScript that calls tools, instead of calling them one at a time — a good fit for browser work: go through twenty product pages, fill a form from a CSV, keep checking until a page changes, all in one script. (Claude in Chrome doesn't work in Code Mode; byob does.)

byob notices Code Mode (CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 in its environment) and adapts:

  • Results are JSON, so a call resolves to an object (.tabId, .text, .value, .json); each tool's description says what it returns.
  • Errors are JSON too: the call throws and e.detail.error is the code (stale_ref, timeout, …).
  • Every tool is listed from the start: Code Mode loads definitions only when a script looks them up.
  • Screenshots return a file path (the model looks with Read); inline:true attaches the image.
  • Results up to ~400k characters stay whole — the script keeps them in a variable, not in the model's context. Bigger ones are cut, with the whole JSON saved to a file.
const b = new Proxy({}, { get: (_, n) => tools[tools.list().find((t) => t.endsWith(`__browser_${n}`))] });

const urls = ['https://example.com', 'https://example.org'];
const opened = await Promise.all(urls.map((url) => b.navigate({ url })));      // a tab each
const titles = await Promise.all(opened.map(({ tabId }) => b.evaluate({ tabId, expression: 'document.title' })));
titles.map((t) => t.value)

Opening several URLs at once gives each its own tab. BYOB_OUTPUT=json|text and BYOB_TOOLS=core|full in the MCP server env override the detection.


How it works

AI tool → byob-mcp → byob-bridge → Chrome extension → your tab
         (stdio)    (Unix socket) (Native Messaging) (Chrome DevTools Protocol)
  • byob's own page scripts run in an isolated world: they share the DOM but not JavaScript with the page — no window.__byob*, no data-byob-* attributes, nothing a site can see or tamper with.
  • Refs live in the extension's memory, bound to Chrome's backend node ids; they survive re-renders and are refused (never silently re-targeted) after navigation.
  • Each MCP client session has its own working tab; tabs the agent opens are grouped under byob and never steal focus.

All communication stays local. No data leaves your machine. When Chrome closes, all byob processes exit automatically.


Everyday commands

bun run setup      # install, re-install, or upgrade after git pull
bun run doctor     # check what's working
bun run bridges    # list running bridge processes
bun run logs       # tail the bridge log
bun run unsetup    # remove everything
bun run policy     # show / change which sites byob may touch (flags below)

All run from the byob repo root.

If the byob extension you run has a different ID than the one setup builds (a Chrome Web Store copy, a teammate's build), let it connect too with bun run setup --extension-id <id>; the ID is remembered for later setups.


Reliability

  • Auto-waiting actions. Before clicking or typing, byob waits until the element is attached, visible, stable, enabled and actually on top at its center; errors say what's wrong ("covered by <div#cookie-banner>").
  • Actions report their effects — navigation (waited for), same-page URL changes, new tabs, JS dialogs — so the agent doesn't have to poll.
  • Dialogs never hang a call. A click that opens confirm() returns immediately with the dialog text.
  • One action per tab at a time. Two agents (or parallel calls) working on the same tab take turns instead of mixing their clicks and keystrokes; answering a dialog, listing tabs and reading the console never wait.
  • End-to-end cancellation. Ctrl+C propagates through the entire chain (MCP → bridge → extension → Chrome).
  • Sleep/wake recovery. After a laptop sleep cycle, byob resets its debug sessions so the next call starts clean.
  • Tested end to end on Chrome for Testing: BYOB_E2E=1 bun test e2e (see CONTRIBUTING).

Security

byob runs on your own machine for your own agent, so since 0.7 it starts fully open and you narrow it if you want:

  • browser_evaluate (and browser_wait's fn) are on; set BYOB_ALLOW_EVAL=0 in the MCP server env to turn them off. Every call is audit-logged.

  • file://, Google / Microsoft / Apple login pages and chrome:// are not blocked (bun run policy --allow-file off --allow-auth off to block them). Chrome itself never lets an extension debug chrome:// pages, so those steps stay with you.

  • Password / one-time-code / card fields are no longer redacted — the agent reads their values (they land in the transcript). To redact again, set REDACT_CREDENTIALS to true in packages/extension/lib/sensitive.ts and re-run bun run setup.

  • To reach other extensions' pages (Tampermonkey's install page, wallet popups…) and drop the "is debugging this browser" banner, launch Chrome with flags — see "Launch Chrome with flags" below.

  • Per-site allow/deny lists, set by you — never by the agent:

    bun run policy --deny "**.chase.com" "mail.proton.me"   # never touch these
    bun run policy --allow "**.github.com"                  # or: only these
    bun run policy --clear-allow --clear-deny                # reset
    bun run policy --allow-file on                           # permit file:// URLs

    Patterns: example.com (exact), *.example.com (subdomains only), **.example.com (apex + subdomains), * (everything). Deny wins over allow. A non-empty allow list means allow-list-only. Enforced when byob attaches to a tab, so it covers every tool.

  • JS dialogs are never auto-accepted; a confirm stays open until the agent answers it explicitly.

  • You can pause byob at any time from its toolbar icon: every call is refused until you resume, and nothing but you can resume it. The popup also shows what the agent did recently (tool, site, result — never what it typed) and any tab it handed to you.

  • Hand-overs happen in extension UI. When the agent asks you to log in or confirm something, the Done / I can't buttons live in the byob popup and a notification — a web page can't press them for you.

  • Credential fields are redacted. Values in password / OTP / card / email inputs are never sent to the model; they surface as [redacted].

  • Each install gets a unique extension key — no collisions.

  • Socket files are 0600, dirs are 0700. Other users can't see them.

  • Zero outbound network traffic. No analytics, no pings, no crash reports.

  • Chrome shows a "byob is debugging this browser" banner on active tabs, unless started with --silent-debugger-extension-api (below).

Launch Chrome with flags

~/code/byob/scripts/chrome-unleashed.sh   # quits Chrome, reopens it with the two flags below
  • --extensions-on-chrome-urls — byob can drive other extensions' pages (chrome-extension://…). chrome:// pages still can't be debugged (verified on Chrome 154).
  • --silent-debugger-extension-api — no "is debugging this browser" banner.

Chrome may warn about an "unsupported command-line flag"; close the bar. The flags last for that launch only — opening Chrome from its normal Dock icon brings the defaults back.


Troubleshooting

Symptom Cause Fix
No live bridge Chrome not running or extension disabled Check chrome://extensions
cdp_attach_failed DevTools open on that tab Close DevTools
url_forbidden Blocked by your site policy bun run policy
stale_ref The page navigated since the snapshot Snapshot again
element_covered A banner / modal is on top Close it, or force:true
extension_not_connected Extension lost connection Reload at chrome://extensions
Nothing works after install Chrome was not fully restarted Quit Chrome completely (⌘Q) and reopen

Run bun run doctor for detailed diagnostics on which step failed.


Platform notes

Platform Auto Manual
macOS Auto-registers selected MCP tools Open chrome://extensions and load the unpacked extension
Windows Same + writes Native Messaging host to registry Same as macOS
Linux Auto-registers selected MCP tools Same as macOS

More

MIT licensed. byob has broad access to your browser — only use it on machines and accounts you own.

About

Bring Your Own Browser — let your AI agent use the Chrome you already have open

Topics

Resources

Contributing

Stars

145 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages