Official Microsoft Playwright MCP server, enabling LLMs to interact with web pages through structured accessibility snapshots
The Playwright Model Context Protocol (MCP) server empowers Large Language Models (LLMs) to seamlessly interact with web environments. By leveraging Playwright's robust browser automation capabilities, this server provides a structured and efficient way for LLMs to access and manipulate web content, opening up a world of possibilities for AI-driven applications.
To integrate Playwright MCP into your workflow, configure your mcpServers
settings as follows:
{ "mcpServers": { "playwright": { "command": "npx", "args": [ "@playwright/mcp@latest" ] } } }
Install the Playwright MCP server directly within VS Code using these convenient buttons:
Alternatively, use the VS Code CLI for installation:
# For VS Code code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}' # For VS Code Insiders code-insiders --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'
The Playwright MCP server offers a range of command-line options to customize its behavior:
--browser <browser>
: Specify the browser or Chrome channel to use (e.g., chrome
, firefox
, webkit
, msedge
, chrome-beta
, chrome-canary
, chrome-dev
, msedge-beta
, msedge-canary
, msedge-dev
). Defaults to chrome
.--caps <caps>
: Enable specific capabilities (e.g., tabs
, pdf
, history
, wait
, files
, install
). Defaults to all capabilities enabled.--cdp-endpoint <endpoint>
: Connect to a specific Chrome DevTools Protocol (CDP) endpoint.--executable-path <path>
: Specify the path to the browser executable.--headless
: Run the browser in headless mode (no GUI). By default, the browser runs in headed mode.--port <port>
: Set the port for the Server-Sent Events (SSE) transport.--user-data-dir <path>
: Define the path to the user data directory.--vision
: Enable vision mode, which uses screenshots for interactions (accessibility snapshots are used by default).Playwright MCP launches the browser with a dedicated profile stored in the following locations:
%USERPROFILE%\AppData\Local\ms-playwright\mcp-chrome-profile
~/Library/Caches/ms-playwright/mcp-chrome-profile
~/.cache/ms-playwright/mcp-chrome-profile
This profile stores all login information and browsing data. You can delete it between sessions to clear the offline state.
To run the browser without a graphical interface, use the --headless
flag:
{ "mcpServers": { "playwright": { "command": "npx", "args": [ "@playwright/mcp@latest", "--headless" ] } } }
When running a headed browser on a system without a display or from IDE worker processes, execute the MCP server from an environment with the DISPLAY
variable set and pass the --port
flag to enable SSE transport:
npx @playwright/mcp@latest --port 8931
Then, configure the MCP client with the SSE endpoint URL:
{ "mcpServers": { "playwright": { "url": "http://localhost:8931/sse" } } }
Playwright MCP offers two distinct tool modes:
To activate Vision Mode, include the --vision
flag when starting the server:
{ "mcpServers": { "playwright": { "command": "npx", "args": [ "@playwright/mcp@latest", "--vision" ] } } }
Vision Mode is particularly effective when used with computer vision models capable of interacting with elements based on X/Y coordinates derived from screenshots.
For advanced customization, you can use Playwright MCP programmatically with custom transports:
import { createServer } from '@playwright/mcp'; // ... const server = createServer({ launchOptions: { headless: true } }); transport = new SSEServerTransport("/messages", res); server.connect(transport);
browser_click
element
(string): Human-readable description of the element.ref
(string): Exact element reference from the page snapshot.browser_hover
element
(string): Human-readable description of the element.ref
(string): Exact element reference from the page snapshot.browser_drag
startElement
(string): Human-readable description of the source element.startRef
(string): Exact source element reference from the page snapshot.endElement
(string): Human-readable description of the target element.endRef
(string): Exact target element reference from the page snapshot.browser_type
element
(string): Human-readable description of the element.ref
(string): Exact element reference from the page snapshot.text
(string): Text to type.submit
(boolean, optional): Whether to submit the text (press Enter).slowly
(boolean, optional): Types text one character at a time, useful for triggering key handlers.browser_select_option
element
(string): Human-readable description of the element.ref
(string): Exact element reference from the page snapshot.values
(array): Array of values to select.browser_snapshot
browser_take_screenshot
raw
(boolean, optional): Returns the screenshot in PNG format without compression if true (defaults to JPEG).browser_screen_move_mouse
element
(string): Human-readable description of the element.x
(number): X coordinate.y
(number): Y coordinate.browser_screen_capture
browser_screen_click
element
(string): Human-readable description of the element.x
(number): X coordinate.y
(number): Y coordinate.browser_screen_drag
element
(string): Human-readable description of the element.startX
(number): Starting X coordinate.startY
(number): Starting Y coordinate.endX
(number): Ending X coordinate.endY
(number): Ending Y coordinate.browser_screen_type
text
(string): Text to type.submit
(boolean, optional): Whether to submit the text (press Enter).browser_press_key
key
(string): Name of the key to press (e.g., ArrowLeft
, a
).browser_tab_list
browser_tab_new
url
(string, optional): The URL to navigate to in the new tab. If not provided, the new tab will be blank.browser_tab_select
index
(number): The index of the tab to select.browser_tab_close
index
(number, optional): The index of the tab to close. Closes the current tab if not provided.browser_navigate
url
(string): The URL to navigate to.browser_navigate_back
browser_navigate_forward
browser_press_key
key
(string): Name of the key to press (e.g., ArrowLeft
, a
).browser_file_upload
paths
(array): An array of absolute file paths to upload.browser_pdf_save
browser_wait
time
(number): The time to wait in seconds (capped at 10 seconds).browser_close
browser_install
๐ โ๏ธ The Scrapeless Model Context Protocol service acts as an MCP server connector to the Google SERP API, enabling web search within the MCP ecosystem without leaving it.
๐ Search ArXiv research papers
๐ โ๏ธ Web search capabilities using Brave's Search API
๐ โ๏ธ MCP to search and read medical / life sciences papers from PubMed.