Skip to main content
Glama
Browserbase MCP Server

Browserbase MCP Server

by ImRonAI

Browserbase MCP Server

cover

The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.

This server provides cloud browser automation capabilities using Browserbase and Stagehand. It enables LLMs to interact with web pages, take screenshots, extract information, and perform automated actions with atomic precision.

Features

Feature

Description

Browser Automation

Control and orchestrate cloud browsers via Browserbase

Data Extraction

Extract structured data from any webpage

Web Interaction

Navigate, click, and fill forms with ease

Screenshots

Capture full-page and element screenshots

Model Flexibility

Supports multiple models (OpenAI, Claude, Gemini, and more)

Vision Support

Use annotated screenshots for complex DOMs

Session Management

Create, manage, and close browser sessions

Multi-Session

Run multiple browser sessions in parallel

Related MCP server: Browserbase MCP Server

How to Setup

Quickstarts:

Add to Cursor

Copy and Paste this link in your Browser:

cursor://anysphere.cursor-deeplink/mcp/install?name=browserbase&config=eyJjb21tYW5kIjoibnB4IEBicm93c2VyYmFzZWhxL21jcCIsImVudiI6eyJCUk9XU0VSQkFTRV9BUElfS0VZIjoiIiwiQlJPV1NFUkJBU0VfUFJPSkVDVF9JRCI6IiIsIkdFTUlOSV9BUElfS0VZIjoiIn19

We currently support 2 transports for our MCP server, STDIO and SHTTP. We recommend you use SHTTP with our remote hosted url to take advantage of the server at full capacity.

SHTTP:

To use the Browserbase MCP Server through our remote hosted URL, add the following to your configuration.

Go to smithery.ai and enter your API keys and configuration to get a remote hosted URL. When using our remote hosted server, we provide the LLM costs for Gemini, the best performing model in Stagehand.

Smithery Image

If your client supports SHTTP:

{
  "mcpServers": {
    "browserbase": {
      "url": "your-smithery-url.com"
    }
  }
}

If your client doesn't support SHTTP:

{
  "mcpServers": {
    "browserbase": {
      "command": "npx",
      "args": ["mcp-remote", "your-smithery-url.com"]
    }
  }
}

STDIO:

You can either use our Server hosted on NPM or run it completely locally by cloning this repo.

❗️ Important: If you want to use a different model you have to add --modelName to the args and provide that respective key as an arg. More info below.

Go into your MCP Config JSON and add the Browserbase Server:

{
  "mcpServers": {
    "browserbase": {
      "command": "npx",
      "args": ["@browserbasehq/mcp-server-browserbase"],
      "env": {
        "BROWSERBASE_API_KEY": "",
        "BROWSERBASE_PROJECT_ID": "",
        "GEMINI_API_KEY": ""
      }
    }
  }
}

That's it! Reload your MCP client and Claude will be able to use Browserbase.

To run 100% local:

# Clone the Repo
git clone https://github.com/browserbase/mcp-server-browserbase.git
cd mcp-server-browserbase

# Install the dependencies and build the project
npm install && npm run build

Then in your MCP Config JSON run the server. To run locally we can use STDIO or self-host SHTTP.

STDIO:

To your MCP Config JSON file add the following:

{
  "mcpServers": {
    "browserbase": {
      "command": "node",
      "args": ["/path/to/mcp-server-browserbase/cli.js"],
      "env": {
        "BROWSERBASE_API_KEY": "",
        "BROWSERBASE_PROJECT_ID": "",
        "GEMINI_API_KEY": ""
      }
    }
  }
}

Then reload your MCP client and you should be good to go!

Configuration

The Browserbase MCP server accepts the following command-line flags:

Flag

Description

--proxies

Enable Browserbase proxies for the session

--advancedStealth

Enable Browserbase Advanced Stealth (Only for Scale Plan Users)

--keepAlive

Enable Browserbase Keep Alive Session

--contextId <contextId>

Specify a Browserbase Context ID to use

--persist

Whether to persist the Browserbase context (default: true)

--port <port>

Port to listen on for HTTP/SHTTP transport

