Browser Automation · MODEL CONTEXT PROTOCOL
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.
WHAT IT CONNECTS
What MCP Web Browser Server gives an AI Agent
The source catalog does not include a structured feature list. Review the repository documentation before use.
SECURITY
An MCP listing is not a security review
An MCP server may receive model context, credentials, local files, or permission to call external systems. Review its code, requested environment variables, network behavior, package provenance, and maintenance status before connecting it to an agent.
README
Repository documentation
An advanced web browsing server for the Model Context Protocol (MCP) powered by Playwright, enabling headless browser interactions through a flexible API.
- Headless Web Browsing: Navigate to any website with SSL certificate validation bypass
- Full Page Content Extraction: Retrieve complete HTML content, including dynamically loaded JavaScript
- Text Extraction: Extract all visible text or text from specific elements
- Web Interaction Tools:
- Click page elements
- Input text into form fields
- Capture screenshots (full page, viewport, or specific elements)
- Extract page links
- Resource Management: Automatic cleanup of browser resources on shutdown
- Python 3.10+
- Playwright (with Chromium installed)
# Clone the repository
git clone https://github.com/random-robbie/mcp-web-browser.git
cd mcp-web-browser
# Install the package and its dependencies (mcp[cli] and playwright)
pip install -e .
# Install the Chromium browser binary
playwright install chromiumAdd to your claude_desktop_config.json:
{
"mcpServers": {
"web-browser": {
"command": "mcp-web-browser"
}
}
}Alternatively, you can run the server module directly:
{
"mcpServers": {
"web-browser": {
"command": "python",
"args": ["-m", "mcp_web_browser.server"]
}
}
}# Browse to a website (returns the full page HTML)
page_content = browse_to("https://example.com")
# Extract all visible page text
text_content = extract_text_content()
# Extract text from specific elements
title_text = extract_text_content("h1.title")# Navigate to a page
browse_to("https://example.com/login")
# Input text into a form
input_text("#username", "your_username")
input_text("#password", "your_password")
# Click a login button
click_element("#login-button")# Capture full page screenshot (returns PNG image content)
full_page_screenshot = get_page_screenshots(full_page=True)
# Capture viewport only
viewport_screenshot = get_page_screenshots()
# Capture a specific element
element_screenshot = get_page_screenshots(selector="#main-content")# Get all links on the current page
page_links = get_page_links()- SSL certificate validation bypass (
ignore_https_errors=Trueon the browser context) - Configurable via environment variables:
MCP_BROWSER_UA(custom User-Agent) andMCP_BROWSER_VIEWPORT(e.g.1920x1080) - Browser resources closed and cleaned up on server shutdown
- SSL Certificate Errors: Automatically bypassed
- Slow Page Load:
browse_to()uses a fixed 30-second timeout and waits fornetworkidle - Element Not Found: Verify CSS selectors carefully; tools raise an error if no page is loaded, so call
browse_to()first
Significant events (navigation, extraction, errors, cleanup) are logged to stderr for easy debugging.
url: Full URL to navigate tomode:"text"(default) returns the visible page text — cheaper for LLM use;"html"returns the full HTML content- Returns the page content plus the current URL and page title
selector: Optional CSS selector to extract text from matching elements
selector: CSS selector of the element to click
full_page: Capture the entire page rather than just the viewportselector: Optional CSS selector to screenshot a specific element- Returns the screenshot as PNG image content
- Returns a list of
{"text": label, "href": absolute URL}objects
selector: CSS selector of the input elementtext: Text to input
selector: CSS selector of the element to focuskey: Key to press, e.g."Enter"to submit a form,"Escape","Tab"- Returns a confirmation plus the current URL and title (a key press may trigger navigation)
selector: CSS selector of the<select>dropdownvalues: Value or label to select (or a list for multi-select)- Returns a confirmation plus the current URL and title
click_element, input_text, press_key and select_option all append the
current page URL and title to their result, so an agent can see where an
action landed.
Contributions are welcome! Please feel free to submit a Pull Request.
# Clone the repository
git clone https://github.com/random-robbie/mcp-web-browser.git
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
# Install dependencies
pip install -e .[dev]MIT License
For issues and questions, please open an issue on GitHub.
Robbie Wiggins — What-Security · GitHub
COMMUNITY