stealth-browser
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| STEALTH_BROWSER_MINIMAL | No | When set to 1, expose only the 16 core tools (equivalent to --minimal). 'status' and 'wait_for_human' are always protected in every mode. | 0 |
| STEALTH_BROWSER_CDP_PORT | No | CDP port used to attempt attaching to an existing browser session over http://127.0.0.1:9222 before falling back to a standalone stealth browser. | 9222 |
| STEALTH_BROWSER_TOKEN_FILE | No | Path to the 0600 Bearer token file required when running the shared daemon with --http. | ~/.config/stealth-browser/daemon.token |
| STEALTH_BROWSER_PROFILE_DIR | No | Directory for the dedicated Patchright stealth Chromium profile. | ~/.agent-chromium-profile |
| STEALTH_BROWSER_RUNTIME_DIR | No | Directory for the 0700 runtime dir containing the 0600 Unix Domain Socket used for the shared daemon. | ~/.cache/stealth-browser |
| STEALTH_BROWSER_IDLE_TIMEOUT | No | Idle timeout in seconds after which the background Patchright Node driver is automatically shut down. | 300 |
| STEALTH_BROWSER_DOWNLOADS_DIR | No | Directory where browser downloads land. | ~/Downloads |
| STEALTH_BROWSER_DISABLE_SECTIONS | No | Comma-separated list of tool sections to disable per session (e.g. debug,lifecycle). |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
The browser runs headed in the background by default and never steals focus. Use wait_for_human() for interactive login/2FA/CAPTCHA — it only sends a macOS notification naming the tab; never call set_headless() unless the user asks. Use this cheat-sheet instead of reading individual tool schemas; prefer snapshot(filter=...)/extract()/batch() over evaluate_js(). tab=-1 targets active tab (or index / stable 'tN'). Always call wait_for_human() (not set_headless churn) whenever a flow hits login/2FA/CAPTCHA/MFA.
status() | new_tab(url='about:blank', block_media=None) | switch_tab(tab=0) | close_tab(tab=-1) For tab URLs/titles: call status() — it lists every open tab's title and URL as [index | id | name] in one call; do NOT evaluate_js location.href/document.title. Tab ids derive from the browser tab itself, so they are unique across concurrent agents; pass tab= or tab= on every call.
navigate(url, block_media=None, new_tab=False, tab=-1, timeout_ms=30000, wait_until='domcontentloaded')
wait_for(selector='', text='', url_contains='', state='visible', timeout_ms=15000, tab=-1)
wait_for_human(reason='...', url_contains='', url_not_contains='', selector='', timeout_s=180, poll_interval_s=1.5, notify=True, tab=-1)
snapshot(selector='body', max_elements=80, tab=-1, include_shadow=True, include_iframes=True, include_hrefs=False, filter='', viewport_only=False, max_length=8000) — pass include_hrefs=True for link URLs
get_content(selector='body', max_length=4000, interactive_only=False, clean=True, tab=-1, offset=0, filter='')
extract(container_selector, fields={k:'text:.sel'|'@attr .sel'|'html:.sel'}, limit=20, include_shadow=True, include_iframes=True, tab=-1, max_length=8000) For form/input values: extract('#form', fields={'price': '@value #priceInput', 'agree': '@checked #agree'}) — do NOT use evaluate_js.
click(selector='', ref='', text='', force=False, tab=-1, timeout_ms=5000)
type(selector='', text='', clear_first=True, press_enter=False, tab=-1, timeout_ms=5000, ref='')
press_key(key, tab=-1) | scroll(direction='down', amount=600, tab=-1) | screenshot(save_path='', tab=-1, full_page=False, selector='', ref='', annotate=False)
batch(actions=[{action:'click'|'fill'|'type'|'select'|'press'|'wait_for'|'sleep'|'evaluate', selector, ref, text, value, key, state, ms, force, expression, main_world, timeout_ms}], tab=-1)
evaluate_js(expression='', tab=-1, timeout_ms=15000, script='', max_length=8000, main_world=False)
fetch(url, method='GET', headers=None, body=None, response_type='auto', tab=-1, timeout_ms=15000, save_path='', max_length=8000)
state(framework='auto', selector='', tab=-1, max_length=8000) | set_media(enable_media=True, tab=-1) | set_animations(enabled=False, persist=True)
downloads(limit=20, include_dir=False) | network_requests(url_filter='', resource_type='', content_type='', status_min=0, limit=30, clear=False, tab=-1, max_length=8000) | console_logs(level='', limit=50, clear=False, tab=-1, max_length=8000)
keep_alive(enable=True, tab=-1, min_seconds=45, max_seconds=90, ping_url=None, click_selector=None) | set_headless(headless=True, force=False) | restart_browser(headless=None, url=None, force=False) | close_browser(force_kill=True, force=False)
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| statusA | Check connection status to Stealth Browser and list all open tabs. |
| keep_aliveC | Keep a tab session alive: trusted CDP mouse/wheel input, modal auto-click, optional click_selector and heartbeat ping_url. |
| navigateB | Navigate a tab to url. block_media=True blocks images/fonts/video (None preserves state); wait_until: 'domcontentloaded'|'commit'|'load'|'networkidle'. Clamped to 60s tool cap. |
| new_tabA | Open a new browser tab and navigate to url (default 'about:blank'). Set block_media=True for high-speed text-only browsing. |
| wait_for_humanA | Hand off a tab to the human for login/2FA/CAPTCHA without stealing focus: sends an optional macOS notification naming the tab and polls until url_contains, url_not_contains, selector visible, or URL change (switches to headed mode only if the browser currently runs headless). |
| set_mediaB | Toggle media loading (images, videos, web fonts) on a tab. enable_media=False blocks heavy media for fast text-only browsing. |
| set_animationsB | Freeze CSS animations/transitions via reduced-motion emulation + a kill-stylesheet; sites may serve reduced-motion content variants, and re-enabling fully applies only after restart_browser() because init scripts cannot be removed. |
| snapshotB | List visible interactive elements with refs (e0, e1, ...) across DOM, Shadow DOM, and same-origin iframes. Use filter/viewport_only to narrow; include_hrefs=True to show link URLs. |
| batchB | Run sequential actions in one turn. Valid actions: click, fill, type, select, press, wait_for, sleep, evaluate (fields: selector, ref, text, value, key, state, ms, force, expression, main_world, timeout_ms). |
| get_contentB | Extract visible text from a tab. Supports offset (negative for tail, e.g. -3000), filter (regex/substring with context), clean=True (strips nav/hidden/whitespace), or interactive_only=True (calls snapshot). |
| extractB | Extract JSON rows from containers (cards/tables/forms) across DOM/Shadow/iframes. fields: name -> 'text:.sel'|'@attr .sel' ('@value'/'@checked' for inputs)|'html:.sel'|{selector,mode,attr}. |
| clickA | Click an element by CSS selector, snapshot ref ('e12' or '@e12'), or visible text. Set force=True to bypass pointer-interception overlays. |
| typeC | Type text into an input/textarea by CSS selector or snapshot ref ('e3' or '@e3'). |
| press_keyC | Press a keyboard key (e.g., 'Enter', 'Tab', 'Escape'). |
| scrollC | Scroll up or down by amount pixels. |
| screenshotC | Capture a screenshot of the active page, full page, or a specific element (by selector or snapshot ref). Set annotate=True to temporarily overlay snapshot ref labels (e0, e1, ...). |
| fetchB | Execute an authenticated in-browser fetch (supports relative, absolute, and blob: URLs). Pass save_path to write binary/PDF responses to disk without entering context. |
| downloadsA | List tracked browser downloads (and recent DOWNLOADS_DIR files when include_dir=True). |
| network_requestsC | List captured network responses/failures for a tab. Filter by url_filter, resource_type ('xhr,fetch'), content_type ('json','pdf'), or status_min (e.g. 400). |
| console_logsB | List captured browser console messages and page errors (filter by comma-separated level: 'error,warning,log,pageerror'). Attaches CDP console listener on first call. |
| stateC | Inspect in-memory client-side state (framework: 'auto'|'next'|'redux'|'react'|'vue'|'apollo'|'query'; optional selector for React Fiber). |
| evaluate_jsB | Evaluate JS in isolated world by default (alias: script=). Set main_world=True for page globals. |
| wait_forB | Wait for a CSS selector state, visible page text substring, URL substring, or combination. Clamped to 60s cap. |
| switch_tabA | Switch tab by index, browser-derived id, or name substring (see status). Accepts 'tab'/'index'. |
| close_tabB | Close tab by index, browser-derived id, or name substring (-1 active, -99 last). Accepts 'tab'/'index'. |
| close_browserB | Completely close the browser window, terminate all browser and renderer processes, and release all resources. |
| restart_browserC | Restart Chromium cleanly, preserving non-blank tabs unless url overrides tab [0]. headless=None keeps current mode. |
| set_headlessA | Switch headed (default) vs headless mode; restarts Chromium on change (switching to headless refuses if non-blank tabs exist unless force=True). Prefer wait_for_human() for login/2FA. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| stealth_browser_cheatsheet | Curated cheat-sheet for stealth-browser tools (use instead of reading raw schema JSON). |
TDQS
Scored across 28 tools
Most tools target clearly distinct browser operations (navigation, tab lifecycle, input, extraction, diagnostics), and descriptions provide good boundaries. Minor overlaps exist between snapshot/get_content/extract and batch vs individual actions, but those are generally resolvable from the descriptions.
All names use consistent snake_case and are readable, with no camelCase mixing. There is some variation between verb-first names (navigate, click, get_content) and noun names (snapshot, status, state, downloads, batch), but the convention remains predictable overall.
At 28 tools, the surface is heavy for a browser automation server, and several niche controls (set_media, set_animations, keep_alive, state) could be folded into broader configuration or utility tools. Each tool is defensible, but the count is on the high side and increases selection overhead.
The set covers navigation, tab management, interaction, extraction, waits, screenshots, downloads, network/console diagnostics, JS evaluation, human handoff, and browser mode switching. Minor gaps remain around cookies/storage, file upload, and hover/drag interactions, but core browser automation workflows are well supported.