Get the FREE Ultimate OpenClaw Setup Guide →

mcp -browserbase

Allow LLMs to control a browser with Browserbase and Stagehand

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio browserbase-mcp-server-browserbase node /path/to/mcp-server-browserbase/cli.js \
  --env GEMINI_API_KEY="" \
  --env BROWSERBASE_API_KEY="" \
  --env BROWSERBASE_PROJECT_ID=""

How to use

The Browserbase MCP Server exposes cloud browser automation capabilities via Stagehand and Browserbase, enabling LLMs to control web pages, perform actions, take screenshots, and extract structured data with advanced selectors. This server supports multiple transport modes (STDIO and SHTTP) so you can run locally or connect through a remote endpoint. Use the STDIO setup to run the server locally in your MCP environment, or configure SHTTP to point to a remote hosted URL for scalable usage and predictable costs. With this server you can automate tasks such as navigating pages, clicking elements, filling forms, capturing screenshots, and extracting data from complex pages including iframes and shadow DOMs. It also exposes new primitives like page, locator, frameLocator, and deepLocator for simplified automation across browsers.

To use it, add a browserbase mcpServer entry to your MCP config as shown, then reload your MCP client. You can specify the model (e.g., Gemini) and API keys, and choose between direct local execution or a remote hosted endpoint. When using STDIO locally, you’ll configure the command (node) and the path to the CLI script, plus the required environment variables for authentication and project context.

How to install

Prerequisites:

  • Node.js and npm/yarn installed
  • Access to the repository or npm package @browserbasehq/mcp-server-browserbase

Option A: Run directly from source (local STDIO)

  1. Clone the repository: git clone https://github.com/browserbase/mcp-server-browserbase.git cd mcp-server-browserbase
  2. Install dependencies and build (if applicable): npm install npm run build
  3. Run the server locally (example): node /path/to/mcp-server-browserbase/cli.js

Option B: Use npm package (STDIO via npx or as a dependency in MCP config)

  1. Install or reference the package in your MCP config: In your MCP config, set: { "mcpServers": { "browserbase": { "command": "npx", "args": ["@browserbasehq/mcp-server-browserbase"] } } }
  2. If you need environment variables, provide them in the config: { "mcpServers": { "browserbase": { "command": "npx", "args": ["@browserbasehq/mcp-server-browserbase"], "env": { "BROWSERBASE_API_KEY": "", "BROWSERBASE_PROJECT_ID": "", "GEMINI_API_KEY": "" } } } }

Option C: Docker (optional)

  1. Build the image (from source): docker build -t mcp-browserbase .
  2. Run the image locally: docker run -it --rm -e BROWSERBASE_API_KEY="" -e BROWSERBASE_PROJECT_ID="" -e GEMINI_API_KEY="" mcp-browserbase

Prerequisites recap: ensure you have Node.js installed if running locally, or use the provided npm package/Docker workflow if you prefer containerized or remote operation.

Additional notes

Environment variables:

  • BROWSERBASE_API_KEY: Your Browserbase API key
  • BROWSERBASE_PROJECT_ID: Your Browserbase project ID
  • GEMINI_API_KEY: API key for the Gemini/OpenAI-compatible model provider (if using Gemini via Stagehand)

Important flags for the server (exposed via CLI or MCP config):

  • --proxies, --advancedStealth, --keepAlive, --contextId, --persist
  • --port, --host to configure network binding
  • --browserWidth, --browserHeight for viewport size
  • --modelName, --modelApiKey to select and authenticate the model used by Stagehand
  • --experimental to enable experimental features

If you switch between transport methods, ensure your MCP client supports the chosen format (STDIO vs. SHTTP). For SHTTP, you’ll typically point to a remote Smithery URL; for STDIO, you run the CLI locally and reference the local path in your MCP config.

Related MCP Servers

Sponsor this space

Reach thousands of developers