--host <host>

Host to bind server to (default: localhost, use 0.0.0.0 for all interfaces)

--cookies [json]

JSON array of cookies to inject into the browser

--browserWidth <width>

Browser viewport width (default: 1024)

--browserHeight <height>

Browser viewport height (default: 768)

--modelName <model>

The model to use for Stagehand (default: google/gemini-2.0-flash)

--modelApiKey <key>

API key for the custom model provider (required when using custom models)

--experimental

Enable experimental features (default: false)

These flags can be passed directly to the CLI or configured in your MCP configuration file.

NOTE:

Currently, these flags can only be used with the local server (npx @browserbasehq/mcp-server-browserbase).

Configuration Examples

Proxies

Here are our docs on Proxies.

To use proxies, set the --proxies flag in your MCP Config:

{
  "mcpServers": {
    "browserbase": {
      "command": "npx",
      "args": ["@browserbasehq/mcp-server-browserbase", "--proxies"],
      "env": {
        "BROWSERBASE_API_KEY": "",
        "BROWSERBASE_PROJECT_ID": "",
        "GEMINI_API_KEY": ""
      }
    }
  }
}

Advanced Stealth

Here are our docs on Advanced Stealth.

To use advanced stealth, set the --advancedStealth flag in your MCP Config:

{
  "mcpServers": {
    "browserbase": {
      "command": "npx",
      "args": ["@browserbasehq/mcp-server-browserbase", "--advancedStealth"],
      "env": {
        "BROWSERBASE_API_KEY": "",
        "BROWSERBASE_PROJECT_ID": "",
        "GEMINI_API_KEY": ""
      }
    }
  }
}

Contexts

Here are our docs on Contexts

To use contexts, set the --contextId flag in your MCP Config:

{
  "mcpServers": {
    "browserbase": {
      "command": "npx",
      "args": [
        "@browserbasehq/mcp-server-browserbase",
        "--contextId",
        "<YOUR_CONTEXT_ID>"
      ],
      "env": {
        "BROWSERBASE_API_KEY": "",
        "BROWSERBASE_PROJECT_ID": "",
        "GEMINI_API_KEY": ""
      }
    }
  }
}

Browser Viewport Sizing

The default viewport sizing for a browser session is 1024 x 768. You can adjust the Browser viewport sizing with browserWidth and browserHeight flags.

Here's how to use it for custom browser sizing. We recommend to stick with 16:9 aspect ratios (ie: 1920 x 1080, 1280 x 720, 1024 x 768)

{
  "mcpServers": {
    "browserbase": {
      "command": "npx",
      "args": [
        "@browserbasehq/mcp-server-browserbase",
        "--browserHeight 1080",
        "--browserWidth 1920"
      ],
      "env": {
        "BROWSERBASE_API_KEY": "",
        "BROWSERBASE_PROJECT_ID": "",
        "GEMINI_API_KEY": ""
      }
    }
  }
}

Model Configuration

Stagehand defaults to using Google's Gemini 2.0 Flash model, but you can configure it to use other models like GPT-4o, Claude, or other providers.

Important: When using any custom model (non-default), you must provide your own API key for that model provider using the --modelApiKey flag.

Here's how to configure different models:

{
  "mcpServers": {
    "browserbase": {
      "command": "npx",
      "args": [
        "@browserbasehq/mcp-server-browserbase",
        "--modelName",
        "anthropic/claude-3-5-sonnet-latest",
        "--modelApiKey",
        "your-anthropic-api-key"
      ],
      "env": {
        "BROWSERBASE_API_KEY": "",
        "BROWSERBASE_PROJECT_ID": ""
      }
    }
  }
}

Note: The model must be supported in Stagehand. Check out the docs here. When using any custom model, you must provide your own API key for that provider.

Resources

