MCP Server
Give AI coding assistants the ability to see and control a real browser. Works with Cursor, Claude Desktop, Windsurf, and any MCP-compatible client.
npx -y @browserbeam/mcp-server — no global install required.
What is MCP? #
The Model Context Protocol (MCP) is an open standard that lets AI agents call external tools. Instead of just generating text, the agent can take real actions — browse the web, fill forms, extract data.
The Browserbeam MCP Server exposes 19 tools that give your AI agent a real browser session. The agent decides which tool to call and when. You just describe what you want.
Setup for Cursor #
Add this to your ~/.cursor/mcp.json file. Create it if it doesn't exist.
{
"mcpServers": {
"browserbeam": {
"command": "npx",
"args": ["-y", "@browserbeam/mcp-server"],
"env": {
"BROWSERBEAM_API_KEY": "sk_live_your_key_here"
}
}
}
}
Restart Cursor. The Browserbeam tools appear in the MCP tools list automatically.
Setup for Claude Desktop #
Open the Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add the Browserbeam server to the mcpServers object:
{
"mcpServers": {
"browserbeam": {
"command": "npx",
"args": ["-y", "@browserbeam/mcp-server"],
"env": {
"BROWSERBEAM_API_KEY": "sk_live_your_key_here"
}
}
}
}
Restart Claude Desktop. You'll see the Browserbeam tools in the tool picker.
Setup for Windsurf #
Add this to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"browserbeam": {
"command": "npx",
"args": ["-y", "@browserbeam/mcp-server"],
"env": {
"BROWSERBEAM_API_KEY": "sk_live_your_key_here"
}
}
}
}
Restart Windsurf. The tools are available immediately.
Available Tools #
The MCP server exposes 19 tools. Your AI agent picks which tool to call based on your instructions.
| Tool | Description |
|---|---|
| browserbeam_create_session | Create a browser session, optionally navigate to a URL |
| browserbeam_navigate | Navigate to a new URL with optional wait conditions |
| browserbeam_observe | Get page content as markdown or HTML + interactive element refs |
| browserbeam_click | Click an element by ref, visible text, or label |
| browserbeam_fill | Fill a single field or an entire form at once |
| browserbeam_type | Type text character-by-character with real keyboard events |
| browserbeam_select | Select an option from a dropdown |
| browserbeam_check | Check or uncheck a checkbox or radio button |
| browserbeam_scroll | Scroll the page or scroll an element into view |
| browserbeam_scroll_collect | Scroll the entire page to load lazy content, then observe |
| browserbeam_wait | Wait for a selector, text, JS expression, or fixed delay |
| browserbeam_extract | Extract structured data from the page with a schema |
| browserbeam_execute_js | Run custom JavaScript in the browser page context |
| browserbeam_screenshot | Take a screenshot of the current page |
| browserbeam_pdf | Generate a PDF of the current page |
| browserbeam_upload | Upload files to a file input element |
| browserbeam_list_sessions | List your active browser sessions |
| browserbeam_get_session | Get the status and metadata of a session |
| browserbeam_close | Close a session and release resources |
browserbeam_create_session
Create a new browser session. Optionally navigate to a URL. The response includes page markdown and interactive element refs — use it as your first observation.
| Parameter | Type | Description |
|---|---|---|
| url | string | URL to navigate to after creating the session |
| viewport_width | number | Viewport width in pixels (default: 1280) |
| viewport_height | number | Viewport height in pixels (default: 720) |
| timeout | number | Session lifetime in seconds (default: 300) |
| auto_dismiss_blockers | boolean | Auto-dismiss cookie banners and popups (default: true) |
| user_agent | string | Custom User-Agent string |
| locale | string | Browser locale (e.g. "en-US") |
| timezone | string | Timezone ID (e.g. "America/New_York") |
| block_resources | string[] | Resource types to block: "image", "font", "media", "stylesheet", "script" |
| cookies | object[] | Cookie objects to inject. Each needs "name", "value", and "domain" or "url". |
browserbeam_observe
Re-read the current page state. Use scope to limit to a CSS container and reduce output. Switch to HTML format when you need tag/class names for building extract selectors.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| scope | string | CSS selector to scope observation to a page section |
| format | string | Content format: "markdown" (default) or "html" |
| max_text_length | number | Max content length in chars (default: 12000) |
browserbeam_click
Click an element on the page. Use a ref from the element list, or match by visible text or label.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| ref | string | Element ref from interactive_elements (e.g. "e1") |
| text | string | Visible text to click |
| label | string | Element label to click |
browserbeam_fill
Fill a form field or an entire form. Use fields to fill multiple fields at once.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| ref | string | Element ref to fill |
| label | string | Field label to fill |
| value | string | Value to fill into the field |
| fields | object | Label-value pairs to fill an entire form |
| submit | boolean | Submit the form after filling (default: false) |
browserbeam_extract
Extract structured data using a declarative schema. Selectors use CSS >> attribute syntax. Use _limit to test with a small sample before extracting a full list.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| schema | string | JSON extraction schema. Scalar: {"title": "h1 >> text"}. List: {"items": [{"_parent": ".card", "_limit": 3, "name": "h2 >> text", "url": "a >> href"}]}. Attributes: >> text, >> href, >> src, >> any HTML attribute. |
browserbeam_type
Type text character-by-character into an input. Fires real keyboard events for each character. Use for autocomplete or search-as-you-type inputs. Does not clear the field first (use fill for that).
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| ref | string | Element ref (e.g. "e1") |
| label | string | Field label to type into |
| value | string | Text to type |
| delay | number | Milliseconds between keystrokes (default: 50) |
browserbeam_select
Select an option from a <select> dropdown by its value.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| ref | string | Element ref (e.g. "e1") |
| label | string | Field label of the select element |
| value | string | Option value to select |
browserbeam_check
Check or uncheck a checkbox or radio button.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| ref | string | Element ref (e.g. "e1") |
| label | string | Element label |
| checked | boolean | Set to false to uncheck (default: true) |
browserbeam_scroll
Scroll the page by direction, to top/bottom, or scroll an element into view.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| direction | string | "up" or "down" |
| amount | number | Pixels to scroll (default: 500) |
| times | number | Repeat scroll N times (default: 1) |
| to | string | Jump to "top" or "bottom" |
| ref | string | Scroll element into view by ref |
| text | string | Scroll element into view by text |
| label | string | Scroll element into view by label |
browserbeam_scroll_collect
Scroll through the entire page to trigger lazy-loaded content, then return a unified observation. Ideal for infinite-scroll or long pages.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| max_scrolls | number | Safety limit on scroll iterations (default: 50) |
| wait_ms | number | Pause between scrolls in ms (default: 500) |
| timeout_ms | number | Total time budget in ms (default: 60000) |
| max_text_length | number | Content length limit (default: 100000) |
browserbeam_wait
Wait for a condition before continuing. Provide exactly one of: ms, selector, text, or until.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| ms | number | Fixed wait in milliseconds |
| selector | string | CSS selector to wait for |
| text | string | Wait for this text to appear on the page |
| until | string | JavaScript expression to wait for (must become truthy) |
| timeout | number | Max wait time in ms (default: 10000) |
browserbeam_execute_js
Run custom JavaScript in the browser page context. Use return to send values back. The return value appears in the extraction field under the result_key.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| code | string | JavaScript code to execute |
| result_key | string | Key name in extraction for the return value (default: "js_result") |
| timeout | number | Max execution time in ms (default: 10000) |
browserbeam_screenshot
Take a screenshot of the current page. Returns base64-encoded image data.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| full_page | boolean | Capture the full scrollable page (default: false) |
browserbeam_pdf
Generate a PDF of the current page. Returns base64-encoded PDF data.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| format | string | Paper size (default: "A4") |
| landscape | boolean | Landscape orientation (default: false) |
| print_background | boolean | Print background graphics (default: true) |
| scale | number | Scale factor 0.1–2 (default: 1) |
browserbeam_upload
Upload files to a <input type="file"> element. Provide file URLs that Browserbeam will download and attach.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
| ref | string | Element ref of the file input (e.g. "e1") |
| label | string | Label of the file input |
| files | string[] | Array of file URLs to download and attach |
browserbeam_list_sessions
List your browser sessions. Useful for checking which sessions are still active.
| Parameter | Type | Description |
|---|---|---|
| status | string | "active" or "closed" (default: all) |
| limit | number | Results per page, 1–100 (default: 25) |
browserbeam_get_session
Get the current status and metadata of a session, including start time and expiry.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
browserbeam_close
Close a browser session and release resources. Stops the billing clock.
| Parameter | Type | Description |
|---|---|---|
| session_id | string | Session ID (ses_...) |
How It Works #
When you ask your AI agent to do something in a browser, the flow looks like this:
- You describe a task in natural language. The AI agent decides which tool to use.
- The agent calls a Browserbeam tool through MCP (e.g.
browserbeam_create_session). - The MCP server sends the request to the Browserbeam API over HTTPS.
- Browserbeam spins up a real Chromium browser and executes the action.
- The API returns structured data: page content as markdown, element refs, extracted data, or screenshots.
- The agent reads the response, reasons about the result, and decides the next step.
Example Conversation #
Here's how an AI agent uses the tools in sequence. You say "Search Hacker News for posts about browser automation." The agent handles the rest.
Create session and navigate
{
"tool": "browserbeam_create_session",
"params": {
"url": "https://news.ycombinator.com/"
}
}
Returns page markdown + element refs like [e1] <a> Hacker News, [e42] <input> Search...
Extract top stories from the front page
{
"tool": "browserbeam_extract",
"params": {
"session_id": "ses_abc123",
"schema": "{\"stories\": [{\"_parent\": \".titleline\", \"title\": \"a >> text\", \"url\": \"a >> href\"}]}"
}
}
Returns structured JSON: {"stories": [{"title": "Show HN: ...", "url": "https://..."}, ...]}
Fill the search form and submit
{
"tool": "browserbeam_fill",
"params": {
"session_id": "ses_abc123",
"fields": {"q": "browser automation"},
"submit": true
}
}
Fills the search input and submits the form. Page navigates to search results.
Take a screenshot
{
"tool": "browserbeam_screenshot",
"params": {
"session_id": "ses_abc123"
}
}
Returns a base64 PNG of the current viewport.
Close the session
{
"tool": "browserbeam_close",
"params": {
"session_id": "ses_abc123"
}
}
Session destroyed. Billing stops.
The agent responds with a summary of the top results about browser automation from Hacker News. Five tool calls, zero code written by you.
Environment Variables #
| Variable | Required | Description |
|---|---|---|
| BROWSERBEAM_API_KEY | Required | Your Browserbeam API key. Get one from the dashboard. |
| BROWSERBEAM_BASE_URL | Optional | API base URL. Defaults to https://api.browserbeam.com. |
Troubleshooting #
"BROWSERBEAM_API_KEY environment variable is required."
The env block is missing or the key is empty. Double-check your config file. Make sure there are no trailing spaces or line breaks in the key value.
"npx: command not found"
Node.js is not installed or not in your PATH. Install Node.js 18+ from nodejs.org. Then restart your AI client.
Server not connecting / tools not appearing
Verify the config file path is correct for your client. Common fixes:
- Restart your AI client after editing the config file.
- Ensure the JSON is valid (no trailing commas, correct brackets).
- Test the server directly:
BROWSERBEAM_API_KEY=sk_live_... npx -y @browserbeam/mcp-server
API errors (401, 403, 429)
401 — Invalid API key. Check that you're using a live key starting with sk_live_.
403 — Your plan doesn't support this feature. Check your dashboard.
429 — Rate limit exceeded. Wait a moment and try again, or upgrade your plan.