Provides comprehensive browser automation capabilities including navigation, content extraction, form filling, screenshot capture, and JavaScript execution through Playwright's Firefox engine.
Browser MCP Server
A Model Context Protocol (MCP) server that provides comprehensive browser automation capabilities using Playwright. This server enables AI assistants to interact with web pages through standardized MCP tools for navigation, content extraction, form filling, and screenshot capture.
🚀 Features
Core Browser Operations
Navigate to URLs with smart waiting strategies
Extract page content with customizable selectors
Take screenshots (full page, viewport, or specific elements)
Execute JavaScript with result capture
Click elements by CSS selectors
Fill forms automatically with validation
Advanced Capabilities
Multi-browser support (Chromium, Firefox, WebKit)
Request interception and monitoring
Viewport customization and responsive testing
Link extraction and URL processing
Error handling with detailed responses
Resource management and cleanup
📦 Installation
Prerequisites
Python 3.8 or higher
Node.js (for Playwright browser installation)
Install from Source
Install from PyPI (when available)
🛠 Usage
As MCP Server
Start the server with stdio transport:
Configuration
Configure the browser through environment variables:
MCP Client Integration
Add to your MCP client configuration:
🔧 Available Tools
navigate_to
Navigate to a specified URL with optional waiting.
get_page_content
Extract text content from the current page.
click_element
Click on elements by CSS selector.
fill_form
Fill form fields with data.
take_screenshot
Capture page screenshots.
execute_javascript
Run JavaScript in the browser context.
📁 Project Structure
🏗 Architecture
Server (server.py
)
MCP server implementation with tool registration
Request routing and response formatting
Error handling and logging
Async tool execution
Browser Manager (browser.py
)
Playwright browser lifecycle management
Context creation and configuration
Resource cleanup and recovery
Multi-browser support
Actions (actions.py
)
High-level browser automation methods
Content extraction and processing
Form interaction and validation
Screenshot and JavaScript execution
Utils (utils.py
)
HTML sanitization and cleaning
URL validation and normalization
Image processing and encoding
Data formatting utilities
🔒 Security Considerations
HTML sanitization removes dangerous scripts and attributes
URL validation prevents malicious redirects
Input validation for all user-provided data
Resource limits prevent excessive memory usage
Timeout controls prevent hanging operations
🐳 Docker Deployment
Quick Start with Docker
Production Deployment
Development with Docker
Container Management
🚨 Error Handling
The server provides detailed error responses with:
Error categorization (timeout, validation, execution)
Context information (URL, selector, arguments)
Recovery suggestions where applicable
Logging for debugging and monitoring
📊 Response Format
All tools return standardized JSON responses:
Error responses include:
🛡 Environment Variables
Variable | Default | Description |
|
| Run browser in headless mode |
|
| Browser engine to use |
|
| Default timeout (ms) |
🤝 Development
Setting up Development Environment
Adding New Tools
Define tool schema in
server.py
Implement action method in
actions.py
Add utility functions in
utils.py
Update documentation and tests
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
Playwright for browser automation
MCP for the protocol specification
Anthropic for Claude and MCP development
📞 Support
Issues: Report bugs and request features on GitHub
Documentation: See inline code documentation
Community: Join MCP community discussions
Note: This is a foundational implementation. Additional features like request interception, advanced form handling, and performance optimizations can be added based on specific use cases.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables AI assistants to automate web browsers through Playwright, providing capabilities for navigation, content extraction, form filling, screenshot capture, and JavaScript execution. Supports multiple browser engines with comprehensive error handling and security features.
Related MCP Servers
- AsecurityFlicenseAqualityA server that enables browser automation using Playwright, allowing interaction with web pages, capturing screenshots, and executing JavaScript in a browser environment through LLMs.Last updated -127,9921
- AsecurityAlicenseAqualityThe server provides tools for web automation using Playwright, allowing navigation, interaction, and JavaScript execution on web pages, and supports note storage with summarization capabilities.Last updated -8152Apache 2.0
- AsecurityAlicenseAqualityA browser automation server providing Playwright capabilities for controlling web browsers, capturing screenshots, extracting content, and performing complex interactions through an MCP interface.Last updated -6Apache 2.0
- AsecurityAlicenseAqualityA server that leverages Playwright for automated browser testing and integrates with Cloudflare Workers, enabling AI assistants to control web browsers for navigation, interaction, and screenshots.Last updated -24547,979184Apache 2.0