run, snapshot, and screenshot calls.
The marketplace plugin requires the first
@browserbasehq/stagehand-mcp@0.1.0 npm release. Until it is published, use the source workflow below.Install the plugin
In Claude Code, run:/mcp to check the Stagehand server. The plugin registers run, snapshot, and screenshot and keeps one browser alive across calls. You can use your existing Claude Code login; the plugin does not require a separate Anthropic API key.
You need Node.js 24+ and either local Chrome or a Browserbase credential. Export BROWSERBASE_API_KEY before starting Claude Code to use Browserbase. See below for optional STAGEHAND_* settings.
This uses Claude Code’s plugin marketplace. The Agent SDK example below is for embedding Claude in an application.
Source example prerequisites
- Node.js 24 or newer
- pnpm 11.10.0
- An Anthropic API key for the example agent
- A current Google Chrome installation for local browser mode
Run the Agent SDK example from source
1
Clone and build Stagehand
2
Configure the Claude Code agent
CLAUDE_STAGEHAND_MODEL to select another model; the example defaults to claude-sonnet-5.3
Choose the browser
The example defaults to Browserbase when
BROWSERBASE_API_KEY is set, otherwise it uses local Chrome:4
Run a browser task
Configuration
Keep the browser session alive
The example mounts one facade MCP server for the entirequery loop and limits allowedTools to the three mcp__stagehand__ tools. A canUseTool guard denies everything else, because headless runs hang on any unanswered permission prompt. Preserve that lifetime if you adapt the integration; a new process per tool call starts a new browser.
The MCP child receives only Stagehand and Browserbase configuration plus the process values required to launch Node. The host’s model credential remains in the Claude Code process.
Connect a running Claude Code CLI
The package ships a project-scoped.mcp.json that mounts the same facade server in the Claude Code CLI. Its args path is relative to the package, so start the CLI from that directory:
Claude Code integration source
Read the MCP mount, permission guard, and contract tests.

