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 --refresh 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": ["--refresh", "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.23.tar.gz (151.8 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.23-py3-none-any.whl (168.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: antigravity_chrome_bridge-2.0.23.tar.gz
  • Upload date:
  • Size: 151.8 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.23.tar.gz
Algorithm Hash digest
SHA256 08bb27a2a328dc56605c4e69d88e68ae1d3865fe138a3b695c17f4cc0ca5bd88
MD5 453409225d57bf573242d2ade19ace59
BLAKE2b-256 253d2c61dcca107b1e7549372c1ffe6370a6093d87153760ddafaff5e5314128

See more details on using hashes here.

File details

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

File metadata

  • Download URL: antigravity_chrome_bridge-2.0.23-py3-none-any.whl
  • Upload date:
  • Size: 168.8 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.23-py3-none-any.whl
Algorithm Hash digest
SHA256 ad60f2a8f9325137736dca7ec764b3315f17ebe7823b4006bfa6f3cdb432db80
MD5 a8326925d276a72d9e0a551573a560ea
BLAKE2b-256 2463837054a872a39af0bcf3cc46e6aa84c2ce1b706b5e8dd5f62251e06d1860

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

This release

2.0.23 This release

2 files

2.0.22

2 files

2.0.21

2 files

2.0.20

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