**Short version:** Playwright MCP gives an AI agent a real browser — click, type, navigate, read the page — through the microsoft/playwright-mcp server (Apache-2.0, about 38,500 GitHub stars). It reads pages as structured accessibility trees rather than screenshots, which makes it fast and reliable without a vision model.
Install in one line
Claude Code:
claude mcp add playwright npx @playwright/mcp@latestCursor, VS Code and most other clients take the standard JSON config:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}For VS Code specifics, see our MCP in VS Code guide; for Claude Code scopes and auth, see MCP in Claude Code.
Snapshots, not screenshots
The server uses Playwright's accessibility tree instead of pixel-based input. The agent sees buttons, links, inputs and their labels as structured data. Two practical effects: it works with models that have no vision, and it is far less brittle than clicking coordinates on a screenshot.
Flags you will actually use

| Flag | What it does |
|---|---|
--headless | No visible window (default is headed) |
--browser | chrome, firefox, webkit or msedge |
--isolated | Keep the profile in memory, not on disk |
--user-data-dir | Use a specific profile directory |
--caps | Extra capabilities: vision, pdf, devtools, network, storage |
--port | Run as a standalone HTTP server |
--config | Load settings from a JSON file |
Add flags to the args array, for example ["@playwright/mcp@latest", "--headless", "--isolated"]. Most flags also have PLAYWRIGHT_MCP_* environment variables.
MCP or the Playwright CLI? Microsoft's own answer

The project's README is candid: for many coding agents, the Playwright CLI with skills is more token-efficient, because CLI calls avoid loading large tool schemas and page snapshots into context. MCP still fits loops that need persistent browser state and rich page introspection — exploratory testing, long-running workflows, agents that browse step by step.
So: writing and running a test suite from Claude Code? The CLI is usually leaner. Letting an agent explore an app interactively? Use MCP. If token spend is a concern either way, our token usage guide covers MCP overhead.
One safety habit
A headed browser using your normal profile can reach every site you are logged into. Use `--isolated` (or a dedicated `--user-data-dir`) so the agent starts clean, and review our MCP server security checklist before pointing it at production.