← Blog

BLOG

MCP Use: Running Browser Tools for AI Agents in Production

Learn what MCP use looks like for browser automation, how MCP servers drive real Chromium, and how to run MCP browser tools on a hosted runtime.

9 min readRemote Browser
Ivory computer towers connected across terracotta platforms in a quiet desert landscape
The infrastructure behind your browserREMOTE BROWSER / ILLUSTRATION

MCP use is the practice of connecting a model to external tools through the Model Context Protocol, a JSON-RPC interface that lets an agent discover and call capabilities it does not have natively. For browser work, MCP use means an agent calls a browser MCP server to navigate pages, click elements, read the DOM, or take screenshots instead of guessing at raw HTML. This guide covers how that works, where it breaks in production, and how to run MCP browser tools against hosted Chromium rather than a laptop.

The short version: MCP is a transport and tool-description layer, not a browser. The browser still has to live somewhere. That "somewhere" is the decision that determines whether your agent is reliable at scale.

What MCP use actually means

The Model Context Protocol standardizes three things:

  • Tool discovery. A server advertises tools with names, descriptions, and JSON schemas. The model reads those schemas and decides what to call.
  • Invocation. The client sends a tools/call request over stdio or HTTP, and the server executes it.
  • Results. The server returns structured content the model can reason over.

For browser automation, an MCP server wraps a browser driver. Common examples include Chrome DevTools MCP and Playwright MCP. Both expose browser actions as tools, but they differ in what they wrap and how they connect to a browser instance.

The important distinction for production: MCP use is the interface, not the runtime. A browser MCP server still needs a Chromium process, a CDP endpoint, and a session lifecycle. If that browser runs locally, your agent inherits every local constraint — one machine, one profile, no isolation between tasks, and no way to scale past what the host can hold.

How a browser MCP server reaches a browser

Most browser MCP servers follow one of two patterns.

Pattern 1: Launch a local browser. The server spawns Chromium on the same machine and drives it over CDP. Simple to start, but the browser is tied to the process. Restart the server and the session is gone. Run two agents and they fight over the same profile.

Pattern 2: Connect to a remote CDP endpoint. The server attaches to an existing browser over a WebSocket CDP URL. This is the pattern that scales, because the browser can live on a different host, be isolated per session, and outlive the MCP server process.

The second pattern is where hosted runtimes fit. Remote Browser provides hosted Chromium sessions with CDP access, so an MCP server configured with a remote endpoint gets a real browser without managing the infrastructure underneath.

The CDP connection under the hood

Whether the MCP server launches locally or connects remotely, the underlying protocol is the same. Chrome DevTools Protocol exposes domains like Page, Runtime, DOM, and Network. Playwright's connectOverCDP is the most common way to attach to a remote endpoint from a Node process. Here is what that looks like when you wire it to a hosted session:

import { chromium, Browser, Page } from "playwright";

// Endpoint and auth come from your Remote Browser session.
// Never hardcode credentials; load them from the environment.
const cdpEndpoint = process.env.REMOTE_BROWSER_CDP_URL;
const apiKey = process.env.REMOTE_BROWSER_API_KEY;

if (!cdpEndpoint || !apiKey) {
  throw new Error("Missing REMOTE_BROWSER_CDP_URL or REMOTE_BROWSER_API_KEY");
}

async function openSession(): Promise<{ browser: Browser; page: Page }> {
  const browser = await chromium.connectOverCDP(cdpEndpoint, {
    headers: { Authorization: `Bearer ${apiKey}` },
    timeout: 30_000,
  });

  // Reuse the existing context if the session already has one.
  const context = browser.contexts()[0] ?? (await browser.newContext());
  const page = context.pages()[0] ?? (await context.newPage());

  await page.goto("https://example.com", { waitUntil: "domcontentloaded" });
  return { browser, page };
}

async function main() {
  const { browser, page } = await openSession();
  try {
    const title = await page.title();
    console.log("Page title:", title);
  } finally {
    // Disconnect the client; the hosted session lifecycle is managed separately.
    await browser.close();
  }
}

main().catch((err) => {
  console.error(err);
  process.exit(1);
});

Two details matter here. First, connectOverCDP attaches to an existing browser — it does not launch one. Second, closing the Playwright client does not necessarily terminate the hosted session; session teardown is a separate API call. That separation is what lets you keep a profile alive across agent turns. See the Playwright CDP documentation for the full option set.

Where MCP use breaks in production

MCP works well in a demo. In production, four failure modes show up repeatedly.

1. Session lifecycle drift

If the MCP server owns the browser process, a server crash kills the session. If the server connects to a remote endpoint, the session can outlive the server — but now you need explicit create/stop calls and a way to reclaim orphaned sessions. Without that, you leak browser-hours.

2. Profile and state collisions

Agents that log into sites need persistent profiles. If every MCP call spins up a fresh browser, the agent re-authenticates on every turn. If every call shares one profile, concurrent tasks corrupt each other's cookies. The fix is per-session isolation with opt-in profile reuse.

