mirror of
https://github.com/wesammustafa/opencode-primer.git
synced 2026-11-18 18:04:22 +00:00
- Bump every version pin, pricing table, and model ID to the verified 2026-07-05 state (v1.17.13): Claude Fable 5 / Sonnet 5 on Zen, new free tier, deprecation sunset table, v1.17.x changelog section - Cover gaps: OpenCode Go vs Zen billing, Anthropic subscription-login removal (PR #18186), MCP resources, --mini mode, --auto flag, yolo mode - Fix correctness bugs: command-template !`cmd` syntax in docs and .opencode/commands, protect-secrets regex missing 'cat .env', dual plugin exports, quickstart PATH fix, Playwright MCP flags, ctrl+d keybind conflict, agent/command required-field claims - Fix links: cursor.com, windsurf.com, platform.claude.com, code.claude.com, opencode.ai/discord, Vercel Grep announcement - Rebrand: banner (Images/banner.svg), 1280x640 social preview asset, hero redesign with star CTA, ecosystem stats, private vulnerability reporting channel, CI-matching local checks, MD060 lint opt-out
3.0 KiB
3.0 KiB
Playwright MCP
Drive a real browser from OpenCode — open pages, click elements, fill forms, take screenshots, capture network requests, inspect accessibility trees.
When to reach for it
- Visual iteration: implement a UI, take a screenshot, refine
- E2E test scaffolding
- Reading documentation from sites that aren't well-indexed
- Reproducing a bug a user reported with a URL
Setup
Add to opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"playwright": {
"type": "local",
"command": ["npx", "-y", "@playwright/mcp@latest", "--browser", "chromium"],
"enabled": true
}
}
}
Restart OpenCode. Verify:
opencode mcp list
You should see playwright in the list.
💡 Pro Tip: The browser is picked with the
--browserCLI flag (chromium,firefox,webkit,msedge) or thePLAYWRIGHT_MCP_BROWSERenv var — there is noBROWSER_TYPEvariable.
Example prompts
use playwright to open https://example.com and screenshot the navbar
use playwright to visit our staging site at https://staging.example.com,
log in with the credentials in @.dev/staging-creds.json, and
verify the dashboard renders without console errors
the user reports a bug at https://app.example.com/billing — use playwright to
reproduce: log in, navigate to billing, click "upgrade plan", and report what
happens
Visual-iteration loop
[plan] > here's a mock: [drag mock.png in]
> sketch the HTML/CSS structure that matches
[build] > <Tab>
[build] > implement it under src/components/Dashboard/
[build] > use playwright to render the new component at http://localhost:5173/dashboard
> and screenshot it; compare to the mock
[build] > refine until the screenshot matches
Two-three iteration rounds usually closes the gap.
What it can do
- Open URLs, navigate, fill forms, click, hover, drag
- Take screenshots (full page, viewport, or element-scoped)
- Read DOM (CSS selectors, XPath, ARIA roles)
- Capture network requests/responses
- Inspect console messages
- Run JavaScript in the page context
- Read the accessibility tree
What it won't do
- Bypass strong bot detection (Cloudflare, etc.)
- Replace a real E2E test suite (use the screenshots and traces to write the tests)
Gotchas
- First run is slow — Playwright downloads a browser the first time you invoke it.
- Headed by default — when a display is available, a visible browser window opens. Pass
--headless(or setPLAYWRIGHT_MCP_HEADLESS=1) for CI and other display-less environments. - Persistent profile by default — cookies and logins survive across sessions. Pass
--isolatedfor a throwaway in-memory session instead. - Cross-origin / authenticated flows — use Playwright's auth-state file pattern; see the upstream docs.