home / mcp / playwright mcp server
for MCP servers
Configuration
View docs{
"mcpServers": {
"amrendra05-mcp-playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}You can automate browser interactions using the Playwright MCP Server. It exposes a structured, accessibility-based view of web pages, letting you drive web pages with an LLM or automation tool without relying on pixel-based inputs. This approach is fast, lightweight, and deterministic, making it suitable for robust web automation tasks.
Set up and connect a client to the Playwright MCP Server to start automating web pages. Use the standard MCP configuration to run the server locally, then point your MCP client at the server’s address. You will interact with web pages by requesting actions (like click, navigate, or fill form) and receiving structured snapshots and events in response.
Prerequisites you need before installing: - Node.js 18 or newer - An MCP client such as VS Code MCP, Cursor, Windsurf, Claude Desktop, Goose, or another MCP client that supports the server type you choose.
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}If you are using a client that supports a quick install button, you can configure it to spawn the server with the standard command above. Otherwise, you can run the command directly in your terminal to start the server in a local MCP environment.
The Playwright MCP Server supports a set of command-line options to customize its behavior. You can extend the server startup by adding arguments to the config, for example to run headless, set timeouts, or adjust security settings. The key options include the browser to use, headless mode, viewport size, isolation mode for sessions, and storage state paths. You typically pass these options via the args array in the MCP config.
Standalone: If you run the server on a machine with no display, start the server with an explicit port and connect clients to that port. For example, run the server on port 8931 and point your MCP client to http://localhost:8931/mcp.
Docker: You can run a headless instance in a container. The container version is configured to work headless with Chromium. Use the standard command to start the container and expose the MCP port to your environment.
The Playwright MCP Server exposes a comprehensive set of browser automation tools. These tools cover core actions like clicking, navigating, typing, filling forms, taking snapshots, handling dialogs, and managing tabs, as well as coordinate-based interactions when enabled. Each tool includes a description, the required parameters, and whether it is read-only.
Click on a web page element using a human-readable target and a precise element reference. Supports optional double-click, button choice, and modifier keys.
Close the current browser page or context. This is a read-only capability.
Retrieve all console messages from the current page. This is a read-only capability.
Drag between two elements by specifying their human-readable targets and exact references.
Evaluate JavaScript on the page or a specific element, returning the result.
Upload one or multiple files to a file input on the page.
Fill multiple fields in a form with their respective values.
Handle modal dialogs by accepting or providing a prompt text.
Hover the mouse over a specific element on the page.
Navigate the browser to a specified URL.
Go back to the previous page in the history.
List all network requests that occurred since the page load.
Press a specific key on the keyboard, including special keys.
Resize the browser window to the given width and height.
Select one or more options in a dropdown by values.
Capture an accessibility snapshot of the current page. This is preferred over pixel-based screenshots.
Capture a screenshot of the current page, with options for target element and full-page capture.
Type text into an editable element with optional submission and typing speed control.
Wait for specific text to appear or disappear, or wait for a timeout.
Manage browser tabs: list, create, close, or switch between tabs.
Install the configured browser in the environment if required.
Click at a specific screen coordinate with the left mouse button.
Drag the mouse from a start coordinate to an end coordinate.
Move the mouse to specific screen coordinates.
Save the current page as a PDF when available.
Start a tracing session to capture performance data.
Stop tracing and collect the trace data.