Connect Playwright MCP to OpenCode
Browser automation over MCP from the Playwright team. Agents use it to open the built UI, take screenshots and check layouts against the design.
MCP serverOfficialChecked 2026-11-16
Before you start
- OpenCode installed (see its MCP documentation (opens in a new tab)).
- Playwright MCP is available on macOS, Windows and Linux.
Step 1: Add Playwright MCP to OpenCode
Add it from the terminal
Run this in your project folder. It saves the server to the project's
opencode.json.Terminal opencode mcp add playwright -- npx -y @playwright/mcp@latestOr edit the config file
Add this to
opencode.jsonat the project root.opencode.json { "$schema": "https://opencode.ai/config.json", "mcp": { "playwright": { "type": "local", "command": [ "npx", "-y", "@playwright/mcp@latest" ], "enabled": true } } }Step 2: Check it's connected
Terminal opencode mcp listStart OpenCode in the project; the server's tools are available to the agent straight away.
Step 3: Try a first request
Ask OpenCode something that only works with Playwright MCP connected:
Say to OpenCode Open http://localhost:3000, take a screenshot at 375 px wide and tell me what looks broken.
If it doesn't work
- OpenCode reads
opencode.jsonfrom the project root, or~/.config/opencode/opencode.jsonfor every project. - Environment variables use the
{env:NAME}syntax inside the config file. - Servers that need a sign-in: run
opencode mcp auth <name>.





