- Home
- MCP servers
- Playwright
Playwright
- python
6
GitHub Stars
python
Language
4 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.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"alexrwilliam-playwright-mcp-server": {
"command": "playwright-mcp",
"args": [
"stdio"
]
}
}
}You can run a lightweight Playwright MCP (Model Context Protocol) server to automate browser tasks through a simple, scalable API. It exposes core browsing capabilities—like navigation, DOM interactions, screenshots, and network inspection—in a way that lets you build higher-level automation and QA workflows without embedding Playwright directly in your client.
How to use
You connect to the MCP server from your client and issue commands that operate on a persistent browser context. Start with a local stdio server to keep everything self-contained, or run an HTTP transport if you prefer remote control. The server tracks open pages/tabs, lets you switch between them, and supports multiple pages, popups, and plugins that extend interactions across tabs.
Key capabilities you’ll use include navigating to URLs, interacting with page elements, querying for elements, collecting snapshots (HTML, screenshots, accessibility trees), and monitoring network activity. Outputs are returned in a raw, unmodified form from Playwright so you can post-process or feed them directly into tools and workflows.
How to install
Prerequisites: you need Python and a Python package manager, plus Playwright browsers installed.
# Install directly from source and install Playwright browsers
pip install git+https://github.com/alexrwilliam/playwright-mcp-server.git
playwright install
Additional setup and usage notes
Run the MCP server in stdio mode for local control or in http mode for remote control. In headed mode you can visually observe the browser.
If you prefer to run the server with a real browser channel, you can specify the channel and optionally a user data directory to preserve cookies and profile data.
Configuration and behavior notes
The server exposes a rich set of configuration options for response budgets, artifacts, and timeouts. You can tune how much inline data is returned, where large artifacts are stored, and how long artifacts are retained. You can also control how many elements are returned by element queries and how many nodes are included in accessibility snapshots.
Security and reliability considerations include limiting the size of inline responses, trimming overflow data, and using artifact previews to keep the main response compact while preserving access to full payloads when needed.
Troubleshooting and tips
If you encounter connectivity issues, verify the transport type you started with (stdio or http) and ensure the server process is running. For large responses, use artifact accessors to retrieve full payloads without overwhelming the client.
Available tools
navigate
Navigate to a URL. Returns the current page reference and state.
reload
Reload the current page to refresh its state.
go_back
Go back in the browser history.
go_forward
Go forward in the browser history.
get_current_url
Return the current page URL with parsed components.
wait_for_url
Wait for the URL to match a pattern within a timeout.
wait_for_load_state
Wait for the page to reach a specific load state such as domcontentloaded, load, or networkidle.
set_viewport_size
Set the browser viewport dimensions for the active page.
list_pages
List all open pages or tabs with identifiers, URLs, and titles.
switch_page
Switch the active context to a specific page by its identifier.
close_page
Close a specific page or tab.
wait_for_popup
Wait for a new popup or tab to open and capture its reference.
switch_to_latest_page
Switch to the most recently opened page.
click
Click an element matched by a selector.
type_text
Type text into an element matched by a selector.
fill
Fill an input field with a value.
clear_text
Clear the text from an input field.
select_option
Select an option in a dropdown or select element.
hover
Hover the mouse over an element.
scroll
Scroll within a page or element to specified coordinates.
press_key
Press a keyboard key in the page context.
check_checkbox
Check a checkbox element.
uncheck_checkbox
Uncheck a checkbox element.
upload_file
Upload a file to a file input element.
query_selector
Query for a single element using CSS, XPath, or Playwright locators with optional text caps.
query_selector_all
Query for all matching elements with optional caps.
query_selector_meta
Provide a quick metadata preview for an element.
is_visible
Check if an element is visible on the page.
is_enabled
Check if an element is enabled for interaction.
wait_for_element
Wait for an element to appear within a timeout.
get_element_bounding_box
Get an element's position and size.
get_element_attributes
Get all attributes of an element.
get_computed_style
Get a CSS computed style property for an element.
evaluate
Execute JavaScript in the page context and return results.
wait_for_network_idle
Wait for network activity to settle.
get_page_errors
Retrieve JavaScript errors from the page.
get_console_logs
Retrieve console logs from the page.
get_network_requests
Retrieve captured network requests with optional filtering.
get_network_responses
Retrieve captured network responses with optional filtering.
clear_network_logs
Clear all captured network logs.
intercept_route
Intercept and handle network requests with a custom action.
unroute_all
Remove all route interceptors.
wait_for_response
Wait for a specific network response to occur.
get_response_body
Extract the body of a network response.
get_html
Retrieve the page HTML content.
get_accessibility_snapshot
Generate an accessibility tree snapshot with optional filtering and node limits.
screenshot
Capture a screenshot of the page or a specific element and store as an artifact.
Generate a PDF of the current page and return artifact metadata.
set_extra_headers
Add custom HTTP headers to all requests.
set_user_agent
Change the browser User-Agent string.