The Browserbase MCP Server brings powerful browser automation capabilities to AI assistants through the Model Context Protocol (MCP). Built on Stagehand, this integration provides AI-powered web automation using natural language commands.
This server enables AI assistants like Claude to control browsers, navigate websites, interact with web elements, and extract data—all through simple conversational commands.
# Clone and buildgit clone https://github.com/browserbase/mcp-server-browserbase.gitcd mcp-server-browserbasenpm install && npm run build# Run with STDIOnode cli.js# Or run with SHTTPnode cli.js --port 8931
const stagehand = new Stagehand({ env: "BROWSERBASE", model: "openai/gpt-4o",});await stagehand.init();const page = stagehand.context.pages()[0];await page.goto("https://www.google.com");// Create agent with MCP integrationconst agent = stagehand.agent({ integrations: [mcpClient], systemPrompt: `You are a helpful assistant with access to external tools. Use the available tools to enhance your capabilities.`});const result = await agent.execute( "Search for the latest AI news and summarize the top results");
import { Stagehand } from "@browserbasehq/stagehand";const stagehand = new Stagehand({ env: "LOCAL", model: "openai/gpt-4o", verbose: 1,});await stagehand.init();const page = stagehand.context.pages()[0];await page.goto("https://www.google.com");const agent = stagehand.agent({ integrations: [ `https://mcp.exa.ai/mcp?exaApiKey=${process.env.EXA_API_KEY}`, ], systemPrompt: `You are a helpful assistant that can use a browser and external tools. You have access to the Exa search tool to find information on the web. When looking for products to buy, search for current and reliable information.`});const result = await agent.execute( "Use Exa to search for the top headphones of 2025. Then go through the checkout flow for the best one.");console.log(result);await stagehand.close();
import { connectToMCPServer, Stagehand } from "@browserbasehq/stagehand";const stagehand = new Stagehand({ env: "LOCAL", verbose: 1,});await stagehand.init();const page = stagehand.context.pages()[0];await page.goto("https://www.opentable.com/");// Connect to Supabase MCP serverconst supabaseClient = await connectToMCPServer( `https://server.smithery.ai/@supabase-community/supabase-mcp/mcp?api_key=${process.env.SMITHERY_API_KEY}`);const agent = stagehand.agent({ model: "openai/computer-use-preview", integrations: [supabaseClient],});const result = await agent.execute( "Search for restaurants in New Brunswick, NJ. Then use Supabase to insert the name of the first result into a table called 'restaurants'.");console.log(result);await stagehand.close();