
MCP server for AI browser automation using Stagehand - supports LOCAL mode without Browserbase cloud
概览
Run Stagehand browser automation locally without cloud services. A fork of the official @browserbasehq/mcp-server-browserbase with LOCAL mode support. The official Browserbase MCP server , requiring a paid Browserbase subscription. However, Stagehand itself fully supports local browser execution. - - Test browser automation without cloud costs - - Run on your own servers - - No external cloud dependency - - Automated testing without cloud API limits All original Browserbase MCP server options are supported: Once connected, your AI assistant can use these tools: In LOCAL mode, screenshots are automatically captured after each action for debugging and visualization: Parse the screenshot path programmatically: Playwright will download Chromium automatically.
README
以下为原文 README 节选,完整内容请查看原文。
Stagehand MCP Server - Local Mode
Run Stagehand browser automation locally without cloud services. A fork of the official @browserbasehq/mcp-server-browserbase with LOCAL mode support.
Why This Fork?
The official Browserbase MCP server only supports cloud mode, requiring a paid Browserbase subscription. However, Stagehand itself fully supports local browser execution.
This fork unlocks that capability:
| Feature | Official Version | This Fork |
|---|---|---|
| Browser execution | Browserbase Cloud only | Local Headless Chrome |
| Required credentials | BROWSERBASE_API_KEY + PROJECT_ID |
Only LLM API key |
| Cost | Browserbase subscription | Free (bring your own LLM key) |
| Network requirement | Internet required | Works offline/intranet |
| Auto screenshots | ❌ | ✅ After each action |
Use Cases
- Local development - Test browser automation without cloud costs
- Self-hosted AI agents - Run on your own servers
- Air-gapped environments - No external cloud dependency
- CI/CD pipelines - Automated testing without cloud API limits
Quick Start
Using npx (Recommended)
npx stagehand-mcp-local
Add to Claude Code
claude mcp add stagehand-local \
-e STAGEHAND_ENV=LOCAL \
-e OPENAI_API_KEY=your_key \
-- npx stagehand-mcp-local
Add to Cursor / VS Code
Add to your MCP configuration:
{
"mcpServers": {
"stagehand-local": {
"command": "npx",
"args": ["stagehand-mcp-local"],
"env": {
"STAGEHAND_ENV": "LOCAL",
"OPENAI_API_KEY": "your_openai_key"
}
}
}
}
Installation
npm (Global)
npm install -g stagehand-mcp-local
From Source
git clone https://github.com/weijiafu14/stagehand-mcp-local.git
cd stagehand-mcp-local
pnpm install
pnpm build
Configuration
Environment Variables
| Variable | Description | Default | Required |
|---|---|---|---|
STAGEHAND_ENV |
Set to LOCAL for local mode |
BROWSERBASE |
Yes |
OPENAI_API_KEY |
OpenAI API key | - | One of these |
GEMINI_API_KEY |
Google Gemini API key | - | is required |
ANTHROPIC_API_KEY |
Anthropic API key | - | for Stagehand |
HEADLESS |
Run browser headless | true |
No |
SCREENSHOT_ENABLED |
Enable auto screenshots | true |
No |
SCREENSHOT_DIR |
Screenshot save directory | /tmp/stagehand-screenshots |
No |
CLI Options
All original Browserbase MCP server options are supported:
npx stagehand-mcp-local --browserWidth 1920 --browserHeight 1080 --experimental
安装
npx stagehand-mcp-local配置
{
"mcpServers": {
"stagehand-local": {
"command": "npx",
"args": ["stagehand-mcp-local"],
"env": {
"STAGEHAND_ENV": "LOCAL",
"OPENAI_API_KEY": "your_openai_key"
}
}
}
}