The Browserbase MCP Server integrates with the Model Context Protocol (MCP) to provide cloud browser automation capabilities. It allows Large Language Models (LLMs) to interact with web pages, take screenshots, and execute JavaScript in a cloud browser environment using Browserbase and Stagehand technologies.
You can install the Browserbase MCP server in two ways:
The simplest way to install is through Smithery:
# Visit the Smithery page to install
https://smithery.ai/server/@browserbasehq/mcp-browserbase
To install and run the server locally:
Clone the repository:
git clone https://github.com/browserbasehq/mcp-browserbase.git
cd mcp-browserbase
Install dependencies:
npm install
Start the server:
npm start
The Browserbase MCP Server provides two main components that you can use:
Browserbase MCP offers a comprehensive set of browser automation features:
Stagehand MCP provides a higher-level abstraction with natural language commands:
Atomic Instructions: Execute precise actions using natural language
act("click the login button")
extract("find the red shoes")
Model Support: Works with multiple models including OpenAI's GPT-4 and Anthropic's Claude-3.7 Sonnet
Vision Support: Uses annotated screenshots for better interpretation of complex DOMs
To configure the MCP server, you'll need to set up appropriate environment variables:
# Browserbase API credentials
BROWSERBASE_API_KEY=your_api_key
# Optional: Set custom port
MCP_SERVER_PORT=3000
// Example of navigating to a webpage
await mcp.browserbase.navigate("https://example.com");
// Take a screenshot
const screenshot = await mcp.browserbase.screenshot();
// Extract data from a page
const data = await mcp.browserbase.extract({
selector: ".product-list",
attributes: ["title", "price"]
});
// Using natural language commands
await mcp.stagehand.act("click the sign-up button");
await mcp.stagehand.act("fill the email field with [email protected]");
await mcp.stagehand.extract("get all product prices from this page");
If you encounter issues with the MCP server:
For additional support, consult the API documentation or reach out to the Stagehand community.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "browserbase" '{"command":"npx","args":["-y","@browserbasehq/mcp-browserbase"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"browserbase": {
"command": "npx",
"args": [
"-y",
"@browserbasehq/mcp-browserbase"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"browserbase": {
"command": "npx",
"args": [
"-y",
"@browserbasehq/mcp-browserbase"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect