home / mcp / playwright mcp server
Playwrite wrapper for MCP
Configuration
View docs{
"mcpServers": {
"misanthropic-ai-playwrite-mcp": {
"command": "uv",
"args": [
"--directory",
"/Users/shannon/Workspace/artivus/playwright-mcp",
"run",
"playwright-mcp"
]
}
}
}You can run a Playwright-based MCP server that lets clients control a browser for automation tasks. This server exposes browser interaction capabilities, page analysis prompts, and built-in tools to navigate, interact, and extract content from web pages, all via MCP-compatible clients.
You interact with the Playwright MCP server through an MCP client that speaks the agreed MCP protocol. The server provides a prompt called interpret-page to analyze the current page and optionally focus on areas like forms, navigation, or text, returning both a text analysis and a screenshot. It also exposes a set of browser automation tools you can call to navigate to URLs, manage pages, click elements, type input, wait for elements, extract text, retrieve page HTML, and take screenshots. You can request screenshots as resources using a page-specific URI pattern and switch between multiple pages as needed. Use the available navigation, interaction, and content extraction tools to automate tasks end-to-end, from loading a page to validating results.
Install dependencies needed to run the MCP server and enable Playwright browser automation.
uv add playwright
playwright install chromiumStart the development server (local path shown as an example). Use the exact path that contains your Playwright MCP source when you run this locally.
uv --directory /Users/shannon/Workspace/artivus/playwright-mcp run playwright-mcpIf you prefer a published/production-style setup, you can run the server using the published command.
uvx playwright-mcpThe server is designed to be run as a stdio-based MCP server. It starts by invoking the runtime tool (uv) with the directory containing your server source and the target script, or by using the published runtime (uvx) with the server name. There are no HTTP endpoints or URLs required to start the server itself, but the server exposes HTTP-style idea endpoints for client interaction via MCP. Ensure you have Chromium installed for Playwright to launch browsers.
Prompts and resources are available for interpreting pages and taking screenshots. The interpret-page prompt analyzes the current page content and structure and can return a screenshot for reference. Screenshot resources are accessible via a page-specific URI like screenshot://{page_id} for any open page.
The server provides a comprehensive set of browser automation tools that your MCP client can invoke to automate tasks.
Browser navigation: navigate to a URL, create new pages, switch pages, and list all pages.
Page interaction: click elements via CSS selectors, type text into inputs, and wait for elements to appear.
Content extraction: retrieve text from elements, get the entire page HTML, and take screenshots.
Navigate the active browser page to a specified URL.
Open a new browser page and assign it a unique identifier.
Switch the active context to a different browser page by ID.
List all currently open browser pages and their IDs.
Click an element identified by a CSS selector on the active page.
Type text into a targeted input element.
Wait for a CSS selector to appear on the page before continuing.
Extract text content from a selected element.
Retrieve the full HTML content of the current page.
Capture a screenshot of the current page or a specific element.
Analyze current page content and structure, returning text analysis and a page screenshot.