Playwright MCP is a Model Context Protocol (MCP) server that gives an LLM control of a web browser through Playwright. Instead of screenshots, the model works from the page's accessibility tree as structured text, so no vision model is needed and tool calls resolve to a specific element reference rather than a guessed pixel position.
The project positions the MCP server against its sibling, Playwright CLI with skills. Coding agents that juggle a large codebase, tests, and reasoning inside a limited context window are pointed at the CLI, which avoids loading tool schemas and accessibility trees into the model. The MCP server stays the fit for agentic loops that need persistent browser state, introspection, and iterative reasoning over page structure, such as exploratory automation, self-healing tests, or long-running autonomous workflows.
It runs as a local stdio server for any MCP client (VS Code, Cursor, Windsurf, Claude Code, Claude Desktop, Codex, Copilot, Gemini CLI, Goose, Cline, Warp, and others), as an HTTP server for headed browsers on display-less systems or IDE worker processes, inside a Docker container (headless Chromium only), or embedded programmatically through a createConnection API. A persistent profile keyed to the client's workspace root is the default, with isolated in-memory profiles for test sessions, a storage-state file for cookies and local storage, and a Chrome extension that attaches to an existing browser's tabs and logged-in sessions.
Configuration happens through command arguments, matching environment settings, or a JSON file: browser choice (Chrome, Firefox, WebKit, Edge), headless or headed mode, device emulation, viewport, proxy, allowed and blocked origins, workspace-scoped file access, action and navigation timeouts, console log level, snapshot mode, image responses, a secrets file, and code generation in TypeScript, Python, Java, or C#. Opt-in capability groups extend the core tool set with config inspection, network routing, cookie and storage control, DevTools-style highlighting, recording and step debugging, coordinate-based mouse input, PDF export, and test assertions with locator generation. Pages that register tools through the WebMCP API are collected unless that is turned off. The server is not a security boundary.
Features
- Accessibility snapshots: the model reads the page as structured accessibility data and targets elements by reference, with no screenshots or vision model required
- Core automation tools: navigate, click, type, fill forms, hover, drag and drop, select options, press keys, upload files, handle dialogs, wait, evaluate JavaScript, run code, read console messages and network requests, take screenshots, and manage tabs
- MCP client coverage: VS Code, Cursor, Windsurf, Claude Code, Claude Desktop, Codex, Copilot, Gemini CLI, Goose, Cline, Warp, Antigravity, Kiro, LM Studio, opencode, Qodo Gen, Junie, Grok, Amp, and Factory
- Profiles and state: a persistent profile per workspace, isolated in-memory sessions, a storage-state file for cookies and local storage, and init scripts or a Playwright page script to prepare each page
- Browser extension: attaches to existing Chrome or Edge tabs to reuse logged-in sessions and browser state
- Transports and deployment: stdio by default, HTTP transport for display-less or IDE worker setups, a Docker image (headless Chromium), and a programmatic createConnection API
- Browser and emulation options: Chrome, Firefox, WebKit, or Edge, headless or headed, named device or generic mobile emulation, viewport size, user agent, proxy, and granted permissions
- Origin and file-access controls: allowed and blocked origin lists, workspace-root file restriction by default, and an idle timeout that closes the browser between tool calls
- Opt-in capabilities: config inspection, network routing and offline state, cookie and local or session storage control, DevTools highlighting with recording and step debugging, coordinate-based mouse input, PDF export, and test assertions
- Code generation: records actions as TypeScript, Python, Java, or C# Playwright code and generates locators for test files
- WebMCP: collects tools a page registers through the WebMCP API, with an option to disable it
- Response shaping: snapshot mode, image response mode, console level, test-id attribute, bounding boxes in snapshots, and an output directory with size-based eviction