The server provides access to screenshot resources:

  1. Screenshots (screenshot://<screenshot-name>)

    • PNG images of captured screenshots

Key Features

  • AI-Powered Automation: Natural language commands for web interactions

  • Multi-Model Support: Works with OpenAI, Claude, Gemini, and more

  • Advanced Session Management: Single and multi-session support for parallel browser automation

  • Screenshot Capture: Full-page and element-specific screenshots

  • Data Extraction: Intelligent content extraction from web pages

  • Proxy Support: Enterprise-grade proxy capabilities

  • Stealth Mode: Advanced anti-detection features

  • Context Persistence: Maintain authentication and state across sessions

  • Parallel Workflows: Run multiple browser sessions simultaneously for complex automation tasks

For more information about the Model Context Protocol, visit:

For the official MCP Docs:

License

Licensed under the Apache 2.0 License.

Copyright 2025 Browserbase, Inc.

Available Tools

17 tools
browserbase_screenshotAInspect

Takes a screenshot of the current page. Use this tool to learn where you are on the page when controlling the browser with Stagehand. Only use this tool when the other tools are not sufficient to get the information you need.

Inputs: name.

browserbase_session_closeAInspect

Closes the current Browserbase session by properly shutting down the Stagehand instance, which handles browser cleanup and terminates the session recording.

Inputs: no named parameters.

browserbase_session_createAInspect

Create or reuse a single cloud browser session using Browserbase with fully initialized Stagehand. WARNING: This tool is for SINGLE browser workflows only. If you need multiple browser sessions running simultaneously (parallel scraping, A/B testing, multiple accounts), use 'multi_browserbase_stagehand_session_create' instead. This creates one browser session with all configuration flags (proxies, stealth, viewport, cookies, etc.) and initializes Stagehand to work with that session. Updates the active session.

Inputs: sessionId.

browserbase_stagehand_actAInspect

Performs an action on a web page element. Act actions should be as atomic and specific as possible, i.e. "Click the sign in button" or "Type 'hello' into the search input". AVOID actions that are more than one step, i.e. "Order me pizza" or "Send an email to Paul asking him to call me".

Inputs: action (required), variables.

browserbase_stagehand_extractAInspect

Extracts structured information and text content from the current web page based on specific instructions and a defined schema. This tool is ideal for scraping data, gathering information, or pulling specific content from web pages. Use this tool when you need to get text content, data, or information from a page rather than interacting with elements. For interactive elements like buttons, forms, or clickable items, use the observe tool instead. The extraction works best when you provide clear, specific instructions about what to extract and a well-defined JSON schema for the expected output format. This ensures the extracted data is properly structured and usable.

Inputs: instruction (required).

browserbase_stagehand_get_all_urlsAInspect

Gets the current URLs of all active browser sessions. Returns a mapping of session IDs to their current URLs.

Inputs: no named parameters.

browserbase_stagehand_get_urlAInspect

Gets the current URL of the browser page. Returns the complete URL including protocol, domain, path, and any query parameters or fragments.

Inputs: no named parameters.

browserbase_stagehand_navigateAInspect

Navigate to a URL in the browser. Only use this tool with URLs you're confident will work and stay up to date. Otherwise, use https://google.com as the starting point

Inputs: url (required).

browserbase_stagehand_observeAInspect

Observes and identifies specific interactive elements on the current web page that can be used for subsequent actions. This tool is specifically designed for finding actionable (interactable) elements such as buttons, links, form fields, dropdowns, checkboxes, and other UI components that you can interact with. Use this tool when you need to locate elements before performing actions with the act tool. DO NOT use this tool for extracting text content or data - use the extract tool instead for that purpose. The observe tool returns detailed information about the identified elements including their properties, location, and interaction capabilities. This information can then be used to craft precise actions. The more specific your observation instruction, the more accurate the element identification will be. Think of this as your 'eyes' on the page to find exactly what you need to interact with.

Inputs: instruction (required), returnAction.

multi_browserbase_stagehand_act_sessionBInspect

Performs an action on a web page element. Act actions should be as atomic and specific as possible, i.e. "Click the sign in button" or "Type 'hello' into the search input". AVOID actions that are more than one step, i.e. "Order me pizza" or "Send an email to Paul asking him to call me". (for a specific session)

Inputs: action (required), sessionId (required), variables.

multi_browserbase_stagehand_extract_sessionAInspect

Extracts structured information and text content from the current web page based on specific instructions and a defined schema. This tool is ideal for scraping data, gathering information, or pulling specific content from web pages. Use this tool when you need to get text content, data, or information from a page rather than interacting with elements. For interactive elements like buttons, forms, or clickable items, use the observe tool instead. The extraction works best when you provide clear, specific instructions about what to extract and a well-defined JSON schema for the expected output format. This ensures the extracted data is properly structured and usable. (for a specific session)

Inputs: sessionId (required), instruction (required).

multi_browserbase_stagehand_get_url_sessionAInspect

Gets the current URL of the browser page. Returns the complete URL including protocol, domain, path, and any query parameters or fragments. (for a specific session)

Inputs: sessionId (required).

multi_browserbase_stagehand_navigate_sessionAInspect

Navigate to a URL in the browser. Only use this tool with URLs you're confident will work and stay up to date. Otherwise, use https://google.com as the starting point (for a specific session)

Inputs: url (required), sessionId (required).

multi_browserbase_stagehand_observe_sessionAInspect

Observes and identifies specific interactive elements on the current web page that can be used for subsequent actions. This tool is specifically designed for finding actionable (interactable) elements such as buttons, links, form fields, dropdowns, checkboxes, and other UI components that you can interact with. Use this tool when you need to locate elements before performing actions with the act tool. DO NOT use this tool for extracting text content or data - use the extract tool instead for that purpose. The observe tool returns detailed information about the identified elements including their properties, location, and interaction capabilities. This information can then be used to craft precise actions. The more specific your observation instruction, the more accurate the element identification will be. Think of this as your 'eyes' on the page to find exactly what you need to interact with. (for a specific session)

Inputs: sessionId (required), instruction (required), returnAction.

multi_browserbase_stagehand_session_closeAInspect

Cleanup parallel session for multi-session workflows. Properly terminates a browser session, ends the Browserbase session, and frees cloud resources. Always use this when finished with a session to avoid resource waste and billing charges. Critical for responsible multi-session automation - each unclosed session continues consuming resources!

Inputs: sessionId (required).

multi_browserbase_stagehand_session_createAInspect

Create parallel browser session for multi-session workflows. Use this when you need multiple browser instances running simultaneously: parallel data scraping, concurrent automation, A/B testing, multiple user accounts, cross-site operations, batch processing, or any task requiring more than one browser. Creates an isolated browser session with independent cookies, authentication, and state. Always pair with session-specific tools (those ending with '_session'). Perfect for scaling automation tasks that require multiple browsers working in parallel.

Inputs: name, browserbaseSessionID.

multi_browserbase_stagehand_session_listAInspect

ONLY WORKS WITH MULTI-SESSION TOOLS! Track all parallel sessions: Critical tool for multi-session management! Shows all active browser sessions with their IDs, names, ages, and Browserbase session IDs. Use this frequently to monitor your parallel automation workflows, verify sessions are running, and get session IDs for session-specific tools. Essential for debugging and resource management in complex multi-browser scenarios.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 17 tools

    Disambiguation4/5

    The tool set clearly separates single-session and multi-session workflows via prefixes. However, there is slight overlap between 'browserbase_stagehand_get_all_urls' and 'multi_browserbase_stagehand_session_list' which both provide session information, potentially causing confusion.

    Naming Consistency3/5

    Most tools follow a consistent 'prefix_action' pattern, but the inclusion of 'stagehand' in some single-session tools (e.g., 'browserbase_stagehand_act') and not others (e.g., 'browserbase_screenshot') is inconsistent. Multi-session tools uniformly use 'multi_browserbase_stagehand_' but this adds length.

    Tool Count5/5

    17 tools is appropriate for a browser automation server. It covers both single and multi-session workflows without being overwhelming, providing essential actions like navigate, act, extract, observe, and session management.

    Completeness4/5

    The tool surface covers core browser automation tasks (navigation, interaction, extraction, observation) and session management. Minor gaps include no dedicated tools for JavaScript execution, cookie handling, or scrolling, but the provided tools are sufficient for typical workflows.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers