Browser automation plugin for OpenCode.
Control your real Chromium browser (Chrome/Brave/Arc/Edge) using your existing profile (logins, cookies, bookmarks). No DevTools Protocol, no security prompts.
demo-1.mp4
This version is optimized for reliability and predictable multi-session behavior:
- No MCP -> just opencode plugin
- No WebSocket port → no port conflicts
- Chrome Native Messaging between extension and a local host process
- A local broker multiplexes multiple OpenCode plugin sessions and enforces per-tab ownership
Help me improve this!
bunx @different-ai/opencode-browser@latest installinstall-1.mp4
The installer will:
- Copy the extension to
~/.opencode-browser/extension/ - Walk you through loading + pinning it in
chrome://extensions - Resolve a fixed extension ID (no copy/paste) and install a Native Messaging Host manifest
- Update your
opencode.jsonoropencode.jsoncto load the plugin
To override the extension ID, pass --extension-id <id> or set OPENCODE_BROWSER_EXTENSION_ID.
Note: if you run the installer you'll be prompted to include this automatically. If you said "yes", you can skip this part.
Your opencode.json or opencode.jsonc should contain:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@different-ai/opencode-browser"]
}bunx @different-ai/opencode-browser@latest updateOpenCode Plugin <-> Local Broker (unix socket) <-> Native Host <-> Chrome Extension
- The extension connects to the native host.
- The plugin talks to the broker over a local unix socket.
- The broker forwards tool requests to the extension and enforces tab ownership.
This branch adds an alternate backend powered by agent-browser (Playwright). It runs headless and does not reuse your existing Chrome profile.
- Install
agent-browserand Chromium:
npm install -g agent-browser
agent-browser install- Set the backend mode:
export OPENCODE_BROWSER_BACKEND=agentOptional overrides:
OPENCODE_BROWSER_AGENT_SESSION(custom session name)OPENCODE_BROWSER_AGENT_SOCKET(unix socket path)OPENCODE_BROWSER_AGENT_AUTOSTART=0(disable auto-start)OPENCODE_BROWSER_AGENT_DAEMON(explicit daemon path)
On the host (e.g., home-server.taild435d7.ts.net), run the TCP gateway:
OPENCODE_BROWSER_AGENT_GATEWAY_PORT=9833 node bin/agent-gateway.cjsOn the client:
export OPENCODE_BROWSER_BACKEND=agent
export OPENCODE_BROWSER_AGENT_HOST=home-server.taild435d7.ts.net
export OPENCODE_BROWSER_AGENT_PORT=9833- Each session owns its own tabs; tabs are never shared between sessions.
- If a session has no tab yet, the broker auto-creates a background tab on first tool use.
browser_open_tabalways creates and claims a new tab for the session.- Claims expire after inactivity (
OPENCODE_BROWSER_CLAIM_TTL_MS, default 5 minutes). - Use
browser_statusorbrowser_list_claimsfor debugging.
Core primitives:
browser_statusbrowser_get_tabsbrowser_list_claimsbrowser_claim_tabbrowser_release_tabbrowser_open_tabbrowser_close_tabbrowser_navigatebrowser_query(modes:text,value,list,exists,page_text; optionaltimeoutMs/pollMs)browser_click(optionaltimeoutMs/pollMs)browser_type(optionaltimeoutMs/pollMs)browser_select(optionaltimeoutMs/pollMs)browser_scroll(optionaltimeoutMs/pollMs)browser_wait
Downloads:
browser_downloadbrowser_list_downloads
Uploads:
browser_set_file_input(extension backend supports small files; use agent backend for larger uploads)
Selector helpers (usable in selector):
label:Mailing Address: Cityaria:Principal Address: Cityplaceholder:Search,name:email,role:button,text:Submitcss:label:has(input)to force CSS
Selector-based tools wait up to 2000ms by default; set timeoutMs: 0 to disable.
Diagnostics:
browser_snapshotbrowser_screenshotbrowser_version
- Add tab management tools (
browser_set_active_tab) - Add navigation helpers (
browser_back,browser_forward,browser_reload) - Add keyboard input tool (
browser_key) - Add download support (
browser_download,browser_list_downloads) - Add upload support (
browser_set_file_input)
Extension says native host not available
- Re-run
npx @different-ai/opencode-browser install - If you loaded a custom extension ID, rerun with
--extension-id <id>
Tab ownership errors
- Errors usually mean you passed a
tabIdowned by another session - Use
browser_open_tabto create a tab for your session (or omittabIdto use your default) - Use
browser_statusorbrowser_list_claimsfor debugging
npx @different-ai/opencode-browser uninstallThen remove the unpacked extension in chrome://extensions and remove the plugin from opencode.json or opencode.jsonc.