Skip to main content

MCP browser-use server library

Project description

browser-use-mcp-server

Twitter URL PyPI version

An MCP server that enables AI agents to control web browsers using browser-use.

Prerequisites

# Install prerequisites
curl -LsSf https://astral.sh/uv/install.sh | sh
uv tool install mcp-proxy
uv tool update-shell

Environment

Create a .env file:

OPENAI_API_KEY=your-api-key
CHROME_PATH=optional/path/to/chrome
PATIENT=false  # Set to true if API calls should wait for task completion

Installation

# Install dependencies
uv sync
uv pip install playwright
uv run playwright install --with-deps --no-shell chromium

Usage

SSE Mode

# Run directly from source
uv run server --port 8000

stdio Mode

# 1. Build and install globally
uv build
uv tool uninstall browser-use-mcp-server 2>/dev/null || true
uv tool install dist/browser_use_mcp_server-*.whl

# 2. Run with stdio transport
browser-use-mcp-server run server --port 8000 --stdio --proxy-port 9000

Client Configuration

SSE Mode Client Configuration

{
  "mcpServers": {
    "browser-use-mcp-server": {
      "url": "http://localhost:8000/sse"
    }
  }
}

stdio Mode Client Configuration

{
  "mcpServers": {
    "browser-server": {
      "command": "browser-use-mcp-server",
      "args": [
        "run",
        "server",
        "--port",
        "8000",
        "--stdio",
        "--proxy-port",
        "9000"
      ],
      "env": {
        "OPENAI_API_KEY": "your-api-key"
      }
    }
  }
}

Config Locations

Client Configuration Path
Cursor ./.cursor/mcp.json
Windsurf ~/.codeium/windsurf/mcp_config.json
Claude (Mac) ~/Library/Application Support/Claude/claude_desktop_config.json
Claude (Windows) %APPDATA%\Claude\claude_desktop_config.json

Features

  • Browser Automation: Control browsers through AI agents
  • Dual Transport: Support for both SSE and stdio protocols
  • VNC Streaming: Watch browser automation in real-time
  • Async Tasks: Execute browser operations asynchronously

Local Development

To develop and test the package locally:

  1. Build a distributable wheel:

    # From the project root directory
    uv build
    
  2. Install it as a global tool:

    uv tool uninstall browser-use-mcp-server 2>/dev/null || true
    uv tool install dist/browser_use_mcp_server-*.whl
    
  3. Run from any directory:

    # Set your OpenAI API key for the current session
    export OPENAI_API_KEY=your-api-key-here
    
    # Or provide it inline for a one-time run
    OPENAI_API_KEY=your-api-key-here browser-use-mcp-server run server --port 8000 --stdio --proxy-port 9000
    
  4. After making changes, rebuild and reinstall:

    uv build
    uv tool uninstall browser-use-mcp-server
    uv tool install dist/browser_use_mcp_server-*.whl
    

Docker

Using Docker provides a consistent and isolated environment for running the server.

# Build the Docker image
docker build -t browser-use-mcp-server .

# Run the container with the default VNC password ("browser-use")
# --rm ensures the container is automatically removed when it stops
# -p 8000:8000 maps the server port
# -p 5900:5900 maps the VNC port
docker run --rm -p8000:8000 -p5900:5900 browser-use-mcp-server

# Run with a custom VNC password read from a file
# Create a file (e.g., vnc_password.txt) containing only your desired password
echo "your-secure-password" > vnc_password.txt
# Mount the password file as a secret inside the container
docker run --rm -p8000:8000 -p5900:5900 \
  -v $(pwd)/vnc_password.txt:/run/secrets/vnc_password:ro \
  browser-use-mcp-server

Note: The :ro flag in the volume mount (-v) makes the password file read-only inside the container for added security.

VNC Viewer

# Browser-based viewer
git clone https://github.com/novnc/noVNC
cd noVNC
./utils/novnc_proxy --vnc localhost:5900

Default password: browser-use (unless overridden using the custom password method)

VNC Screenshot

VNC Screenshot

Example

Try asking your AI:

open https://news.ycombinator.com and return the top ranked article

Support

For issues or inquiries: cobrowser.xyz

Star History

Star History Chart

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

browser_use_mcp_server-1.0.3.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

browser_use_mcp_server-1.0.3-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file browser_use_mcp_server-1.0.3.tar.gz.

File metadata

  • Download URL: browser_use_mcp_server-1.0.3.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for browser_use_mcp_server-1.0.3.tar.gz
Algorithm Hash digest
SHA256 f741ab76203558836d98e411de551a747ed819ffc097de6c0a7b1734cffd92fa
MD5 9bae1b88facf4c8f6e9b897d314104e3
BLAKE2b-256 c4c62f2ab1b79819f0b8c0c87efa6eda14c8825d1fb29eaa1115367a336e0850

See more details on using hashes here.

Provenance

The following attestation bundles were made for browser_use_mcp_server-1.0.3.tar.gz:

Publisher: python-publish.yml on co-browser/browser-use-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file browser_use_mcp_server-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for browser_use_mcp_server-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4467752309572c3b5553f24916e0381a31538603dc21b026cc9e89379e3446cb
MD5 882a87c4ca2b8d25bd7d75fa3cb99287
BLAKE2b-256 e8d5515a87acdc05f1d5dfc2e71a6b70f8b0d0d2a0a7b8515d8562f8291a13ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for browser_use_mcp_server-1.0.3-py3-none-any.whl:

Publisher: python-publish.yml on co-browser/browser-use-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page