The MCP Web Browser Server is an advanced tool for automated web interactions and content extraction using headless browsing (Playwright). You can:
- Navigate websites: Browse to URLs and retrieve HTML content
- Extract content: Capture text from pages or specific elements using CSS selectors
- Interact with pages: Click elements and input text into form fields
- Capture screenshots: Take full-page or element-specific screenshots
- Manage links: Extract and optionally filter links from the current page
- Control navigation: Scroll pages, refresh, wait for navigation to complete
- Execute JavaScript: Run custom code on the page
- Manage tabs: Create, list, switch between, and close browser tabs
- Configure settings: Custom user-agents, SSL validation bypass, CSP control
- Handle resources: Automatic cleanup and timeout configuration
Enables execution of JavaScript code on web pages through the execute_javascript method, allowing interaction with dynamic web content.
MCP Web Browser Server
An advanced web browsing server for the Model Context Protocol (MCP) powered by Playwright, enabling headless browser interactions through a flexible, secure API.
🌐 Features
- Headless Web Browsing: Navigate to any website with SSL certificate validation bypass
- Full Page Content Extraction: Retrieve complete HTML content, including dynamically loaded JavaScript
- Multi-Tab Support: Create, manage, and switch between multiple browser tabs
- Advanced Web Interaction Tools:
- Extract text content
- Click page elements
- Input text into form fields
- Capture screenshots
- Extract page links with filtering capabilities
- Scroll pages in any direction
- Execute JavaScript on pages
- Refresh pages
- Wait for navigation to complete
- Resource Management: Automatic cleanup of unused resources after inactivity
- Enhanced Page Information: Get detailed metadata about the current page
🚀 Quick Start
Prerequisites
- Python 3.10+
- MCP SDK
- Playwright
Installation
Configuration for Claude Desktop
Add to your claude_desktop_config.json
:
💡 Usage Examples
Basic Web Navigation
Web Interaction
Screenshot Capture
Link Extraction
Multi-Tab Browsing
Advanced Interactions
🛡️ Security Features
- SSL certificate validation bypass
- Secure browser context management
- Custom user-agent configuration
- Error handling and comprehensive logging
- Configurable timeout settings
- CSP bypass control
- Protection against cookie stealing
🔧 Troubleshooting
Common Issues
- SSL Certificate Errors: Automatically bypassed
- Slow Page Load: Adjust timeout in
browse_to()
method - Element Not Found: Verify selectors carefully
- Browser Resource Usage: Auto-cleanup after inactivity period
Logging
All significant events are logged with detailed information for easy debugging.
📋 Tool Parameters
browse_to(url: str, context: Optional[Any] = None)
url
: Website to navigate tocontext
: Optional context object (currently unused)
extract_text_content(selector: Optional[str] = None, context: Optional[Any] = None)
selector
: Optional CSS selector to extract specific contentcontext
: Optional context object (currently unused)
click_element(selector: str, context: Optional[Any] = None)
selector
: CSS selector of the element to clickcontext
: Optional context object (currently unused)
get_page_screenshots(full_page: bool = False, selector: Optional[str] = None, context: Optional[Any] = None)
full_page
: Capture entire page screenshotselector
: Optional element to screenshotcontext
: Optional context object (currently unused)
get_page_links(filter_pattern: Optional[str] = None, context: Optional[Any] = None)
filter_pattern
: Optional text pattern to filter linkscontext
: Optional context object (currently unused)
input_text(selector: str, text: str, context: Optional[Any] = None)
selector
: CSS selector of input elementtext
: Text to inputcontext
: Optional context object (currently unused)
create_new_tab(url: Optional[str] = None, context: Optional[Any] = None)
url
: Optional URL to navigate to in the new tabcontext
: Optional context object (currently unused)
switch_tab(tab_id: str, context: Optional[Any] = None)
tab_id
: ID of the tab to switch tocontext
: Optional context object (currently unused)
list_tabs(context: Optional[Any] = None)
context
: Optional context object (currently unused)
close_tab(tab_id: Optional[str] = None, context: Optional[Any] = None)
tab_id
: Optional ID of the tab to close (defaults to current tab)context
: Optional context object (currently unused)
refresh_page(context: Optional[Any] = None)
context
: Optional context object (currently unused)
get_page_info(context: Optional[Any] = None)
context
: Optional context object (currently unused)
scroll_page(direction: str = "down", amount: str = "page", context: Optional[Any] = None)
direction
: Direction to scroll ('up', 'down', 'left', 'right')amount
: Amount to scroll ('page', 'half', or a number)context
: Optional context object (currently unused)
wait_for_navigation(timeout_ms: int = 10000, context: Optional[Any] = None)
timeout_ms
: Maximum time to wait in millisecondscontext
: Optional context object (currently unused)
execute_javascript(script: str, context: Optional[Any] = None)
script
: JavaScript code to executecontext
: Optional context object (currently unused)
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
📄 License
MIT License
🔗 Related Projects
💬 Support
For issues and questions, please open an issue on GitHub.
local-only server
The server can only run on the client's local machine because it depends on local resources.
An advanced web browsing server enabling headless browser interactions via a secure API, providing features like navigation, content extraction, element interaction, and screenshot capture.
- 🌐 Features
- 🚀 Quick Start
- 💡 Usage Examples
- 🛡️ Security Features
- 🔧 Troubleshooting
- 📋 Tool Parameters
- browse_to(url: str, context: Optional\[Any] = None)
- extract_text_content(selector: Optional\[str] = None, context: Optional\[Any] = None)
- click_element(selector: str, context: Optional\[Any] = None)
- get_page_screenshots(full_page: bool = False, selector: Optional\[str] = None, context: Optional\[Any] = None)
- get_page_links(filter_pattern: Optional\[str] = None, context: Optional\[Any] = None)
- input_text(selector: str, text: str, context: Optional\[Any] = None)
- create_new_tab(url: Optional\[str] = None, context: Optional\[Any] = None)
- switch_tab(tab_id: str, context: Optional\[Any] = None)
- list_tabs(context: Optional\[Any] = None)
- close_tab(tab_id: Optional\[str] = None, context: Optional\[Any] = None)
- refresh_page(context: Optional\[Any] = None)
- get_page_info(context: Optional\[Any] = None)
- scroll_page(direction: str = "down", amount: str = "page", context: Optional\[Any] = None)
- wait_for_navigation(timeout_ms: int = 10000, context: Optional\[Any] = None)
- execute_javascript(script: str, context: Optional\[Any] = None)
- 🤝 Contributing
- 📄 License
- 🔗 Related Projects
- 💬 Support
Related Resources
Related MCP Servers
- AsecurityFlicenseAqualityEnables AI agents to interact with web browsers using natural language, featuring automated browsing, form filling, vision-based element detection, and structured JSON responses for systematic browser control.Last updated -150Python
- -securityAlicense-qualityEnables browser automation and real-time computer vision tasks through AI-driven commands, offering zero-cost digital navigation and interaction for enhanced web experiences.Last updated -01JavaScriptMIT License
- AsecurityAlicenseAqualityA headless browser MCP server that allows AI agents to fetch web content and perform Google searches without API keys, supporting various output formats like Markdown, JSON, HTML, and text.Last updated -212TypeScriptMIT License
- AsecurityAlicenseAqualityA headless server that enables reading and sending Gmail emails through API calls without requiring local credentials or browser access, designed to run remotely in containerized environments.Last updated -41946PythonMIT License