A powerful browser automation and control system that enables AI agents to interact with web browsers through the Model Context Protocol (MCP). This implementation is specifically designed to work with Ollama local models, providing a secure and efficient way to automate browser interactions using locally-hosted AI models.
# Clone the repository
git clone https://github.com/yourusername/browser-use-mcp.git
cd browser-use-mcp
# Install dependencies
pip install -r requirements.txt
# Configure Ollama (ensure Ollama is running)
ollama pull qwen2.5-coder:7b # or your preferred model
from browser_use.agent import Agent
from browser_use.browser import Browser
from browser_use.mcp import MCPServer
# Initialize MCP server and Ollama model
mcp_server = MCPServer(model="qwen2.5-coder:7b")
# Initialize browser and agent
browser = Browser()
agent = Agent(browser, mcp_server)
# Execute browser actions through MCP
agent.execute("Navigate to https://example.com and click the first button")
browser_use/
├── agent/ # AI agent coordination
├── browser/ # Browser control and automation
├── dom/ # DOM tree management
├── controller/ # System coordination
└── telemetry/ # System monitoring
Comprehensive documentation is available in the .context
directory:
.context/index.md
.context/docs/architecture.md
.context/diagrams/system-flow.md
To use browser-use-mcp with Claude Desktop:
claude_desktop_config.json
):{
"mcpServers": {
"browser-use": {
"command": "/path/to/.venv/bin/python",
"args": [
"/path/to/server.py"
]
}
}
}
Restart Claude Desktop to load the new MCP server
The browser control tools will now be available to Claude through the MCP protocol:
browser_action
: Control browser interactionsread_dom
: Access page DOM informationget_screenshot
: Capture browser stateFor other MCP-compatible clients, configure the server using these parameters:
python
["-m", "browser_use.mcp_server"]
OLLAMA_HOST
: Ollama API host (default: http://localhost:11434)BROWSER_HEADLESS
: Run browser in headless mode (default: false)SCREENSHOT_DIR
: Directory for saving screenshots (default: ./screenshots)Check out the examples/
directory for various use cases:
# Run all tests
pytest
# Run specific test file
pytest tests/test_browser.py
git checkout -b feature/amazing-feature
)git commit -m 'Add amazing feature'
)git push origin feature/amazing-feature
)This project is licensed under the MIT License - see the LICENSE file for details.
{
"mcpServers": {
"browser-use": {
"env": {},
"args": [
"/path/to/server.py"
],
"command": "python"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.