MCP Web Browser Server
A Playwright-powered MCP server for headless web browsing, content extraction, and basic page interaction.
Navigate to URLs and retrieve page HTML content.
Extract visible text from the whole page or specific CSS-selected elements.
Click page elements and input text into form fields.
Capture screenshots of the full page, viewport, or a specific element.
Extract all links from the current page.
Bypass SSL certificate errors, support custom User-Agent/viewport settings, and clean up browser resources on shutdown.
Enables execution of JavaScript code on web pages through the execute_javascript method, allowing interaction with dynamic web content.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Web Browser Server go to github.com and take a screenshot of the trending page"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 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
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
Related MCP server: Cloudflare Playwright MCP
Quick Start
Prerequisites
Python 3.10+
Playwright (with Chromium installed)
Installation
# 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 chromiumConfiguration for Claude Desktop
Add 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"]
}
}
}Usage Examples
Basic Web Navigation
# 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")Web Interaction
# 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")Screenshot Capture
# 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")Link Extraction
# Get all links on the current page
page_links = get_page_links()Security Features
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
Troubleshooting
Common Issues
SSL Certificate Errors: Automatically bypassed
Slow Page Load:
browse_to()uses a fixed 30-second timeout and waits fornetworkidleElement Not Found: Verify CSS selectors carefully; tools raise an error if no page is loaded, so call
browse_to()first
Logging
Significant events (navigation, extraction, errors, cleanup) are logged to stderr for easy debugging.
Tool Parameters
browse_to(url: str, mode: str = "text")
url: Full URL to navigate tomode:"text"(default) returns the visible page text โ cheaper for LLM use;"html"returns the full HTML contentReturns the page content plus the current URL and page title
extract_text_content(selector: Optional[str] = None)
selector: Optional CSS selector to extract text from matching elements
click_element(selector: str)
selector: CSS selector of the element to click
get_page_screenshots(full_page: bool = False, selector: Optional[str] = None)
full_page: Capture the entire page rather than just the viewportselector: Optional CSS selector to screenshot a specific elementReturns the screenshot as PNG image content
get_page_links()
Returns a list of
{"text": label, "href": absolute URL}objects
input_text(selector: str, text: str)
selector: CSS selector of the input elementtext: Text to input
press_key(selector: str, key: str)
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)
select_option(selector: str, values: str | list[str])
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.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
# 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]License
MIT License
Related Projects
Support
For issues and questions, please open an issue on GitHub.
Author
Robbie Wiggins โ What-Security ยท GitHub
Available Tools
6 toolsbrowse_toA
Navigate to a specific URL and return the page's HTML content.
Args:
url: The full URL to navigate to
context: Optional context object for logging (ignored)
Returns:
The full HTML content of the page
Inputs: url (required), context. Returns: result
click_elementC
Click an element on the current page.
Args:
selector: CSS selector for the element to click
context: Optional context object for logging (ignored)
Returns:
Confirmation message or error details
Inputs: selector (required), context. Returns: result
extract_text_contentA
Extract text content from the current page, optionally using a CSS selector.
Args:
selector: Optional CSS selector to target specific elements
context: Optional context object for logging (ignored)
Returns:
Extracted text content
Inputs: selector, context. Returns: result
get_page_linksB
Extract all links from the current page.
Args:
context: Optional context object for logging (ignored)
Returns:
List of links found on the page
Inputs: context. Returns: result
get_page_screenshotsA
Capture screenshot of the current page.
Args:
full_page: Whether to capture the entire page or just the viewport
selector: Optional CSS selector to screenshot a specific element
context: Optional context object for logging (ignored)
Returns:
Base64 encoded screenshot image
Inputs: full_page, selector, context. Returns: result
input_textB
Input text into a specific element on the page.
Args:
selector: CSS selector for the input element
text: Text to input
context: Optional context object for logging (ignored)
Returns:
Confirmation message
Inputs: selector (required), text (required), context. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose with no overlap: navigation, clicking, text extraction, link extraction, screenshot capture, and text input. The descriptions reinforce these distinct functions, making it easy for an agent to select the right tool for each task without confusion.
The tools follow a consistent verb_noun or verb_adjective_noun pattern (e.g., browse_to, click_element, extract_text_content), with all names using snake_case. The only minor deviation is 'get_page_links' and 'get_page_screenshots' using 'get' instead of a more specific verb like 'extract', but this is still readable and maintains overall consistency.
With 6 tools, this server is well-scoped for basic web browsing automation, covering essential actions like navigation, interaction, and content extraction. Each tool earns its place without being overly complex or insufficient for the domain, making it manageable and effective for typical use cases.
The toolset provides solid coverage for core web browsing tasks, including navigation, interaction (clicking and input), and content extraction (text, links, screenshots). A minor gap is the lack of tools for more advanced actions like form submission, scrolling, or handling pop-ups, but agents can likely work around this with the existing tools for most workflows.
Maintenance
Related MCP Connectors
Cloud browser, web extraction, screenshots, and remote CDP tools for AI agents.
Undetectable cloud browser sessions for AI agents and scrapers. Navigate, extract, click, captcha.
Programmatic headless browser sessions: create, interact, browse, and extract - rendered in a real
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
Related MCP Servers
- AlicenseBqualityDmaintenanceA server that enables browser automation using Playwright, allowing interaction with web pages, capturing screenshots, and executing JavaScript in a browser environment through LLMs.1213,901 npm1MIT
- AlicenseNot gradedqualityNot gradedmaintenanceA server that enables AI assistants to control a browser through tools, allowing them to perform web automation tasks like navigation, typing, clicking, and taking screenshots.Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables browser automation and web scraping with multi-session management, supporting page navigation, element interaction, network request capture, and content extraction across multiple concurrent browser instances.11 npmMIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server for browser automation using Puppeteer that enables AI assistants to navigate web pages, interact with UI elements, and capture screenshots. It supports comprehensive web tasks including form filling, content extraction, and executing custom JavaScript within the browser context.2MIT