Skip to main content
Glama

browser-ext-agent

Let your AI agent drive your real browser — via a Chrome extension, only while you have it enabled.

agent ⇄ MCP (stdio) ⇄ server (Node) ⇄ WebSocket ⇄ Chrome extension (MV3) ⇄ web page

Built for debugging: your agent reads the page, clicks, types, scrolls, screenshots, and reads console logs — on the browser that already has your sessions, extensions and login state. No headless setup, no re-authentication.

Highlights

  • Consent by default — the extension connects only after you click Enable in its popup. Turn it off and every tool call fails immediately. The agent has no way to enable itself.

  • Secret protection — input values are never returned to the agent (value=•••), password/OTP/card fields are masked entirely, screenshots blur sensitive fields before capture, and token-like strings (sk-…, Bearer …, AWS keys, JWTs) are redacted from page text.

  • Token-cheap observations — the agent sees a compact text outline with stable element refs ([ref=e12] button "Place order"), not raw HTML. Screenshots on demand.

  • Console capture — console.* output and uncaught exceptions are buffered per tab and readable via a tool. Made for debugging apps in the page.

  • One npm package — MCP server + WebSocket server ship as a single npx-able binary; the extension installs unpacked.

Related MCP server: byob

Tools exposed to the agent

Tool

What it does

browser_navigate

Open a URL (returns title + url + snapshot)

browser_snapshot

Text outline of interactive elements + text, each with a ref

browser_click / browser_type

Act on an element by ref; typing supports submit

browser_scroll / browser_wait_for

Scroll; wait for text or a selector

browser_screenshot

PNG of the tab (sensitive fields pre-masked)

browser_tab_list / browser_tab_new / browser_tab_select / browser_tab_close

Tab management

browser_console_logs

Captured console logs / exceptions per tab

Setup

Zero-to-running guide: SETUP.md. Quick version:

1. Compile & run the server

pnpm install
pnpm build
node packages/server/release/index.js     # MCP on stdio + WS on ws://localhost:8765

Options: --port, --host (bind non-localhost requires --token), or env PORT / HOST / EXT_TOKEN / SECRET_CONFIG_PATH.

2. Install the extension

Chrome → chrome://extensions → Developer mode → Load unpacked → packages/extension/release/

3. Connect

Click the extension icon → server URL (default is already right for localhost) → token if the server requires one → Enable. The badge shows ON while connected.

4. Add the MCP server to your agent

# straight from GitHub — no clone needed
claude mcp add browser-ext-agent -- npx -y github:haipham22/browser-ext-agent

# or from a local clone (while developing)
claude mcp add browser-ext-agent -- node /absolute/path/packages/server/release/index.js

Then try: browser_navigate → browser_snapshot → browser_click → browser_console_logs.

Security model

Redaction happens inside the content script — the last layer before data leaves your browser. The server and agent never have a code path to the raw values.

Known limits (stated plainly): if a page displays a secret as plain text (e.g. a token printed on a dashboard), it can appear in a snapshot — token-pattern redaction mitigates common formats. There are deliberately no tools for cookies, localStorage, network traffic or history. Tune the extra guards via SECRET_CONFIG_PATH (JSON with blockedDomains, blockedSelectors, sensitivePatterns regexes).

Architecture

  • packages/shared — zod protocol (commands/responses), central error codes, secret config, scenario schema (v2-ready)

  • packages/server — WebSocket server + bridge + 12 MCP tools in one Node process

  • packages/extension — MV3 service worker (WS client, router), content script (snapshot refs, redact, actions, console capture), popup

Design decisions and rationale: context/DECISIONS.md. Architecture doc: context/ARCHITECTURE.md.

Development

pnpm test                                # 16 tests across the 3 packages
pnpm --filter @haipham22/browser-ext-agent-extension exec tsc --noEmit   # typecheck
cd packages/extension && node compile.mjs                                # rebuild extension bundle

