BLOG
Browserbase MCP: What It Is and How to Run It in Production
Browserbase MCP connects AI agents to hosted browsers. Learn how the MCP server works, its limits, and how to wire it to a production runtime.
# Browserbase MCP: What It Is and How to Run It in Production
Browserbase MCP is a Model Context Protocol server that exposes Browserbase's hosted browser sessions as tools an AI agent can call. Instead of writing Playwright or Puppeteer code yourself, you give the model a set of MCP tools — create a session, navigate, click, extract text — and the agent decides when to use them. It is a thin, opinionated layer between an LLM client (Claude Desktop, Cursor, a custom agent loop) and a remote Chromium instance.
That description already tells you where the trade-offs live. MCP is a tool-calling protocol, not a runtime. It standardizes *how* an agent asks for a browser action; it says nothing about session isolation, proxy quality, profile persistence, or what happens when a page takes 40 seconds to hydrate. Those are runtime concerns, and they decide whether your agent works in a demo or in production. This guide covers what Browserbase MCP actually does, where it fits, and how to connect an MCP-style agent to a hosted Chromium runtime you control.
What Browserbase MCP actually is
The Model Context Protocol, published by Anthropic, defines a client-server contract: a host application (the LLM client) connects to MCP servers that advertise tools, resources, and prompts. Browserbase ships an MCP server that wraps its browser API. When an agent calls a tool like browserbase_session_create or a page-interaction tool, the MCP server translates that call into an API request against a Browserbase session and returns the result as structured content the model can read.
Practically, that means:
- You get tool schemas for free. The MCP server declares its tools with JSON Schema, so any MCP-compatible client can discover and call them without custom glue code.
- The agent, not your code, sequences the actions. You describe a goal; the model picks tools. This is the same pattern as browser-use, just expressed through MCP instead of a Python loop.
- The browser is remote. Sessions run on Browserbase infrastructure, so you don't need a local Chrome install or a headless server on your laptop.
What you do *not* get from the protocol itself: a guarantee about latency, a cost model, or a debugging story. Those come from the provider behind the MCP server.
Where MCP fits in an agent stack
It helps to separate three layers that people often blur together:
| Layer | What it does | Examples |
|---|---|---|
| Agent framework | Decides *what* to do next | browser-use, LangGraph, a custom ReAct loop, Claude with tool use |
| Tool protocol | Standardizes *how* the agent calls tools | MCP, OpenAI function calling, raw JSON tool schemas |
| Browser runtime | Actually runs Chromium, manages sessions, proxies, profiles | Remote Browser, Browserbase, Browserless, self-hosted Playwright |
Browserbase MCP sits in the middle row. It is a protocol adapter plus a client for one specific runtime. If you swap the runtime — because of cost, latency, data residency, or a feature gap — you either need a different MCP server or you bypass MCP and call the runtime's API directly from your agent code.
This is the single most important architectural decision when you evaluate Browserbase MCP: do you want the protocol and the runtime bundled, or decoupled? Bundling is faster to start. Decoupling survives the first provider migration.
Setting up Browserbase MCP
The setup path is standard for MCP servers. You install or reference the server, add it to your client's MCP configuration with an API key and project ID, and restart the client. In Claude Desktop that means editing claude_desktop_config.json; in Cursor it's the MCP settings panel; in a custom agent you instantiate an MCP client and connect over stdio or SSE.
A minimal configuration looks like this:
{
"mcpServers": {
"browserbase": {
"command": "npx",
"args": ["-y", "@browserbasehq/mcp-server-browserbase"],
"env": {
"BROWSERBASE_API_KEY": "your-key",
"BROWSERBASE_PROJECT_ID": "your-project-id"
}
}
}
}Check the current package name and required environment variables against Browserbase's own docs before you ship — MCP servers move fast and argument names change. Once connected, the client lists the available tools and the model can call them.
Two practical notes from running MCP browser servers in anger:
- Tool output size matters. Page snapshots and accessibility trees are large. If your MCP server returns full DOM dumps, you will burn context window on every step. Prefer servers that return trimmed accessibility trees or extracted text.
- Timeouts are not optional. A tool call that hangs blocks the agent loop. Set client-side timeouts and make the agent handle a failed tool call as a recoverable state, not a crash.
The runtime questions MCP doesn't answer
Once the agent is calling tools, the hard problems start. These are the criteria that separate a working prototype from a system you can leave running overnight.
Session isolation and concurrency
Each agent task should get its own browser context. If two tasks share cookies or localStorage, you get cross-contamination that is maddening to debug — a login from task A leaks into task B and the agent "mysteriously" sees the wrong account. Ask how the runtime isolates sessions: separate browser processes, separate contexts, or shared contexts with cleanup. Also ask what concurrency you actually get at your tier; the number in the marketing page is usually the ceiling, not the default.
Persistent profiles and login state
Many real tasks need an authenticated session. Either the agent logs in each run (slow, fragile, CAPTCHA-prone) or you persist a profile with cookies and storage state. Persistent profiles are a runtime feature, not an MCP feature. If your MCP server can't attach to a saved profile, every run starts cold. Remote Browser supports persistent profiles you can reuse across sessions; check whether your chosen MCP server exposes that capability or whether you need to call the runtime API directly.
Proxies and network egress
IP reputation affects success rates more than most teams expect. A datacenter IP from a cloud region gets different treatment than a residential IP. Runtime providers differ in what proxy options they offer and how they're billed. If your workload touches sites with bot detection, proxy configuration is a first-class requirement, not an afterthought.
Live debugging
When an agent fails, you need to see *what the page looked like*. A live viewer — a URL you can open to watch the session in real time — turns a 30-minute log-reading session into a 30-second glance. Screenshots and session recordings cover the post-mortem case. Confirm your runtime gives you at least one of these; MCP tool output alone rarely tells you why a click didn't land.
Cost model
Browserbase prices per browser-hour with tiered plans; the specifics change, so read the current Browserbase pricing page rather than trusting a blog post. The structural question is whether you pay for wall-clock session time or for something else, and whether idle sessions bill. An agent that thinks for 20 seconds between actions is still holding a browser open. For current Remote Browser rates and metering details, see /pricing.
Connecting an MCP-style agent to a hosted runtime
If you want the MCP ergonomics without coupling to one provider, the pattern is to keep the tool layer thin and point it at a runtime you control. The runtime exposes CDP, so any Playwright or Puppeteer client can drive it. Here is a TypeScript example that connects Playwright to a hosted Chromium session over CDP and runs a simple extraction — the same primitive an MCP tool would call under the hood:
import { chromium, Browser, Page } from "playwright";
interface SessionInfo {
cdpUrl: string;
sessionId: string;
}
async function createSession(): Promise<SessionInfo> {
// Your runtime's session-creation endpoint. Replace with the
// actual API path and auth header from /documentation.
const res = await fetch("https://api.remote-browser.dev/v1/sessions", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.REMOTE_BROWSER_API_KEY}`,
},
body: JSON.stringify({
// configurable browser settings: region, proxy, profile
profileId: process.env.PROFILE_ID,
}),
});
if (!res.ok) {
throw new Error(`Session create failed: ${res.status} ${await res.text()}`);
}
const data = await res.json();
return { cdpUrl: data.cdpUrl, sessionId: data.id };
}
async function runTask(): Promise<string> {
const { cdpUrl, sessionId } = await createSession();
let browser: Browser | undefined;
try {
browser = await chromium.connectOverCDP(cdpUrl);
const context = browser.contexts()[0] ?? (await browser.newContext());
const page: Page = await context.newPage();
await page.goto("https://example.com", {
waitUntil: "domcontentloaded",
timeout: 30_000,
});
// Return a trimmed accessibility snapshot, not raw HTML.
// This is what keeps agent context small.
const snapshot = await page.accessibility.snapshot();
return JSON.stringify(snapshot).slice(0, 8_000);
} finally {
await browser?.close();
// Always release the session, even on failure, or you keep paying.
await fetch(`https://api.remote-browser.dev/v1/sessions/${sessionId}`, {
method: "DELETE",
headers: { Authorization: `Bearer ${process.env.REMOTE_BROWSER_API_KEY}` },
});
}
}
runTask()
.then((out) => console.log(out))
.catch((err) => {
console.error(err);
process.exit(1);
});The connectOverCDP call is documented in the Playwright CDP guide; the important detail is that you connect to an *existing* browser rather than launching one, which is exactly what a hosted runtime provides.
To expose this as an MCP tool, wrap runTask (or finer-grained steps) in a tool definition and register it with your MCP server. The agent then calls navigate, click, extract — and each call maps to a Playwright operation against the same CDP session. You keep the protocol benefits and the runtime flexibility.
Browserbase MCP vs. a decoupled runtime
Here is the comparison that matters when you're choosing, not the feature checklist.
| Criterion | Browserbase MCP (bundled) | Decoupled MCP + hosted runtime |
|---|---|---|
| Time to first working demo | Fast — one config block | Moderate — you write a thin tool wrapper |
| Provider lock-in | High — MCP server targets one API | Low — swap runtime behind the same tools |
| Tool granularity | Fixed by the server | You define it |
| Session/profile control | Whatever the server exposes | Full runtime API access |
| Debugging | Provider's viewer and logs | Runtime's viewer, plus your own logging |
| Cost visibility | Provider's billing model | Runtime's metering, see /pricing |
| Best for | Prototypes, single-provider stacks | Production agents, multi-provider or self-hosted plans |
Neither column is universally better. If you're validating an idea this week, the bundled path is correct. If you're building something that will run for months and may need to change infrastructure, the decoupled path costs you a day of setup and saves you a migration later.
Common failure modes and how to handle them
These show up regardless of which MCP server or runtime you pick.
- Context bloat from page snapshots. Cap the size of tool output. Return accessibility trees or extracted text, not
page.content(). - Silent timeouts. A navigation that never resolves should fail the tool call, not hang the loop. Set explicit timeouts on every Playwright call.
- Session leaks. If the agent errors out mid-task, the browser session stays open and bills. Use
try/finallyand a session-reaper job that kills sessions older than your task budget. - Stale profiles. A saved login that expires produces confusing failures. Have the agent detect login walls and re-authenticate rather than retrying the same click.
- Assuming the tool list is stable. MCP servers evolve. Pin versions in your config and read changelogs before upgrading.
For a broader treatment of the runtime layer these agents depend on, see Remote Browser for AI agents and the remote web browser overview. If you want to drive sessions interactively while debugging, remote control browser covers the live-viewer workflow.
Bottom line
Browserbase MCP is a reasonable way to give an MCP-compatible agent browser tools with minimal setup. It is a protocol adapter over one hosted runtime, and that bundling is both its convenience and its constraint. The questions that determine production success — session isolation, persistent profiles, proxy configuration, live debugging, and how you're billed for idle time — are runtime questions that MCP does not answer for you.
If you're prototyping, start with the bundled server. If you're building something durable, keep the tool layer thin, connect over CDP to a runtime you can change, and read the documentation for the session API and connection details before you commit.