Playwright MCP
by Microsoft
Playwright MCP is a Model Context Protocol server that provides browser automation capabilities using Playwright. It enables LLMs to interact with web pages through structured accessibility snapshots, bypassing the need for screenshots or visually-tuned models.
Last updated: N/A
What is Playwright MCP?
Playwright MCP is a server that allows Large Language Models (LLMs) to interact with web pages using Playwright's accessibility tree, providing a structured and efficient way to automate browser tasks.
How to use Playwright MCP?
The server can be installed in VS Code using the provided buttons or via the VS Code CLI. After installation, configure your MCP client to use the Playwright MCP server. Command-line options are available to customize the browser, enable capabilities, and specify headless mode.
Key features of Playwright MCP
Fast and lightweight: Uses Playwright's accessibility tree, not pixel-based input.
LLM-friendly: No vision models needed, operates purely on structured data.
Deterministic tool application: Avoids ambiguity common with screenshot-based approaches.
Supports both snapshot-based and vision-based interactions.
Use cases of Playwright MCP
Web navigation and form-filling
Data extraction from structured content
Automated testing driven by LLMs
General-purpose browser interaction for agents
FAQ from Playwright MCP
What browsers are supported?
What browsers are supported?
Chrome, Firefox, Webkit, and MS Edge are supported. You can also specify Chrome and Edge channels like beta, canary, and dev.
What is the difference between Snapshot Mode and Vision Mode?
What is the difference between Snapshot Mode and Vision Mode?
Snapshot Mode uses accessibility snapshots for better performance and reliability, while Vision Mode uses screenshots for visual-based interactions.
How do I run the browser in headless mode?
How do I run the browser in headless mode?
Use the --headless
command-line option when starting the server.
How do I specify the port for the SSE transport?
How do I specify the port for the SSE transport?
Use the --port
command-line option when starting the server, and then set the url
in the MCP client config to the SSE endpoint (e.g., http://localhost:8931/sse
).
Where is the user data directory located?
Where is the user data directory located?
The user data directory is located at %USERPROFILE%\AppData\Local\ms-playwright\mcp-chrome-profile
on Windows, ~/Library/Caches/ms-playwright/mcp-chrome-profile
on macOS, and ~/.cache/ms-playwright/mcp-chrome-profile
on Linux.