- Home
- MCP servers
- Playwright
Playwright
- typescript
0
GitHub Stars
typescript
Language
3 months ago
First Indexed
3 weeks ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Playwright MCP is a lightweight server that exposes browser automation capabilities through Playwright’s accessibility tree. It lets you drive web pages using structured data, which is fast, deterministic, and friendly to language models that don’t rely on pixel-based inputs.
How to use
You connect to the Playwright MCP server from an MCP client (such as VS Code, Windsurf, or Claude) and issue automation commands through a defined tool API. Use the accessible snapshot and context data to navigate pages, interact with elements, and extract information without rendering full screenshots. This approach helps you build reliable automations that remain robust across visual changes.
Typical usage patterns include navigating to URLs, clicking elements, filling forms, taking page snapshots for accessibility, and inspecting network activity. You can also run arbitrary Playwright code snippets against the current page when needed, or manage browser tabs and view console output for debugging.
How to install
Prerequisites you need before installing the Playwright MCP server:
- Node.js 18 or newer
- An MCP client such as VS Code, Cursor, Windsurf, Claude Desktop, Goose, or any other MCP client
Install the Playwright MCP server using the standard configuration. The server runs locally via a package manager command.
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
Standalone MCP server
If you run the server as a standalone process, you can expose it over HTTP so clients connect via a URL. Start the server on a display-enabled system or from an IDE worker process, and provide the HTTP endpoint to your MCP client.
Start the server on port 8931 and connect clients via the HTTP URL.
npx @playwright/mcp@latest --port 8931
{
"mcpServers": {
"playwright": {
"url": "http://localhost:8931/mcp"
}
}
}
Docker
You can run the Playwright MCP server in Docker as a headless container. The container version is suitable for automated environments and CI pipelines.
{
"mcpServers": {
"playwright": {
"command": "docker",
"args": ["run", "-i", "--rm", "--init", "--pull=always", "mcr.microsoft.com/playwright/mcp"]
}
}
}
Or run the container long-lived with a mapped port and an entrypoint for the MCP server:
docker run -d -i --rm --init --pull=always \
--entrypoint node \
--name playwright \
-p 8931:8931 \
mcr.microsoft.com/playwright/mcp \
cli.js --headless --browser chromium --no-sandbox --port 8931
Programmatic usage
You can integrate Playwright MCP directly into a Node.js service. The following snippet shows how to create a connection and expose an SSE transport for client communication.
import http from 'http';
import { createConnection } from '@playwright/mcp';
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
http.createServer(async (req, res) => {
// ...
// Creates a headless Playwright MCP server with SSE transport
const connection = await createConnection({ browser: { launchOptions: { headless: true } } });
const transport = new SSEServerTransport('/messages', res);
await connection.connect(transport);
// ...
});
" ]},{
## Available tools
### browser\_click
Click on a web page element using a target reference and optional modifiers and mouse button.
### browser\_close
Close the current page or browser context.
### browser\_snapshot
Capture an accessibility snapshot of the current page, preferred over pixel-based screenshots.
### browser\_take\_screenshot
Capture a screenshot of the current page or a specific element.
### browser\_navigate
Navigate the browser to a specified URL.
### browser\_type
Type text into an editable element with optional submission and speed controls.
### browser\_wait\_for
Wait for specific text to appear, disappear, or a timeout to elapse.
### browser\_tabs
Manage tabs: list, create, close, or switch between tabs.
### browser\_console\_messages
Retrieve console messages from the page.
### browser\_run\_code
Run a block of Playwright code against the current page.
### browser\_verify\_text\_visible
Verify that specific text is visible on the page.
### browser\_verify\_element\_visible
Verify that a specific element is visible using accessibility data.