microsoft avatar

Playwright Mcp

microsoft/playwright-mcpOfficial

Playwright MCP provides browser automation capabilities to LLMs through structured accessibility snapshots rather than screenshots, enabling deterministic web page interactions without requiring vision models. The server exposes Playwright's automation tools via the Model Context Protocol, making it suitable for exploratory automation, self-healing tests, and long-running autonomous workflows that benefit from persistent browser state and rich page structure introspection. It operates as a lightweight, token-efficient alternative to visual approaches, particularly valuable for specialized agentic loops requiring iterative reasoning over page content.

install copies · 90 days. Times the install command was copied on this site in the last 90 days, bots filtered.
42
GitHub stars
39.5K
tools
23
transport
STDIO
last updated
Nov 9, 2026

Install

From registry metadata
$ npx add-mcp @playwright/mcp --name playwright-mcp

Run in your terminal. add-mcp asks which agents to add it to (Claude Code, Codex, Cursor and more). Add -g to install it for every project.

Review the command, arguments and environment values before installing. MCP servers run with your local permissions.

Other ways

Claude Code

$ claude mcp add playwright-mcp -- npx -y @playwright/mcp

Run in your terminal. Replace YOUR_* placeholders with real values; add --scope user to install for every project.

Tools

Verified live · 23 tools

Verified live against the running server on Jun 10, 2026.

browser_closeClose the page

Close the page

No parameters. Call it with no arguments.

browser_resizeResize the browser window2 params

Resize the browser window

Parameters* required
height*number
Height of the browser window
width*number
Width of the browser window
browser_console_messagesReturns all console messages3 params

Returns all console messages

Parameters* required
allboolean
Return all console messages since the beginning of the session, not just since the last navigation. Defaults to false.
filenamestring
Filename to save the console messages to. If not provided, messages are returned as text.
level*string
Level of the console messages to return. Each level includes the messages of more severe levels. Defaults to "info".one of error · warning · info · debugdefault: info
browser_handle_dialogHandle a dialog2 params

Handle a dialog

Parameters* required
accept*boolean
Whether to accept the dialog.
promptTextstring
The text of the prompt in case of a prompt dialog.
browser_evaluateEvaluate JavaScript expression on page or element4 params

Evaluate JavaScript expression on page or element

Parameters* required
elementstring
Human-readable element description used to obtain permission to interact with the element
filenamestring
Filename to save the result to. If not provided, result is returned as text.
function*string
() => { /* code */ } or (element) => { /* code */ } when element is provided
targetstring
Exact target element reference from the page snapshot, or a unique element selector
browser_file_uploadUpload one or multiple files1 params

Upload one or multiple files

Parameters* required
pathsarray
The absolute paths to the files to upload. Can be single file or multiple files. If omitted, file chooser is cancelled.
browser_dropDrop files or MIME-typed data onto an element, as if dragged from outside the page. At least one of "paths" or "data" must be provided.4 params

Drop files or MIME-typed data onto an element, as if dragged from outside the page. At least one of "paths" or "data" must be provided.

Parameters* required
dataobject
Data to drop, as a map of MIME type to string value (e.g. {"text/plain": "hello", "text/uri-list": "https://example.com"}).
elementstring
Human-readable element description used to obtain permission to interact with the element
pathsarray
Absolute paths to files to drop onto the element.
target*string
Exact target element reference from the page snapshot, or a unique element selector
browser_fill_formFill multiple form fields1 params

Fill multiple form fields

Parameters* required
fields*array
Fields to fill in
browser_press_keyPress a key on the keyboard1 params

Press a key on the keyboard

Parameters* required
key*string
Name of the key to press or a character to generate, such as `ArrowLeft` or `a`
browser_typeType text into editable element5 params

Type text into editable element

Parameters* required
elementstring
Human-readable element description used to obtain permission to interact with the element
slowlyboolean
Whether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.
submitboolean
Whether to submit entered text (press Enter after)
target*string
Exact target element reference from the page snapshot, or a unique element selector
text*string
Text to type into the element
browser_navigateNavigate to a URL1 params

Navigate to a URL

Parameters* required
url*string
The URL to navigate to
browser_navigate_backGo back to the previous page in the history

Go back to the previous page in the history

No parameters. Call it with no arguments.

browser_network_requestsReturns a numbered list of network requests since loading the page. Use browser_network_request with the number to get full details.3 params

Returns a numbered list of network requests since loading the page. Use browser_network_request with the number to get full details.

Parameters* required
filenamestring
Filename to save the network requests to. If not provided, requests are returned as text.
filterstring
Only return requests whose URL matches this regexp (e.g. "/api/.*user").
static*boolean
Whether to include successful static resources like images, fonts, scripts, etc. Defaults to false.default: false
browser_network_requestReturns full details (headers and body) of a single network request, or a single part if `part` is set. Use the number from browser_network_requests.3 params

Returns full details (headers and body) of a single network request, or a single part if `part` is set. Use the number from browser_network_requests.

Parameters* required
filenamestring
Filename to save the result to. If not provided, output is returned as text.
index*integer
1-based index of the request, as printed by browser_network_requests.
partstring
Return only this part of the request. Omit to return full details.one of request-headers · request-body · response-headers · response-body
browser_run_code_unsafeRun a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.2 params

