kblood/MCPBrowserServer
If you are the rightful owner of MCPBrowserServer and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
MCPBrowserServer is a comprehensive Model Context Protocol server designed for browser automation using Selenium WebDriver, providing AI agents with advanced web browsing capabilities.
MCPBrowserServer
A comprehensive Model Context Protocol (MCP) server for browser automation using Selenium WebDriver. This server provides AI agents with powerful web browsing capabilities including session management, tab control, navigation, and element interaction.
Features
🌐 Session Management
- Create and manage multiple browser sessions
- Switch between sessions seamlessly
- Persist session state between restarts
- Configurable browser options (headless, window size, timeouts)
📑 Tab Management
- Create, switch, and close tabs within sessions
- Track tab state (URL, title, loading status)
- Navigate between multiple tabs efficiently
🧭 Navigation
- Navigate to URLs with load time tracking
- Page refresh, back, and forward navigation
- Execute JavaScript code on pages
- Capture screenshots for debugging
🎯 Element Interaction
- Find elements using CSS selectors, XPath, ID, class, etc.
- Click elements, type text, get element properties
- Wait for elements to appear
- Scroll to elements and hover interactions
📊 Debugging & Information
- Comprehensive page information extraction
- Screenshot capture (in memory or saved to file)
- Detailed error reporting and logging
- Debug information for all operations
Requirements
- .NET 9.0 or later
- Chrome browser installed on the system
- ChromeDriver (automatically managed by NuGet package)
Installation
- Clone or download the project
- Build the project:
dotnet build MCPBrowserServer.csproj
- Publish the executable:
dotnet publish -c Release --self-contained false -o publish
Configuration
Add to your Claude Desktop configuration (claude_desktop_config.json
):
{
"mcpServers": {
"browser": {
"command": "C:\\path\\to\\MCPBrowserServer\\publish\\MCPBrowserServer.exe",
"args": []
}
}
}
Available Tools
Session Management
create_session
- Create a new browser sessionlist_sessions
- List all active sessionsget_session
- Get session detailsswitch_session
- Switch to a different sessionclose_session
- Close a sessionget_active_session
- Get currently active session
Tab Management
create_tab
- Create a new tablist_tabs
- List all tabs in a sessionget_tab
- Get tab detailsswitch_tab
- Switch to a different tabclose_tab
- Close a tabget_active_tab
- Get currently active tabrename_tab
- Rename a tab
Navigation
navigate
- Navigate to a URLrefresh
- Refresh current pagego_back
- Go back in browser historygo_forward
- Go forward in browser historyget_page_info
- Get page information (URL, title, meta data)take_screenshot
- Capture page screenshotexecute_javascript
- Execute JavaScript code
Element Interaction
find_elements
- Find elements on the pageclick_element
- Click an elementtype_text
- Type text into an elementget_element_text
- Get text from an elementget_element_attribute
- Get element attribute valuewait_for_element
- Wait for element to appearscroll_to_element
- Scroll to an elementhover_element
- Hover over an element
Usage Examples
Basic Session Creation
# Create a new browser session
create_session("Main Session", headless=false, width=1920, height=1080)
# Navigate to a website
navigate("session-id", "https://example.com")
# Take a screenshot
take_screenshot("session-id", saveToFile=true)
Tab Management
# Create a new tab
create_tab("session-id", "Google Tab", "https://google.com")
# List all tabs
list_tabs("session-id")
# Switch to a specific tab
switch_tab("session-id", "tab-id")
Element Interaction
# Find search input and type
find_elements("session-id", "input[name='q']", "css")
type_text("session-id", "input[name='q']", "MCP browser automation")
# Click search button
click_element("session-id", "button[type='submit']", "css")
# Wait for results and get text
wait_for_element("session-id", ".search-results", "css", 10)
get_element_text("session-id", ".search-results", "css")
Browser Options
When creating sessions, you can configure:
headless
- Run browser without GUI (default: true)width
/height
- Browser window size (default: 1920x1080)pageLoadTimeoutSeconds
- Page load timeout (default: 30)userAgent
- Custom user agent string- Additional Chrome options
Logging
Logs are written to %TEMP%/mcp-browser-server-log.txt
for debugging purposes.
Session data is persisted to %TEMP%/mcp-browser-sessions.json
.
Error Handling
All tools return structured JSON responses with:
Success
- Boolean indicating operation successError
- Error message if operation failedDebugInfo
- Additional debugging informationTimestamp
- Operation timestamp
Architecture
The server is built with:
- Models: Data structures for sessions, tabs, and responses
- Services: Core business logic for browser and session management
- Tools: MCP tool implementations that expose functionality to AI agents
Building from Source
# Restore dependencies
dotnet restore
# Build project
dotnet build
# Run tests (if available)
dotnet test
# Publish executable
dotnet publish -c Release -o publish
Troubleshooting
- Chrome not found: Ensure Chrome is installed and in PATH
- Permission issues: Run with appropriate permissions for file access
- Port conflicts: Each session uses a unique Chrome instance
- Memory usage: Monitor memory usage with many concurrent sessions
Contributing
This MCP server demonstrates advanced browser automation patterns and can be extended with additional tools and functionality.
License
This project is provided as-is for educational and development purposes.