We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Playwright MCP

Playwright MCP gives an agent control of a real browser via the Model Context Protocol (MCP). It can navigate pages, inspect accessibility snapshots, fill forms, click controls, and capture screenshots. To enable this MCP server, add the following to opencode.jsonc:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "playwright": {
        "type": "local",
        "command": [
          "bunx",
          "--bun",
          "@playwright/[email protected]",
          "--isolated",
          "--browser",
          "chromium",
        ],
      },
    },
  },
}

The --isolated flag starts the browser with a temporary profile. Cookies and local storage disappear when the session closes, which is exactly what we want for repeatable local testing. The --browser chromium option selects Chromium.

Structured Control

Playwright MCP uses accessibility snapshots by default. A text-only model can locate a button by its role and name, click it, then inspect the updated page. Coordinate-based vision tools are optional, and you'll be able to use them only if you're working with an image-capable model:

"command": ["bunx", "--bun", "@playwright/[email protected]", "--isolated", "--browser", "chromium", "--caps=vision"]

Assignment

Have OpenCode run a program through the playground's browser interface. This code:

hallucinate(“browser slop”, 42)✨

prints browser slop 42 on one line.

Tell OpenCode to run and submit the CLI tests from the project root.