A Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright with stealth features
Project description
Playwright Stealth Browser MCP Server
A Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright with stealth features. This server enables LLMs to interact with web pages through structured accessibility snapshots or vision-based interactions, while avoiding detection by anti-bot systems.
Key Features
- Stealth browsing: Uses playwright-stealth to avoid detection by anti-bot systems
- Fast and lightweight: Uses Playwright's accessibility tree by default, not pixel-based input
- LLM-friendly: No vision models needed for default mode, operates purely on structured data
- Deterministic tool application: Avoids ambiguity common with screenshot-based approaches
- Vision mode support: Optional screenshot-based interactions for visual-based models
- Complete feature parity: Matches all capabilities of the official Playwright MCP server
Installation
Using uvx (Recommended)
The easiest way to use this MCP server is with uvx, which handles the Python environment automatically:
uvx stealth-browser-mcp
or via docker
docker run --rm -p 3000:3000 stealth-browser-mcp
MCP Client Configuration
VS Code / Cursor / Windsurf
Add this configuration to your MCP settings:
{
"mcpServers": {
"stealth-browser": {
"command": "uvx",
"args": ["stealth-browser-mcp"]
}
}
}
Claude Desktop
Add this to your Claude Desktop configuration file:
{
"mcpServers": {
"stealth-browser": {
"command": "uvx",
"args": ["stealth-browser-mcp"]
}
}
}
Vision Mode
To enable vision mode (screenshot-based interactions), add the --vision flag:
{
"mcpServers": {
"stealth-browser": {
"command": "uvx",
"args": ["stealth-browser-mcp", "--vision"]
}
}
}
Usage
The server provides two interaction modes:
- Snapshot Mode (default): Uses accessibility snapshots for better performance and reliability
- Vision Mode: Uses screenshots for visual-based interactions
Quick Start
- Install and configure the MCP server in your client
- Start a conversation with your AI assistant
- Ask it to navigate to a website:
Please navigate to https://example.com and take a snapshot of the page
Available Tools
Navigation
browser_navigate- Navigate to a URLbrowser_navigate_back- Go back to the previous pagebrowser_navigate_forward- Go forward to the next page
Interactions
browser_snapshot- Capture accessibility snapshot of the current pagebrowser_click- Perform click on a web page elementbrowser_type- Type text into editable elementsbrowser_hover- Hover over page elementsbrowser_drag- Perform drag and drop between elementsbrowser_select_option- Select options in dropdownsbrowser_press_key- Press keyboard keysbrowser_wait_for- Wait for conditions (time, text appear/disappear)browser_file_upload- Upload files through file inputsbrowser_handle_dialog- Handle browser dialogs (alerts, confirms, prompts)
Resources
browser_take_screenshot- Take screenshots of the page or elementsbrowser_pdf_save- Save page as PDFbrowser_network_requests- List all network requestsbrowser_console_messages- Get browser console messages
Tab Management
browser_tab_list- List all open tabsbrowser_tab_new- Open new tabsbrowser_tab_select- Switch between tabsbrowser_tab_close- Close tabs
Utilities
browser_install- Install required browser binariesbrowser_close- Close the browserbrowser_resize- Resize browser window
Testing
browser_generate_playwright_test- Generate Playwright test code
Vision Mode Tools
browser_screen_capture- Take screenshotsbrowser_screen_move_mouse- Move mouse to coordinatesbrowser_screen_click- Click at coordinatesbrowser_screen_drag- Drag between coordinatesbrowser_screen_type- Type text in vision mode
Stealth Features
This server includes advanced stealth capabilities to avoid detection by anti-bot systems:
- User Agent Spoofing: Uses realistic browser user agents
- WebGL Fingerprinting: Spoofs WebGL vendor and renderer information
- Language Headers: Sets appropriate language preferences
- Automation Detection Bypass: Disables automation control features
- Stealth Scripts: Injects scripts to hide automation indicators
Browser Setup
The server will automatically install the required Chromium browser on first run. If you encounter issues, you can manually install browsers:
# Install Playwright browsers
uvx playwright install chromium
# Or if you have the package installed locally
playwright install chromium
Development
Local Development
# Clone the repository
git clone <repository-url>
cd stealth_browser_mcp
# Install in development mode
pip install -e .
# Run the server
python playwright_mcp.py
# Run with vision mode
python playwright_mcp.py --vision
Testing
# Install development dependencies
pip install -e ".[dev]"
# Run tests (if available)
pytest
# Format code
black .
ruff check .
Troubleshooting
Browser Installation Issues
If you encounter browser installation issues:
# Use the browser_install tool through your MCP client, or manually:
uvx playwright install chromium
Permission Issues
On some systems, you may need to install additional dependencies:
# Ubuntu/Debian
sudo apt-get install libnss3 libatk-bridge2.0-0 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libxss1 libasound2
# CentOS/RHEL/Fedora
sudo yum install nss atk java-atk-wrapper at-spi2-atk gtk3 libdrm libxkbcommon libxcomposite libxdamage libxrandr mesa-libgbm
Network Issues
If you encounter network-related issues, the server includes network monitoring tools:
- Use
browser_network_requeststo see all network activity - Check console messages with
browser_console_messages
Contributing
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built on top of Playwright
- Uses playwright-stealth for anti-detection
- Inspired by the official Playwright MCP Server
- Built with FastMCP
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stealth_browser_mcp-0.1.4.tar.gz.
File metadata
- Download URL: stealth_browser_mcp-0.1.4.tar.gz
- Upload date:
- Size: 48.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9911fa55e99de52677235cca67e302bdf3a23960b32d601a8d7d1258d70c902
|
|
| MD5 |
b5bdd24bd3f04a348a9e31480dc59c50
|
|
| BLAKE2b-256 |
5cb87bd50d4b1e605ead1a793e4aca2bd100352019b2bda8eb304d8a08cd7f51
|
File details
Details for the file stealth_browser_mcp-0.1.4-py3-none-any.whl.
File metadata
- Download URL: stealth_browser_mcp-0.1.4-py3-none-any.whl
- Upload date:
- Size: 60.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ca3739ff53b2ce91be21f442d98002c2a53b676f295571ab1faf4666fe20d79
|
|
| MD5 |
5485f5ca338b51d7ff4542ffeb5a0fb2
|
|
| BLAKE2b-256 |
a673533d7e604c84683074a9a0eed795bb0c1b2af3348d3d70885f79f745bb5d
|