
Playwright MCP Server
OfficialMicrosoft's official browser-automation MCP using Playwright's accessibility tree (no vision model).
Add to your client
Copy the config for your MCP client and paste it into its config file.
npx -y @playwright/mcp@latestPaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"playwright-mcp-server": {
"command": "npx",
"args": [
"-y",
"@playwright/mcp@latest"
]
}
}
}Before you start
- Node.js 18 or newer
- An MCP-capable client (VS Code, Cursor, Windsurf, Claude Desktop, Claude Code, Goose, LM Studio, Codex, Gemini CLI, and many more)
- Playwright browsers are downloaded on demand; for containerized use, the mcr.microsoft.com/playwright/mcp Docker image runs headless Chromium
- No credential or auth required for the server itself
About Playwright MCP Server
Playwright MCP is Microsoft's official browser-automation MCP server, built on Playwright. It lets an LLM drive a real browser — navigate, click, type, fill forms, manage tabs, inspect network and console — using structured accessibility snapshots rather than screenshots and a vision model. That makes actions fast, deterministic, and cheap on tokens.
It installs as a local stdio server via the @playwright/mcp npm package (npx @playwright/mcp@latest) and also supports SSE and standalone HTTP transports (via --port). By default it launches a headed browser with a persistent profile so logins survive between sessions; --headless, --isolated, --user-data-dir, and --browser (chrome, firefox, webkit, msedge) tune that behavior. A Docker image (mcr.microsoft.com/playwright/mcp) is published for headless Chromium.
The core toolset (navigation, snapshot, click/type/fill, tabs, network, console, evaluate) is always on, and additional capability groups are opt-in via --caps: vision adds coordinate-based mouse tools, storage adds cookie/localStorage/sessionStorage tools, devtools adds tracing/video/highlight, and pdf adds PDF export. Note that the docs explicitly state Playwright MCP is not a security boundary.
Tools & capabilities (12)
browser_navigateNavigate to a URL (with browser_navigate_back to go back).
browser_snapshotCapture the page's accessibility tree snapshot used for deterministic, vision-free interaction.
browser_clickClick an element identified from the snapshot (plus browser_hover for hover).
browser_typeType text into a focused element; browser_press_key sends individual keys.
browser_fill_formFill multiple form fields in one call (with browser_select_option for dropdowns).
browser_take_screenshotCapture a screenshot of the page or an element.
browser_evaluateRun JavaScript in the page context and return the result.
browser_tabsList, create, select, and close browser tabs.
browser_network_requestsInspect network requests made by the page (with browser_console_messages for console output).
browser_file_uploadUpload a file to a file-input element.
browser_handle_dialogAccept or dismiss JavaScript dialogs (alert/confirm/prompt).
browser_pdf_save / browser_cookie_* / browser_mouse_*_xyOpt-in capability tools enabled via --caps (pdf, storage, vision/devtools).
When to use it
- Use it when you want an agent to test or reproduce a bug in a real browser by acting on the accessibility tree, not pixels.
- Use it when you need deterministic, token-efficient automation without paying for a vision model on every step.
- Use it when a workflow needs persistent login state, rich introspection, and iterative reasoning across pages.
- Use it when you want to scrape or extract content by navigating and reading structured snapshots.
- Use it when you need to inspect network requests, console logs, or run JS to debug a web app from your agent.
- Use it when you want to run browser automation headless in CI/Docker via the official image.
Quick setup
- 1Add a server to your client running `npx @playwright/mcp@latest` (or use a one-click install button for VS Code, Cursor, Goose, or LM Studio).
- 2Optionally pass flags like `--headless`, `--browser chrome|firefox|webkit|msedge`, or `--isolated` for the run mode you want.
- 3Enable extra capabilities as needed with `--caps=vision,storage,devtools,pdf`.
- 4Restart/reload the client so the browser_* tools register.
- 5For standalone HTTP/SSE, start with `--port <n>` and point the client at the resulting endpoint.
- 6Ask the agent to navigate to a page and take a snapshot to verify it works.
Security notes
The server can drive a real browser to any URL and submit forms, so it can reach internal sites and act with whatever session state the browser has; run it against trusted targets and consider an isolated browser profile.
Playwright MCP Server FAQ
Does it use screenshots and a vision model?
No, by default it drives the browser from the page's accessibility tree (browser_snapshot), which is faster and deterministic. Coordinate/vision tools exist but are opt-in via --caps=vision.
Headed or headless by default?
Headed (a visible browser window) by default; pass --headless to run without a window, which is required for the Docker image.
How are logins/sessions handled?
By default a persistent profile stores login state between sessions; use --isolated for in-memory profiles or --user-data-dir to control the location.
Which transports are supported?
stdio by default, plus SSE and standalone HTTP when you launch with --port.
Is it safe to expose to untrusted content?
The docs explicitly say Playwright MCP is not a security boundary; use flags like --allowed-hosts/--blocked-origins and follow MCP security best practices when automating untrusted sites.
Alternatives to Playwright MCP Server
Up-to-date, version-specific library documentation injected into your coding agent.
LSP-powered coding agent toolkit: semantic symbol search, references and structural edits.
Connect MCP clients to a running JetBrains IDE (IntelliJ, PyCharm, WebStorm, Android Studio).
Compare Playwright MCP Server with: