What is MCP?
The Model Context Protocol (MCP) is a standardized protocol that enables Large Language Models (LLMs) to interact with external systems through a structured client-server architecture. MCP provides a consistent way for AI agents to access tools, resources, and capabilities beyond their training data. Playwright MCP is a server implementation that exposes browser automation capabilities through the MCP protocol, allowing LLMs to interact with web pages using structured data rather than visual interpretation.Client-Server Architecture
Playwright MCP follows the standard MCP architecture pattern:MCP Client
The AI agent or IDE that sends requests to the server. Examples include Claude Desktop, VS Code, Cursor, and other MCP-compatible tools.
MCP Server
The Playwright MCP server that receives requests, executes browser automation, and returns structured responses.
Communication Flow
Transport Protocols
Playwright MCP supports multiple transport mechanisms: STDIO Transport (Default) The most common mode, where the server communicates with the client through standard input/output streams:SSE (Server-Sent Events) transport is useful when running headed browsers on systems without displays or when the IDE worker process can’t access the display.
Tool Capabilities System
Playwright MCP uses a capability-based system to control which tools are available. This allows you to enable only the features you need:Core Capabilities
Core (Default)- Page navigation and snapshots
- Element interactions (click, type, hover)
- Form handling
- Dialog handling
- Keyboard and mouse actions
- PDF generation from web pages
- Requires
--caps=pdfflag
- Coordinate-based interactions
- XY position clicking and dragging
- Requires
--caps=visionflag
- Browser developer tools access
- Advanced debugging capabilities
- Requires
--caps=devtoolsflag
Enabling Capabilities
Capabilities can be enabled via command-line arguments:By default, only core capabilities are enabled. This keeps the tool list minimal and reduces context window usage.
Configuration Options
Playwright MCP can be configured through:- Command-line arguments - Quick configuration via
--option=value - Environment variables - System-level settings via
PLAYWRIGHT_MCP_* - Configuration file - Comprehensive JSON configuration via
--config
Configuration File
For complex setups, use a JSON configuration file:Playwright MCP vs Playwright CLI
Playwright offers two approaches for AI-driven automation:Playwright CLI + SKILLS
Best for: Coding agents working with large codebases
- More token-efficient
- Concise, purpose-built commands
- Avoids loading large tool schemas
- Better for high-throughput agents
Playwright MCP
Best for: Exploratory automation and persistent workflows
- Rich page introspection
- Persistent browser state
- Structured accessibility data
- Long-running autonomous workflows
Key Features
Accessibility-First Approach
Playwright MCP uses the browser’s accessibility tree instead of screenshots:- Faster - No image processing required
- Smaller - Structured text data vs large image files
- Deterministic - Precise element references vs coordinate guessing
- LLM-friendly - No vision models needed
Session Management
The server maintains browser state across multiple tool calls:- Cookies and local storage persist
- Login sessions remain active
- Tab state preserved between operations
- Optional session recording and trace saving
Security Boundaries
Security features include:- Origin allowlists and blocklists
- File access restrictions
- Service worker blocking
- Secrets management
Next Steps
Browser Automation
Learn how Playwright manages browser contexts and sessions
Accessibility Snapshots
Understand the structured snapshot format

