Overview
The MCP (Model Context Protocol) Server exposes OpenBrowser’s browser automation as a singleexecute_code tool for AI assistants like Claude Desktop, Claude Code, and other MCP-compatible clients. The LLM writes Python code to navigate, interact with, and extract data from web pages. No external LLM API keys required — the MCP client provides the intelligence.
Quick Start
Start MCP Server
Claude Desktop Integration
Add this configuration to your Claude Desktop config file:macOS
Edit~/Library/Application Support/Claude/claude_desktop_config.json:
Windows
Edit%APPDATA%\Claude\claude_desktop_config.json:
Claude Code
Add to your project’s.mcp.json:
Environment Variables
Optional configuration:OPENBROWSER_HEADLESS- Set totrueto run browser without GUI (default:false)OPENBROWSER_ALLOWED_DOMAINS- Comma-separated domain whitelist
The execute_code Tool
The MCP server exposes a single tool that runs Python code in a persistent namespace with browser automation functions. All functions are async — use await.
Available Functions
| Category | Functions |
|---|---|
| Navigation | navigate(url, new_tab), go_back(), wait(seconds) |
| Interaction | click(index), input_text(index, text, clear), scroll(down, pages, index), send_keys(keys), upload_file(index, path) |
| Dropdowns | select_dropdown(index, text), dropdown_options(index) |
| Tabs | switch(tab_id), close(tab_id) |
| JavaScript | evaluate(code) — run JS in page context, returns Python objects |
| State | browser.get_browser_state_summary() — page metadata and interactive elements |
| CSS | get_selector_from_index(index) — CSS selector for an element |
| Completion | done(text, success) — signal task completion |
json, csv, re, datetime, asyncio, Path, requests, numpy, pandas, matplotlib, BeautifulSoup
Variables and state persist between execute_code calls within the same session.
Example Usage
Once configured with Claude Desktop or Claude Code, you can ask the AI to perform browser automation tasks:execute_code tool to write Python code that navigates, interacts, and extracts data.
Programmatic Usage
You can also connect to the MCP server programmatically:Troubleshooting
Common Issues
“MCP SDK is required” Error- Check that you have Chrome/Chromium installed
- Try setting
OPENBROWSER_HEADLESS=falseto see browser window - Ensure no other browser instances are using the same profile
- Restart Claude Desktop after config changes
- Check the config file syntax is valid JSON
- Verify the file path is correct for your OS
Debug Mode
Enable debug logging by setting:Security Considerations
- The MCP server has access to your browser and file system
- Only connect trusted MCP clients
- Be cautious with sensitive websites and data
- Use
OPENBROWSER_ALLOWED_DOMAINSto restrict navigation
Next Steps
- Explore the examples directory for more usage patterns
- Check out MCP documentation to learn more about the protocol
- Join our Discord for support and discussions