OpenCode in Chrome
OpenCode in Chrome
让你的本地 opencode 代理查看并控制浏览器——标签页、点击、JS、截图。
Anton Petnitsky · github.com/Mukller · LinkedIn
opencode 的 Claude-in-Chrome 替代方案:Chrome 扩展 + 带 MCP 接口的本地桥接。代理可以完全控制你的实时浏览器——包括已登录的会话,无需 --remote-debugging-port,也无需云端。一切通过 localhost 完成。
┌──────────────────┐ WebSocket ┌─────────────────┐ stdio/MCP ┌──────────┐
│ Chrome extension │◄──────────────►│ bridge (Node) │◄───────────────►│ opencode │
│ chrome.debugger │ 127.0.0.1 │ ws + mcp │ │ │
└──────────────────┘ └─────────────────┘ └──────────┘关键技巧:扩展程序通过 chrome.debugger 自行启动 CDP 会话——因此无需浏览器启动标志,所有配置文件和 Cookie 都照常工作。
功能
MCP 工具 | 功能说明 |
| 列出打开的标签页 |
| 打开/导航/关闭标签页 |
| 等待页面加载完成 |
| 在页面上执行 JavaScript 并获取结果 |
| 点击 CSS 选择器 |
| 填充字段(React 友好,通过原生 setter) |
| 向聚焦元素发送按键 |
| 标题 + URL + 页面可见文本 |
| 标签页 PNG 截图(作为图像块返回) |
| 最近的 console.log / 页面异常 |
Related MCP server: @nimbus21.ai/chrome-devtools-mcp
安装
1. 桥接
git clone https://github.com/Mukller/opencode-chrome.git
cd opencode-chrome
npm install
node bridge/bridge.mjs首次启动时,桥接会打印一个令牌并将其保存到 ~/.opencode-chrome/token。
2. 扩展
打开
chrome://extensions→ 启用开发者模式加载已解压的扩展程序 → 选择
extension/文件夹点击扩展图标 → 设置 → 粘贴步骤 1 中的令牌 → 保存并重新连接
图标徽章应变为绿色 ON
3. 连接到 opencode
在 ~/.config/opencode/opencode.json(或项目配置)中:
{
"mcp": {
"chrome": {
"type": "local",
"command": ["node", "<путь до репо>/bridge/bridge.mjs"],
"enabled": true
}
}
}重启 opencode——代理将看到 chrome_* 工具。
桥接环境变量:OPENCODE_CHROME_PORT(默认 8766)、OPENCODE_CHROME_TOKEN(使用固定令牌而不是文件)。
安全
WS 服务器仅监听 127.0.0.1,拒绝外部连接。
握手需要令牌;令牌无效 = 连接关闭。
扩展仅执行来自已连接桥接的命令;活动操作期间,黄色“调试已开始”横幅会显示所有内容。
已知限制
只要标签页上存在活动的 CDP 会话,Chrome 就会显示“扩展程序已开始调试此浏览器”信息栏——这是无需 devtools 标志即可访问的代价。
当 Chrome 空闲时,扩展的 Service Worker 会休眠;桥接只是等待重新连接(自动重连)。
测试
npm test # E2E: фейковое расширение + MCP-клиент против реального моста许可证
MIT © Anton Petnitsky
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to control the Google Chrome browser through a Node.js WebSocket bridge and a dedicated browser extension. It provides tools for capturing screenshots, executing JavaScript, managing tabs, and extracting page content via the MCP protocol.2
- AlicenseNot gradedqualityBmaintenanceLets AI coding agents control and inspect a live Chrome browser via MCP, providing Chrome DevTools capabilities for automation, debugging, and performance analysis.11Apache 2.0
- AlicenseNot gradedqualityCmaintenanceGives coding agents full control over a real Chrome browser, enabling navigation, clicking, typing, screenshotting, and more via an MCP server and Chrome extension.132MIT
- AlicenseNot gradedqualityBmaintenanceLets coding agents control and inspect a live Chrome browser via MCP, providing Chrome DevTools capabilities for automation, debugging, and performance analysis.2,211,104Apache 2.0
Related MCP Connectors
Hosted real Google Chrome MCP with per-user persistent state. Navigate, click, type, screenshot.
Live browser debugging for AI assistants — DOM, console, network via MCP.
Browser MCP for logged-in tasks. Uses your Chrome — credentials stay local. Zero-token replay.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Mukller/opencode-chrome'
If you have feedback or need assistance with the MCP directory API, please join our Discord server