Antigravity Browser Controller
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Antigravity Browser Controller 🌐⚡ (v2.1.0)
Seamless Native Chrome Automation for AI Agents via Model Context Protocol (MCP)
免重启、免 CDP 端口调试、零幽灵窗口、超低 Token 开销,让 AI 随心接管你日常已登录的 Chrome 浏览器。
🌐 English Documentation
💡 Why Antigravity Browser Controller v2.1? (The Problem It Solves)
Current AI browser automation approaches—such as Playwright, Selenium, and vision-based OS "Computer Use"—suffer from critical friction points in real-world workflows:
Challenges | Traditional Playwright / CDP | Claude Vision "Computer Use" | Antigravity Browser Controller v2.1 |
Element Addressing & Token Cost | Fragile CSS selectors / XPath guessing; easily broken by obfuscated class names | Takes heavy screenshot & guesses coordinates; burns high-cost Vision tokens | Low-Token Ref Snapshot ( |
Screenshot Context Bloat | Dumps raw base64 or pollutes Git working tree | High token cost per frame | Zero-Base64 Bloat ( |
Login Persistence (Cookies) | Requires separate profile; loses sessions; triggers aggressive captchas/bot blocks | Operates in active desktop foreground; disrupted by user input | 100% inherits your existing Chrome logins (no re-auth, bypasses captchas) |
Multi-Agent Concurrency | Single debugger port locks out secondary agents | Fullscreen lock; cannot share mouse | Dual-port decoupled architecture (WS:18888 + HTTP:18889): concurrent, stateless, zero-lockout |
Background & Lock Screen | Creates blank | Cannot run in background; fails immediately when screen is locked ( | Runs silently in memory & DOM; continues operating even when Windows is locked |
Modern Web Frameworks & Forms | Form fills fail to trigger React / Vue synthetic state changes | Coordinate clicks are prone to 5px offsets on dynamic or scrolling pages | Native setter bypass for inputs + dedicated |
Security & CSRF | Unauthenticated local ports expose browser to malicious websites | N/A | Mandatory Bearer Token auth ( |
✨ What's New in v2.1.0
Zero-Base64 Bloat & Git-Safe Screenshots (
browser_take_screenshot):Returns a lightweight metadata dictionary (
{"savedPath", "bytes", "tabId", "clipped"}, ~30 tokens) instead of dumping 110,000+ characters of Base64 into the LLM context.Defaults to
%TEMP%/antigravity_screenshotsand automatically redirects relative paths or paths inside Git repositories to the system temp directory so screenshots never pollutegit status.Supports element-level clipping via
reforselector.
Low-Token Page Snapshot (
browser_page_snapshot):Native
<select>dropdowns (e.g., 90+ birth-year options) no longer dump all option texts intotextorbodyTextPreview. Instead, each<select>reports its current selection,optionsCount, and a 5-itemoptionsPreview.Configurable
max_text_len(default500) andinclude_body_preview(True/False).
Native Dropdown Selection (
browser_select_option):Select any
<option>in a<select>element byvalue, visibletext, or 0-basedindex(targetingreforselector), automatically dispatchinginputandchangeevents for React/Vue forms.
Mobile Viewport Simulation (
browser_set_viewport):Switch any logged-in tab to mobile dimensions (default
375x812,mobile=True) via persistent CDP device emulation, or passreset=Trueto restore desktop layout.
Transparent Error Diagnostics:
Fixed HTTP 500 error masking and wrapped MCP tools so timeouts or missing selectors return explicit JSON diagnostics (
timeout,target,url,title,readyState) instead of generic"Error executing tool"messages.
🚀 10-Second Quickstart
Step 1: Install the Chrome Extension
git clone https://github.com/yihongdo-glitch/antigravity-browser-mcp.gitOpen Chrome and navigate to
chrome://extensions/.Toggle Developer mode in the top-right corner to ON.
Drag and drop the cloned project folder directly into the extensions page (or click Load unpacked and select the folder).
The purple Antigravity icon will appear in your Chrome toolbar.
Step 2: Configure Your AI Client (One-Click MCP Integration)
1. Claude Desktop / Claude Code (claude_desktop_config.json / .claude.json)
Add the following to your mcpServers object:
{
"mcpServers": {
"antigravity-browser": {
"command": "python",
"args": [
"path/to/antigravity-browser-mcp/bridge/mcp_server.py"
]
}
}
}2. Cursor / Windsurf
In Settings -> Features -> MCP, add a new stdio server:
Name:
antigravity-browserType:
commandCommand:
python path/to/antigravity-browser-mcp/bridge/mcp_server.py
3. Antigravity IDE
Pre-registered in mcp_config.json, fully plug-and-play.
🛠️ MCP Tools Reference (Full Capabilities)
Tool Name | Key Parameters | Description |
|
| AI Page Eyes (Low-Token): Analyzes visible interactive elements with numbered refs ( |
|
| Smart Content Extraction: Cleanly extracts main article body text while discarding noise. |
|
| Waits until a CSS selector or visible text snippet appears; returns rich diagnostics on timeout. |
|
| Simulates mobile screen layout (default |
|
| Clicks an element. Prioritizes |
|
| Injects text into inputs/textareas while bypassing React/Vue synthetic DOM barriers. |
|
| Selects an |
|
| Simulates keyboard key presses ( |
|
| Scrolls the page or scrolls a specific element ref into view ( |
| none | Lists all open tabs in your Chrome window (ID, title, URL, active state). |
| none | Retrieves metadata of the currently focused browser tab. |
|
| Instantly finds an open tab matching a URL or title substring (e.g., |
|
| Executes arbitrary JavaScript in the page context, automatically bypassing page CSP restrictions. |
|
| Captures full-page or element-clipped screenshots to |
|
| Direct Chrome DevTools Protocol escape hatch. |
|
| Navigates the specified tab to a new URL. |
|
| Opens a new browser tab. |
|
| Closes a specific tab by ID. |
🏗️ Architecture & Privacy Guarantee
[ AI Clients: Claude Code / Claude Desktop / Cursor / Antigravity / CLI ]
▲
│ (HTTP POST REST Gateway: http://127.0.0.1:18889/action)
│ (Authenticated via ~/.antigravity/bridge.token)
▼
[ Antigravity Bridge Daemon & WebSocket Hub ]
▲
│ (Local WebSocket: ws://127.0.0.1:18888/ws)
│ (Handshake Origin Pinned: chrome-extension://<EXTENSION_ID>)
▼
[ Chrome Extension v2.1 (Manifest V3 Service Worker) ]
│
┌────────────────┴────────────────┐
▼ ▼
[ Isolated World DOM Sandbox ] [ Chrome DevTools Protocol (CDP) ]
- window.__agRefs (Ref Model) - CSP Bypass Runtime.evaluate
- Smart <select> Folding & Pick - Lock-Screen & Clipped Screenshot
- Controlled Component Bypass - Mobile Viewport Emulation (375x812)🔒 Privacy & Security Hardening:
Mandatory Token Authentication: Every request to the HTTP REST control gateway (
18889) must provide a valid token viaAuthorization: Bearer <token>orX-Bridge-Token: <token>. Missing or invalid tokens are immediately rejected with HTTP401 Unauthorized.WebSocket Handshake Origin Validation & Extension ID Pinning: WebSocket connections on port
18888strictly validate theOriginheader during the HTTP opening handshake, immediately rejecting unauthorized origins (such as malicious webpages ornull) with HTTP403 Forbidden. Wildcardchrome-extension://prefix acceptance has been eliminated; connections are strictly pinned to the specific extension ID configured viaANTIGRAVITY_EXTENSION_IDor~/.antigravity/extension.id.Strict Origin Isolation & Zero Wildcard CORS: Wildcard
Access-Control-Allow-Origin: *has been completely eliminated. Requests withOrigin: null(such as sandboxed iframes orfile://contexts) are strictly blocked with HTTP403 Forbidden. CORS response headers are strictly reflected only for explicitly whitelisted origins (chrome-extension://,127.0.0.1,localhost).Fail-Secure Token Management: Cryptographically secure random tokens (
secrets.token_hex(24)) are persisted to~/.antigravity/bridge.token. The daemon strictly halts execution if token persistence or read fails, completely eliminating fallback to default static tokens.100% Local Loopback: All communication happens strictly over the local loopback interface (
127.0.0.1). No external servers, no cloud relays, zero telemetry, zero analytics. Your account cookies, session tokens, and browsing data never leave your local machine.
Related MCP server: chrome-agent-browser
🇨🇳 中文说明文档
💡 为什么选择 Antigravity Browser Controller v2.1?(痛点对比)
目前主流的 AI 浏览器控制方案(Playwright / Selenium / 视觉截图 OS Control)普遍存在以下痛点:
痛点维度 | 传统 Playwright / CDP 方案 | Claude 视觉“操作电脑” | Antigravity Browser Controller v2.1 |
元素定位与 Token 消耗 | 脆弱的 CSS 选择器/XPath,页面动态哈希 class 变动即失效 | 截全屏估算物理坐标,极耗高额视觉 Token | 低 Token Ref 快照 ( |
截图上下文爆炸与仓库污染 | 截图返回 Base64 撑爆上下文,或误写入 Git 仓库目录 | 每帧消耗高额视觉额度 | 零 Base64 膨胀截图 ( |
日常登录态 (Cookie) | 必须使用独立用户目录,掉登录态,极易触发滑块风控 | 必须在前台全屏操作,易受外界干扰 | 100% 继承你日常 Chrome 中所有网站的已登录状态 |
多 Agent 并发与锁死 | 调试端口互斥,二次拉起直接端口冲突崩溃 | 独占物理桌面,无法并发 | 双端口解耦 (WS:18888 + HTTP:18889):无状态 HTTP 控制网关,多 Agent/脚本并发零锁死 |
后台与锁屏 | 经常弹死白空白窗口( | 无法在后台运行;锁屏 ( | 纯静默后台与内存 DOM 操作,锁屏后全自动运行 |
前端框架与下拉表单 | 注入表单常因 React/Vue 受控组件虚拟 DOM 而无法提交 | 依靠物理坐标点击易偏 5 像素 | 重写 Native Setter + 新增 |
本地网络安全 | 本地无鉴权端口,易受网页 CSRF / DNS Rebinding 攻击 | 无 | 强制 Bearer Token 鉴权 + 严格来源白名单(封杀 null)+ 消除通配符 CORS + WS 握手强校验与专属扩展 ID 绑定 |
✨ v2.1.0 核心升级亮点
截图零 Base64 膨胀 + Git 仓库防污染保护 (
browser_take_screenshot):默认只返回结构化落盘回执(
{"savedPath", "bytes", "tabId", "clipped"},仅约 30 Tokens),彻底告别单张截图塞回 11 万字符 Base64 撑爆上下文的问题。默认落盘至
%TEMP%\antigravity_screenshots;若传入相对路径或位于 Git 仓库内的路径,自动重定向至系统临时目录,物理级杜绝测试截图污染代码仓库。新增支持按
ref或selector进行局部元素/卡片精准裁剪截图。
页面快照瘦身与
<select>智能折叠 (browser_page_snapshot):针对包含几十上百个
<option>的下拉框(如 90+ 年份选择器),不再把全部选项拼接进text和bodyTextPreview,而是仅返回当前选中项、optionsCount及前 5 项预览。支持自定义
max_text_len(默认 500 字)与include_body_preview=False开关,获取元素坐标时不再为大段正文重复买单。
原生下拉框选择工具 (
browser_select_option):无需手写 JS,直接通过
ref或selector定位<select>,按选项value、可见文字text(如"1990年")或序号index一键选中,自动派发input与change事件。
手机屏幕宽度模拟 (
browser_set_viewport):基于持久化 CDP 设备仿真,支持将已登录标签页一键切换为手机视口(默认
375x812),或传reset=True恢复桌面排版,轻松验收移动端 UI。
全链路透明报错诊断:
修复 HTTP 500 错误吞噬问题;当
browser_page_wait等工具超时或未找到元素时,直接返回包含等待时长、目标选择器/文字、当前页面 URL/标题与readyState的明文诊断字典,告别模糊的“执行出错”。
🚀 10 秒极速上手
步骤 1:安装 Chrome 扩展
git clone https://github.com/yihongdo-glitch/antigravity-browser-mcp.git打开 Chrome 地址栏输入并回车:
chrome://extensions/打开右上角 「开发者模式」 开关。
将本项目文件夹直接拖入该页面(或点击左上角「加载已解压的扩展程序」选择本项目目录)。
工具栏出现紫色 Antigravity 图标即表示就绪!
步骤 2:配置你的 AI 客户端 (MCP 一键挂载)
1. 在 Claude Desktop / Claude Code 中使用
在 claude_desktop_config.json 或 .claude.json 的 mcpServers 节点中添加:
{
"mcpServers": {
"antigravity-browser": {
"command": "python",
"args": [
"path/to/antigravity-browser-mcp/bridge/mcp_server.py"
]
}
}
}2. 在 Cursor / Windsurf 中使用
在 Settings -> Features -> MCP 中添加自定义 stdio 命令:
Name:
antigravity-browserCommand:
pythonArgs:
path/to/antigravity-browser-mcp/bridge/mcp_server.py
3. 在 Antigravity 中使用
已内置挂载至全局 mcp_config.json,开箱即用。
🛠️ MCP 核心工具能力一览
工具名 (Tool) | 关键参数 (Params) | 描述 (Description) |
|
| AI 页面之眼(低 Token 版):分析当前页面可见交互元素并分配编号 Ref( |
|
| 智能正文抽取:自动识别文章/主内容容器,剥离无关导航和噪音。 |
|
| 异步等待指定选择器或文字出现;超时返回包含当前 URL、标题与状态的详细诊断。 |
|
| 模拟手机屏幕宽度(默认 |
|
| 精准点击。优先支持 Ref 编号,文本模式具备最深叶子节点匹配 + 向上交互语义穿透,杜绝点偏死容器。 |
|
| 自动输入文本,支持 Ref 编号,穿透 React/Vue 虚拟 DOM,100% 触发 input/change 事件。 |
|
| 原生选择 |
|
| 模拟按键( |
|
| 滚动页面或将指定 Ref 元素居中对齐,支持 |
| 无 | 列出当前 Chrome 中打开的所有标签页(ID、标题、网址、激活状态)。 |
| 无 | 获取当前正在浏览的活动标签页详情。 |
|
| 按网址或标题关键词瞬间找到指定标签页(如搜索 |
|
| 在页面上下文执行任意 JS 脚本,底层自动绕过 CSP 安全限制。 |
|
| 高清全页或局部元素截图,默认存入 |
|
| 直接发送 Chrome DevTools Protocol 指令(逃生舱)。 |
|
| 控制标签页跳转到新网址。 |
|
| 新建标签页。 |
|
| 关闭指定标签页。 |
🏗️ 架构与安全设计
[ AI 客户端 (Claude Code / Claude Desktop / Cursor / Antigravity / 脚本) ]
▲
│ (无状态 HTTP REST 网关: http://127.0.0.1:18889/action)
│ (Bearer Token 鉴权: ~/.antigravity/bridge.token)
▼
[ Python 桥服务守护进程 (WebSocket + HTTP) ]
▲
│ (ws://127.0.0.1:18888/ws 本地环回)
│ (握手阶段 Origin 精确绑定: chrome-extension://<EXTENSION_ID>)
▼
[ Chrome 扩展 v2.1 (Manifest V3 Service Worker) ]
│
┌────────────────┴────────────────┐
▼ ▼
[ 页面 Isolated DOM 沙箱 ] [ CDP 调试桥接 ]
- window.__agRefs (Ref 快照模型) - 绕过 CSP 注入
- <select> 智能折叠与原生选择 - 锁屏后台静默/局部裁剪截图
- React/Vue 受控组件穿透 - 375x812 移动端视口模拟🔒 隐私与深度安全加固:
HTTP 控制通道强制鉴权:访问 REST 控制网关(
18889)的每个请求必须携带有效令牌(Authorization: Bearer <token>或X-Bridge-Token: <token>),未提供或令牌错误一律返回 HTTP401 Unauthorized。WebSocket 握手期强校验与专属扩展 ID 绑定:端口
18888的 WebSocket 服务在 HTTP 握手阶段即对Origin进行强校验,非法来源(如恶意网页或null)直接拒绝(403 Forbidden),绝不先建连后断开;彻底废除chrome-extension://宽泛前缀通配,仅精确放行通过ANTIGRAVITY_EXTENSION_ID环境变量或~/.antigravity/extension.id绑定的专属扩展 ID。严格 Origin 来源隔离与 CORS 强化:彻底移除
Access-Control-Allow-Origin: *通配符;明确封杀沙箱 iframe 与本地文件发出的Origin: null(直接拦截并返回 HTTP403 Forbidden);仅对显式白名单来源(chrome-extension://、127.0.0.1、localhost)响应对应 CORS 头。安全失败退出原则 (Fail-Secure):采用加密级随机令牌生成(
secrets.token_hex(24))并持久化至~/.antigravity/bridge.token。杜绝硬编码后门密钥降级,读写令牌失败时主动报错退出。纯本地进程环回:所有交互严格限制在
127.0.0.1本地回环接口。无任何外部服务器、无任何云端中继、零隐私数据收集,保护浏览器数据与日常 Cookie 绝对安全。
📄 License
This project is licensed under the MIT License - created by @yihongdo-glitch. Free for personal and commercial use.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Let AI agents use your real, signed-in Chrome: tabs, clicks, forms, screenshots and video.
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Give AI agents a real cloud Chrome: open sessions, navigate, read pages, click, type and screenshot.
Let AI agents use any website you're logged in to. Sessions stay encrypted on your machine.
Related MCP Servers
- FlicenseBqualityBmaintenanceEnables AI agents to control existing Chrome and Firefox browser sessions locally, including tab management, navigation, form filling, screenshots, and persistent scripts, without remote relays or debugging ports.36-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to directly operate a user's local Chrome browser with full login state and cookies, supporting 23 tools such as tab management, clicking, typing, screenshots, file upload, and network inspection through natural language.MIT
- AlicenseNot gradedqualityAmaintenanceEnables 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 npmISC
- AlicenseNot gradedqualityAmaintenanceLets 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 npmISC