Browser Use MCP server

Enables LLMs, agents, and apps to access, search, and extract web data in real-time using the browser-use.com API.
Back to servers
Setup instructions
Provider
Browser Use
Release date
Jul 28, 2025
Language
JavaScript
Stats
72.9K stars

The Browser-Use MCP server is a powerful tool that allows you to run browser automation agents that can perform tasks on your behalf. These agents can fill out forms, shop for groceries, search for information, and much more through a browser interface, all controlled through API calls.

Installation

Set Up Environment

First, create a Python environment (Python 3.11 or newer required) using uv:

uv init

Install the Package

Install the Browser-Use package:

uv add browser-use
uv sync

Get API Key

Obtain your API key from Browser Use Cloud. New signups receive $10 in free credits.

Add the API key to your .env file:

# .env
BROWSER_USE_API_KEY=your-key

Install Chromium

Install the required Chromium browser:

uvx browser-use install

Basic Usage

Running Your First Agent

Here's a simple example to get started with Browser-Use:

from browser_use import Agent, Browser, ChatBrowserUse
import asyncio

async def example():
    browser = Browser(
        # use_cloud=True,  # Uncomment to use a stealth browser on Browser Use Cloud
    )

    llm = ChatBrowserUse()

    agent = Agent(
        task="Find the number of stars of the browser-use repo",
        llm=llm,
        browser=browser,
    )

    history = await agent.run()
    return history

if __name__ == "__main__":
    history = asyncio.run(example())

Advanced Usage

Using Sandboxes for Deployment

Browser-Use provides sandboxes for easy deployment. Sandboxes handle agents, browsers, persistence, auth, cookies, and LLMs:

from browser_use import Browser, sandbox, ChatBrowserUse
from browser_use.agent.service import Agent
import asyncio

@sandbox()
async def my_task(browser: Browser):
    agent = Agent(task="Find the top HN post", browser=browser, llm=ChatBrowserUse())
    await agent.run()

# Call it like any async function
asyncio.run(my_task())

Using Templates

Generate ready-to-run templates for faster development:

uvx browser-use init --template default

This creates a browser_use_default.py file with a working example. Available templates include:

  • default - Minimal setup to get started quickly
  • advanced - All configuration options with detailed comments
  • tools - Examples of custom tools and extending the agent

You can specify a custom output path:

uvx browser-use init --template default --output my_agent.py

Custom Tools

You can extend the agent's capabilities with custom tools:

from browser_use import Tools

tools = Tools()

@tools.action(description='Description of what this tool does.')
def custom_tool(param: str) -> str:
    return f"Result: {param}"

agent = Agent(
    task="Your task",
    llm=llm,
    browser=browser,
    tools=tools,
)

Authentication Handling

For websites requiring login, you can:

  1. Use real browser profiles with saved logins
  2. Use temporary accounts with inbox services
  3. Sync your auth profile with remote browsers

To sync your auth profile with a remote browser:

curl -fsSL https://browser-use.com/profile.sh | BROWSER_USE_API_KEY=XXXX sh

(Replace XXXX with your actual API key)

Handling CAPTCHAs

For better CAPTCHA handling, use Browser Use Cloud which provides stealth browsers designed to avoid detection and CAPTCHA challenges by utilizing better browser fingerprinting and proxies.

Recommended LLM

Browser-Use offers an optimized model specifically for browser automation tasks:

llm = ChatBrowserUse()

This model typically completes tasks 3-5x faster than other models with state-of-the-art accuracy.

For other LLM providers, you can check the supported models documentation on the official website.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "browser-use" '{"command":"uvx","args":["browser-use[cli]","--mcp"],"env":{"OPENAI_API_KEY":"sk-..."}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "browser-use": {
            "command": "uvx",
            "args": [
                "browser-use[cli]",
                "--mcp"
            ],
            "env": {
                "OPENAI_API_KEY": "sk-..."
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "browser-use": {
            "command": "uvx",
            "args": [
                "browser-use[cli]",
                "--mcp"
            ],
            "env": {
                "OPENAI_API_KEY": "sk-..."
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later