Skip to main content

Chrome Bridge

License: MIT Platform Python 3.10+ Chrome MV3

Connect AI agents directly to your real, logged-in Google Chrome browser.

Unlike Puppeteer or Playwright which launch isolated, empty browser instances, Chrome Bridge connects to your existing browser session:

  • Live User Session: Retains all cookies, logins, credentials, and active tab states (Gmail, GitHub, internal dashboards).
  • Native Messaging IPC: Communicates directly with Chrome via standard Chrome Native Messaging and fast local IPC.
  • 99% Token Reduction: Translates full DOM trees into compact text outlines with numbered interactive reference IDs ([#1], [#2]).
  • Stateful Python REPL: Agents write procedural Python in a persistent runtime where state, variables, and tab bindings persist across turns.

Architecture & Request Flow

sequenceDiagram
    autonumber
    actor Agent as AI Agent (Claude Code / Cursor / Claude Desktop / Antigravity)
    participant REPL as Python Runtime (chrome_sdk)
    participant Host as Native Host (stdio IPC)
    participant Ext as Chrome MV3 Extension
    participant Tab as Live Chrome Tab (DOM & Shadow DOM)

    Agent->>REPL: execute_python("chrome.click(14)")
    Note over REPL: Resolves active tab & serializes JSON packet
    REPL->>Host: JSON message via length-prefixed stdio
    Host->>Ext: Chrome Native Messaging port
    Ext->>Tab: Dispatches trusted event / queries Shadow DOM
    Tab-->>Ext: Element updated / DOM mutated
    Ext-->>Host: Action ack & distilled Ref-ID delta
    Host-->>REPL: stdio response stream
    REPL-->>Agent: Action return value / refreshed snapshot outline
flowchart LR
    subgraph ClientLayer ["AI & Client Runtime"]
        A["AI Agent<br/>(Claude Code / Cursor / Claude Desktop / Antigravity)"]
        B["Python REPL Runtime<br/>(chrome_sdk)"]
        A -->|"execute_python(code)"| B
    end

    subgraph NativeBridge ["OS Native Bridge"]
        C["Native Messaging Host<br/>(native_host.py / stdio)"]
        B -->|"Length-prefixed stdio"| C
    end

    subgraph BrowserEngine ["Chrome Browser (Live Session)"]
        D["MV3 Extension Service Worker"]
        E["Active Tab & Content Scripts<br/>(DOM, Shadow DOM, Ref-IDs)"]
        C -->|"Native Messaging Port"| D
        D -->|"chrome.tabs / scripting"| E
    end

Installation (2 Steps)

Step 1: Run the Automated Setup

uvx antigravity-chrome-bridge setup

This single command automatically:

  • Provisions the isolated Python runtime (~/.chrome-bridge).
  • Registers the Native Messaging Host for Chrome, Brave, and Edge across Linux, macOS, and Windows.
  • Automatically configures MCP servers for Claude Code, Claude Desktop, Cursor, and Antigravity CLI.
Alternative: Install from source (for contributors)
# macOS & Linux
git clone https://github.com/sh7vansh/chrome-bridge.git && cd chrome-bridge && ./setup.sh

# Windows (PowerShell)
git clone https://github.com/sh7vansh/chrome-bridge.git; cd chrome-bridge; .\setup.ps1

Step 2: Load the Extension in Chrome

  1. Open Google Chrome and navigate to chrome://extensions.
  2. Enable Developer mode using the toggle in the top-right corner.
  3. Click Load unpacked (top-left) and select ~/.chrome-bridge/extension (or chrome-bridge/extension if installed from source).
  4. You're done! The Chrome Bridge icon in your toolbar will show connected status.
Manual MCP Configuration Reference (Optional)

If configuring a custom or manual MCP client:

{
  "mcpServers": {
    "chrome-bridge": {
      "command": "uvx",
      "args": ["antigravity-chrome-bridge", "mcp"]
    }
  }
}

Python SDK Quick Reference

The synchronous chrome client is ready to use directly in Python scripts and agent REPL sessions:

from chrome_sdk import chrome

# Inspect current page structure with numbered Ref-IDs
print(chrome.snapshot())

# Click button or link by element ID
chrome.click(12)

# Type into input field and submit
chrome.type(3, "Search query", press_enter=True)

# Select dropdown option
chrome.select(5, "option_value")

# Multimedia fast-path (Shadow-DOM & audio/video)
chrome.media.play_pause()
chrome.media.seek(30)

# Tab management
tab = chrome.new_tab("https://github.com")
print(chrome.tabs)

Core API Methods

Method Syntax Description
snapshot chrome.snapshot() Returns a distilled text outline of interactive elements with [#id] references
click chrome.click(id) Dispatches a click event to the target Ref-ID or CSS selector
type chrome.type(id, text, press_enter=False) Focuses target input and inputs text with optional Enter keypress
select chrome.select(id, value) Chooses an option in a <select> dropdown
hover chrome.hover(id) Triggers mouse hover state on target element
scroll chrome.scroll(x=0, y=500) Scrolls active page viewport
navigate chrome.navigate(url) Navigates active tab to specified URL
new_tab chrome.new_tab(url) Opens a new browser tab
tabs chrome.tabs Returns list of all open tabs with IDs and URLs
eval_js chrome.eval_js(expr) Executes JavaScript expression in page context and returns result
screenshot chrome.screenshot() Returns base64 PNG data of current tab
media chrome.media.play_pause() Controls active HTML5 video/audio playback

Testing

Run the test suite to verify the native host and SDK bindings:

./test.sh
# or
pytest tests/

Security & Architecture Principles

  • Local-Only Communication: All data transfer occurs over local standard I/O pipes. No data leaves your machine.
  • No Cloud Proxies: All browsing sessions execute against your local Chrome application directly.
  • Bot-Detection Immunity: Operates within your actual user profile and existing session cookies without triggering automation or CAPTCHA defenses.

License

MIT License. See LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

antigravity_chrome_bridge-2.0.20.tar.gz (151.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

antigravity_chrome_bridge-2.0.20-py3-none-any.whl (167.9 kB view details)

Uploaded Python 3

File details

Details for the file antigravity_chrome_bridge-2.0.20.tar.gz.

File metadata

  • Download URL: antigravity_chrome_bridge-2.0.20.tar.gz
  • Upload date:
  • Size: 151.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for antigravity_chrome_bridge-2.0.20.tar.gz
Algorithm Hash digest
SHA256 35d8cffeaf0cef334524f6b44aebad74580b24a7e76287a15088447c0f6afaba
MD5 003994b6d662998288d37850dd3e84dc
BLAKE2b-256 4e0d75c1d6ab0e0cd6cdffdadd33af4b3ebd85a3c11396733a9567a35602d58b

See more details on using hashes here.

File details

Details for the file antigravity_chrome_bridge-2.0.20-py3-none-any.whl.

File metadata

  • Download URL: antigravity_chrome_bridge-2.0.20-py3-none-any.whl
  • Upload date:
  • Size: 167.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for antigravity_chrome_bridge-2.0.20-py3-none-any.whl
Algorithm Hash digest
SHA256 a8ad83245552c976406522053e3145e5a0d9e8e343482c35b52be64ad9a5264d
MD5 7563329af476d3cd3f43cbee5596cc38
BLAKE2b-256 cf03722b2bfb007d4064cee115387eb0dc8d4497b78fea51f7ca0433866bce5d

See more details on using hashes here.

Release history Release notifications | RSS feed

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.29

2 files

2.0.28

2 files

2.0.27

2 files

2.0.26

2 files

2.0.25

2 files

2.0.24

2 files

2.0.23

2 files

2.0.22

2 files

2.0.21

2 files

This release

2.0.20 This release

2 files

2.0.19

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page