BrowserTools MCP Server

April 1, 2025 ยท View on GitHub

A Model Context Protocol server for browser interactions. This server allows Claude to interact with web browsers for debugging and testing web applications.

Features

  • Launch browsers (Chromium, Firefox, WebKit)
  • Navigate to URLs
  • Take screenshots
  • Execute JavaScript code
  • Extract content from pages
  • Monitor console and network logs
  • Run performance tests

Installation

Prerequisites

  • Python 3.10+
  • Virtual environment (recommended)
  • Playwright for browser automation

Setup

  1. Clone this repository
  2. Create a virtual environment:
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  3. Install dependencies:
    pip install -r requirements.txt
    playwright install  # Install browser binaries
    

Running the Server

You can run the server directly:

./run_server.sh

This will start the server on port 8080.

Installation in Claude Desktop

To install the server in Claude Desktop:

./install_claude.sh

This will:

  1. Generate a configuration file
  2. Install the server in Claude Desktop
  3. Make it available as the "BrowserTools" server

After installation, restart Claude Desktop and you'll be able to use the BrowserTools server.

Claude Configuration Format

The installation script generates a claude_config.json file that points to your local installation. Here's an example of what this file looks like (with paths obfuscated):

{
  "mcpServers": {
    "BrowserTools": {
      "command": "/path/to/venv/bin/python",
      "args": [
        "/path/to/BrowserTools/browser_tools.py"
      ]
    }
  }
}

You'll need to replace the paths with the actual locations on your system.

Integration with Cursor AI

To integrate the BrowserTools MCP server with Cursor AI:

  1. Create or edit the mcp.json file in your Cursor configuration directory:

    • On macOS: ~/.cursor/mcp.json
    • On Windows: %APPDATA%\Cursor\mcp.json
    • On Linux: ~/.config/Cursor/mcp.json
  2. Add the following configuration to the file:

{  
  "mcpServers": {
    "BrowserTools": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with",
        "playwright",
        "mcp",
        "run",
        "/path/to/BrowserTools/server.py"
      ]
    }
  }
}
  1. Replace /path/to/BrowserTools/server.py with the actual path to the server.py file in your BrowserTools installation.

  2. Restart Cursor AI to apply the changes.

After restarting, the BrowserTools server will be available for Cursor AI to interact with web browsers.

Available Tools

The server provides the following tools to Claude:

  • browser_create - Create a new browser instance
  • browser_close - Close a browser instance
  • browser_navigate - Navigate to a URL
  • browser_screenshot - Take a screenshot
  • browser_execute_javascript - Execute JavaScript code
  • browser_get_console_logs - Get console logs
  • browser_performance_test - Run performance tests

License

MIT