Skip to main content
Glama
opencode-browser-control

opencode-browser-control

by FileXego

opencode-browser-control

Playwright-powered browser automation MCP server for OpenCode.
Controls Chrome/Edge with ARIA accessibility snapshots and numbered element refs — no CSS selectors, no guessing.

Quick Start

1. Install dependencies

npm install -g playwright-core
npx playwright install chromium

2. Configure OpenCode

Add to ~/.config/opencode/opencode.json:

{
  "mcp": {
    "browser-control": {
      "type": "local",
      "command": ["npx", "-y", "opencode-browser-control"],
      "enabled": true
    }
  }
}

3. Restart OpenCode

The browser, browser_snapshot, browser_click, and browser_type tools will be available.

Related MCP server: Pilot

Tools

browser(action, ...) — Multiplexed Tool

Action

Description

Key Params

start

Launch browser

headed (default: true)

stop

Close browser

—

navigate

Open URL

url, page_id

snapshot

ARIA snapshot with element refs

page_id

click

Click element by ref

ref (e.g. e42)

type

Type into input by ref

ref, text, submit

evaluate

Execute JavaScript

code

screenshot

Full-page screenshot

page_id

tabs

List all tabs

—

close_tab

Close a tab

page_id

back / forward

Navigate history

—

Shortcut Tools

Tool

Description

browser_snapshot

Get ARIA snapshot with e1, e2, e3... refs

browser_click(ref)

Click element by snapshot ref

browser_type(ref, text)

Type into element by snapshot ref

Typical Workflow

1. browser(action="navigate", url="https://example.com")
2. browser_snapshot()            → returns e1: button "Login", e2: textbox "Email", ...
3. browser_type(ref="e2", text="user@example.com")
4. browser_click(ref="e1")
5. browser_snapshot()            → verify result

Browser Support

Auto-detects in priority order:

OS

Priority

Windows

Edge → Chrome

macOS

Chrome → Edge

Linux

Chrome → Edge → Chromium

Falls back to Playwright's bundled Chromium if no system browser is found.

Persistent Profile

A persistent profile is stored at ~/.opencode/browser-profile/{browser}/. Login state, cookies, and local storage persist across sessions. The profile is isolated from your normal browser — it won't interfere with your daily browsing.

Architecture

OpenCode ──MCP(stdio)──▶ index.mjs ──Playwright──▶ Edge/Chrome

Single-file Node.js MCP server. No HTTP middle layer, no browser extensions, no CDP port configuration. Playwright manages the browser lifecycle automatically.

Troubleshooting

Problem

Solution

"playwright-core not found"

npm install -g playwright-core

Browser doesn't launch

Install Chromium: npx playwright install chromium

SPA navigation breaks refs

Re-run browser_snapshot() after navigation — refs are invalidated on page change

Elements not clickable

The snapshot only finds visible elements. Use browser_evaluate to scroll or interact with hidden elements

License

MIT

Available Tools

4 tools
browserC

浏览器控制主工具。通过 action 参数选择操作。首次使用自动启动浏览器。

Inputs: action (required), url, ref, text, +5 more.

browser_clickA

通过 ARIA 快照引用(如 e42)点击页面元素。需先调用 browser_snapshot 获取引用。

Inputs: ref (required), page_id.

browser_snapshotA

获取页面 ARIA 可访问性快照,返回带编号引用(e1, e2...)的交互元素列表。使用 browser_click(ref) 点击这些元素。

Inputs: page_id.

browser_typeA

通过 ARIA 快照引用在输入框中输入文本。需先调用 browser_snapshot 获取引用。

Inputs: ref (required), text (required), submit, page_id.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose: browser for general control, snapshot for getting ARIA references, click for clicking elements, and type for typing text. No overlap in functionality.

    Naming Consistency4/5

    All tools use the 'browser_' prefix, providing a consistent pattern. The main tool is simply 'browser', which deviates slightly from the verb_noun pattern but is still clear and predictable.

    Tool Count5/5

    With 4 tools covering core browser control (navigation, snapshot, click, type), the count is well-scoped and appropriate for the domain.

    Completeness4/5

    The tool set covers essential browser interactions, but lacks explicit support for scrolling, keyboard actions, or file handling. Minor gaps that can be worked around.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      A high-performance browser automation MCP server that provides AI agents with a fast, persistent Chromium instance via Playwright. It features reference-based element interaction, snapshot diffing, and manual handoff capabilities to handle complex tasks like CAPTCHAs.
      61
      11 npm
      32
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server that lets LLM agents control all Chrome browser tabs via accessibility snapshots, element references, and a virtual cursor, supporting operations like click, type, navigate, screenshot, and video recording.
      MIT