Planned (v2): scenario runner — a scenario is just a JSON list of steps reusing the same command protocol (scenarioSchema is already in shared).

License

MIT

Available Tools

12 tools
browser_clickB

Click an element by ref from the last snapshot. Returns action result + fresh snapshot.

Inputs: ref (required), tabId.

browser_console_logsB

Read captured console logs (log/info/warn/error, uncaught exceptions) from a tab — for debugging.

Inputs: level, since, tabId.

browser_navigateB

Open a URL in the user browser (new tab if no tabId). Returns title+url, then a DOM snapshot outline.

Inputs: url (required), tabId.

browser_screenshotB

Screenshot the current tab (PNG, sensitive fields are masked). Returns an image.

Inputs: tabId.

browser_scrollC

Scroll the page up/down. Returns new scroll position.

Inputs: direction (required), tabId, amount.

browser_snapshotA

Text outline of the page: interactive elements + meaningful text, each with a ref like [ref=e12]. Use refs for click/type. Long pages are paginated — pass offset from the footer to get the next page.

Inputs: tabId, offset.

browser_tab_closeB

Close a browser tab (defaults to the active tab).

Inputs: tabId.

browser_tab_listA

List open browser tabs (id, title, url, active).

Inputs: no named parameters.

browser_tab_newC

Open a new browser tab, optionally with a URL.

Inputs: url.

browser_tab_selectC

Focus a browser tab by id.

Inputs: tabId (required).

browser_typeB

Type text into an input/textarea by ref. submit=true presses Enter. Returns result + fresh snapshot.

Inputs: ref (required), text (required), tabId, submit.

browser_wait_forC

Wait until text appears or a CSS selector matches (after navigation/loading).

Inputs: text, tabId, selector, timeoutMs.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 12 tools

    Disambiguation5/5

    Each tool maps to a distinct action on a distinct resource: navigation, snapshot, click, type, scroll, screenshot, wait, console logs, and explicit tab lifecycle operations. The only mild overlap is browser_navigate vs browser_tab_new, but the descriptions clearly differentiate opening a URL from creating a blank/optionally-URL tab.

    Naming Consistency4/5

    All names use a consistent browser_ prefix and snake_case, with tab operations cleanly grouped as browser_tab_*. A few names are noun-style (browser_snapshot, browser_screenshot, browser_console_logs) rather than verb_noun, but the overall pattern remains predictable.

    Tool Count5/5

    Twelve tools is well within the ideal 3-15 range for a browser automation server. Each tool covers a necessary capability—interaction, inspection, waiting, and tab management—without redundant entries.

    Completeness4/5

    Core agent browser workflows are covered: navigate, observe via snapshot/screenshot, click/type/scroll, wait, console debugging, and full tab lifecycle. Minor gaps exist around hover, dropdown selection, key presses, JS evaluation, and back/forward/reload navigation, but most can be worked around.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI agents to directly control your real Chrome browser with full context including login sessions, cookies, and open tabs. It provides tools for page scanning, JavaScript execution, CDP control, screenshots, and physical mouse/keyboard input for authentic browser automation.
      20
      243
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to drive the user's real, already-logged-in Chrome browser locally, so they can read and navigate pages, click, type, fill forms, take screenshots, and inspect cookies, tabs, console, and network traffic without headless browsers or remote-debugging ports.
      1 npm
      ISC
    • A
      license
      Not graded
      quality
      A
      maintenance
      Lets AI agents control the real, already-logged-in Chrome browser: reading pages, clicking, typing, navigating tabs, taking screenshots, and inspecting cookies, network traffic, console output, and storage. It connects as a local extension over Native Messaging, so no remote-debugging port or headless profile is needed.
      1 npm
      ISC
    • A
      license
      Not graded
      quality
      A
      maintenance
      Lets AI agents drive the user's real Chromium browser, including opening and controlling tabs, taking screenshots, capturing network traffic, recording screen activity, and handing control back for logins or payments while using the user's existing sessions, logins, and extensions.
      1,134
      MIT