Playwright MCP is a Model Context Protocol (MCP) server that lets a language model drive a web browser through Playwright. Rather than sending screenshots, the server hands the model a structured accessibility snapshot of the page; tools then act on elements referenced from that snapshot. This means a text-only model can browse without a vision model, and tool calls resolve to specific elements instead of pixel coordinates.
An MCP client such as VS Code, Cursor, Windsurf, Claude Desktop, Claude Code, Codex, Goose, Gemini CLI, or Warp spawns the server over stdio, or you run it as a standalone HTTP server or Docker container (headless Chromium only) that several clients can reach. Command-line options select the browser or Chrome channel, headed or headless mode, device emulation, a persistent or isolated user profile, a CDP endpoint to attach to, allowed and blocked origins, and optional capability groups.
The project frames MCP as the interface for agentic loops that need persistent browser state and iterative reasoning over page structure, such as exploratory automation, self-healing tests, and long-running autonomous workflows. For coding agents that must conserve context, it points to the separate Playwright CLI with skills, which avoids loading tool schemas and accessibility trees into the model context.
Features
- Accessibility snapshots: browser_snapshot returns the page as structured data that later tool calls reference by element
- Interaction tools: click, type, hover, drag and drop, fill forms, select options, press keys, upload files, handle dialogs, and wait for text or time
- Navigation and tabs: navigate, go back, resize the viewport, and list, open, or close tabs
- Network control: list requests, issue requests, set route mocks, and toggle network state such as offline
- Storage tools: get, set, delete, and clear cookies, localStorage, and sessionStorage, plus export and restore full storage state
- Diagnostics: console messages by level, screenshots, PDF export, Playwright tracing, and video recording with chapters and action overlays
- Verification tools: assert that an element, text, list, or value is visible, and generate a locator for an element
- Code generation: records actions as Playwright code in TypeScript, Python, Java, or C# (or none)
- Optional capabilities: --caps vision adds coordinate-based mouse tools, pdf adds PDF export, and devtools adds developer-tools access
- Browser and profile options: Chrome, Firefox, WebKit, or Edge; persistent, isolated, or extension-attached sessions; device emulation such as iPhone 15
- Initial state: storage state files, init scripts, and TypeScript init-page files set up context before a session
- Access boundaries: allowed and blocked origin lists, workspace-scoped file access, host checks for the HTTP server, and explicit permission grants such as geolocation
Integrates with
Claude Code
Terminal-based agentic coding tool that reads your codebase and runs tasks through natural-language commands
Cline
Open-source coding agent with one engine behind VS Code, JetBrains, a headless CLI, an SDK, and a parallel Kanban board
Codex
Lightweight coding agent that runs in your terminal
Goose
Rust-built local agent with desktop, CLI, and API surfaces, 15+ model providers, and 70+ MCP extensions
Integrated by
Alternatives
Marionette MCP
MCP server that lets AI agents inspect and drive running Flutter apps — tap, type, scroll, and screenshot at runtime
MCP Chrome
Chrome extension MCP server that exposes your browser to AI assistants for automation, content analysis, and semantic tab search
Stealth Browser MCP
Undetectable browser automation for MCP agents, using real Chrome instances to bypass anti-bot systems and intercept network traffic