Chrome Bridge
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
- Open Google Chrome and navigate to
chrome://extensions. - Enable Developer mode using the toggle in the top-right corner.
- Click Load unpacked (top-left) and select
~/.chrome-bridge/extension(orchrome-bridge/extensionif installed from source). - 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file antigravity_chrome_bridge-2.0.21.tar.gz.
File metadata
- Download URL: antigravity_chrome_bridge-2.0.21.tar.gz
- Upload date:
- Size: 151.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb477ead63dc4800e39ef70396f6249d62ac017e61ca1a992cae2115a8cce296
|
|
| MD5 |
95537f7094237d036d79b3a43290fef4
|
|
| BLAKE2b-256 |
e8ecfd298e5c6c3c76e15469e573b74bdcc69f03d3517d59a5c7e674ae4acafc
|
File details
Details for the file antigravity_chrome_bridge-2.0.21-py3-none-any.whl.
File metadata
- Download URL: antigravity_chrome_bridge-2.0.21-py3-none-any.whl
- Upload date:
- Size: 168.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5c160cc70545854fd17e7cc1b681c67d3ef99fbfbed1b9c38e155a4162080bd
|
|
| MD5 |
47cb621238e222a89d4940ca0bf5b003
|
|
| BLAKE2b-256 |
c74d998c20277492dff493b91ee42d8a4d4612fa82839fe0bf044879e535b6cd
|