home / mcp / playwright mcp server

Playwright MCP Server

for MCP servers

Installation
Add the following to your MCP client configuration file.

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.

How to use

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.

How to install

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"
      ]
    }
  }
}

Additional setup notes

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.

Configuration and usage details

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 and container usage

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.

Tools and capabilities

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.

Available tools

browser_click

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.

browser_close

Close the current browser page or context. This is a read-only capability.

browser_console_messages

Retrieve all console messages from the current page. This is a read-only capability.

browser_drag

Drag between two elements by specifying their human-readable targets and exact references.

browser_evaluate

Evaluate JavaScript on the page or a specific element, returning the result.

browser_file_upload

Upload one or multiple files to a file input on the page.

browser_fill_form

Fill multiple fields in a form with their respective values.

browser_handle_dialog

Handle modal dialogs by accepting or providing a prompt text.

browser_hover

Hover the mouse over a specific element on the page.

browser_navigate

Navigate the browser to a specified URL.

browser_navigate_back

Go back to the previous page in the history.

browser_network_requests

List all network requests that occurred since the page load.

browser_press_key

Press a specific key on the keyboard, including special keys.

browser_resize

Resize the browser window to the given width and height.

browser_select_option

Select one or more options in a dropdown by values.

browser_snapshot

Capture an accessibility snapshot of the current page. This is preferred over pixel-based screenshots.

browser_take_screenshot

Capture a screenshot of the current page, with options for target element and full-page capture.

browser_type

Type text into an editable element with optional submission and typing speed control.

browser_wait_for

Wait for specific text to appear or disappear, or wait for a timeout.

browser_tabs

Manage browser tabs: list, create, close, or switch between tabs.

browser_install

Install the configured browser in the environment if required.

browser_mouse_click_xy

Click at a specific screen coordinate with the left mouse button.

browser_mouse_drag_xy

Drag the mouse from a start coordinate to an end coordinate.

browser_mouse_move_xy

Move the mouse to specific screen coordinates.

browser_pdf_save

Save the current page as a PDF when available.

browser_start_tracing

Start a tracing session to capture performance data.

browser_stop_tracing

Stop tracing and collect the trace data.