Let your coding agent use the browser you are already signed into.
WebBrain MCP connects Codex, Claude Code, Cursor, OpenCode, and other stdio MCP clients to your real Chromium profile. After the one-time setup, just describe the browser job in normal language. Your coding agent chooses and calls the appropriate WebBrain tool; WebBrain performs the goal inside the browser with the same modes, origin permissions, and visible stop controls as the side panel.
Say “Use WebBrain to summarize the dashboard already open in my browser” or “Use WebBrain in Act mode to update this form.” Codex or Claude Code translates that request into the MCP call and returns the result in the same conversation. Function-shaped examples later in this guide show what happens under the hood and are mainly for debugging or client builders.
The bridge requires the extension’s offscreen document, so use Chrome, Edge, Brave, Opera, or Vivaldi. The Firefox extension remains fully usable on its own, but it cannot connect to this MCP server.
What starts where
Your MCP client launches the npm package as a local child process over stdio. That process listens only on 127.0.0.1:17374. The extension dials out to it, then carries each task through WebBrain’s agent loop in the selected browser tab.
The server is not a second browser and does not copy cookies. It is a local handoff point between the MCP client and the extension. The browser profile—and therefore the authenticated session—never moves.
Before you connect
| Requirement | What to check |
|---|---|
| Chromium browser | Chrome, Edge, Brave, Opera, or Vivaldi with the current WebBrain extension installed. |
| Node.js | Node 20 or newer. npx downloads and launches the package. |
| MCP client | A client that supports local stdio servers, such as Codex, Claude Code, Cursor, or OpenCode. |
| One free local port | 17374 must not already be held by another WebBrain MCP process. |
| An active WebBrain provider | The extension still needs a configured WebBrain Cloud, local, or API-backed model to perform the delegated task. |
Register the server with your MCP client
Use one of these client-specific configurations once. These are installation commands, not the way you request browser work. After registration, the client launches the server for you and you continue chatting normally; do not also keep a manual copy running on the same port.
Codex app, CLI, or IDE extension
codex mcp add webbrain -- npx -y @webbrain/mcp-serverCodex stores MCP servers in ~/.codex/config.toml; the app, CLI, and IDE extension on the same Codex host share that configuration. For long browser tasks, open that file and give the tool more than Codex’s default per-call budget:
[mcp_servers.webbrain]
command = "npx"
args = ["-y", "@webbrain/mcp-server"]
tool_timeout_sec = 360Restart the app or IDE extension after changing the file. In the CLI, run codex mcp list to confirm the entry and use /mcp inside a Codex session to inspect connected servers. See the official Codex MCP guide for the shared host configuration and all supported options.
Claude Code
claude mcp add --transport stdio webbrain -- npx -y @webbrain/mcp-serverThe explicit transport matches the current Claude Code MCP configuration. Run claude mcp list after adding it to inspect server health.
Cursor
Add a local stdio server in Cursor’s MCP settings, or place this in the MCP JSON file Cursor uses. The shape follows Cursor’s local MCP server format:
{
"mcpServers": {
"webbrain": {
"command": "npx",
"args": ["-y", "@webbrain/mcp-server"]
}
}
}OpenCode
Add this entry to ~/.config/opencode/opencode.json, using OpenCode’s local MCP server format:
{
"mcp": {
"webbrain": {
"type": "local",
"command": ["npx", "-y", "@webbrain/mcp-server"]
}
}
}Run it manually
Manual launch is useful for diagnosing the listener, but not required during normal MCP use:
npx -y @webbrain/mcp-serverLeave that terminal open. Closing it closes the bridge listener. From a source checkout, run npm install, npm run build, then npm start inside mcp-server/.
Point WebBrain at the local listener
- Start or restart your MCP client. Its WebBrain server must be running before the extension can connect.
- Open WebBrain Settings. Go to General → Advanced → Cloud bridge.
- Set the exact URL. Enter
ws://127.0.0.1:17374/extension. - Enable Cloud bridge. The status should move from connecting to connected. The name is historical: this destination is local.
- Verify end to end. Ask the MCP client to call
webbrain_connection. “Connected” proves the client, local server, WebSocket listener, and extension handshake are all present.
The extension holds one outbound bridge socket: WebBrain Cloud on 17373, this MCP server on 17374, or the LM Studio plugin on 17375. Changing the URL switches the destination; it does not multiplex them.
Describe the browser job in natural language
In Codex, Claude Code, Cursor, or OpenCode, write the request the same way you would give it to a teammate. Naming WebBrain makes your intent unambiguous; include the page, desired outcome, scope, and whether changes are allowed.
Read something without changing the page
Use WebBrain to read the Stripe dashboard already open in my browser. List failed payments from the last seven days with customer, amount, currency, date, and failure reason. Do not change anything.
Return predictable JSON
Use WebBrain to extract every overdue invoice from the dashboard already open in my browser. Return JSON with customer, amount, currency, due date, and invoice URL. Do not change anything.
Interact with the page
Use WebBrain in Act mode to open the customer record already visible in my browser and update the company name to Acme Europe. Stop before any final submit or confirmation.
The coding agent chooses webbrain_run for general reading or interaction and webbrain_extract when you request structured data. It supplies the arguments, monitors the run, and presents WebBrain’s result back in the conversation. Ask mode can read and extract; it cannot click, type, navigate, or submit. Act mode can interact, subject to WebBrain’s normal browser-side permissions.
For the first prompt above, the client will make a call similar to the following. This representation is useful when building or debugging an MCP client, but ordinary Codex and Claude Code users can ignore it.
webbrain_run(
task: "read the open Stripe dashboard and list failed payments from the last 7 days with customer, amount, currency, date, and failure reason",
mode: "ask"
)For a task that must interact, explicitly say “use WebBrain in Act mode” and keep the browser visible. WebBrain will apply its normal capability-by-origin approval prompts.
What your MCP client uses for you
You normally choose an outcome, not a tool. Codex or Claude Code reads these descriptions, selects the appropriate tool, fills its inputs from your request, and handles follow-up calls. This reference is here so you can understand or debug that behavior.
| Tool | Use it for | Important inputs |
|---|---|---|
webbrain_run | Any browser goal, read-only or interactive. | task, mode, optional tab_id, wait, timeout_seconds, and Act-only allow_api_mutations. |
webbrain_extract | Predictable JSON from authenticated page data. Always Ask mode. | task, output_schema, optional tab_id, wait, and timeout_seconds. |
webbrain_status | Poll one background run or list all known runs. | Optional run_id. Omit it to list runs. |
webbrain_respond | Pass the human’s answer back to a paused run. | run_id, clarify_id, answer, optional timeout_seconds. |
webbrain_abort | Stop a run that is wrong or no longer needed. | run_id. It does not undo actions already taken. |
webbrain_connection | Check the extension handshake and get a targeted fix when disconnected. | No inputs. |
WebBrain’s permission checks live in the extension agent loop. Exposing low-level primitives directly over MCP would sit below that boundary. These tools delegate a goal through the normal loop, preserving in-browser review while using fewer round trips and tokens.
Ask for structured JSON
In normal use, say what to extract and name the fields you want: “Use WebBrain to extract every overdue invoice from the open dashboard as JSON with customer, amount, currency, due date, and invoice URL.” Codex or Claude Code can translate those fields into the required schema and call webbrain_extract for you.
The function-shaped example below shows the equivalent tool call for client builders and debugging. Describe the selection logic in task; describe only the output shape in output_schema.
webbrain_extract(
task: "extract every overdue invoice visible in this account; preserve the displayed currency and use ISO dates where the page provides a full date",
output_schema: {
type: "object",
properties: {
invoices: {
type: "array",
items: {
type: "object",
properties: {
customer: { type: "string" },
amount: { type: "number" },
currency: { type: "string" },
due_date: { type: "string" },
invoice_url: { type: "string" }
},
required: ["customer", "amount", "currency", "due_date"]
}
}
},
required: ["invoices"]
}
)- Use an object root with explicit
propertiesandrequiredfields. - Ask for the narrowest data you need. A schema does not grant access to data that is not visible to the browser session.
- The tool is read-only, but the page text and result still travel to whichever LLM provider WebBrain is configured to use.
- If the result is too large for the run’s persisted snapshot, status can report that the stored result was truncated. Narrow the request and rerun.
Understand the run lifecycle
Codex and Claude Code normally manage this lifecycle for you: they wait for the result, show WebBrain’s clarification question when human input is needed, and continue with your answer. The explicit calls below are useful for client builders, troubleshooting, or deliberately prompting the client to start a long task in the background.
A foreground call waits by default. For long work, the client can set wait: false and poll with webbrain_status.
runningWork continues in the browserneeds_user_inputRelay the question to the humancompletedResult is readyfailedRead the error and evidenceabortedStopped; earlier actions remain# Tool-level reference
# Start without waiting
webbrain_run(task: "compare the invoices across all visible pages", mode: "ask", wait: false)
# Poll the returned ID
webbrain_status(run_id: "mcp_…")A WebBrain run timeout returns control to the MCP client but deliberately does not abort the browser task. Poll the returned run_id. This prevents a timeout from silently killing a task after it may already have taken a consequential action.
When WebBrain asks a question
A paused snapshot includes both a human-readable question and a clarify_id. Show the question to the user. Send their answer verbatim; do not infer it.
webbrain_respond(
run_id: "mcp_…",
clarify_id: "clarify_…",
answer: "Use the Acme EU account."
)Choose the smallest authority
| Choice | What it allows | Use when |
|---|---|---|
mode: "ask" | Reading, summarizing, comparing, and extracting. No page interaction. | You only need information. This is the default. |
mode: "act" | Navigation, clicking, typing, downloading, and form interaction through WebBrain’s permission gate. | The outcome requires visible browser actions. |
allow_api_mutations: true | Allows an Act run to use mutating HTTP requests when the UI path is unsuitable. | Rare, explicit exceptions. It is rejected in Ask mode and should stay off by default. |
MCP-client approval and WebBrain approval are separate layers. Your client may ask before it invokes webbrain_run; WebBrain may then ask before a consequential action on a particular origin. One approval does not replace the other.
Security boundaries you should keep
- Keep the listener local. It binds to
127.0.0.1. Do not forward port17374, publish it through a container bridge, or proxy it onto a network. - Loopback is not authentication. The extension sends an identifying handshake but no shared secret. A process already running as your local user could attempt to impersonate the extension or server. Treat local code and MCP packages as trusted software.
- Use Ask first. Read-only work is easier to verify and has a smaller blast radius.
- Keep the browser visible for Act. You can stop the run in the side panel, and unexpected navigation or typing should be treated as a reason to stop.
- Remember the provider boundary. The MCP bridge stays local, but page content is sent to the model provider configured in WebBrain. Use a local model when the content must remain on-device.
- Do not mistake a timeout for a rollback. Aborting stops future steps; it cannot undo a sent email, submitted form, purchase, or other completed action.
For the complete design, see the security model, privacy and data flow, and modes, safety, and privacy guide.
Troubleshooting by symptom
| Symptom | What it usually means | Fix |
|---|---|---|
| Connection error: WebSocket error | No process is listening at the configured URL. | Start or restart the MCP client, confirm port 17374, and leave the server process running. |
webbrain_connection says not connected | The local server exists, but the extension has not completed its handshake. | Use a Chromium browser, enable Cloud bridge, and set the exact /extension URL. |
EADDRINUSE or the server exits immediately | Another MCP client or manual server already owns port 17374. | Stop the other process. Only one WebBrain MCP server can own the default port at a time. |
| The MCP tools do not appear | The client has not reloaded its configuration or the npm process failed to start. | Restart the client, inspect its MCP server list/log, and confirm Node 20+ plus npm access. |
The tool returns running | The server or client wait budget expired; the browser run was intentionally left alive. | Poll webbrain_status with the returned ID, or start future long tasks with wait: false. |
The run says needs_user_input | WebBrain needs a human decision before it can continue. | Relay the exact question, then call webbrain_respond with the matching IDs. |
| Firefox never connects | Firefox has no offscreen-document bridge runtime. | Use Chrome, Edge, Brave, Opera, or Vivaldi for MCP. Firefox remains supported for direct side-panel use. |
| WebBrain Cloud or LM Studio disconnected | The MCP URL replaced the extension’s single bridge destination. | Switch the Cloud bridge URL back to port 17373 or 17375 when you are finished. |
Check the listener directly:
lsof -nP -iTCP:17374 -sTCP:LISTENNo output means nothing is listening. If a PID appears and you did not expect it, identify the process before stopping it.
Environment configuration
| Variable | Default | Meaning |
|---|---|---|
WEBBRAIN_BRIDGE_PORT | 17374 | Loopback port the extension connects to. |
WEBBRAIN_BRIDGE_PATH | /extension | WebSocket path; it must match Settings. |
WEBBRAIN_COMMAND_TIMEOUT_MS | 30000 | Budget for one bridge command and reply. |
WEBBRAIN_RUN_TIMEOUT_MS | 300000 | Default wait ceiling for a run or extraction. |
WEBBRAIN_POLL_INTERVAL_MS | 1000 | How often the server polls a running task. |
For a stdio client, set environment variables in that client’s MCP configuration. If you change the port or path, update the Cloud bridge URL in WebBrain Settings to match exactly.
What this server deliberately does not do
- It does not launch a headless browser or create a fresh browser profile.
- It does not work through the Firefox build.
- It does not export cookies, credentials, or session storage.
- It does not expose WebBrain’s roughly fifty click, type, frame, screenshot, network, and DOM primitives directly to the MCP client.
- It does not make the bridge safe to expose remotely.
- It does not remove the need for a configured model inside WebBrain.
If you need deterministic low-level browser automation in an isolated profile, a Playwright-style MCP server may fit better. Use WebBrain MCP when the defining requirement is your existing signed-in browser session plus WebBrain’s in-browser safety model.
