> ## Documentation Index
> Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up Browserbase MCP Server

> Connect Browserbase as a remote MCP server on the TrueFoundry MCP Gateway so agents can drive a cloud browser, extract data, and take screenshots.

[Browserbase](https://www.browserbase.com) provides cloud browsers that AI agents can control. Its official remote MCP server is built on [Stagehand](https://docs.stagehand.dev), so agents interact with pages using natural language instead of brittle selectors. Register it on the TrueFoundry MCP Gateway so your agents can open a session, navigate to any URL, act on the page, observe actionable elements, and extract structured data through governed access.

Browserbase is available in TrueFoundry's **Official Remote MCP Servers** catalog. It needs your own Browserbase API key and project ID, which you supply once when registering the server.

## Using Browserbase through the MCP Gateway

The [TrueFoundry MCP Gateway](/docs/ai-gateway/mcp/mcp-overview) centralizes access to Browserbase - agents connect through one endpoint instead of maintaining separate server configurations per client.

When you use Browserbase MCP server through the AI Gateway, TrueFoundry provides:

* **Authentication** - Clients [authenticate inbound](/docs/ai-gateway/mcp/mcp-gateway-auth-security#inbound-authentication) to the AI Gateway with a Personal Access Token, Virtual Account, or IDE OAuth flow. For outbound access, your Browserbase API key and project ID are configured once on the server and injected on outbound calls.
* **Tool-level access control** - You can selectively enable or disable individual Browserbase tools from the TrueFoundry UI.
* **Access control** - [Collaborators and role-based policies](/docs/ai-gateway/mcp/mcp-gateway-auth-security#access-control) define who can use the server and which tools they can invoke. Enable or disable individual Browserbase tools from the server detail page.
* **Observability** - Tool calls are traced with caller identity, tool name, inputs, and latency. Monitor server- and tool-level usage in [MCP Metrics](/docs/ai-gateway/analytics-mcp-metrics) and export traces to your observability stack via OpenTelemetry.
* **Guardrails** - Apply [pre-tool and post-tool guardrails](/docs/ai-gateway/guardrails-overview) on MCP tool calls.

## Prerequisites

* A TrueFoundry account with permission to add MCP servers.
* A [Browserbase account](https://www.browserbase.com).
* A Browserbase **API key** and **project ID**.

Both live on the Browserbase dashboard under **Settings → General**. Copy the **Project ID** and reveal and copy the **API key**, then paste them into the server URL when registering Browserbase in TrueFoundry.

![Browserbase dashboard Settings General page showing the Project ID and API key fields](https://mintcdn.com/truefoundry/jyc1A4wSStpQVwOT/images/docs/ai-gateway/browserbase-api-key.png?fit=max\&auto=format\&n=jyc1A4wSStpQVwOT\&q=85\&s=175d508bc1c9751d7f8b6ca3d18d95e7)

> [!WARNING]
>
> Keep the API key secret. Anyone with it can drive cloud browsers in your Browserbase project. Rotate it from this page if it is ever exposed.

## Adding Browserbase MCP server to TrueFoundry

**1. Open the MCP Server catalog**

Navigate to **MCP Servers** in the TrueFoundry sidebar and click **Add new MCP Server**. On the next screen, select **Connect Official Remote MCP Servers** - this lists official, vetted remote MCP servers that you connect with your own auth.

**2. Add Browserbase**

Find **browserbase** in the catalogue and click **+ Add**. TrueFoundry opens the Browserbase MCP server detail page with the server URL pre-filled.

**3. Configure the server**

TrueFoundry pre-fills the server details for Browserbase. Add your Browserbase API key and project ID to the URL:

| Field | Value |
| - | - |
| **Name** | `browserbase` |
| **Description** | Cloud browser automation via Browserbase and Stagehand |
| **URL** | `https://mcp.browserbase.com/mcp?browserbaseApiKey=YOUR_BROWSERBASE_API_KEY&browserbaseProjectId=YOUR_PROJECT_ID` |

Add **Collaborators** - the users and teams that can use or manage this server - and assign each an **MCP Server Manager** or **MCP Server User** role. Because the credentials travel in the URL, leave **Auth Data** toggled off. Click **Update MCP Server** to save.

> [!TIP]
>
> Prefer configuration as code? Click **Apply using YAML** and paste the spec in [Configuring the server URL](#configuring-the-server-url) below.

**4. Verify tools**

After saving, the **Tools** tab lists Browserbase's available tools (`start`, `end`, `navigate`, `act`, `observe`, and `extract`). Click **Try** on any tool to test it and inspect the JSON output before using it in an agent.

![Browserbase Tools tab populated with tools after a successful connection](https://mintcdn.com/truefoundry/jyc1A4wSStpQVwOT/images/docs/ai-gateway/browserbase-tools-list.png?fit=max\&auto=format\&n=jyc1A4wSStpQVwOT\&q=85\&s=9ee2efff4333d05007bbced974942e43)

## Configuring the server URL

Browserbase reads the project from the `browserbaseProjectId` query parameter and authenticates with your API key. The simplest option for the TrueFoundry catalog is to pass both in the URL:

```
https://mcp.browserbase.com/mcp?browserbaseApiKey=YOUR_BROWSERBASE_API_KEY&browserbaseProjectId=YOUR_PROJECT_ID
```

The equivalent YAML for the **Apply using YAML** option:

```yaml theme={"dark"}
url: >-
  https://mcp.browserbase.com/mcp?browserbaseApiKey=YOUR_BROWSERBASE_API_KEY&browserbaseProjectId=YOUR_PROJECT_ID
name: browserbase
type: mcp-server/remote
description: >-
  Cloud browser automation via Browserbase and Stagehand, navigate pages,
  extract data, take screenshots, and perform web actions
collaborators:
  - role_id: mcp-server-manager
    subject: user:you@your-company.com
```

> [!NOTE]
>
> Browserbase also accepts the API key as an HTTP header, `Authorization: Bearer YOUR_BROWSERBASE_API_KEY` or `x-bb-api-key: YOUR_BROWSERBASE_API_KEY`. The `browserbaseApiKey` query parameter shown above is Browserbase's fallback for clients that can't send custom headers. Keep the project ID (`browserbaseProjectId`) in the URL either way.

> [!WARNING]
>
> Your Browserbase API key grants access to your cloud browsers and any credentials in your Browserbase projects. Treat it as a secret, restrict who has the **MCP Server Manager** role, and rotate the key from the Browserbase dashboard if it is exposed.

## Connecting to an MCP Client

Open the **How To Use** tab on the Browserbase server detail page for your tenant-specific Gateway URL and ready-to-paste client snippets - don't build the endpoint manually.

The tab includes snippets for Claude Code, VS Code, Claude Web, Claude Desktop, Cursor, Windsurf, Codex, and the Python and TypeScript MCP SDKs. Use **Show API Key** if your client requires a Gateway token in a header.

## Using the Tool Playground

Before deploying an agent, you can test any Browserbase MCP server tool directly in TrueFoundry:

**1. Open a tool**

On the Browserbase MCP server detail page, click **Try** next to any tool - for example `start`.

**2. Fill in the inputs**

Provide the tool's inputs. A quick end-to-end check: run `start`, then `navigate` to a URL, then `extract` to confirm the session drives a real cloud browser.

**3. Execute and inspect**

Click **Execute Tool** and inspect the JSON output in the right panel.

## Tool Metrics

The **Tool Metrics** tab on the Browserbase server detail page tracks how agents use each tool:

* **Invocation count** - which tools are called most often
* **Latency** - how long each tool takes to respond
* **Error rates** - which tools are failing in production

See [MCP Metrics](/docs/ai-gateway/analytics-mcp-metrics) for server- and tool-level dashboards across your Gateway.

## Disabling Individual Tools

On the **Tools** tab, toggle off any Browserbase tools your agents don't need:

* **Disabled tools** are hidden from MCP clients and cannot be invoked.
* **Enabled tools** remain available to agents as usual.

For example, disable `act` for read-only research agents that should only `navigate`, `observe`, and `extract`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.