$ 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.

Tools it registers in OpenCode
  1. browser_openOpen a page in a persistent dev session
  2. browser_snapshotAccessibility tree with @e1, @e2 refs
  3. browser_click / type / fillDrive the page like a user
  4. browser_screenshotThe rendered page, in the agent's context
  5. browser_errorsUncaught exceptions and console logs
  6. 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.

  1. 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.

  2. 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.

  3. 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.

OptionWhat it does
autoInstallProvisions the browser driver when a session starts, no manual setup
enableMcpExposes the tools over MCP, discoverable by OpenCode's tool router
mcpTools"core" keeps the toolset small to save context
defaultSessionA 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_console and browser_errors for uncaught JS exceptions.
  • Accessibility: browser_a11y runs an axe-core audit on the current page.

Set it up

You need OpenCode. The plugin is on npm as opencode-browser-tools.

  1. 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. 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.
esc