OpenCode in Chrome
Enables local opencode agents to control a live Chrome browser via MCP tools, including tab management, JavaScript execution, clicking, form filling, page reading, screenshots, and console log retrieval.
README
<div align="center">
<div align="center">
English • Русский
</div>
OpenCode in Chrome
<p align="center"> <a href="https://github.com/Mukller"> <img src="https://img.shields.io/badge/Anton%20Petnitsky-Developer-0d1117?style=for-the-badge&logo=github&logoColor=white&labelColor=0d1117&color=58a6ff" alt="Anton Petnitsky" /> </a> </p>
Пусть твой локальный агент opencode видит и управляет браузером — вкладки, клики, JS, скриншоты.
Anton Petnitsky · github.com/Mukller · LinkedIn
</div>
Альтернатива Claude-in-Chrome для opencode: расширение Chrome + локальный мост с MCP-интерфейсом. Агент получает полноценный контроль над твоим живым браузером — с залогиненными сессиями, без --remote-debugging-port и без облаков. Всё через localhost.
┌──────────────────┐ WebSocket ┌─────────────────┐ stdio/MCP ┌──────────┐
│ Chrome extension │◄──────────────►│ bridge (Node) │◄───────────────►│ opencode │
│ chrome.debugger │ 127.0.0.1 │ ws + mcp │ │ │
└──────────────────┘ └─────────────────┘ └──────────┘
Ключевой трюк: расширение само поднимает CDP-сессию через chrome.debugger — поэтому не нужны флаги запуска браузера, и работают все профили и куки как обычно.
Возможности
| Инструмент MCP | Что делает |
|---|---|
chrome_tabs_list |
список открытых вкладок |
chrome_tab_open / _navigate / _close |
открыть/перейти/закрыть вкладку |
chrome_tab_wait_load |
дождаться загрузки страницы |
chrome_eval |
выполнить JavaScript на странице, получить результат |
chrome_click |
клик по CSS-селектору |
chrome_fill |
заполнить поле (React-friendly, через native setter) |
chrome_press_key |
отправить клавишу сфокусированному элементу |
chrome_read |
заголовок + URL + видимый текст страницы |
chrome_screenshot |
PNG-скриншот вкладки (возвращается как image-блок) |
chrome_console |
последние console.log / исключения страницы |
Установка
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/ - Кликни по иконке расширения → Settings → вставь токен из шага 1 → Save & reconnect
- Бейдж иконки должен стать зелёным 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-флагов.
- Service worker расширения засыпает при простое Chrome; мост просто ждёт переподключения (авто-reconnect).
Тесты
npm test # E2E: фейковое расширение + MCP-клиент против реального моста
Лицензия
MIT © Anton Petnitsky
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.