playwright-mcp (microsoft/playwright-mcp)

Searching Database…

What is this?A Model Context Protocol (MCP) server that gives LLMs browser automation through Playwright: your AI assistant can open pages, click around and read web content via structured accessibility snapshots instead of screenshots.
So it's a server, not a library I code against?Right — your MCP client (VS Code, Cursor, Claude Desktop and the like) launches it and exposes Playwright browser tools to the model, so the AI drives the browser for you rather than you writing Playwright code.
How do I hook it up to my AI assistant?Add an MCP server that runs 'npx @playwright/mcp@latest'. Cursor and VS Code have one-click install buttons; Claude Code, Codex, Copilot and Grok add it through their CLI; most other clients take the same standard config.
What do I need installed first?Node.js 18 or newer, plus any MCP client — VS Code, Cursor, Windsurf, Claude Desktop, Goose, Grok, Junie and many others are supported out of the box.
The README also mentions a Playwright CLI — when would I pick the MCP server over it?CLI + skills is more token-efficient for high-throughput coding agents. The MCP server fits loops that need persistent browser state and iterative reasoning, like exploratory automation, self-healing tests or long-running workflows.
Will the AI be browsing with my real logins?By default it keeps a persistent profile on disk where logged-in sessions survive. Run with --isolated to hold the profile in memory, or use --user-data-dir and delete it between sessions to clear that state.
Why accessibility snapshots instead of screenshots?Snapshots are structured data taken from Playwright's accessibility tree, so no vision model is needed, responses stay fast and lightweight, and tool actions are deterministic rather than an ambiguous reading of pixels.
Can it emulate a phone or tablet?Yes — --device emulates a specific model like 'iPhone 15', and --mobile emulates a generic Pixel 10 on Chromium or iPhone 17 on WebKit. Mobile pages are usually lighter, which also saves tokens.
Can it generate Playwright code for me?Yes, the --codegen option writes the agent's actions out as code — TypeScript by default, with Python, Java and C# also available.
Which extra capabilities can be switched on?The --caps flag enables additional capabilities: vision, pdf and devtools. Plenty of other behavior — headless mode, proxy, viewport size, timeouts, device emulation — is tuned through command-line args in the config.
Creator
microsoft
Size
2 MB
Stars
40.3K
Age
1y
Commits · 90 Days