概览
What is Playwright MCP?
A Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright. It enables LLMs to interact with web pages through structured accessibility tree snapshots, bypassing the need for screenshots or visually-tuned models.
How to use Playwright MCP?
Install the server with your MCP‑compatible client (e.g., VS Code, Cursor, Claude Desktop). Use the standard JSON configuration: "command": "npx" and "args": ["@playwright/mcp@latest"]. Detailed setup guides for each client are in the README.
Key features of Playwright MCP
- Fast and lightweight – uses accessibility tree, not pixel input.
- LLM‑friendly – no vision models needed.
- Deterministic tool application – avoids ambiguity of screenshot‑based approaches.
- Runs on Node.js 18 or newer.
- Supports a wide range of MCP clients.
Use cases of Playwright MCP
- Exploratory automation with persistent browser state.
- Self‑healing tests that iterate over page structure.
- Long‑running autonomous workflows requiring continuous context.
- General browser automation driven by language models.
FAQ from Playwright MCP
How does Playwright MCP differ from the Playwright CLI?
The MCP variant is suited for agentic loops that benefit from persistent state, rich introspection, and iterative reasoning over page structure. The CLI + SKILLs approach is more token‑efficient for high‑throughput coding agents.
What are the system requirements?
Node.js 18 or newer is required. No additional runtime dependencies are mentioned.
Which clients can I use with Playwright MCP?
It works with VS Code, Cursor, Windsurf, Claude Desktop, Goose, Junie, Copilot, Gemini CLI, Warp, and many other MCP‑compatible tools. Detailed per‑client installation instructions are provided.
How do I install Playwright MCP?
Run the standard MCP configuration: npx @playwright/mcp@latest. Specific commands for each client (e.g., claude mcp add, code --add-mcp) are documented in the README.
Are there any security or host filtering options?
Yes, you can pass --allowed-hosts <hosts...> to limit which hosts the server can serve from. The environment variable PLAYWRIGHT_MCP_ALLOWED_HOSTS can also be used.