Playwright MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Playwright MCP Navigate to google.com and search for 'MCP servers'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Playwright MCP
An MCP server that gives compatible clients structured control of a real Playwright browser for QA, scraping diagnostics, accessibility-minded inspection, and reproducible browser workflows.
Architecture
Transport entrypoints are thin:
src/index.tsstarts MCP over stdio.src/http.tsstarts MCP over Streamable HTTP.src/server.tsbuilds oneMcpServerand registers all tools.
Core services own browser state:
BrowserManagerserializes tool execution, launches browsers lazily, and manages contexts/pages.TelemetryStorecaptures console messages, page errors, failed requests, and recent network events.Tool modules register focused actions and depend only on the public browser/session APIs.
Tool groups:
Browser/context/page lifecycle
Navigation and waiting
Interaction
Inspection and screenshots
Assertions
Diagnostics, tracing, and storage
Related MCP server: Playwright Server MCP
Install
npm install
npm run install-browsers
npm run buildRun
npm startHTTP transport:
npm run start:httpDefault HTTP endpoint: http://127.0.0.1:8931/mcp.
Production Controls
Configuration is environment-driven:
PLAYWRIGHT_MCP_HTTP_TOKEN: requireAuthorization: Bearer <token>for HTTP mode.PLAYWRIGHT_MCP_HTTP_ALLOWED_ORIGINS: comma-separated CORS allowlist.PLAYWRIGHT_MCP_ALLOWED_ORIGINS: comma-separated browser navigation allowlist.PLAYWRIGHT_MCP_BLOCKED_ORIGINS: comma-separated browser navigation blocklist.PLAYWRIGHT_MCP_ALLOW_EVALUATE: enable the dangerousevaluatetool. Default:false.PLAYWRIGHT_MCP_ALLOW_DOWNLOADS: enable download tools and accepting downloads. Default:false.PLAYWRIGHT_MCP_ALLOW_UPLOADS: enable upload tools. Default:false.PLAYWRIGHT_MCP_ARTIFACT_DIR: screenshots, traces, PDFs, downloads, and storage state directory. Default:./artifacts.PLAYWRIGHT_MCP_MAX_CONTEXTS: browser context cap. Default:8.PLAYWRIGHT_MCP_MAX_PAGES: page cap. Default:32.PLAYWRIGHT_MCP_DEFAULT_TIMEOUT_MS: default Playwright timeout. Default:30000.PLAYWRIGHT_MCP_LOG_LEVEL:debug,info,warn, orerror.
HTTP mode should use PLAYWRIGHT_MCP_HTTP_TOKEN before binding to anything other than localhost.
MCP client config
Examples are available in examples/:
claude_config.jsoncursor_mcp.jsoncodex_config.tomlcline_mcp_settings.jsonopencode_config.json
Development
npm run checkAvailable Tools
34 toolsassertAssertC
Run a browser assertion and return a pass/fail result with failure context.
Inputs: kind (required), pageId, expected, selector, +1 more.
browser_closeClose BrowserA
Close the browser and release all contexts/pages.
Inputs: no named parameters.
browser_launchLaunch BrowserB
Launch a Playwright browser lazily. Other tools also launch Chromium automatically when needed.
Inputs: browser, headless, slowMoMs.
browser_stateBrowser StateB
List active browser, contexts, pages, and current active page.
Inputs: no named parameters.
clickClickC
Click an element by selector, text, role, label, test id, or xpath.
Inputs: selector (required), button, pageId, timeoutMs, +1 more.
context_closeClose ContextC
Close a browser context. Defaults to the active context.
Inputs: contextId.
context_newNew ContextC
Create an isolated browser context and make it active.
Inputs: locale, userAgent, timezoneId, permissions, +5 more.
download_by_clickDownload By ClickB
Click an element, wait for a download, and save it into the artifact directory.
Inputs: selector (required), pageId, timeoutMs.
element_infoElement InfoB
Return text, attributes, bounding box, visibility, and enabled state for an element.
Inputs: selector (required), pageId.
evaluateEvaluate JavaScriptB
Evaluate JavaScript in the page. Use for diagnostics when dedicated tools are insufficient.
Inputs: script (required), arg, pageId.
fillFillC
Fill an input, textarea, contenteditable, or labelled field.
Inputs: value (required), selector (required), pageId, timeoutMs.
go_backGo BackC
Navigate back in page history.
Inputs: pageId, timeoutMs.
hoverHoverC
Hover an element.
Inputs: selector (required), pageId, timeoutMs.
network_blockBlock NetworkC
Block requests whose URL matches a regular expression for the active page.
Inputs: urlPattern (required), pageId.
network_mock_jsonMock JSON ResponseC
Fulfill matching requests with a JSON response for the active page.
Inputs: body (required), urlPattern (required), pageId, status.
page_closeClose PageC
Close a page. Defaults to the active page.
Inputs: pageId.
page_newNew PageC
Create a new page in a context and make it active.
Inputs: contextId.
page_switchSwitch PageC
Make an existing page active.
Inputs: pageId (required).
pdfExport PDFC
Export the current page as a PDF artifact. Chromium only.
Inputs: format, pageId, printBackground.
pressPressC
Press a key, optionally scoped to a selector.
Inputs: key (required), pageId, selector, timeoutMs.
reloadReloadC
Reload the current page.
Inputs: pageId, timeoutMs, waitUntil.
screenshotScreenshotC
Capture a page or element screenshot as PNG image content.
Inputs: pageId, fullPage, selector, saveArtifact.
select_optionSelect OptionC
Select options in a element.
Inputs: values (required), selector (required), pageId, timeoutMs.
set_checkedSet CheckedB
Check or uncheck a checkbox/radio control.
Inputs: checked (required), selector (required), pageId, timeoutMs.
set_viewportSet ViewportC
Set viewport dimensions for a page.
Inputs: width (required), height (required), pageId.
snapshotPage SnapshotB
Return title, URL, capped visible text, interactive elements, console errors, and network failures.
Inputs: pageId, maxElements, maxTextChars, telemetryLimit.
storage_stateStorage StateB
Return cookies and local storage for the active page context.
Inputs: pageId.
storage_state_saveSave Storage StateB
Save cookies and local storage for the active page context into the artifact directory.
Inputs: pageId.
telemetryTelemetryC
Return recent console, page error, response, and failed request telemetry.
Inputs: clear, limit, pageId.
trace_startStart TraceC
Start Playwright tracing for the active page context.
Inputs: pageId, sources, snapshots, screenshots.
trace_stopStop TraceA
Stop tracing and return trace zip bytes as base64.
Inputs: pageId.
upload_filesUpload FilesA
Set files on an input[type=file]. File paths must be inside the artifact directory.
Inputs: paths (required), selector (required), pageId.
wait_forWait ForC
Wait for selector, text, URL regex, timeout, load state, or network idle.
Inputs: kind (required), state, value, pageId, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 34 tools
Most tools have distinct purposes: lifecycle management (browser/context/page), interactions (click, fill, press), inspection (snapshot, element_info, telemetry), and artifact/network utilities. There is some potential overlap between snapshot, element_info, telemetry, evaluate, and assert, but the descriptions make the intended boundaries reasonably clear.
Everything uses snake_case, which is good, but conventions are mixed: noun_verb lifecycle names (browser_launch, page_new), bare action verbs (navigate, click), verb_noun actions (set_viewport, upload_files), and noun-only tools (pdf, storage_state). It remains readable, but an agent cannot fully predict the naming pattern.
34 tools is well above the comfortable range and feels heavy for a browser automation surface. While Playwright is feature-rich, several areas could be consolidated (e.g., storage_state/storage_state_save, trace_start/trace_stop, browser_launch versus implicit launch), making the set harder to navigate than necessary.
The surface covers the core browser automation lifecycle very broadly: launch/state/close, contexts, pages, navigation, interactions, waits, assertions, screenshots, PDFs, tracing, storage, uploads/downloads, and network mocking. Minor gaps remain around dialogs, iframes, drag-and-drop, forward history, and direct cookie/localStorage mutation, but evaluate can work around many of those.
Related MCP Connectors
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
Unofficial Browserless MCP — wraps the Browserless headless-Chromium REST API (browserless.io)
MCP server for Mint — AI-powered QA that runs your app in a real browser on every PR.
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
Related MCP Servers
- AlicenseBqualityNot gradedmaintenanceA MCP server that provides browser automation tools, allowing users to navigate websites, take screenshots, click elements, fill forms, and execute JavaScript through Playwright.82Apache 2.0
- AlicenseBqualityDmaintenanceA browser automation server providing Playwright capabilities for controlling web browsers, capturing screenshots, extracting content, and performing complex interactions through an MCP interface.6Apache 2.0
- AlicenseNot gradedqualityNot gradedmaintenanceA Playwright-based MCP server that exposes a live browser as a traceable, inspectable, debuggable and controllable execution environment for AI agents.5,213 npm57-
- AlicenseBqualityDmaintenanceA universal browser automation MCP server using Playwright, enabling programmatic control of Chrome with 63 tools for navigation, interaction, media control, and CDP-based diagnostics.6314 npm3MIT