playwright
MCP Server for Playwright Browser Tools
claude mcp add --transport stdio alexrwilliam-playwright-mcp-server python -m playwright_mcp.server stdio
How to use
This MCP server exposes Playwright browser automation capabilities via a simple MCP API. It wraps core features such as browser context management, navigation, DOM interaction, element discovery, and network controls, delivering raw Playwright results through an MCP-compatible interface. Use it when you need programmatic browser automation with structured outputs suitable for large language model workflows, including artifacts for large responses and built-in overflow handling. The server can operate over stdio or HTTP transports depending on how you invoke it in your MCP client setup.
From the command line, you can start the server using the provided CLI entry point (as documented in the repository) and then issue MCP requests to perform actions like opening pages, querying elements, taking snapshots, intercepting network requests, and executing scripts inside the page context. The server supports multiple pages/tabs, persistent contexts (headless or headed), and configurable output budgets to ensure responses remain consumable by downstream tools. Outputs are delivered as raw Playwright results, with optional artifact references for large payloads. Use the artifact reader tools to fetch full payloads when needed.
How to install
Prerequisites:
- Python 3.8+ (recommended 3.9+)
- pip (Python package manager)
- Playwright Python package and browsers installed
Installation steps:
-
Install the MCP server package (example assumes you are installing from GitHub or a PyPI-compatible source):
If using pip from GitHub or PyPI
pip install git+https://github.com/alexrwilliam/playwright-mcp-server.git
-
Install Playwright browsers (required for Playwright to run): playwright install
-
Run the MCP server (example using stdio transport): python -m playwright_mcp.server stdio
-
(Optional) Run with HTTP transport instead of stdio: python -m playwright_mcp.server http --port 8000
Tip: You can also integrate this with development workflows by cloning the repo, installing in editable mode, and running locally: git clone https://github.com/alexrwilliam/playwright-mcp-server.git cd playwright-mcp-server pip install -e . playwright install python -m playwright_mcp.server stdio
Additional notes
Notes and tips:
- The server exposes a broad set of Playwright capabilities (context management, navigation, DOM interaction, element discovery, snapshotting, script evaluation, network controls, cookies/storage, headers). Outputs are kept as close to raw Playwright results as possible.
- To manage large responses, the server supports response budgeting with truncation, previews, and overflow artifacts that can be retrieved later via an artifact reader.
- Artifacts can be written to a custom directory using command-line flags (e.g., --artifact-dir) if your MCP client supports passing extra options.
- When running in HTTP mode, ensure your environment firewall rules allow port access, and consider securing endpoints if exposed publicly.
- If you need CDP-like attach behavior or stealth/fingerprinting options, these capabilities are available via Playwright and can be integrated through appropriate initialization scripts and options passed through the MCP protocol.
- Common issues tend to involve environment constraints (missing browsers, incompatible Python versions) or transport misconfiguration between MCP client and server. Check logs for port binding and transport negotiation details.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP