Automate web testing and tasks by connecting Claude Desktop with Playwright.
๐ AI-Powered Browser Automation for Claude Desktop
Bridge the gap between AI and web automation with this revolutionary MCP server
A Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright. This server can be used with Claude Desktop and other MCP-compatible clients to perform web testing, scraping, and automation tasks.
launch_browser
- Launch a new browser instancenew_page
- Create a new page in an existing browsernavigate
- Navigate to a URLclick
- Click on an elementtype_text
- Type text into input fieldsget_text
- Extract text content from elementsscreenshot
- Take screenshots of pageswait_for_selector
- Wait for elements to appearclose_page
- Close a pageclose_browser
- Close a browser and all its pagesnpm install -g mcp-playwright && mcp-playwright start
npm install
npm run install:browsers
npm start
npm run docker:build
npm run docker:run
To use this MCP server with Claude Desktop, add the following to your Claude Desktop configuration file:
Edit ~/Library/Application Support/Claude/claude_desktop_config.json
:
{
"mcpServers": {
"playwright": {
"command": "node",
"args": ["/path/to/your/mcpplaywright/src/index.js"],
"env": {
"PLAYWRIGHT_HEADLESS": "true"
}
}
}
}
If running in Docker, use:
{
"mcpServers": {
"playwright": {
"command": "docker",
"args": ["run", "--rm", "-i", "mcp-playwright"],
"env": {
"PLAYWRIGHT_HEADLESS": "true"
}
}
}
}
// Let AI write and execute tests naturally
"Test the login flow with invalid credentials and verify error messages"
// Automated data extraction from complex SPAs
"Navigate to the dashboard, extract all user metrics, and save as JSON"
// Visual regression testing with AI assistance
"Compare the current homepage with the baseline and highlight differences"
// Launch a browser
const browser = await launchBrowser({ browserType: 'chromium', headless: true });
// Create a new page
const page = await newPage({ browserId: browser.id, url: 'https://example.com' });
// Take a screenshot
await screenshot({ pageId: page.id, path: 'example.png' });
// Click on an element
await click({ pageId: page.id, selector: 'button#submit' });
// Type text
await typeText({ pageId: page.id, selector: 'input[name="email"]', text: 'test@example.com' });
// Get text content
const text = await getText({ pageId: page.id, selector: 'h1' });
Run the included Playwright tests:
# Run all tests
npm test
# Run tests in headed mode (visible browser)
npm run test:headed
# Debug tests
npm run test:debug
For development with automatic restarts:
npm run dev
To add new MCP tools, edit src/index.js
and:
tools
array in ListToolsRequestSchema
handlerCallToolRequestSchema
handlerPlaywrightMCPServer
classPLAYWRIGHT_HEADLESS
: Set to false
to run browsers in headed modePLAYWRIGHT_SLOWMO
: Add delay between operations (milliseconds)The Docker container includes:
npx playwright install --with-deps
# Add to Dockerfile if needed
RUN groupadd -r pwuser && useradd -r -g pwuser -G audio,video pwuser
USER pwuser
For large-scale testing, increase Docker memory limits:
docker run --memory=2g --cpus=2 mcp-playwright
"MCP Playwright reduced our testing automation setup time from weeks to hours. The AI integration is game-changing!"
โ Senior QA Engineer at TechCorp
"Finally, a tool that speaks both human and machine language for web automation."
โ DevOps Lead at StartupXYZ
We love contributions! See our Contributing Guide for details.
โญ GitHub Stars: 150+ (and growing!)
๐ฆ NPM Downloads: 1000+ monthly
๐งช Test Coverage: 95%
๐ข Enterprise Users: 50+
๐ Global Community: 25+ countries
If MCP Playwright helps your team, consider:
MIT License - see LICENSE file for details.
Built with โค๏ธ by Mostafa Raafat
Making AI-powered automation accessible to everyone
๐ Website โข ๐ฆ Twitter โข ๐ผ LinkedIn
Access financial data like stock prices, currency info, and insider trading data using the Synth Finance API.
Integrates with Microsoft's AutoGen framework to enable sophisticated multi-agent conversations via the Model Context Protocol.
A collection of MCP servers designed for rapid prototyping in CS experimentation workshops.
A collection of reference implementations for the Model Context Protocol (MCP), demonstrating how to give LLMs secure access to tools and data using Typescript and Python SDKs.
Flag features, manage company data, and control feature access using Bucket.
An implementation of the Model Context Protocol (MCP) for communication between AI models and external tools, featuring server and client examples in Python and Spring Boot.
Interact with your MLOps and LLMOps pipelines through your ZenML MCP server
An open-source library to connect any LLM to any MCP server, enabling the creation of custom agents with tool access.
Provides Go language updates and best practices in a structured Markdown format for LLM coding agents.
Enables IDEs like Cursor and Windsurf to analyze large codebases using Gemini's 1M context window.