/autoweb:setup-playwrightfrom autoweb
Set up and verify Playwright MCP in the current directory, then prove a browser opens and acts
Ships in autoweb. Installing the plugin adds it to Claude Code.
Set up Microsoft's Playwright MCP server for Claude Code in the current working directory, then prove it works by opening a real browser and taking actions in it.
This command is self-contained. It assumes nothing about the surrounding project — drop it into any directory and it does the same thing. It is idempotent; re-running it is always safe.
Work through the phases in order. Stop at the first hard failure and report it plainly — a clear failure beats an improvised success. Report one short line per check as you go, then print the Phase 5 summary.
Run these and record results. Do not fix anything yet.
Node ≥ 20 — node -v
@playwright/mcp declares engines: { node: ">=18" }, but the playwright-core 1.64
it bundles refuses to start on 18 ("Playwright requires Node.js 20 or higher").
Below 20 is a hard stop.
Config present — does .mcp.json exist in the current directory with an
mcpServers.playwright entry? The plugin ships no MCP server: the project's own
.mcp.json is the only place this server comes from. /autoweb:aw-setup writes it
into every project it is run in, pinned to the project's lanes.mcp_version.
Expected content:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/[email protected]"]
}
}
}
Chrome present. The server's default is channel=chrome — real Google
Chrome, not bundled Chromium. This is the most likely thing to be missing and it
fails late, on the first browser call. There is no browser_install tool any
more, so it cannot be fixed from inside a session.
C:/Program Files/Google/Chrome/Application/chrome.exe or
C:/Program Files (x86)/Google/Chrome/Application/chrome.exe/Applications/Google Chrome.appwhich google-chrome || which google-chrome-stableServer status — claude mcp get playwright
Record the Scope and Status lines verbatim. If it reports the server defined in
more than one scope, record that too — project scope wins, but the user should
know about the collision.
Act only on what Phase 1 found missing.
Node < 20 or absent → STOP. Tell the user to install Node 20+ and re-run
/autoweb:setup-playwright. Do not attempt to install Node.
.mcp.json missing, or present without a playwright entry → in an AutoWeb
project (the folder holds autoweb.toml), tell the user to run /autoweb:aw-setup,
which writes it, merges it beside other servers, and enables it in
.claude/settings.local.json. In any other folder, write exactly the JSON from
Phase 1 step 2. If the file exists with other servers in it, add the playwright
entry and leave the rest untouched. If it does not parse, stop and report it rather
than replace it.
Add no flags. Not --user-data-dir, not --isolated, not --headless. Zero
flags is the stock configuration from the official README, and browser-profile
handling is deliberately out of scope here.
Prewarm the package — npx @playwright/[email protected] --help
Do this even when everything looks fine. It forces the npm download now instead of
mid-task, where it surfaces as an unexplained hang. Allow up to a minute on a cold
cache.
Chrome missing → npx playwright install chrome
If that fails or Chrome cannot be installed, the fallback is
npx playwright install chromium plus adding "--browser", "chromium" to the
args array in .mcp.json. If you take the fallback, say so loudly — it is a
deviation from stock and the user needs to know it is there.
Re-run claude mcp get playwright.
Status: ✔ Connected → continue to Phase 4.
Pending approval, failed, or not found → STOP HERE. This cannot be fixed
from inside the running session. .mcp.json is read only at Claude Code
startup, so a server that is not connected now will not connect until a restart,
whatever claude mcp commands you run.
Tell the user, in this order:
playwright server at the project-scope prompt, if one appears.
Claude Code then writes enabledMcpjsonServers into .claude/settings.local.json
itself. In an AutoWeb project /autoweb:aw-setup has already written that entry./autoweb:setup-playwright.Worth saying in the report: an enabledMcpjsonServers entry committed to a tracked
.claude/settings.json is ignored until the workspace is trusted. It is a
convenience, not the mechanism. The approval prompt is the mechanism.
Prove a browser opens and acts. Run exactly this sequence, nothing more:
browser_navigate → https://example.combrowser_snapshot — note the page title and the "Learn more" link's refbrowser_click on "Learn more", using the ref from the snapshot you just took
— never a hardcoded ref, never one from an earlier snapshot; refs go stalebrowser_snapshot — note the resulting URL and titlebrowser_take_screenshotbrowser_closeExpected: https://example.com/ → https://www.iana.org/help/example-domains, title
"Example Domains", and browser_close returning
No open tabs. Navigate to a URL to create one.
Then verify the artifact yourself — do not trust the tool's success message alone.
Confirm the screenshot exists under .playwright-mcp/ and starts with the PNG magic
bytes 89 50 4E 47.
If any step fails, report the exact error verbatim and stop. No retries, no substitute URL or link. Errors mentioning a profile, a lock, "already in use", or a Chromium download are diagnostic — quote them in full.
If the user's own instructions require delegating browser tool calls to a subagent, follow that. The sequence and the verification are identical either way.
Print this, filled in:
Playwright MCP setup
Node <version> pass/fail
Chrome <path or note> pass/fail
.mcp.json <present/written> pass/fail
Server <scope>, <status> pass/fail
Smoke test <url before> -> <url after> pass/fail
Screenshot <path>, <bytes> pass/fail
Result: ready / blocked at phase <n>
If everything passed, say plainly that Playwright MCP is connected and verified, and that a browser opened and took actions.
If anything is blocked, say which phase, why, and the single next action the user should take. Do not offer a menu of options.
allowed-tools grant. It covers only the three read-only checks and the
five browser tools the smoke test actually calls. Everything that changes the
machine — writing .mcp.json, npx ... --help, npx playwright install — is
deliberately left out, so it goes through the normal permission prompt. This matters
because allowed-tools is not gated by workspace trust: a command shipped in a
plugin, or checked into a repository, grants itself those tools even in a folder you
have never trusted.
Keep this list exact-match and minimal. Do not widen it to Bash(npx:*) or
mcp__playwright__*..playwright-mcp/
in the working directory. If this directory is a git repo, add .playwright-mcp/
to .gitignore. Deleting it between runs is safe and makes evidence unambiguous.@playwright/[email protected] is deliberate. @latest is how a first run
hangs on an unexpected download, and how a working setup silently breaks later.Files this command reads when invoked
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub rohan-g0re/autoweb --plugin autoweb