🔌

Agent-Browser MCP

Browser Automation11,753

Fast native Rust CLI for browser automation via CDP with accessibility-tree snapshots.

Claude DesktopCursorClaude Code

Overview

Fast native Rust CLI for browser automation via CDP with accessibility-tree snapshots.

Setup

Run with npx:

npm install -g @anthropic-ai/agent-browser

Configuration

AGENT_BROWSER_URL environment variable

Documentation

Agent-Browser MCP Server

Overview

agent-browser is a fast, native Rust CLI for browser automation via CDP with accessibility-tree snapshots. Unlike traditional browser automation tools that rely on visual screenshots, agent-browser uses accessibility tree data for precise, efficient browser interaction.

With over 11,753 GitHub stars, agent-browser has become a popular choice for AI agent browser automation, especially for accessibility-focused workflows and fast browser-based tooling.

Features

  • Accessibility-tree snapshots — Precise element detection via accessibility tree
  • Native Rust implementation — Fast, memory-efficient browser automation
  • CDP protocol support — Works with Chrome, Chromium, and Edge
  • MCP integration — Standard Model Context Protocol support
  • Cross-platform — Supports Windows, macOS, and Linux
  • Zero dependencies — No heavy browser automation frameworks required
  • Real-time interaction — Low-latency browser commands
  • Headless mode — Fully headless execution for CI/CD

Installation

Quick Setup

# Install via npm (recommended)
npm install -g @anthropic-ai/agent-browser

# Or install from source
cargo install agent-browser

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "agent-browser": {
      "command": "agent-browser",
      "args": ["serve"],
      "env": {
        "AGENT_BROWSER_URL": "http://localhost:3000"
      }
    }
  }
}

Docker Setup

docker run -p 3000:3000 agent-browser:latest

Setup

  1. Install Chrome or Chromium

    • Ensure Chrome/Chromium is installed and accessible
    • For headless mode, ensure Chrome can run headless
  2. Start the Browser

    agent-browser start
    
  3. Connect to MCP

    agent-browser serve
    

Available Tools

ToolDescription
browser_navigateNavigate to a URL
browser_snapshotGet accessibility tree snapshot
browser_clickClick an element by selector
browser_typeType text into an element
browser_scrollScroll the page
browser_backNavigate back
browser_forwardNavigate forward
browser_refreshRefresh the page
browser_get_textGet text content of element
browser_get_htmlGet HTML content of element
browser_take_screenshotTake a screenshot
browser_execute_jsExecute JavaScript

Usage Examples

Navigate to a URL

{
  "name": "browser_navigate",
  "arguments": {
    "url": "https://github.com/anthropics/agent-browser"
  }
}

Get Accessibility Snapshot

{
  "name": "browser_snapshot",
  "arguments": {
    "depth": 5
  }
}

Click an Element

{
  "name": "browser_click",
  "arguments": {
    "selector": "#submit-button"
  }
}

Type Text

{
  "name": "browser_type",
  "arguments": {
    "selector": "#search-input",
    "text": "MCP servers",
    "slowly": true
  }
}

Take Screenshot

{
  "name": "browser_take_screenshot",
  "arguments": {
    "fullPage": false,
    "format": "png"
  }
}

Advanced Features

Accessibility Tree Parsing

agent-browser excels at accessibility tree parsing, providing structured data about page elements:

{
  "name": "browser_snapshot",
  "arguments": {
    "includeHidden": false,
    "maxDepth": 10
  }
}

Headless Mode

For CI/CD and automated workflows:

agent-browser start --headless

Multi-Tab Support

agent-browser supports multiple browser tabs:

{
  "name": "browser_new_tab",
  "arguments": {
    "url": "https://example.com"
  }
}

Form Filling

Automated form filling with accessibility-aware selectors:

{
  "name": "browser_fill_form",
  "arguments": {
    "fields": {
      "username": "testuser",
      "password": "securepassword123"
    },
    "submit": true
  }
}

Integration with AI Agents

Claude Code Integration

agent-browser works seamlessly with Claude Code for browser automation:

# In Claude Code, use browser tools
> Click the login button
> Type my email in the input
> Submit the form

Agent Workflow Example

# Example agent workflow using agent-browser
async def search_and_extract(url: str, query: str):
    # Navigate
    await browser_navigate(url)
    
    # Search
    await browser_type("#search", query)
    await browser_click("#search-button")
    
    # Extract results
    snapshot = await browser_snapshot()
    return parse_results(snapshot)

Pros

  • ✅ Fast native Rust implementation
  • ✅ Accessibility-tree snapshots for precise interaction
  • ✅ MCP standard integration
  • ✅ Cross-platform support
  • ✅ Low latency browser commands
  • ✅ Headless mode for CI/CD
  • ✅ Works with any CDP-compatible browser

Cons

  • ❌ Requires Chrome/Chromium installation
  • ❌ Accessibility tree may miss visual-only elements
  • ❌ Less mature than Playwright/Puppeteer
  • ❌ No built-in waiting mechanisms
  • ❌ Limited screenshot-based debugging

When to Use

  • AI agent browser automation
  • Accessibility-focused web scraping
  • Fast browser-based tooling
  • MCP-integrated workflows
  • Headless browser automation
  • Form filling and submission

Resources