Playwright MCP
$ playwright-mcp Official Med RiskMicrosoft's official Playwright MCP server enables LLMs to interact with web pages using structured accessibility snapshots instead of pixel-only screenshots. Supports --headless, --browser, --port for HTTP/SSE hosting, --isolated, --config, and --secrets env files.
npm install -g @playwright/mcp playwright-mcp exposes structured accessibility snapshots and stateful page interactions as MCP tools; for deterministic script/CLI runs, pair with playwright-cli.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Deterministic accessibility-tree snapshots avoid vision-model fragility, with --headless, --isolated, and --port transport controls.
- Structured accessibility snapshot MCP tools +
--headless/--port/--configflags
Supports --isolated ephemeral profiles, --allowed-origins/--blocked-origins, and --secrets, though full browser navigation can mutate remote web apps.
--isolatedmemory-only profiles and--secretscredential scoping
Cross-platform via npx @playwright/mcp@latest on macOS, Linux, and Windows (downloads browser binaries on first use if absent).
- Published on npm (
@playwright/mcp) with Docker image support
Accessibility snapshots consume far fewer tokens and click more accurately than screenshot-only computer use.
- Accessibility-tree DOM refs eliminate coordinate guessing
First-party Microsoft Playwright team repository (microsoft/playwright-mcp) under Apache-2.0.
- Official Microsoft repository under Apache-2.0
Detailed README covering CLI flags, JSON config schema, Docker, and extension/isolated modes.
- Comprehensive CLI and config reference in GitHub README
Security, Auth & Guardrails
Uses ephemeral browser profiles (--isolated), persistent user data dirs, or secret key-value files via --secrets <path>.
Free and Apache-2.0 open-source.
# Playwright MCP Agent Rules - Prefer `--headless --isolated` in automated runs so personal browser sessions and cookies stay untouched. - Pass credentials via `--secrets <file>` instead of hardcoding values into prompt text.
Agent-Ready Command Recipes
Safe Read-Only Queries
npx -y @playwright/mcp@latest --help
Lists browser, viewport, transport (--port), --headless, and --isolated flags without launching Chromium.
Controlled Writes & Previews
npx -y @playwright/mcp@latest --headless --isolated --port 8931
Starts an isolated headless browser MCP server listening on localhost port 8931 without reusing personal cookies.
Strengths for Agents
- + Accessibility-tree snapshots make web interaction deterministic and token-efficient.
- +
--isolatedand--secretsprotect local browser state and credentials cleanly. - + Official Microsoft Playwright maintenance with
--portHTTP/SSE hosting support.
Caveats & Pitfalls
- ! Long-lived MCP server process requires
--portor an MCP host; it is not a one-shot page-query CLI. - ! Large DOM accessibility snapshots can still consume significant context on heavy web apps.