5.7 KiB
opencode (Chrome extension)
Gives opencode the same browser tools as Anthropic's Claude in Chrome: the same 22 MCP tools, with the same names, parameters and behaviour, driving your real Chrome (logged-in profile, real tabs) through an extension.
Fork of noemica-io/open-claude-in-chrome,
reworked for opencode. License: PolyForm Noncommercial 1.0.0 (inherited
from upstream, see LICENSE): personal/non-commercial use only.
How it works
opencode ──stdio MCP──▶ host/mcp-server.js ──unix socket──▶ native host ──native messaging──▶ extension ──CDP──▶ tabs
- Each browser with the extension runs its own native host, which opens a
socket and descriptor in
~/.config/opencode-browser/run/. The MCP server finds browsers there, which is whatlist_connected_browsers,select_browserandswitch_browserwork on. - Each opencode session (one MCP server process) gets its own tab group: a background tab at the end of the window you are using, so your own tab stays in front (focus emulation keeps the background tab rendering). A session's calls run one at a time, in order, even when the model issues them in parallel.
- While the agent works in a tab, the page shows the official extension's overlay: a pulsing orange glow around the edges and an orange cursor that glides to each click, hover, scroll or drag. Unlike the official extension, which takes the glow out for every screenshot (so it blinks), the overlay is left alone and shows in the agent's screenshots. It stays until the session ends.
- Screenshots use the official frame: the viewport at device resolution,
shrunk to fit the image budget (1568 tiles of 28 px). Coordinates the agent
passes are in that frame. Tool output text (Tab Context blocks, batch labels,
read_pagelines, console and network listings, errors) follows the official extension's wording; it was compared side by side with it. browser_batch,navigatewithout atabId, the browser-selection tools,file_uploadpath checks andsave_to_diskare handled in the MCP server; everything else runs in the extension.
Install
Requires Node.js 18+.
./install.sh --opencode
This registers the native host for Chrome, Chrome Beta/Canary, Chrome for
Testing, Chromium, Edge, Brave, Vivaldi and Arc (wherever installed), copies the
host to ~/Library/Application Support/opencode-browser/host (macOS won't let a
browser run it from ~/Documents), and adds this to
~/.config/opencode/opencode.json (after backing it up):
"mcp": { "chrome": { "type": "local", "command": ["<node>", "<repo>/host/mcp-server.js"], "timeout": 150000 } },
"instructions": ["<repo>/host/instructions.md"]
Then, in each browser: chrome://extensions → Developer mode → Load
unpacked → select extension/. The ID is fixed by the manifest key:
ilgnnaeidkbcbnklkmjllflfkmendiib. The toolbar popup should say
"Connected"; you can rename the browser there.
./install.sh --uninstall removes the native host registrations.
macOS installer (.pkg)
For another Mac, build a self-contained installer (no Node.js needed there):
packaging/build-pkg.sh # dist/opencode-browser-<version>.pkg (universal)
packaging/build-pkg.sh --arch arm64 # smaller, Apple silicon only
It installs a Node.js runtime, the MCP server and native host (bundled with
esbuild) and the extension into /Library/Application Support/opencode-browser.
It then registers the native host (system-wide for Chrome, and per user for the
other browsers) and adds the chrome MCP server to the logged-in user's
~/.config/opencode/opencode.json. An optional component, on by default,
adds the llama.cpp provider and makes it the default model when none is set.
The last installer page explains how to load the extension. The package is
unsigned: open it with right-click → Open, or System Settings → Privacy &
Security → Open Anyway.
On the installed Mac, …/opencode-browser/setup [--llama] repeats the per-user
setup for another account, and sudo …/opencode-browser/uninstall removes it.
Tools
tabs_context_mcp, tabs_create_mcp, tabs_close_mcp, navigate,
computer (click/type/key/scroll/drag/hover/screenshot/zoom/scroll_to/wait),
read_page, get_page_text, find, form_input, javascript_tool,
file_upload, upload_image, read_console_messages,
read_network_requests, resize_window, gif_creator, shortcuts_list,
shortcuts_execute, list_connected_browsers, select_browser,
switch_browser, browser_batch. In opencode they appear as chrome_<name>.
Differences from the official extension:
- No per-site permission prompts and no site blocklist. Use opencode's own
permissionconfig if you want approval before browser actions. finduses scored keyword/role matching in the page, not a language model, so its one-line explanations are templated.- Shortcuts are an official side-panel feature:
shortcuts_listis always empty. - The GIF watermark says "opencode".
Development
cd host && npm test # host + MCP server against a simulated extension
- After changing
extension/, reload it inchrome://extensions. A browser restart alone can keep running the cached service worker if the version is unchanged. - After changing
host/native-host.jsorhost/endpoint.js, re-run./install.sh(the browser runs the installed copy), then reload the extension. - Changes to
host/mcp-server.jsand friends take effect in the next opencode session. - Logs:
~/.config/opencode-browser/host.log(native host exits),server-exits.log(MCP server).