Skip to main content

Configuration Overview

The Browserbase MCP server supports extensive configuration options through command-line flags and environment variables. Configure browser behavior, proxy settings, stealth modes, model selection, and more to customize your browser automation workflows.
Command-line flags are only available when running the server locally (npx @browserbasehq/mcp with flags or local development setup).

Environment Variables

Configure the essential Browserbase credentials and optional debugging settings:

BROWSERBASE_API_KEY

Your Browserbase API key for authentication

Command-Line Flags

Available Flags

Configuration Examples

Basic Configuration

When using our remote hosted server, we provide the LLM costs for Gemini, the best performing model in Stagehand.

Advanced Features

Enable Browserbase proxies for IP rotation and geo-location testing.

Browser Customization

Customize browser window dimensions. Default is 1288x711. Recommended aspect ratios: 16:9.
Common Resolutions:
  • Desktop: 1920x1080, 1280x720, 1024x768
  • Mobile: 375x667 (iPhone), 360x640 (Android)
  • Tablet: 768x1024 (iPad)

Model Configuration

Configure AI models for enhanced browser automation. Stagehand defaults to Google’s Gemini 2.5 Flash Lite but supports multiple providers.
When using any custom model (non-default), you must provide your own API key for that model provider using the --modelApiKey flag.
Google Gemini (Default)
  • google/gemini-2.5-flash-lite (default)
  • google/gemini-2.5-pro
  • google/gemini-2.5-flash
OpenAI
  • gpt-5-2025-08-07
  • gpt-4.1-2025-04-14
  • gpt-4o
  • gpt-4o-mini
Anthropic Claude
  • claude-sonnet-4-5
  • claude-haiku-4-5
View full list of supported models

Development Configuration

Configure custom host and port for SHTTP transport.

Best Practices

  • Use appropriate viewport sizes for your use case
  • Enable proxies only when needed for geo-location
  • Choose efficient models (Gemini Flash for speed, GPT-4o for accuracy)
  • Reuse contexts for authentication persistence
  • Store API keys securely in environment variables
  • Use Advanced Stealth for sensitive operations
  • Implement proper session management
  • Rotate cookies and contexts regularly
  • Use NPM installation for reliability
  • Configure appropriate timeouts
  • Implement error handling and retries
  • Monitor performance and resource usage

Further Reading

Browserbase Documentation

Complete platform documentation

Stagehand Docs

AI-powered browser automation

Support

Get help from our team