home / mcp / playwright mcp server
Provides browser automation via Playwright using structured accessibility snapshots for reliable language-model interactions.
Configuration
View docs{
"mcpServers": {
"manishamishraacc-mcp": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}Playwright MCP is a lightweight server that enables browser automation by exposing Playwright’s structured accessibility snapshots. It lets you control and query web pages without relying on pixel-based inputs or vision models, making it fast, deterministic, and friendly for language-model interactions.
You connect to the Playwright MCP server from an MCP client (such as a code editor extension or an IDE-based integration) to automate web pages using a stable, accessibility-based interface. Start the server with a simple command, then point your MCP client at the server to begin issuing actions like navigating pages, clicking elements, typing text, and more. You can run in standard mode using a local, bundled setup or enable a standalone URL endpoint to connect remotely.
Key interaction patterns include capturing a page snapshot for element references, performing actions such as click, type, and navigate, and optionally taking screenshots or PDFs if you enable vision-related features. For best performance, use the Snapshot mode by default, which relies on the accessibility tree instead of rendering pixels. If you need visual-based interactions, you can opt into Vision Mode by starting the server with the --vision flag, though this uses a different set of endpoints and data.
Typical workflow: configure a Playwright MCP server entry in your client, start the server, and then issue high-level actions through your MCP client interface. You can also run a standalone SSE endpoint for integration with clients that expect a streaming interface.
Prerequisites: you need Node.js 18 or newer to run the Playwright MCP server.
Option A: Configure a local stdio server (embedded in your client workflow) using npx
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}If you run a standalone Playwright MCP server on your machine, start it with an explicit port to enable SSE transport and then configure your MCP client to connect to the SSE endpoint.
npx @playwright/mcp@latest --port 8931
```
```
{
"mcpServers": {
"playwright": {
"url": "http://localhost:8931/sse"
}
}
}You can install and configure the Playwright MCP server across multiple MCP clients. The following examples show how to register the server in common environments.
// VS Code style configuration to add the Playwright MCP server
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}Playwright MCP accepts a range of command-line options to customize browser behavior, network permissions, and how data is returned to clients. You can specify browser type, headless mode, viewport size, isolated profiles, storage state, and more. The visible options include enabling or disabling images, controlling which origins the browser can access, and selecting the browser channel or executable path.
Example of configuring a standalone server with an isolated context and a preloaded storage state:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest",
"--isolated",
"--storage-state={path/to/storage.json}"
]
}
}
}The server exposes a rich set of actions you can perform on web pages. These include taking page snapshots, clicking and typing, navigating, selecting options, handling dialogs, and more. You can also generate Playwright tests from scenarios and use a range of utilities to manage browser tabs, file uploads, and network observations.
Capture accessibility snapshot of the current page, this is better than screenshot
Perform click on a web page
Perform drag and drop between two elements
Hover over element on page
Type text into editable element
Select an option in a dropdown
Press a key on the keyboard
Wait for text to appear or disappear or a specified time to pass
Upload one or multiple files
Handle a dialog
Navigate to a URL
Go back to the previous page
Go forward to the next page
Take a screenshot of the current page
Save page as PDF
List network requests
Get console messages
Install the browser specified in the config
Close the page
Resize the browser window
List browser tabs
Open a new tab
Select a tab
Close a tab
Generate a Playwright test
Take a screenshot in Vision mode
Move mouse to a given position
Click left mouse button
Drag left mouse button
Type text
Press a key on the keyboard
Wait for text or a timeout
Upload files
Handle a dialog