Playwright MCP
Microsoft's official MCP server for driving a real browser from AI agents
BestMCPTools
Playwright MCP
bestmcptools.org
Last verified: October 20, 2026
Maintenance status
ActiveHow to Install Playwright MCP
$npx @playwright/mcp@latestCompatible with: Claude Desktop, Claude Code, Cursor, VS Code, Windsurf.
Setup by client
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"playwright-mcp": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}Cursor (~/.cursor/mcp.json)
{
"mcpServers": {
"playwright-mcp": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}VS Code (.vscode/mcp.json)
{
"servers": {
"playwright-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}Claude Code (terminal)
claude mcp add playwright-mcp -- npx @playwright/mcp@latestAdd any API keys or environment variables the server's README lists.
About Playwright MCP
What it does
Playwright MCP is Microsoft's official Model Context Protocol server for browser automation. It lets an AI agent open pages, click, type, fill forms and read content by working on Playwright's accessibility tree instead of screenshots, so the model reads structured page data and does not need a vision model. It runs locally through npx and works with most MCP clients, which is why it shows up on so many lists of Claude Code MCP servers and Cursor MCP servers.
Key features and tools
The README describes three design goals: fast and lightweight (accessibility tree, not pixel input), LLM friendly (no vision model needed) and deterministic tool application (less ambiguity than screenshot based approaches).
Core automation tools available by default:
browser_navigate,browser_navigate_back,browser_tabs,browser_close,browser_resizebrowser_snapshot(page snapshot) andbrowser_find(find in page snapshot)browser_click,browser_hover,browser_drag,browser_drop,browser_type,browser_press_key,browser_select_option,browser_fill_form,browser_file_upload,browser_handle_dialog,browser_wait_forbrowser_take_screenshot,browser_console_messages,browser_network_requests,browser_network_requestbrowser_evaluate(run JavaScript) andbrowser_run_code_unsafe(run Playwright code)browser_emulate_media
Opt in tool groups, enabled with the --caps flag:
| Capability | Example tools |
|---|---|
network | browser_route, browser_route_list, browser_unroute, browser_network_state_set |
storage | browser_cookie_list, browser_cookie_set, browser_localstorage_get, browser_storage_state, browser_set_storage_state |
devtools | browser_start_tracing, browser_start_video, browser_highlight, browser_annotate |
vision | browser_mouse_click_xy, browser_mouse_drag_xy, browser_mouse_wheel |
pdf | browser_pdf_save |
testing | browser_generate_locator, browser_verify_element_visible, browser_verify_text_visible, browser_verify_value |
config | browser_get_config |
Each tool in the README is marked read only or not, which helps when a client asks you to approve tool calls.
Setup
Requirements are Node.js 18 or newer and an MCP client. The standard config, which the README says works in most tools, is:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}
In Claude Code, add it with claude mcp add playwright npx @playwright/mcp@latest. In Cursor, go to Cursor Settings, then MCP, then Add new MCP Server, choose the command type and enter npx @playwright/mcp@latest. VS Code users can run code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'. The README also has instructions for Claude Desktop, Windsurf, Codex, Copilot CLI, Gemini CLI, Goose, Kiro, LM Studio, opencode, Warp and others.
Useful options, passed in the args list or as environment variables:
--headlessruns the browser headless (it is headed by default).--isolatedkeeps the browser profile in memory instead of saving it to disk; pair it with--storage-stateto load cookies and local storage.--browserpicks chrome, firefox, webkit or msedge.--capsturns on extra tool groups such as vision, pdf or devtools.--extensionconnects to a running Chrome or Edge browser through the Playwright Extension, so the agent can use your logged in tabs.--allowed-originsand--blocked-originsfilter what the browser requests, and--proxy-serverroutes traffic through a proxy.--portstarts HTTP transport, for examplenpx @playwright/mcp@latest --port 8931, and clients then connect tohttp://localhost:8931/mcp.
There is no API key and no account. Transport is stdio by default, with optional HTTP via --port. A Docker image (mcr.microsoft.com/playwright/mcp) is also documented.
Use cases
- Letting a coding agent open your local dev server, click through a flow and read console errors or network requests.
- Filling and submitting forms, or walking multi step web flows, for repetitive browser chores.
- Generating Playwright locators and checking that text or elements are visible with the
testingcapability. - Saving pages as PDF or recording traces and video for debugging with the
pdfanddevtoolscapabilities. - Reading pages that need a signed in session, using a persistent profile or the browser extension.
You can find more browser tools in the browser automation category.
Limitations and things to watch
- The README states plainly that Playwright MCP is not a security boundary. The origin allow and block lists do not serve as a security boundary either and do not affect redirects.
browser_evaluateandbrowser_run_code_unsafeexecute code in the page or against Playwright, so review those calls before approving them.- By default the persistent profile stores logged in state on disk. A persistent profile can only be used by one browser at a time, so parallel clients in the same workspace need
--isolatedor separate--user-data-dirfolders. - File access is limited to workspace roots by default;
--allow-unrestricted-file-accesslifts that. - The Docker image supports headless Chromium only.
- Microsoft itself notes that coding agents may get better token efficiency from Playwright CLI with skills, because MCP loads tool schemas and accessibility trees into the model context. MCP is positioned for long running, stateful agent loops.
- Headless browsers close after one hour without a tool call by default (
--idle-timeout), and the next call relaunches them.
Pros and cons
Pros
- Official Microsoft project under the Apache 2.0 license.
- Works on structured accessibility snapshots, so no vision model is needed.
- One npx command, no API key, and setup instructions for a long list of clients.
- Chromium, Firefox, WebKit and Edge support, plus device emulation.
- Fine grained control through capability flags and dozens of options.
Cons
- Accessibility snapshots can be large and use a lot of context tokens.
- Not a security boundary, so it needs care around untrusted sites and code execution tools.
- Runs a real browser on your machine, which needs Node.js and local resources.
- Many useful tools are off until you enable the matching
--capsvalue.
Who it is for
Developers who want an agent to drive a real browser: front end engineers checking their own app, QA engineers writing or repairing Playwright scripts, and anyone automating web tasks from Claude Code, Cursor, VS Code or Windsurf. Teams that need hosted browsers with proxy handling at scale may prefer a cloud service. If the page you are checking was designed in Figma, the Figma MCP server gives the same agent the layout, components and variables to build it from.
Pricing
As of October 2026, Playwright MCP is free and open source under the Apache 2.0 license. There is no paid tier; you only need Node.js and a browser.
Alternatives
- Chrome DevTools MCP server for debugging and performance work through a live Chrome DevTools session.
- BrowserStack MCP server for cross-browser testing on real devices in BrowserStack's cloud instead of locally.
- Bright Data MCP server for web scraping and data extraction at scale.
Sources
Pricing
Open Source: from Free (open source, as of October 2026)
Our Take on Playwright MCP
Playwright MCP is the default choice when an agent needs a real browser on your own machine. It is official, free, quick to install in Claude Code, Cursor and VS Code, and its accessibility snapshots let a text model act on pages without vision. Plan for the token cost of large snapshots, turn on only the capability groups you need, and remember the README's warning that it is not a security boundary; coding agents that care most about context size may also look at Microsoft's Playwright CLI.
Alternatives to Playwright MCP
Web scraping and data extraction at scale for AI agents
View Bright Data MCP →Real-device cross-browser testing wired directly into your AI agent
View BrowserStack MCP →Google's official MCP server that gives AI agents a live Chrome DevTools session.
View Chrome DevTools MCP →