browser-relay
MCP server that drives a user's real Chrome browser via a WebSocket-connected MV3 extension, enabling tab management, navigation, page interaction, screenshots, and script evaluation through natural language.
README
browser-relay
Drives the user's real, logged-in Chrome from AI agent sessions without ever handing another browser client the user's cookies (which gets sessions invalidated). An MV3 extension lives inside real Chrome and executes commands sent over a WebSocket from a local relay daemon.
Architecture
Claude session -> MCP (HTTP :9277/mcp) -> relay daemon -> WebSocket -> MV3 extension -> real Chrome tabs
extension/- the Chrome MV3 extension.server/relay.js- the relay daemon: MCP streamable-HTTP server + WebSocket server. Node >= 18, single dependency (ws).deploy/ai.wecko.browser-relay.plist- launchd LaunchAgent template (macOS);install.shfills in your node and repo paths.install.sh- installs deps + the LaunchAgent and prints the two remaining manual steps.test/- MCP smoke test (e2e.sh), a direct tool-call helper (call.js), and a mock extension for testing the relay without Chrome.
The extension connects out to ws://127.0.0.1:9277/ws as a client (it does
not run a server itself), sends a hello on open, and answers every command
the relay sends with exactly one ok:true/ok:false reply.
Install
/bin/bash install.sh
This copies the LaunchAgent, (re)starts it, and waits for
http://127.0.0.1:9277/health to answer. It then prints two steps you do by
hand:
- Register the MCP server:
claude mcp add --transport http browserx http://127.0.0.1:9277/mcp -s user - Load the extension:
chrome://extensions-> enable Developer mode -> Load unpacked -> selectextension/.
Tools (relay commands)
| command | args | result |
|---|---|---|
list_tabs |
{} |
{tabs:[...]} |
new_tab |
{url?, active?} |
{id,url} |
close_tab |
{tab_id} |
{closed:true} |
activate_tab |
{tab_id} |
{id,title,url} |
navigate |
{url, tab_id?} |
{id,url,title} |
back |
{tab_id?} |
{id,url} |
forward |
{tab_id?} |
{id,url} |
snapshot |
{tab_id?, max_elements?} |
{tab_id,title,url,elements,truncated?,text_excerpt} |
click |
{ref, tab_id?} |
{clicked:ref} |
type_text |
{ref, text, submit?, clear?} |
{typed:ref} |
evaluate |
{js, tab_id?} |
{result} |
screenshot |
{tab_id?, format?} |
{mime,data_base64} |
wait_for |
{text, tab_id?, timeout_ms?} |
{found:true,waited_ms} |
tab_id is optional everywhere it appears - it falls back to the active tab
of the last focused normal window.
snapshot is the main way an agent finds things to act on: it walks the top
document (same-origin iframes are out of scope in v1) for interactive
elements, tags each one with a stable data-bx-id="eN" ref, and returns a
compact list plus a text excerpt of the page. click and type_text then
target elements by that ref.
Known limitations
- Synthetic input is not trusted input.
clickandtype_textdispatch real DOM events, but they are not OS-level input, so some sites (payment iframes, bot-detection-heavy forms) may reject or flag them. - Screenshots require the tab to be active.
chrome.tabs.captureVisibleTabonly captures the active tab of a window;screenshotbriefly activates the target tab if it isn't already, then restores the previous one. evaluatecan be blocked by a page's CSP. Strictscript-srcpolicies can reject the injected eval; when that happens the error is surfaced verbatim rather than swallowed. A future version should switch tochrome.userScripts.executein theUSER_SCRIPTworld, which is exempt from page CSP.- The MV3 service worker gets killed by Chrome. It is normal for
background.jsto be torn down and revived repeatedly; thebx-keepalivealarm (every ~24s) and the reconnect-on-close logic are what keep the WebSocket connection coming back. A short gap in connectivity right after Chrome starts or the SW is revived is expected. - Google (and similar) may challenge with reCAPTCHA or a security check. If that happens, the agent must stop and ask the human to clear it in the real browser window rather than trying to script around it.
- Same-origin iframes are not walked by
snapshotin v1.
Troubleshooting
curl 127.0.0.1:9277/health- confirms the relay daemon is up.tail -f relay.log- relay daemon stdout/stderr (from the LaunchAgent).- Reload the extension from
chrome://extensionsif it stops responding. - Inspect the service worker console:
chrome://extensions-> browserx relay -> "service worker" link, to see WebSocket connect/reconnect logs and any errors from injected scripts.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。