Main components
| Component | Responsibility |
|---|---|
| Entry point | Parses config, chooses stdio or HTTP transport, starts the MCP server, and handles shutdown. |
| API-key auth | Validates hosted HTTP /mcp requests using the same sb_live_... keys created in StableBrowse settings. |
| MCP server | Registers tools, validates parameters, serializes tool calls, resolves the active session/page, and formats results. |
| Session manager | Creates and tracks browser sessions, active session selection, and session limits. |
| Session | Owns a browser context, pages, selected page, and session-level settings. |
| Page wrapper | Stores page state such as snapshots, network requests, console logs, and mutation status. |
| Browser pool | Reuses stealth browser processes by fingerprint while preserving isolation across different fingerprints. |
| CDP layer | Provides low-level accessibility tree extraction, DOM node resolution, mouse/keyboard dispatch, screenshots, and PDF support. |
Tool execution path
Every MCP tool call follows the same high-level path:- The MCP client sends a JSON-RPC
tools/call. - The server acquires a mutex so shared browser state is not mutated concurrently.
- Zod validates the input schema.
- The active session and page are resolved unless the tool does not require a session.
- The tool handler runs browser work through Playwright, CDP, or both.
- The page snapshot cache is invalidated if the DOM changed.
- The result is returned as text, image, or mixed MCP content.
Playwright and CDP
StableBrowse uses both Playwright and Chrome DevTools Protocol:| Layer | Used for |
|---|---|
| Playwright | Browser lifecycle, contexts, pages, locators, high-level waits, file uploads, and fallback actions. |
| CDP | Accessibility snapshots, backend node IDs, precise bounding boxes, raw input dispatch, screenshots, and low-level DOM operations. |
Snapshot refs
Thesnapshot tool extracts the accessibility tree and assigns stable refs like [ref=e12] to interactive elements.
Those refs are consumed by:
clickfillfill_forminteract.hoverinteract.select_optioninteract.draginteract.upload_filescreenshotfor element screenshots
Why compound tools exist
The implementation contains many browser operations, but the MCP surface exposes 17 tools:- direct tools for the common fast path
- compound tools for action families
storage tool with actions.
Knowledge graphs
Theknowledge tool lets agents consult bundled site knowledge before broad exploration. It can return:
- indexed sites
- relevant page nodes, regions, actions, and selectors
- known flow graphs
- deterministic site strategies, such as Amazon product extraction
Safety and isolation
Browser MCP is designed for controlled automation:- each session has isolated browser context state
- optional persistent profiles can preserve login state
- proxies and fingerprints can be set per session
- session/page limits prevent unbounded browser growth
- all parameters are schema-validated
- tool calls are serialized to avoid race conditions
HTTP mode
HTTP mode exposes:| Endpoint | Purpose |
|---|---|
POST /mcp | MCP streamable HTTP endpoint |
GET /health | Liveness check |
