Browser MCP
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Browser MCP
Browser MCP is an Electron-based Model Context Protocol server that gives MCP clients control over a real local browser window. It exposes tools for starting browser sessions and for running page actions: accessibility snapshots with element refs, real mouse and keyboard input, forms, frames and shadow DOM, uploads and downloads, cookies and storage, console and uncaught errors, and network inspection, mocking, and blocking.
The package is published on NPM as @cypherpotato/browser-mcp.
Contents
Related MCP server: chrome-mcp
How it works
Browser MCP has two runtime layers:
A Node entrypoint named
browser-mcp-electron.An Electron browser host that opens and controls real browser windows.
By default, MCP clients should start the package with --mcp. That command starts or reuses a local HTTP sentinel, then proxies MCP messages over stdin/stdout for the client.
flowchart LR
Client["MCP client"] --> Stdio["browser-mcp-electron --mcp"]
Stdio --> Sentinel["Local HTTP sentinel"]
Sentinel --> Electron["Electron browser host"]
Electron --> Page["Live browser session"]The sentinel stores its current local endpoint in the operating system temp directory under browser-mcp-electron-sessions/sentinel.json. The server only listens on 127.0.0.1.
Requirements
Node.js 18 or newer.
npm or another Node package manager.
A desktop session capable of running Electron.
Linux only: the usual Electron runtime libraries for your distribution.
Installation
Install globally if your MCP client will call the binary directly:
npm install -g @cypherpotato/browser-mcpOr run it without a global install:
npx @cypherpotato/browser-mcp --helpTo verify the binary:
browser-mcp-electron --helpMCP client configuration
Use the stdio bridge mode for normal MCP client integration:
{
"mcpServers": {
"browser": {
"command": "browser-mcp-electron",
"args": ["--mcp"]
}
}
}With npx:
{
"mcpServers": {
"browser": {
"command": "npx",
"args": ["-y", "@cypherpotato/browser-mcp", "--mcp"]
}
}
}Optional startup URL and profile directory:
{
"mcpServers": {
"browser": {
"command": "browser-mcp-electron",
"args": [
"--mcp",
"--url",
"https://example.com",
"--data-dir",
"~/.browser-mcp"
]
}
}
}Running the HTTP sentinel
For normal MCP client usage, configure the client to run browser-mcp-electron --mcp. That command starts the HTTP sentinel automatically when needed and reuses a healthy sentinel when one already exists.
Run the HTTP sentinel manually only when you want to manage the browser host separately from an MCP stdio client.
Start it in the foreground:
browser-mcp-electron --mcp-http --url https://example.com --data-dir ~/.browser-mcpStart it in the background and return after it is healthy:
browser-mcp-electron --mcp-http-background --url https://example.com --data-dir ~/.browser-mcpThe local sentinel uses port 55332 by default so the Session Copy browser extension can discover it. Override the port when needed:
browser-mcp-electron --mcp-http-background --sentinel-port 55333When --mcp runs later, it reuses a healthy sentinel when one exists on the requested port. If no healthy sentinel exists, it starts one automatically.
CLI reference
browser-mcp-electron [--mcp] [--url <url>] [--data-dir <path>]
browser-mcp-electron --mcp-http [--url <url>] [--data-dir <path>]
browser-mcp-electron --mcp-http-background [--url <url>] [--data-dir <path>]
browser-mcp-electron --mcp-stdio [--url <url>] [--data-dir <path>]Option | Description |
| Starts or reuses the local HTTP sentinel and proxies MCP over stdin/stdout. Recommended for MCP clients. |
| Starts or reuses only the local HTTP MCP sentinel and keeps the process alive. |
| Starts or reuses the local HTTP MCP sentinel, then returns after it is healthy. |
| Starts the legacy MCP server directly over stdin/stdout. |
| Initial browser URL. Defaults to |
| Browser profile/session directory. Defaults to |
| Port for the HTTP sentinel. Defaults to |
| Comma-separated helpers that must be confirmed before they run. See Action confirmation. |
| Prints the CLI help. |
Tools
browser_toggle_session
Starts or stops a real Electron browser session.
Start a session:
{
"action": "start",
"start_url": "https://example.com"
}Stop a session:
{
"action": "stop",
"session_id": 1
}browser_import_session
Opens a new agent browser window and imports a Session Copy extension payload, including its URL, cookies, localStorage, and sessionStorage. The page is loaded, its storage is written, and it is reloaded. A JavaScript dialog the page opens during the first load is dismissed; the one it opens after the reload is reported as pendingDialog by the next browser_run_actions call. A page that opens a dialog again every time it is dismissed cannot be imported by this tool: after 20 dialogs the call fails and the window is closed. browser.state("load") and the Import button of the window follow the same steps in the current window, where such a page keeps its dialog pending and the import finishes once that dialog is answered.
{
"session": {
"version": 1,
"url": "https://example.com",
"localStorage": {},
"sessionStorage": {},
"cookies": []
}
}browser_get_context
Lists active Browser MCP sessions with process ID, session ID, title, sanitized URL, and state. The sanitized URL has no query, except when a password typed by browser.auth("login") contains the ? of that URL: the password is replaced by [redacted] and the rest of the query stays.
Session states:
State | Meaning |
| Ready for actions. |
| Loading or running an action. |
| A JavaScript dialog is pending. Resolve it with |
browser_run_actions
Runs an async JavaScript function body in the live page. The function receives a browser helper object.
Inspect the current page:
return browser.snapshot();The snapshot lists the accessibility tree. Elements you can act on carry a ref:
URL: https://example.com/login
Title: Sign in
Viewport: 1264x813
Pending dialog: none
Console: recent=0 errors=0 warnings=0
- heading "Sign in" [level=1, ref=e1]
- textbox "Email" [ref=e2]
- textbox "Password" [ref=e3]
- button "Continue" [ref=e4]Fill a form by ref or selector and wait for the result:
await browser.fill("@e2", "user@example.com");
await browser.fill("input[type=password]", "secret");
await browser.click("@e4");
await browser.wait({ text: "Welcome" });
return await browser.get("text", "h1");Navigate:
return browser.navigate("https://example.com");Mock an API response:
await browser.network("route", "*/api/user", { body: { name: "Ada" }, status: 200 });
return await (await fetch("/api/user")).json();Capture a screenshot:
return await browser.screenshot();Review network activity:
const logs = await browser.networkLogs({ filterMethod: "POST", filterPath: "/api/" });
return await browser.inspectNetworkRequest(logs.requests[0].id);Targets
Helpers that act on an element accept any of these as target:
Target | Example |
Snapshot ref |
|
CSS selector |
|
XPath |
|
DOM element |
|
Pointer helpers (click, leftClick, rightClick, dblclick, hover, scroll, drag) also accept viewport CSS pixels in place of a target, for example browser.leftClick(120, 240). A point with no element under it, such as one outside the viewport, is an error, except as the destination of drag.
Every helper returns a promise, including the ones that only read (
consoleLogs,snapshot). Alwaysawaitthe call.Refs are reassigned by every snapshot and dropped when the page navigates. A ref whose element is gone fails with an error instead of acting on another element, even when a similar element took its place.
Selectors and refs reach open shadow DOM and iframes, including iframes from another origin. A selector must match inside a single root:
"#host #inner"does not cross a shadow boundary, so use"#inner"or a ref.Closed shadow roots are reachable by ref only.
Input is real browser input sent through the DevTools protocol. It triggers CSS
:hover, focus, native drag and drop, and trusted events. A click fails when another element covers the click point.
Navigation inside a script
A script runs inside the page, so it ends when the page loads another document. Make the navigating call (navigate, back, forward, reload, or a click that follows a link) the last statement and continue in a follow-up tool call. Statements after it may not run; when the document is replaced mid-script the tool returns the result of the last helper call, or { navigated: true } when there was none.
A helper that is still loading a document when timeout_ms runs out is left to finish (up to 15 seconds) instead of being interrupted by a reload. Any other script that times out is stopped by reloading the page; a page stuck in a synchronous loop has that script terminated first. Recovery can add a few seconds to timeout_ms. A page that stops responding again as soon as it loads makes every call time out, with a postActionSnapshot that reports it; leave it with browser.navigate.
Helpers
Inspect:
Helper | Description |
| Page header and accessibility tree with refs. Options: |
| Reads |
| Checks |
| Returns the page as Markdown. Options: |
| Lists the refs of elements inside shadow roots, with the root mode ( |
| Returns an MCP image. |
| Outlines an element for 3 seconds. |
| Opens DevTools for the session. |
| Recent console entries, uncaught exceptions, and browser messages such as failed resources. |
| Uncaught exceptions and unhandled promise rejections, with stack, line, and column. |
Act:
Helper | Description |
| Clicks an element. |
| Double clicks. |
| Left or right click, optionally holding the button. |
| Moves the pointer over an element. |
| Replaces the value of an input, textarea, or contenteditable element. |
| Types into the focused element. |
| Focuses an element. |
| Presses a key or chord: |
|
|
|
|
| Selects options by value or label. Also drives ARIA comboboxes. |
| Sets a checkbox, radio, or switch. Fails when the click does not change the state. |
| Drags between two targets or coordinates. |
| Scrolls with the mouse wheel over a target. |
| Locates by |
| Scopes selectors and snapshots to an iframe. Use |
| Sets files on a file input, or on the chooser opened by the target. More than one file requires an input with |
| Clicks the target and waits for the download, optionally copying it to |
Wait and navigate:
Helper | Description |
| Waits a fixed time. |
| Waits until the target is |
| Waits for page text, a URL glob, a load state ( |
| Waits inside the page action. |
| Loads a URL and waits for it. |
| History navigation. |
| Client-side navigation through |
Waits never outlast the action: the default and maximum timeout is the time left in timeout_ms.
Network:
Helper | Description |
| Intercepts requests whose URL contains |
| Removes one route, or all of them. |
| Lists recorded requests. |
| Request and response details, including bodies. |
| Records a HAR 1.2 file. An existing |
| Compact request list and request details. |
A mocked body is served as JSON when it parses as JSON and as plain text otherwise. Pass headers: { "Content-Type": "text/html" } to mock a document. Routing a URL again replaces its previous route, and when several routes match a request the newest one wins. A route with an invalid header name or value is rejected. A mock the browser still refuses is reported in browser.consoleLogs() and the request fails; it never reaches the server.
Environment:
Helper | Description |
| Resizes the emulated viewport, enabling mobile emulation first when needed. |
|
|
| Overrides geolocation. Without arguments, clears the override. |
| Turns the network off or on. |
| Extra HTTP headers for every request. |
| HTTP Basic credentials for every request, to every origin the page loads. |
| Emulates |
| Shortcuts for the settings above. |
Viewport emulation uses mobile metrics, so a page without <meta name="viewport"> is laid out 980 px wide, as on a phone.
State:
Helper | Description |
| Reads, writes, and clears cookies. |
|
|
|
|
|
|
|
|
|
|
Saved states and login profiles are encrypted with the operating system keychain through Electron safeStorage.
Dialogs and confirmation:
Helper | Description |
| Accepts a pending alert/confirm/prompt. Pass the text for a prompt. |
| Dismisses a pending alert/confirm/prompt. |
| Runs or discards an action held by action confirmation. |
Action confirmation
Start the host with --confirm-actions (or BROWSER_MCP_CONFIRM_ACTIONS) to hold selected helpers until they are confirmed:
browser-mcp-electron --mcp --confirm-actions navigate,upload,stateThe list accepts helper names (click, fill, upload, ...) and these categories. The host does not start with a name it does not know:
Category | Helpers |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A held helper is not executed. The tool returns { confirmationRequired: true, confirmationId, action, message }. Run browser.confirm("confirm-1") to execute it with the original arguments, or browser.deny("confirm-1") to discard it. Each session keeps one pending confirmation; a newer held helper replaces it. browser.confirm must run in a later browser_run_actions call than the one that was held, and a held helper whose target was a DOM element cannot be confirmed: use a ref or a selector.
Helpers that perform another helper's action are held with it: browser.find(..., action) follows its action, browser.mouse("down" | "up"), browser.download and browser.upload count as click, browser.read(url) and browser.state("load") as navigate, browser.auth("login") as navigate, fill and click, and browser.wait({ download }) as download.
A sentinel that is already running keeps the list it was started with; starting a client with a different list fails instead of running without it.
Confirmation applies to browser helpers only. The script runs inside the page, so it can still call DOM APIs such as element.click() or set location.href directly.
Notes and limitations
The browser host runs with site isolation disabled so one DevTools session can reach iframes from every origin. Do not use it as a hardened browsing profile.
JavaScript dialogs (
alert,confirm,prompt) are captured in every frame and reported aspendingDialog. An iframe sandboxed withoutallow-modalsalso reports them, although a regular browser would block the call.A page cannot veto navigation with
beforeunload: the host always leaves the page, and no dialog is reported.While a dialog is pending,
browser_run_actionsonly runsbrowser.setDialogandbrowser.dismissDialog; any other script returnspendingDialogwithout running. Navigating, going back or forward, or reloading from the window toolbar dismisses the dialog.A dialog opened while a page is loading is reported like any other, by
browser.navigateand bybrowser_toggle_session; the page finishes loading after the dialog is resolved. A dialog opened after the script returned, for example by a timer, is reported aspendingDialognext toresult.A page that closes itself with
window.close()ends its session.browser.navigaterejectsjavascript:URLs.The
targetreturned by pointer and focus helpers describes the element without the value of text fields. Read a value withbrowser.get("value", target).The console counters in the snapshot header cover the current document only;
browser.consoleLogs()keeps the entries of earlier pages.The console buffer holds 200 entries. When it is full, the oldest entry that is not an uncaught exception is dropped first, so
browser.errors()survives a noisy console. Once exceptions fill more than half of it, the oldest entry of any kind is dropped instead.A middle click moves the pointer 40 pixels to the right and back while the button is down, because Chromium's autoscroll would otherwise swallow the next click. The page sees those two moves.
Keys and mouse buttons left down by
browser.keyboard("down")orbrowser.mouse("down")are released when the script ends.Request interception starts with the first
browser.network("route", ...)call and stays on until the session closes. Afterunroute, requests still pass through the host and continue unchanged, which adds a small delay per request.browser.clipboardreads and writes the clipboard of the logged-in user.The HTTP sentinel listens on
127.0.0.1without authentication. Any local process can call it, including the cookie, storage, and saved-state helpers.
Environment variables
Variable | Description | Default |
| Browser profile/session directory. |
|
| Initial browser URL. |
|
| HTTP sentinel port. Use |
|
| Comma-separated helpers or categories that require confirmation. | unset |
| Debug log path used by the launcher and Electron host. | OS temp file |
| Internal RPC port for detached Electron host mode. | unset |
| Internal RPC token for detached Electron host mode. | unset |
Development
Install dependencies:
npm installRun the app:
npm startRun the recommended MCP mode from the local checkout:
npm run mcpCheck JavaScript syntax:
npm run checkRun tests:
npm testThe test suite starts local HTTP test pages and Browser MCP HTTP sentinels, then validates the public MCP tools (tests/mcp-browser-actions.test.js) and every browser helper (tests/mcp-agent-commands.test.js). It uses ports 55331, 55332, and 55351 to 55353; override them with BROWSER_MCP_TEST_PORT, BROWSER_MCP_AGENT_TEST_PORT, BROWSER_MCP_SENTINEL_PORT, and BROWSER_MCP_CONFIRM_SENTINEL_PORT.
The clipboard test is skipped by default because it writes to the system clipboard. It restores the previous text afterwards, and skips itself when the clipboard holds an image or files. Run it with:
BROWSER_MCP_TEST_CLIPBOARD=1 npm testSession Copy browser extension
Load extensions/session_copy/chrome as an unpacked Chromium extension. Its Open in agent browser action exports the active HTTP(S) tab and calls the Browser MCP sentinel at http://127.0.0.1:55332/mcp. Keep the default sentinel port when using this action.
The imported session opens in a new agent browser window using the Browser MCP profile. The extension transfers the page URL, cookies, localStorage, and sessionStorage.
Troubleshooting
The MCP client cannot find browser-mcp-electron
Use the npx configuration or provide the absolute path to the binary.
Windows:
where.exe browser-mcp-electronLinux/macOS:
command -v browser-mcp-electronThe sentinel starts, but the MCP client opens a new one
Make sure both commands use the same user account and, if you pinned a port, the same --sentinel-port value. The sentinel registry is stored in the OS temp directory and is scoped to the current machine/user environment.
Electron does not start on Linux
Install the Electron runtime libraries required by your distribution and start the sentinel from a graphical user session. For systemd, prefer a user service instead of a system service because Browser MCP needs access to the user's desktop session.
A page action times out
Pass a larger timeout_ms to browser_run_actions:
{
"code": "await browser.sleep(15000); return browser.snapshot();",
"timeout_ms": 20000
}Action timeouts are clamped between 100 ms and 5 minutes.
A helper returns confirmationRequired
The host was started with --confirm-actions or BROWSER_MCP_CONFIRM_ACTIONS. Run browser.confirm(id) with the returned confirmationId to execute the action, or browser.deny(id) to discard it.
A ref no longer works
Refs belong to the latest snapshot of the current document. Run browser.snapshot() again after a navigation or a large re-render and use the new ref.
Multiple sessions are active
Pass the session_id returned by browser_toggle_session to browser_run_actions. When more than one session exists, Browser MCP requires explicit session selection.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted real Google Chrome MCP with per-user persistent state. Navigate, click, type, screenshot.
Stealth web browser for agents: search, fetch, click, download and type in persistent MCP sessions.
Unofficial Browserless MCP — wraps the Browserless headless-Chromium REST API (browserless.io)
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables MCP clients to drive a real, logged-in Chrome browser for web automation tasks like navigation, clicking, typing, and screenshotting.MIT
- FlicenseNot gradedqualityDmaintenanceDrive your real, signed-in Chrome browser from any MCP client, enabling browser automation such as navigation, clicking, typing, and screenshots through standard MCP tools.1-
- AlicenseBqualityCmaintenanceEnables MCP clients to drive a real Chromium browser for automation, including navigation, JavaScript execution, CDP commands, network capture, and multi-tab control.722 PyPIGPL 3.0
- FlicenseNot gradedqualityAmaintenanceEnables remote agents to control a local Chrome/Edge browser via MCP, supporting navigation, snapshots, clicks, typing, screenshots, and script execution.-