MCP Playwright Server
An MCP server that enables AI-powered browser automation, web scraping, and testing using Playwright across Chromium, Firefox, and WebKit. It allows users to perform actions like navigation, clicking, typing, and taking screenshots through natural language interfaces.
README
MCP Playwright Server
<div align="center">
🚀 AI-Powered Browser Automation for Claude Desktop
Bridge the gap between AI and web automation with this revolutionary MCP server
</div>
🎯 What is MCP Playwright?
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.
🌟 Why Choose MCP Playwright?
- 🤖 AI-First Design: Built specifically for AI agents and natural language automation
- 🎭 Multi-Browser Support: Chromium, Firefox, and WebKit out of the box
- 🐳 Production Ready: Docker support for consistent, scalable deployments
- ⚡ Lightning Fast: Optimized for enterprise-grade testing workflows
- 🔧 Developer Friendly: Comprehensive tooling and extensive documentation
Features
- Multi-browser support: Chromium, Firefox, and WebKit
- Comprehensive automation: Navigate, click, type, screenshot, and more
- Docker support: Run in containers for consistent environments
- Testing framework: Built-in Playwright test configuration
- MCP integration: Compatible with Claude Desktop and other MCP clients
Available Tools
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 pages
🚀 Quick Start
One-Line Installation
npm install -g mcp-playwright && mcp-playwright start
Installation
Local Development
- Install dependencies:
npm install
- Install Playwright browsers:
npm run install:browsers
- Start the MCP server:
npm start
Docker Deployment
- Build the Docker image:
npm run docker:build
- Run the container:
npm run docker:run
Configuration for Claude Desktop
To use this MCP server with Claude Desktop, add the following to your Claude Desktop configuration file:
macOS Configuration
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"
}
}
}
}
Docker Configuration
If running in Docker, use:
{
"mcpServers": {
"playwright": {
"command": "docker",
"args": ["run", "--rm", "-i", "mcp-playwright"],
"env": {
"PLAYWRIGHT_HEADLESS": "true"
}
}
}
}
💡 Real-World Use Cases
🧪 AI-Powered Testing
// Let AI write and execute tests naturally
"Test the login flow with invalid credentials and verify error messages"
📊 Data Collection
// Automated data extraction from complex SPAs
"Navigate to the dashboard, extract all user metrics, and save as JSON"
🔍 Quality Assurance
// Visual regression testing with AI assistance
"Compare the current homepage with the baseline and highlight differences"
Usage Examples
Basic Web Testing
// 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' });
Running Tests
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
Development
Watch Mode
For development with automatic restarts:
npm run dev
Adding New Tools
To add new MCP tools, edit src/index.js and:
- Add the tool definition to the
toolsarray inListToolsRequestSchemahandler - Add a case in the
CallToolRequestSchemahandler - Implement the tool method in the
PlaywrightMCPServerclass
Environment Variables
PLAYWRIGHT_HEADLESS: Set tofalseto run browsers in headed modePLAYWRIGHT_SLOWMO: Add delay between operations (milliseconds)
Docker Environment
The Docker container includes:
- Node.js 18
- All Playwright browsers pre-installed
- System dependencies for browser operation
- Optimized for headless operation
Troubleshooting
Browser Installation Issues
npx playwright install --with-deps
Permission Issues (Linux/Docker)
# Add to Dockerfile if needed
RUN groupadd -r pwuser && useradd -r -g pwuser -G audio,video pwuser
USER pwuser
Memory Issues
For large-scale testing, increase Docker memory limits:
docker run --memory=2g --cpus=2 mcp-playwright
🎥 Demo & Tutorials
- 📺 Getting Started Video - 5-minute setup guide
- 📖 Complete Tutorial Series - From basics to advanced
- 🎮 Interactive Playground - Try it live
🏆 Success Stories
"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
🤝 Contributing
We love contributions! See our Contributing Guide for details.
🎯 Ways to Contribute
- 🐛 Bug Reports: Help us squash bugs
- 💡 Feature Requests: Share your ideas
- 📝 Documentation: Improve our docs
- 🧪 Testing: Add test coverage
- 🎨 Examples: Create usage examples
📈 Project Stats
⭐ GitHub Stars: 150+ (and growing!)
📦 NPM Downloads: 1000+ monthly
🧪 Test Coverage: 95%
🏢 Enterprise Users: 50+
🌍 Global Community: 25+ countries
🌟 What's Next?
- 🤖 Enhanced AI Integration: GPT-4 powered test generation
- 📱 Mobile Testing: React Native and Flutter support
- 🔄 CI/CD Plugins: GitHub Actions, Jenkins, GitLab
- 📊 Advanced Analytics: Test insights and reporting dashboard
💖 Support the Project
If MCP Playwright helps your team, consider:
- ⭐ Starring this repository
- 🐦 Sharing on social media
- 💬 Joining our Discord community
- ☕ Sponsoring development
License
MIT License - see LICENSE file for details.
<div align="center">
Built with ❤️ by Mostafa Raafat
Making AI-powered automation accessible to everyone
🌐 Website • 🐦 Twitter • 💼 LinkedIn
</div>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。