3. Tool-call latency and token cost

MCP tool results go back into the model's context. A tool that returns a full DOM snapshot on every call burns tokens fast. Good browser MCP servers return scoped results — an accessibility tree, a specific element's text, or a screenshot — rather than the whole page. This is a server design choice, not something MCP enforces.

4. Debugging blind

When an agent fails mid-task, you need to see what the browser saw. A live viewer and session recordings turn a 40-minute log dive into a 30-second check. Local MCP setups usually lack this; hosted runtimes typically provide it.

Local browser MCP vs hosted Chromium

The table below compares the two deployment models on the criteria that matter once you move past a single developer machine.

CriterionLocal browser MCPHosted Chromium via CDP
Browser locationSame host as the MCP serverRemote, isolated per session
ScalingBounded by host resourcesSession-per-task, horizontally scalable
Session persistenceTied to server processIndependent lifecycle, survives client restarts
Profile isolationManual, error-pronePer-session by default, reusable profiles optional
DebuggingLocal DevTools onlyLive viewer, recordings, CDP inspection
Network egressYour machine or CI runnerProvider-managed, configurable proxy settings
Ops burdenYou patch, restart, and monitor ChromiumProvider handles browser lifecycle
Cost modelCompute you already pay forMetered browser-hours; see /pricing

Neither column is universally better. A developer debugging a single flow on their laptop is fine with local. A team running many agent tasks a day is not.

Choosing a browser MCP server

If you are evaluating MCP browser tools, check these properties before committing.

  • Transport support. Does it speak stdio for local clients and HTTP for remote clients? Many agent frameworks prefer one or the other.
  • Remote endpoint support. Can you point it at a CDP URL, or is it hardwired to launch a local browser? The latter blocks hosted runtimes.
  • Tool granularity. Are tools scoped (click, type, read element) or coarse (run arbitrary script)? Scoped tools are safer and cheaper in tokens.
  • Result shaping. Does it return accessibility trees or raw HTML? Trees are smaller and more model-friendly.
  • Auth handling. Can it pass headers to the CDP endpoint, or does it assume no auth? Hosted endpoints need bearer tokens or signed URLs.

Chrome DevTools MCP and Playwright MCP both cover the basics. The differentiator is usually how they connect, not what tools they expose.

Wiring MCP use to a hosted runtime

The integration is straightforward once you separate the MCP server from the browser.

  1. Create a session. Call the Remote Browser API to start a hosted Chromium session. You get back a CDP WebSocket URL and a session ID.
  2. Configure the MCP server. Point it at the CDP URL with the required auth header. If the server does not support remote endpoints, use a thin adapter that calls connectOverCDP and exposes the same tool surface.
  3. Run the agent. The model calls MCP tools; the server translates them into CDP commands against the hosted browser.
  4. Inspect and stop. Use the live viewer to watch the session, then call the stop endpoint to release the browser-hour.

For a deeper walkthrough of the runtime model, see Remote Browser for AI Agents. If you are comparing hosted options, Remote Browser Online covers what to evaluate.

A note on profiles and proxies

Persistent profiles let an agent keep cookies and local storage across sessions, which is essential for logged-in workflows. Configurable browser settings — including proxy configuration — let you route traffic through the network you need. Be precise about what you claim: these are configurable settings, not guarantees of undetectability. Treat stealth as a spectrum you tune, not a switch you flip.

Production checklist for MCP browser tools

Before you ship an agent that uses MCP for browser work, confirm the following.

  • [ ] The MCP server can connect to a remote CDP endpoint with auth headers.
  • [ ] Session creation and teardown are explicit API calls, not side effects of the MCP process.
  • [ ] Each task gets an isolated session; profile reuse is opt-in and scoped.
  • [ ] Tool results are scoped to what the model needs, not full-page dumps.
  • [ ] You have a live viewer or recording path for post-mortem debugging.
  • [ ] Browser-hour usage is metered and visible; check /pricing for current rates.
  • [ ] Proxy and browser settings are configured per workload, not globally.
  • [ ] You have a retry policy for CDP disconnects that does not orphan sessions.

When MCP is the wrong layer

MCP is a good fit when a model needs to decide *which* browser action to take next. It is a poor fit when the action sequence is already known. If you have a deterministic script — log in, navigate, extract a table — skip the model and the MCP server. Use Playwright or Puppeteer directly against the hosted CDP endpoint. You will get lower latency, lower cost, and fewer failure modes.

MCP use earns its overhead when the task is open-ended: research, form filling across unfamiliar sites, or multi-step workflows where the next step depends on what the page shows. In those cases, the tool-description layer is doing real work.

Bottom line

MCP use for browser automation is a two-part decision: which MCP server exposes the tools, and where the browser actually runs. The first is a library choice you can swap. The second is an infrastructure choice that shapes reliability, cost, and debuggability. Hosted Chromium with CDP access gives you the isolation, persistence, and observability that local browser MCP setups cannot provide at scale. Start with the documentation to see the session API, then wire your MCP server to a remote endpoint and measure what changes.