playwright.dev
playwright.dev logo

Playwright Browser Automation

Enables web browser control for navigating websites, capturing page snapshots, interacting with elements, and taking scr...

Created bySep 22, 2025

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.
Video preview

Key Features

  • Fast and lightweight: Uses Playwright's accessibility tree, not pixel-based input.
  • LLM-friendly: No vision models needed, operates purely on structured data.
  • Deterministic tool application: Avoids ambiguity common with screenshot-based approaches.

Use Cases

  • Web navigation and form-filling
  • Data extraction from structured content
  • Automated testing driven by LLMs
  • General-purpose browser interaction for agents

Example config

NPX

Installation in VS Code

Install the Playwright MCP server in VS Code using one of these buttons:
Alternatively, you can install the Playwright MCP server using the VS Code CLI:
After installation, the Playwright MCP server will be available for use with your GitHub Copilot agent in VS Code.

CLI Options

The Playwright MCP server supports the following command-line options:
  • --browser <browser>: Browser or chrome channel to use. Possible values:
  • --caps <caps>: Comma-separated list of capabilities to enable, possible values: tabs, pdf, history, wait, files, install. Default is all.
  • --cdp-endpoint <endpoint>: CDP endpoint to connect to
  • --executable-path <path>: Path to the browser executable
  • --headless: Run browser in headless mode (headed by default)
  • --port <port>: Port to listen on for SSE transport
  • --user-data-dir <path>: Path to the user data directory
  • --vision: Run server that uses screenshots (Aria snapshots are used by default)

User data directory

Playwright MCP will launch the browser with the new profile, located at
All the logged in information will be stored in that profile, you can delete it between sessions if you'd like to clear the offline state.

Running headless browser (Browser without GUI).

This mode is useful for background or batch operations.

Running headed browser on Linux w/o DISPLAY

When running headed browser on system w/o display or from worker processes of the IDEs, run the MCP server from environment with the DISPLAY and pass the --port flag to enable SSE transport.
And then in MCP client config, set the url to the SSE endpoint:

Docker

NOTE: The Docker implementation only supports headless chromium at the moment.

Tool Modes

The tools are available in two modes:
  1. Snapshot Mode (default): Uses accessibility snapshots for better performance and reliability
  1. Vision Mode: Uses screenshots for visual-based interactions
To use Vision Mode, add the --vision flag when starting the server:
Vision Mode works best with the computer use models that are able to interact with elements using X Y coordinate space, based on the provided screenshot.

Build with Docker

You can build the Docker image yourself.

Programmatic usage with custom transports

Snapshot-based Interactions

  • browser_snapshot
  • browser_click
  • browser_drag
  • browser_hover
  • browser_type
  • browser_select_option
  • browser_take_screenshot

Vision-based Interactions

  • browser_screen_capture
  • browser_screen_move_mouse
  • browser_screen_click
  • browser_screen_drag
  • browser_screen_type

Tab Management

  • browser_tab_list
  • browser_tab_new
  • browser_tab_select
  • browser_tab_close

Navigation

  • browser_navigate
  • browser_navigate_back
  • browser_navigate_forward

Keyboard

  • browser_press_key

Console

  • browser_console_messages

Files and Media

  • browser_file_upload
  • browser_pdf_save

Utilities

  • browser_close
  • browser_wait
  • browser_resize
  • browser_install
  • browser_handle_dialog