tmwd-bridge-mcp
Allows AI agents to directly control the user's real Google Chrome browser, using the existing profile, cookies, and login state. Provides tools for tab management, cookie access, JavaScript evaluation, raw CDP commands, clicking, typing, file uploads, screenshots, and more.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@tmwd-bridge-mcpIn my logged-in GitHub, open the latest pull request and screenshot it"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
tmwd-browser-mcp
让 AI agent 直接操作你真实的浏览器。 一个 MCP server + 一个极小的浏览器扩展,把 你自己在用的 Microsoft Edge / Google Chrome 交给 agent —— 同一个 profile、同一批 cookie、同一份登录态。
不用 Selenium,不用 Playwright,不开 --remote-debugging-port,也不启动任何额外浏览器。
English: README.en.md
┌──────────────┐ MCP (stdio) ┌────────────────────┐ WebSocket ┌──────────────────┐
│ AI agent / │ ◄─────────────► │ tmwd-bridge-mcp │ ◄───────────── │ 你的 Edge / │
│ MCP client │ browser_* │ (本项目的 server) │ 127.0.0.1: │ Chrome + │
└──────────────┘ 工具 │ + WebSocket 主端 │ 18765 │ 这个扩展 │
└────────────────────┘ └──────────────────┘
chrome.debugger
(标签页级 CDP)扩展是主动外连到 server 的,所以本机没有任何调试端口在监听,浏览器也不会跑在一个 "自动化专用 profile" 里。
为什么不用调试端口?
因为 Chromium 已经把它在默认 profile 上禁掉了。当浏览器用的是正常用户目录时,
--remote-debugging-port 会被直接忽略 —— 这是官方为防 cookie 窃取刻意做的限制。想用它,
就只能另开一个一次性 profile,代价是丢掉所有登录态。
本项目走另一条路:一个带 debugger 权限的扩展,在你本来就在用的 profile 里拿到
标签页级的 CDP。已在 Edge 154 上端到端验证。
Related MCP server: TraeBridge MCP Server
安装
1. 装扩展
Edge:
edge://extensionsChrome:
chrome://extensions
打开开发者模式 → 加载解压缩的扩展 → 选 assets/tmwd_cdp_bridge/。
装好后每个页面右下角会出现一个小徽章:绿色 = 已连上 server,橙色 = 重连中,红色 = 断开。
2. 注册 MCP server
{
"mcpServers": {
"tmwd": {
"type": "stdio",
"command": "node",
"args": ["/改成绝对路径/tmwd-browser-mcp/mcp/tmwd-bridge-mcp.mjs"]
}
}
}改完要重启 MCP 客户端 —— server 是启动时发现的。server 会占用 127.0.0.1:18765,
并且对普通 GET / 返回 200(扩展就是靠这个探活的)。
扩展自己会重试(chrome.alarms 每 ~5 秒探一次,每 ~24 秒发一次保活让 MV3 service worker
不被挂起),所以谁先启动都无所谓。
工具
工具 | 作用 |
| 连接状态、已知标签页、当前解析到的活动标签页 |
| 列出可脚本化的标签页(仅 http/https) |
| 读取 cookie(含 partitioned),按标签页或 URL |
| 在页面里跑 JS(world=MAIN;CSP 拦 eval 时自动回落 CDP) |
| 通过 |
| 一次往返跑多条命令,懒 attach,支持 |
|
|
| 完整鼠标生命周期 + 首次 attach 的坐标预热 |
|
|
| DataTransfer 上传文件(不依赖 CDP) |
| 例如 |
每个工具的 tabId 都是可选的 —— 不传就落到当前活动标签页。
这个项目真正编码进去的坑
价值大半不在管道,而在失败模式。有几条我直接写进了工具实现里:
browser_click一定会先发mouseMoved再按下去 —— 漏掉它,所有依赖 hover 的组件 (MUI Tooltip、Ant Design Dropdown)会静默失效。首次 attach 的信息栏偏移: 第一次
chrome.debugger.attach会弹出一条约 20px 高的 "正在受自动化控制" 提示栏,把页面内容往下推。attach 之前量的坐标会整体偏掉这么多。browser_click首次使用时会先用mouseMoved(0,0)预热。这条正是上游一次下拉框点歪的 真实根因。browser_eval里用了await却不写return会拿到null—— 代码被包在 async IIFE 里。导航和后续操作必须拆成两次调用 —— 写在同一段 JS 里会报
Inspected target navigated or closed。只有标签页级的 CDP 域可用。
Browser.*(getVersion、setDownloadBehavior)和Target.getTargets/Target.attachToTarget都不可用 —— debugger 会话是按标签页的。 命令报 "wasn't found" 时,先怀疑域,别怀疑浏览器。browser_batch: 前面一条失败,后面所有$N引用会静默变成undefined。 必须逐条看results里的ok,不能只看外层ok。上传走 DataTransfer —— 因为这个桥里
DOM.setFileInputFiles的 nodeId 跨调用会失效。跨域 iframe:
Page.getFrameTree→Page.createIsolatedWorld→ 用返回的executionContextId调Runtime.evaluate。autofill 的值只在前台标签页释放 —— 先
Page.bringToFront。
完整清单(batch 链式引用、穿透 Shadow DOM、验证码截图、多文件下载对话框绕法)在
SKILL.md。
当作 Claude Code skill 用
SKILL.md 就是按 Claude Code skill 格式写的:把仓库放到 ~/.claude/skills/tmwd-browser/,
agent 就会按触发词自动认出来(用我的 Chrome、保留登录态、browser automation …)。
配置
环境变量 | 默认 | 含义 |
|
| WebSocket + HTTP 端口。必须和扩展里的 |
|
| 绑定地址。 |
|
| 单条命令超时。 |
改端口要同时改 assets/tmwd_cdp_bridge/background.js 里两处硬编码:WS_URL 和
isServerAlive() 里的 fetch。
环境要求
Node.js ≥ 18(server 零 npm 依赖 —— WebSocket 服务端和 MCP stdio 传输都是手写的, 裸
node就能跑)Microsoft Edge 或 Google Chrome,且能开开发者模式
扩展需要
debugger权限,这会导致每个标签页首次 attach 时出现一条"正在受自动化控制" 的信息栏。这是预期行为,也正是坐标必须在 attach 之后测量的原因。
致谢
浏览器扩展,以及蒸馏进 SKILL.md 的操作知识,来自
lsdefine/GenericAgent(MIT):
assets/tmwd_cdp_bridge/ 和 memory/tmwebdriver_sop.md。扩展是逐字再分发并保留其
原始许可;MCP server、工具层和文档属于本项目。
上游有一处矛盾值得知道:SOP 里写主端监听 18766,而扩展代码里是 18765。 本 server 以代码为准。
许可证
This server cannot be deployed
Maintenance
Related MCP Connectors
Let your AI agent operate any website through a real, logged-in browser session.
Undetectable cloud browser sessions for AI agents and scrapers. Navigate, extract, click, captcha.
Provides cloud browser automation capabilities using Stagehand and Browserbase, enabling LLMs to i…
Stealth web automation for AI agents. Login, signup, navigate, screenshot.
Related MCP Servers
- AlicenseBqualityFmaintenanceEnables AI agents to directly control your real Chrome browser with full context including login sessions, cookies, and open tabs. It provides tools for page scanning, JavaScript execution, CDP control, screenshots, and physical mouse/keyboard input for authentic browser automation.20245MIT
- AlicenseAqualityCmaintenanceEnables AI clients to control the user's already-open, logged-in browser pages in real time over a local WebSocket channel, without Playwright, Puppeteer, Selenium, or any browser driver. Exposes tools for navigation, semantic page snapshots, clicking, form filling, JavaScript evaluation, screenshots, network monitoring, cookie handling, and tab management via the CDP.20MIT
- AlicenseBqualityAmaintenanceEnables AI agents and developers to automate real Chrome/Chromium browsers through the Chrome DevTools Protocol, with token-efficient snapshots, multi-action batching, shadow DOM traversal, system-page control, extension management, and network/WebSocket inspection.691MIT
- AlicenseNot gradedqualityAmaintenanceEnables an AI agent to read and operate the Chrome or Edge tabs you are already using — titles, URLs, text, HTML, screenshots, clicks, typing, scrolling, and tab management — via a browser extension and native messaging, without restarting the browser, switching profiles, or opening a debug port. It exposes these capabilities as 19 MCP tools, with access limited to explicitly shared tabs and hardened by per-tab, origin-bound grants plus domain allow/deny lists.1MIT