$ opencode
Give your terminal agent eyes.
opencode-browser-tools lets an OpenCode agent open your app, click through it, screenshot it and read its errors, then fix what it sees.
- browser_openOpen a page in a persistent dev session
- browser_snapshotAccessibility tree with @e1, @e2 refs
- browser_click / type / fillDrive the page like a user
- browser_screenshotThe rendered page, in the agent's context
- browser_errorsUncaught exceptions and console logs
- browser_a11yAn axe-core accessibility audit
Why a terminal agent needs a browser
A green npm run build says the compiler is happy. It says nothing about a nav bar overflowing on mobile or a modal losing focus. Without a browser, you are the agent's eyes.
Execute, then verify
The agent edits the CSS, opens
localhost, resizes to 375×812, screenshots, reads the computed width, fixes it and checks again, all in one turn.Structured tools, not a CLI prompt
Each action has a typed schema and deterministic JSON output, so long sessions make fewer syntax mistakes than an agent assembling CLI flags.
A lean default
"mcpTools": "core"exposes only the essential primitives, so the tool registry doesn't eat the context on every turn.
Configuration
Plugin options in opencode.json.
| Option | What it does |
|---|---|
autoInstall | Provisions the browser driver when a session starts, no manual setup |
enableMcp | Exposes the tools over MCP, discoverable by OpenCode's tool router |
mcpTools | "core" keeps the toolset small to save context |
defaultSession | A persistent session, so HMR state and cookies survive across turns |
What you get
- Navigation and sessions: multi-tab dev sessions, auth cookies and local storage kept between turns.
- DOM inspection: accessibility snapshots with refs, computed styles and live state via
browser_eval. - Interaction:
browser_click,browser_type,browser_fill,browser_press,browser_hover. - Screenshots attached straight into the agent's visual context.
- Debugging:
browser_consoleandbrowser_errorsfor uncaught JS exceptions. - Accessibility:
browser_a11yruns an axe-core audit on the current page.
Set it up
You need OpenCode. The plugin is on npm as opencode-browser-tools.
- 1
Add it to opencode.json
In your project's root. OpenCode installs the package when it loads the plugin.
{ "$schema": "https://opencode.ai/config.json", "plugin": [ ["opencode-browser-tools", { "autoInstall": true, "enableMcp": true, "mcpTools": "core", "defaultSession": "dev" }] ] } - 2
Start OpenCode and ask
Then give it a task that needs eyes, like the one shown here.
Open the dev server at localhost:4321, submit the contact form, check for console errors, and verify the mobile layout.
Know the limits
It gives the agent eyes, not judgment.
- Built for OpenCode's plugin lifecycle, not for other agents.
- Every tool schema costs context on each turn, which is why the core set is the default.
- The agent still decides what to check: ask for the viewports and flows you care about.
How it was built
The design, the wrong turns and the measurements are in the write-up.