About this project

Playwright MCP is a Model Context Protocol (MCP) server that exposes browser automation through Playwright. Rather than relying on screenshots or vision-tuned models, it lets LLM clients interact with web pages using structured accessibility snapshots, which the project describes as fast, lightweight, LLM-friendly and deterministic. The README contrasts the MCP server with the separate Playwright CLI plus SKILLs approach. It notes that coding agents often prefer CLI-based workflows because they are more token-efficient, while MCP remains useful for agentic loops that need persistent state, rich introspection and iterative reasoning over page structure, such as exploratory automation, self-healing tests or long-running autonomous workflows. Requirements are Node.js 18 or newer and an MCP client such as VS Code, Cursor, Windsurf, Claude Desktop, Goose, Grok, Junie or others. Installation is typically done with npx @playwright/mcp@latest, and the README provides client-specific setup snippets for many tools including VS Code, Cursor, Claude Code, Claude Desktop, Cline, Codex, Copilot, Factory, Gemini CLI, Goose, Grok, Junie, Kiro, LM Studio, opencode, Qodo Gen, Warp and Windsurf. Configuration is extensive. Command-line options and matching environment variables cover browser selection (chrome, firefox, webkit, msedge), headless mode, viewport size, device emulation, mobile emulation, proxy settings, CDP endpoints, timeouts, console levels, test-id attributes, permissions, output directories, secrets files, session saving, snapshot modes and boxes, service worker blocking, HTTPS error handling, sandbox toggling, and more. A JSON configuration file can also be supplied with --config. User profile handling supports a persistent profile stored in platform-specific cache locations keyed by workspace hash, isolated sessions that discard storage state on close, and connection to an existing browser via the Playwright Chrome extension. Initial state can be provided through a user data directory, a storage state file, an init-page TypeScript file evaluated on the Playwright page object, or init-script JavaScript files evaluated before page scripts.