stagehand-repl-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@stagehand-repl-mcpOpen https://news.ycombinator.com and extract the top 3 story titles"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
stagehand-repl-mcp
An MCP server that gives an LLM agent (Claude Code, Claude Desktop, or any MCP client) a persistent, scriptable browser via Stagehand.
Instead of exposing one MCP tool per browser action (click, type, goto, ...), it exposes a single stagehand_eval tool that runs arbitrary JavaScript against a live Stagehand + Playwright session. The agent writes short async code snippets — await page.goto(...), await stagehand.act(...), await stagehand.extract(...) — and gets structured JSON back. The browser stays open between calls, so cookies, logins, and page state persist for the whole session.
No child process, no socket, no polling — Stagehand runs directly inside the MCP server process, and the browser launches lazily on the first tool call.
Why
Browser-automation MCP servers usually wrap Playwright/Puppeteer 1:1 into dozens of tools (browser_click, browser_type, browser_screenshot, ...). That's a lot of round trips for anything beyond a single action, and it pushes all the sequencing logic onto the client. This server instead gives the agent a REPL: it can chain steps, branch on results, and use Stagehand's AI-driven act/extract/observe primitives inline, in one call.
Related MCP server: Browserbase MCP Server
How it works
patchright launches a persistent, stealth-patched Chromium/Chrome profile and exposes it over CDP.
Stagehand connects to that browser via
cdpUrland provides the AI-drivenact/extract/observe/agentprimitives on top of plain Playwright.Stagehand's LLM calls go through the Vercel AI SDK's Anthropic provider, pointed at any Anthropic-compatible endpoint (this was built against MiniMax's Anthropic-compatible API, but any compatible provider works by changing
MODEL_BASE_URL/MODEL_NAME).A small
Proxypatches tool-call arguments in the model's responses on the fly — a workaround for providers that returnargumentsas a raw string instead of a JSON array, which trips up Stagehand's tool-calling loop.Submitted code runs as the body of a generated
async function, withstagehand,page,context,z(Zod), andscreenshot()in scope — an ad hoc REPL without an actual REPL process.
Install
git clone https://github.com/<you>/stagehand-repl-mcp.git
cd stagehand-repl-mcp
npm installConfigure
Point your MCP client (e.g. Claude Code's mcpServers config) at the script:
{
"mcpServers": {
"stagehand-repl": {
"command": "node",
"args": ["/path/to/stagehand-repl-mcp/stagehand-mcp.mjs"],
"env": {
"MINIMAX_API_KEY": "sk-..."
}
}
}
}Environment variables
Variable | Default | Description |
| (required) | API key for the Anthropic-compatible LLM endpoint |
|
| Model name passed to the provider |
|
| Base URL of the Anthropic-compatible API |
|
| Set to |
|
| Local CDP debugging port |
|
| Persistent Chrome profile directory (cookies, logins) |
Tools
stagehand_eval
Executes JavaScript as an async function body, with these globals in scope:
stagehand— the Stagehand instance (act,extract,observe,agent)page— the PlaywrightPage(goto,click,fill,content,url, ...)context— the PlaywrightBrowserContext(pages,newPage,cookies)z— Zod, for building extraction schemasscreenshot(path?)— saves a full-page screenshot, returns the path
// Navigate and read the URL
await page.goto('https://example.com')
return await page.url()
// AI-driven interaction
await stagehand.act('Click the login button')
// AI-driven structured extraction
const data = await stagehand.extract(
'Get the page title',
z.object({ title: z.string() })
)
return datastagehand_screenshot
Takes a full-page screenshot and returns it as an inline image.
stagehand_close
Closes the browser and resets the session. The browser relaunches lazily on the next stagehand_eval / stagehand_screenshot call.
Status
This was built as a personal tool and isn't under active development — it's shared as-is for reference. Issues and PRs may not get fast turnaround.
License
MIT — see LICENSE.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables LLMs to control cloud browsers for web automation, data extraction, screenshots, and form interactions using Browserbase and Stagehand with support for multiple AI models and parallel browser sessions.Last updated173,396Apache 2.0
- AlicenseAqualityDmaintenanceEnables cloud browser automation through Browserbase and Stagehand, allowing LLMs to navigate web pages, extract data, take screenshots, fill forms, and perform automated web interactions with multi-session support.Last updated143,396Apache 2.0
- AlicenseAqualityDmaintenanceEnables cloud browser automation through Browserbase and Stagehand, allowing LLMs to interact with web pages, take screenshots, extract data, and perform automated actions with support for proxies, stealth mode, and parallel sessions.Last updated144,960Apache 2.0
- Alicense-qualityDmaintenanceEnables local browser automation using Stagehand without cloud services. Supports navigation, data extraction, and autonomous agent tasks through natural language.Last updatedApache 2.0
Related MCP Connectors
Provides cloud browser automation capabilities using Stagehand and Browserbase, enabling LLMs to i…
AI-powered browser automation — navigate, click, fill forms, and extract data from any website.
Reliable web access for AI agents: smart HTTP, rotating proxies, and full-browser rendering.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/srozov/stagehand-repl-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server