rcrumpto14/playwright-mcp-server
If you are the rightful owner of playwright-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Playwright MCP Server is a Model Context Protocol server that offers browser automation capabilities using the Playwright library.
Playwright MCP Server
A Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright.
Features
- Browser management (launch, close)
- Page navigation
- Element interaction (click, type, get text)
- Wait for elements
- Screenshot capture
- PDF generation
- Headless and headed browser modes
Installation
npm install
npm run build
Usage
As an MCP Server
Add to your MCP configuration file (e.g., ~/.cursor/mcp.json):
{
"servers": {
"playwright": {
"command": "node",
"args": ["path/to/playwright-mcp-server/dist/index.js"]
}
}
}
Or if published to npm:
{
"servers": {
"playwright": {
"command": "npx",
"args": ["playwright-mcp-server"]
}
}
}
Development
npm run dev
Available Tools
browser_launch
Launch a new browser instance.
headless(boolean, optional): Run in headless mode (default: true)
navigate
Navigate to a URL.
url(string, required): URL to navigate to
click
Click on an element.
selector(string, required): CSS selector for the element
type
Type text into an input field.
selector(string, required): CSS selector for the input fieldtext(string, required): Text to type
get_text
Get text content from an element.
selector(string, required): CSS selector for the element
screenshot
Take a screenshot of the current page.
path(string, required): File path to save the screenshotfullPage(boolean, optional): Capture full page (default: false)
generate_pdf
Generate a PDF of the current page.
path(string, required): File path to save the PDFformat(string, optional): Paper format (default: A4)
wait_for_selector
Wait for an element to appear.
selector(string, required): CSS selector to wait fortimeout(number, optional): Timeout in milliseconds (default: 30000)
browser_close
Close the browser instance.
Example Usage
- Launch browser:
browser_launch - Navigate to a page:
navigatewith URL - Interact with elements:
click,type,get_text - Capture content:
screenshotorgenerate_pdf - Close browser:
browser_close
License
MIT