MCP Browser Use Server
MCP server w/ Browser Use
MCP server for browser-use.
Overview
This repository contains the server for the browser-use library, which provides a powerful browser automation system that enables AI agents to interact with web browsers through natural language. The server is built on Anthropic's Model Context Protocol (MCP) and provides a seamless integration with the browser-use library.
Features
- Browser Control
- Automated browser interactions via natural language
- Navigation, form filling, clicking, and scrolling capabilities
- Tab management and screenshot functionality
- Cookie and state management
- Agent System
- Custom agent implementation in custom_agent.py
- Vision-based element detection
- Structured JSON responses for actions
- Message history management and summarization
- Configuration
- Environment-based configuration for API keys and settings
- Chrome browser settings (debugging port, persistence)
- Model provider selection and parameters
Dependencies
This project relies on the following Python packages:
Package | Version | Description |
---|---|---|
pydantic | >=2.10.5 | Data validation and settings management using Python type annotations. Provides runtime enforcement of types and automatic model creation. Essential for defining structured data models in the agent. |
fastapi | >=0.115.6 | Modern, fast (high-performance) web framework for building APIs with Python 3.7+ based on standard Python type hints. Used to create the server that exposes the agent's functionality. |
uvicorn | >=0.22.0 | ASGI web server implementation for Python. Used to serve the FastAPI application. |
fastmcp | >=0.4.1 | A framework that wraps FastAPI for building MCP (Model Context Protocol) servers. |
python-dotenv | >=1.0.1 | Reads key-value pairs from a .env file and sets them as environment variables. Simplifies local development and configuration management. |
langchain | >=0.3.14 | Framework for developing applications with large language models (LLMs). Provides tools for chaining together different language model components and interacting with various APIs and data sources. |
langchain-openai | >=0.2.14 | LangChain integrations with OpenAI's models. Enables using OpenAI models (like GPT-4) within the LangChain framework. Used in this project for interacting with OpenAI's language and vision models. |
langchain-ollama | >=0.2.2 | Langchain integration for Ollama, enabling local execution of LLMs. |
openai | >=1.59.5 | Official Python client library for the OpenAI API. Used to interact directly with OpenAI's models (if needed, in addition to LangChain). |
browser-use | ==0.1.19 | A powerful browser automation system that enables AI agents to interact with web browsers through natural language. The core library that powers this project's browser automation capabilities. |
instructor | >=1.7.2 | Library for structured output prompting and validation with OpenAI models. Enables extracting structured data from model responses. |
pyperclip | >=1.9.0 | Cross-platform Python module for copy and paste clipboard functions. |
Components
Resources
The server implements a browser automation system with:
- Integration with browser-use library for advanced browser control
- Custom browser automation capabilities
- Agent-based interaction system with vision capabilities
- Persistent state management
- Customizable model settings
Requirements
- Operating Systems (Linux, macOS, Windows; we haven't tested for Docker or Microsoft WSL)
- Python 3.11 or higher
- uv (fast Python package installer)
- Chrome/Chromium browser
- Claude Desktop
Quick Start
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
Installing via Smithery
To install Browser Use for Claude Desktop automatically via Smithery:
Environment Variables
Key environment variables:
Development
Setup
- Clone the repository:
- Create and activate virtual environment:
- Install dependencies:
- Start the server
Debugging
For debugging, use the MCP Inspector:
The Inspector will display a URL for the debugging interface.
Browser Actions
The server supports various browser actions through natural language:
- Navigation: Go to URLs, back/forward, refresh
- Interaction: Click, type, scroll, hover
- Forms: Fill forms, submit, select options
- State: Get page content, take screenshots
- Tabs: Create, close, switch between tabs
- Vision: Find elements by visual appearance
- Cookies & Storage: Manage browser state
Security
I want to note that their are some Chrome settings that are set to allow for the browser to be controlled by the server. This is a security risk and should be used with caution. The server is not intended to be used in a production environment.
Security Details: SECURITY.MD
Contributing
We welcome contributions to this project. Please follow these steps:
- Fork this repository.
- Create your feature branch:
git checkout -b my-new-feature
. - Commit your changes:
git commit -m 'Add some feature'
. - Push to the branch:
git push origin my-new-feature
. - Submit a pull request.
For major changes, open an issue first to discuss what you would like to change. Please update tests as appropriate to reflect any changes made.
This server cannot be installed
Enables AI agents to interact with web browsers using natural language, featuring automated browsing, form filling, vision-based element detection, and structured JSON responses for systematic browser control.