Run a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.

Parameters* required
codestring
A JavaScript function containing Playwright code to execute. It will be invoked with a single argument, page, which you can use for any page interaction. For example: `async (page) => { await page....
filenamestring
Load code from the specified file. If both code and filename are provided, code will be ignored.
browser_take_screenshotTake a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.5 params

Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.

Parameters* required
elementstring
Human-readable element description used to obtain permission to interact with the element
filenamestring
File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified. Prefer relative file names to stay within the output directory.
fullPageboolean
When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Cannot be used with element screenshots.
targetstring
Exact target element reference from the page snapshot, or a unique element selector
type*string
Image format for the screenshot. Default is png.one of png · jpegdefault: png
browser_snapshotCapture accessibility snapshot of the current page, this is better than screenshot4 params

Capture accessibility snapshot of the current page, this is better than screenshot

Parameters* required
boxesboolean
Include each element's bounding box as [box=x,y,width,height] in the snapshot. Coordinates are viewport-relative, in CSS pixels (Element.getBoundingClientRect)
depthnumber
Limit the depth of the snapshot tree
filenamestring
Save snapshot to markdown file instead of returning it in the response.
targetstring
Exact target element reference from the page snapshot, or a unique element selector
browser_clickPerform click on a web page5 params

Perform click on a web page

Parameters* required
buttonstring
Button to click, defaults to leftone of left · right · middle
doubleClickboolean
Whether to perform a double click instead of a single click
elementstring
Human-readable element description used to obtain permission to interact with the element
modifiersarray
Modifier keys to press
target*string
Exact target element reference from the page snapshot, or a unique element selector
browser_dragPerform drag and drop between two elements4 params

Perform drag and drop between two elements

Parameters* required
endElementstring
Human-readable target element description used to obtain the permission to interact with the element
endTarget*string
Exact target element reference from the page snapshot, or a unique element selector
startElementstring
Human-readable source element description used to obtain the permission to interact with the element
startTarget*string
Exact target element reference from the page snapshot, or a unique element selector
browser_hoverHover over element on page2 params

Hover over element on page

Parameters* required
elementstring
Human-readable element description used to obtain permission to interact with the element
target*string
Exact target element reference from the page snapshot, or a unique element selector
browser_select_optionSelect an option in a dropdown3 params

Select an option in a dropdown

Parameters* required
elementstring
Human-readable element description used to obtain permission to interact with the element
target*string
Exact target element reference from the page snapshot, or a unique element selector
values*array
Array of values to select in the dropdown. This can be a single value or multiple values.
browser_tabsList, create, close, or select a browser tab.3 params

List, create, close, or select a browser tab.

Parameters* required
action*string
Operation to performone of list · new · close · select
indexnumber
Tab index, used for close/select. If omitted for close, current tab is closed.
urlstring
URL to navigate to in the new tab, used for new.
browser_wait_forWait for text to appear or disappear or a specified time to pass3 params

Wait for text to appear or disappear or a specified time to pass

Parameters* required
textstring
The text to wait for
textGonestring
The text to wait for to disappear
timenumber
The time to wait in seconds

Sponsors

Readme

Playwright MCP

A Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages through structured accessibility snapshots, bypassing the need for screenshots or visually-tuned models.

Playwright MCP vs Playwright CLI

This package provides MCP interface into Playwright. If you are using a coding agent, you might benefit from using the CLI+SKILLS instead.

  • CLI: Modern coding agents increasingly favor CLI–based workflows exposed as SKILLs over MCP because CLI invocations are more token-efficient: they avoid loading large tool schemas and verbose accessibility trees into the model context, allowing agents to act through concise, purpose-built commands. This makes CLI + SKILLs better suited for high-throughput coding agents that must balance browser automation with large codebases, tests, and reasoning within limited context windows.
    Learn more about Playwright CLI with SKILLS.

View the full README on GitHub

Details

Repository
github.com/microsoft/playwright-mcp
Category
Web & Browser Automation
Package
@playwright/mcp
Transport
STDIO
Registry
MCP registry, active
Tools verified
Jun 10, 2026

More from microsoft

Related Web & Browser Automation MCP servers

View all
1benjaminr avatarChrome DevToolsbenjaminr/chrome-devtools-mcpAn MCP Server for Chrome DevTools, following the Chrome DevTools Protocol. Integrates with Claude Desktop and Claude Code.297stars
2blackwhite084 avatarPlaywrightblackwhite084/playwright-plus-python-mcpExposes Playwright-based tools to automate browsing, capture content, and summarize stored notes via an MCP client.186stars
3runbook-ai avatarBrowser Agentrunbook-ai/runbook-ai-mcpMCP server for browser automation with AI agent3stars
4bitepro avatarChrome Debugger MCPbitepro/chrome-debugger-mcpChrome breakpoint debugging MCP server for inspecting runtime values and stepping through code1stars
5brainfuel avatarMCP Browserbrainfuel/mcp-browserNative macOS browser exposing an MCP server so AI agents can drive a real WKWebView.1stars
6dinesh-nalla-se avatarPlaywright Mcpdinesh-nalla-se/playwright-mcpPlaywright Tools for MCP0stars