Skip to content

feat(collab): bake Playwright browser MCP (off by default) + fix Headroom serve#48

Merged
hblanken merged 1 commit into
collabfrom
feat/baked-mcp-playwright
Jun 15, 2026
Merged

feat(collab): bake Playwright browser MCP (off by default) + fix Headroom serve#48
hblanken merged 1 commit into
collabfrom
feat/baked-mcp-playwright

Conversation

@hblanken

Copy link
Copy Markdown

What

Adds a Playwright browser-automation MCP to the collab container and fixes the Headroom MCP launch command (both edits live on the same baked-config line, hence one PR).

Playwright MCP

  • npm install -g @playwright/mcp@0.0.76 + a version-matched headless Chromium baked at build time (PLAYWRIGHT_BROWSERS_PATH=/home/opencode/.cache/playwright) — installed via the bundled playwright so the browser revision can't drift. No runtime download / no cold-task network dependency.
  • Registered in the global opencode.json mcp block as enabled:false → shows in every collab session's MCP toggle panel (grey dot); a Driver flips it ON per session when browser automation is needed. Idle cost is zero until toggled.
  • Flags: --headless --no-sandbox (mandatory for Chromium as the non-root opencode user without SYS_ADMIN) + --isolated (throwaway profile per connect → no cross-session state, no disk growth) + --browser chromium + --output-dir /home/opencode/.cache/playwright-output. timeout:60000 for the first browser launch.
  • Cache/output dirs added to the mkdir block; AGENTS.md nudge tells the agent the tools exist but must be toggled on first.

Headroom fix (same line)

  • Launch command corrected ["headroom","mcp"]["headroom","mcp","serve"]. The bare mcp is the subcommand group (install/status/uninstall/serve) — it printed help and exited, so the stdio handshake never completed and opencode flagged the server failed (the red dot). Connect timeout bumped 10s → 30s.

Why

Built-in browser tools (OPENCODE_ENABLE_BROWSER / browser:true) do not exist in this fork (v1.15.4) — verified by repo-wide grep — so an MCP server is the only route. Mirrors the existing Headroom MCP bake pattern.

Scope

  • One file: Dockerfile. No app code, no infra/terraform, no new ports or domains.
  • Rides the next image build + "Deploy collab".

Verification

  • ✅ Baked opencode.json re-parses; mcp = {headroom (serve, on), playwright (off)}.
  • Build-time smoke checks fail the build loudly if anything's wrong: command -v playwright-mcp, playwright-mcp --version, ls $PLAYWRIGHT_BROWSERS_PATH/chromium-*.
  • Post-deploy: MCP panel shows playwright grey → toggle ON → green within 60s → prompt "navigate to example.com and screenshot" → output in /home/opencode/.cache/playwright-output.

Guardrails

  • enabled:false + --isolated keep memory off the 4 vCPU / 16 GB task (shared with the preview build) until actually used; the existing S6 cgroup memory monitor still WARNs >13 GB.
  • Image grows ~250-350 MB (Chromium + libs), baked once.

🤖 Generated with Claude Code

…room serve

Add @playwright/mcp@0.0.76 to the collab container with a version-matched
headless Chromium baked at PLAYWRIGHT_BROWSERS_PATH (no runtime download).
Registered as an OFF-by-default MCP server in the global opencode.json, so it
appears in every collab session's MCP toggle panel; a Driver enables it per
session when browser automation is needed. --headless --no-sandbox keep
Chromium runnable as the non-root opencode user; --isolated gives each connect
a throwaway profile (no cross-session state) for multi-user safety. Adds the
browser cache/output dirs and an AGENTS.md nudge.

Also fixes the Headroom MCP launch command on the same baked-config line: the
stdio server is `headroom mcp serve`, not `headroom mcp` (the bare subcommand
group printed help and exited, so the handshake never completed and opencode
flagged the server failed). Bumps its connect timeout 10s -> 30s.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@hblanken hblanken merged commit e40e2a6 into collab Jun 15, 2026
2 of 3 checks passed
@hblanken hblanken deleted the feat/baked-mcp-playwright branch June 15, 2026 03:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant