browser-mcp
A Model Control Protocol server that enables AI agents to perform web browsing tasks through a standardized interface using the browser-use library.
README
browser-mcp
A MCP (Model Control Protocol) server for browser-use library. This package allows AI agents to perform web browsing tasks through a standardized interface.
Installation
You can install the package using pip:
pip install browser-mcp
Or with uv (recommended):
uv pip install browser-mcp
After installation, you'll need to install Playwright's browser dependencies:
playwright install
Alternatively, you can use the browser-mcp-run command which will automatically install these dependencies if they're missing.
Setup
For development, clone the repository and install in development mode:
# Clone the repository
git clone https://github.com/pranav7/browser-mcp.git
cd browser-mcp
# Install dependencies with uv
uv pip install -e .
# Or with pip
pip install -e .
Environment Variables
Create a .env file with your OpenAI API key:
OPENAI_API_KEY=your_api_key_here
Usage
Running the MCP Server
In Development Mode
When working with the package in development mode, you can run it directly with Python:
mcp dev browser_mcp/server.py
In Production
After installing the package from PyPI, you can run it with uvx:
uvx browser-mcp
The package is specifically designed to work with uvx, which allows for more efficient package loading and execution.
With Automatic Dependency Check
You can also use the browser-mcp-run command, which checks for and installs Playwright dependencies automatically before starting the server:
browser-mcp-run
This ensures that all required Playwright browsers are installed on your system.
Using as a Client
from mcp.client import Client
async def main():
client = await Client.connect()
# Perform a task with the browser
result = await client.rpc("perform_task_with_browser",
task="Search for the latest news about AI and summarize the top 3 results")
print(result)
await client.close()
Programmatic Usage
You can also use the package programmatically:
# In development mode
from src import run
# In production (after installing the package)
# from browser_mcp import run
# Run the MCP server with stdio transport
run(transport="stdio")
# Or with SSE transport
# run(transport="sse")
Available RPC Methods
search_web(task: str, model: str = "gpt-4o-mini")- Performs basic web searches using browser-use Agent. Themodelparameter is optional and defaults to "gpt-4o-mini".search_web_with_planning(task: str, base_model: str = "gpt-4o-mini", planning_model: str = "o3-mini")- Performs complex web searches that require planning. Uses a planner LLM for better task decomposition. Bothbase_modelandplanning_modelparameters are optional with their respective defaults.
Development
Testing
Tests can be run with:
python -m unittest discover
You can also test the package functionality with:
python test_uvx.py
This script will:
- Test importing the package directly (development mode)
- Attempt to run it with uvx (production mode)
Note: The uvx test may fail in development mode unless the package is published to PyPI. This is expected behavior.
Publishing to PyPI
This project uses GitHub Actions to automatically publish to PyPI when a new release is created. The workflow:
- Builds the package using uv
- Publishes it to PyPI using trusted publishing
To create a new release:
- Update the version in
pyproject.toml - Create a new release on GitHub
- The GitHub Action will automatically build and publish the package
License
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.