Browser Use MCP server

Provides browser automation capabilities for capturing screenshots, retrieving HTML, executing JavaScript, and accessing console logs from web pages.
Back to servers
Setup instructions
Provider
ztobs
Release date
Jan 28, 2025
Language
TypeScript
Stats
17 stars

Browser Use Server is a Model Context Protocol (MCP) server that enables browser automation tasks through Python scripts. It allows you to programmatically capture screenshots, retrieve HTML content, execute JavaScript, and get console logs from webpages, with support for custom interaction steps like clicking elements or scrolling after page load.

Prerequisites

System Dependencies

You'll need to install Xvfb for headless browser automation (optional but recommended):

# Ubuntu/Debian
sudo apt-get install xvfb

# CentOS/RHEL
sudo yum install xorg-x11-server-Xvfb

# Arch Linux
sudo pacman -S xorg-server-xvfb

Xvfb creates a virtual display for browser automation without being detected as a bot.

Python Environment Setup

  1. Install Miniconda or Anaconda
  2. Create and activate a dedicated environment:
conda create -n browser-use python=3.11
conda activate browser-use
pip install -r requirements.txt

LLM Configuration

Set up at least one API key for the LLM providers:

# Required: Set at least one of these API keys
export GLHF_API_KEY=your_api_key
export GROQ_API_KEY=your_api_key
export OPENAI_API_KEY=your_api_key
export OPENROUTER_API_KEY=your_api_key
export GITHUB_API_KEY=your_api_key
export DEEPSEEK_API_KEY=your_api_key
export GEMINI_API_KEY=your_api_key
export OLLAMA_API_KEY=your_api_key

# Optional: Override default configuration
export MODEL=your_preferred_model
export BASE_URL=your_custom_url
export USE_VISION=false

Installation

Via Smithery

To install automatically via Smithery:

npx -y @smithery/cli install @ztobs/cline-browser-use-mcp --client claude

Manual Installation

  1. Clone the repository to /home/YOUR_HOME/Documents/Cline/
  2. Install dependencies:
npm install
  1. Build the server:
npm run build

MCP Configuration

Add this configuration to your Cline MCP settings:

"browser-use": {
  "command": "node",
  "args": [
    "/home/YOUR_HOME/Documents/Cline/MCP/browser-use-server/build/index.js"
  ],
  "env": {
    "GLHF_API_KEY": "your_api_key",
    "GROQ_API_KEY": "your_api_key",
    "OPENAI_API_KEY": "your_api_key",
    "OPENROUTER_API_KEY": "your_api_key",
    "GITHUB_API_KEY": "your_api_key",
    "DEEPSEEK_API_KEY": "your_api_key",
    "GEMINI_API_KEY": "your_api_key",
    "OLLAMA_API_KEY": "your_api_key",
    "MODEL": "your_preferred_model",
    "BASE_URL": "your_custom_url",
    "USE_VISION": "false"
  },
  "disabled": false,
  "autoApprove": []
}

Replace YOUR_HOME with your actual home directory and add your API keys.

Usage

Start the server:

node build/index.js

Available Operations

Screenshot

Parameters:

  • url: The webpage URL (required)
  • full_page: Whether to capture the full page or just the viewport (optional, default: false)
  • steps: Comma-separated actions to take after page load (optional)

Get HTML

Parameters:

  • url: The webpage URL (required)
  • steps: Comma-separated actions to take after page load (optional)

Execute JavaScript

Parameters:

  • url: The webpage URL (required)
  • script: JavaScript code to execute (required)
  • steps: Comma-separated actions to take after page load (optional)

Get Console Logs

Parameters:

  • url: The webpage URL (required)
  • steps: Comma-separated actions to take after page load (optional)

Example Tasks with Cline

Here's an example of modifying web page elements during development:

Change the colour of the headline with the text "Alle Foren im Überblick." to deep blue on https://localhost:3000/foren/ page

To check/see the page, use browser-use MCP server to:
Open https://localhost:3000/auth,
Login with ztobs:Password123,
Navigate to https://localhost:3000/foren/,
Accept cookies if required

hint: execute all browser actions in one command with multiple comma-separated steps

This demonstrates:

  • Multi-step browser automation
  • Authentication handling
  • Cookie acceptance
  • DOM manipulation
  • CSS styling changes

Configuration Details

LLM Providers

The server supports multiple LLM providers with default configurations:

  • GLHF: Uses deepseek-ai/DeepSeek-V3 model
  • Ollama: Uses qwen2.5:32b-instruct-q4_K_M model
  • Groq: Uses deepseek-r1-distill-llama-70b model
  • OpenAI: Uses gpt-4o-mini model
  • Openrouter: Uses deepseek/deepseek-chat model
  • Github: Uses gpt-4o-mini model
  • DeepSeek: Uses deepseek-chat model
  • Gemini: Uses gemini-2.0-flash-exp model

Vision Support

Enable vision capabilities with the USE_VISION environment variable:

  • Set USE_VISION=true to enable vision capabilities
  • Default is false to optimize performance

Timeout Settings

The default timeout is 5 minutes (300000 ms). Modify the TIMEOUT constant in build/index.js to change this.

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":"node","args":["/home/YOUR_HOME/Documents/Cline/MCP/browser-use-server/build/index.js"],"env":{"GLHF_API_KEY":"your_api_key","GROQ_API_KEY":"your_api_key","OPENAI_API_KEY":"your_api_key","OPENROUTER_API_KEY":"your_api_key","GITHUB_API_KEY":"your_api_key","DEEPSEEK_API_KEY":"your_api_key","GEMINI_API_KEY":"your_api_key","OLLAMA_API_KEY":"your_api_key","MODEL":"your_preferred_model","BASE_URL":"your_custom_url","USE_VISION":"false"},"disabled":false,"autoApprove":[]}'

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": "node",
            "args": [
                "/home/YOUR_HOME/Documents/Cline/MCP/browser-use-server/build/index.js"
            ],
            "env": {
                "GLHF_API_KEY": "your_api_key",
                "GROQ_API_KEY": "your_api_key",
                "OPENAI_API_KEY": "your_api_key",
                "OPENROUTER_API_KEY": "your_api_key",
                "GITHUB_API_KEY": "your_api_key",
                "DEEPSEEK_API_KEY": "your_api_key",
                "GEMINI_API_KEY": "your_api_key",
                "OLLAMA_API_KEY": "your_api_key",
                "MODEL": "your_preferred_model",
                "BASE_URL": "your_custom_url",
                "USE_VISION": "false"
            },
            "disabled": false,
            "autoApprove": []
        }
    }
}

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": "node",
            "args": [
                "/home/YOUR_HOME/Documents/Cline/MCP/browser-use-server/build/index.js"
            ],
            "env": {
                "GLHF_API_KEY": "your_api_key",
                "GROQ_API_KEY": "your_api_key",
                "OPENAI_API_KEY": "your_api_key",
                "OPENROUTER_API_KEY": "your_api_key",
                "GITHUB_API_KEY": "your_api_key",
                "DEEPSEEK_API_KEY": "your_api_key",
                "GEMINI_API_KEY": "your_api_key",
                "OLLAMA_API_KEY": "your_api_key",
                "MODEL": "your_preferred_model",
                "BASE_URL": "your_custom_url",
                "USE_VISION": "false"
            },
            "disabled": false,
            "autoApprove": []
        }
    }
}

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