# mcp-stealth-chrome [Health: Active]

**Category:** 📂 Browser Automation  
**Repository:** https://github.com/RobithYusuf/mcp-stealth-chrome  
**GitHub Stars:** 29  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-stealth-chrome

## Description
Stealth Chrome MCP server - 100++ tools for AI agents. One-liner Cloudflare Turnstile bypass (proven), dual-mode HTTP with TLS fingerprint, AI Vision reCAPTCHA solver. Python + nodriver + curl_cffi + FastMCP.

## Tools
Capabilities this server exposes over MCP:

- **screenshot_element** — Capture exactly one element's box — scroll- and DPR-correct.

    `screenshot(region_selector=...)` measures the element for you but the clip
    is built here, in page coordinates: CDP's clip is page-space (scroll
    included), so a bare getBoundingClientRect() rect captures the wrong strip
    on any scrolled page — and the wrong strip still looks like a screenshot.

    The result is verified against the box that was requested. If the capture
    comes back viewport-sized (the classic silent degradation), this fails and
    says so instead of handing you a browser-window screenshot labelled as an
    element.

    Args:
        selector: CSS selector for the element. Or pass `ref` from browser_snapshot.
        exact_bounds: clip to the element's exact border box (default). False
            rounds outward to whole CSS pixels and honours `padding`.
        padding: extra CSS px of context on each side (needs exact_bounds=False)
        scroll_into_view: scroll the element to the middle of the viewport first.
            Off-viewport elements still capture correctly either way; scrolling
            mainly matters for lazy-loaded images and hover/sticky layouts.
        scale: multiplies the captured resolution on top of the page's DPR
        tab: tab index (from tab_list) to capture WITHOUT switching to it.
            Chrome throttles background renderers, so a background tab may hand
            back its last painted frame.
        output: "artifact" (default: compact text + a resource link),
            "inline_image" (an MCP image block), "path", or "base64".

    Returns the saved path, the native pixel size, the CSS box, and the checksum.
    
- **inspect_image** — Fetch an image's NATIVE bytes — not a screenshot of the page showing it.

    Opening a PNG in Chrome and calling screenshot() gives you a viewport-sized
    picture of a browser window with the asset scaled inside it: the wrapper is
    in the pixels and the asset's real size is nowhere in the result. This
    fetches the bytes the page fetched (in-page `fetch` with the session's
    cookies, so authenticated assets work) and reports what they actually are.

    fit="none" (default) saves the bytes byte-for-byte: the checksum in the
    result is the checksum of the file on disk and of the asset itself. Nothing
    is resized, re-encoded, or re-compressed. fit="contain" only affects an
    inline copy, never the saved file.

    Args:
        url: absolute or page-relative image URL. `data:` and `file:` work too.
        selector: CSS selector of an <img> (or any element with src/href) to
            read the URL from — also reports displayed vs native size.
        tab: tab index to read from WITHOUT switching to it
        filename: name under ~/.mcp-stealth/assets/ (default derived from the URL)
        fit: "none" keeps every pixel (default); "contain" allows the inline copy
            to be downscaled to max_dimension
        max_dimension: longest side for the inline copy when fit="contain"
        output: "artifact" (default), "inline_image", "path", or "base64"
        max_bytes: refuse assets larger than this rather than marshalling them
            through CDP

    Returns: source URL, HTTP status, MIME (from the bytes, not just the header),
    native width×height, byte size, sha256, and the saved path.
    
- **solve_turnstile_oscursor** — Try interactive Turnstile with the real OS cursor in a disposable headed Chrome.

    Takes desktop focus and moves the physical cursor. Do not use the desktop during
    the call. Requires a running main browser, matching IP and natural user agent,
    and macOS Accessibility + Screen Recording permissions (install [os-cursor]).
    Windows SendInput and Linux X11 backends are implemented but not yet field-tested.
    No sidecar CDP client connects until six seconds of rendering, native input and
    eight seconds of scoring have elapsed. Site cookies are transferred privately
    through the existing storage-state loader, then main HTTP status/challenge are
    checked. A clearance cookie or a click alone never counts as confirmed access.
    url defaults to the active tab URL. timeout_s bounds the attempt, not cleanup;
    at least 16 seconds is required. A standalone run takes about 16 to 20 seconds,
    but inside the MCP server native input and screen capture run slower: 35 timed out
    during scoring and 50 passed, so 50 is the default. Only this call's temporary
    profile is removed.
    
- **browser_launch** — Launch stealth Chrome via nodriver. Creates persistent profile by default.

    Reports which profile it actually used (actual_profile, session_state_source)
    and the observed postconditions of the initial load (final_url,
    redirect_chain, status, ready_state) — reporting the requested URL after a
    redirect is what left callers reading a page they never asked for.

    Args:
        url: initial URL to load
        headless: run without UI (many sites detect headless — prefer False). A visible
            window opens behind the app in use and does not take the keyboard. A click that
            calls window.open still brings Chrome forward for about 130 ms before focus returns.
            With MCP_STEALTH_DOCK_ICON=1 in the server's environment, on macOS it runs from a
            copy of Chrome with its own Dock icon. The copy is made in the background and a
            launch never waits for it: when it is not ready this launch uses Chrome itself and
            the result says so. Off by default.
            When the person quits it (Cmd+Q, Dock > Quit) or closes every window, the server
            ends that Chrome within a few seconds, and the next call says it was closed and
            why; call browser_launch again to continue. tab_close on the last tab does not.
        proxy: "http://user:pass@host:port" or "socks5://host:port"
        user_agent: override UA string
        window_width, window_height: viewport size
        persistent: reuse the profile at ~/.mcp-stealth/profile (for the "main"
            instance; other instances get ~/.mcp-stealth/profiles/<id>).
            Left unset it defaults to True — EXCEPT under testing_mode, which
            defaults to an ephemeral throwaway profile. Pass persistent=True
            explicitly to keep state during a testing_mode run.
        lang: browser language
        extra_args: additional Chromium flags
        storage_state_path: load cookies/localStorage from JSON before first nav
        profile_mode: "light" saves memory and network by not loading images and
            turning off background Chrome services. For reading ordinary pages.
            Pages can notice images failing to load (img.naturalWidth stays 0), and
            layout or vision tools see no pictures, so keep "default" on bot-protected
            sites or when looking at the page matters.
        testing_mode: 2-5× faster startup+nav for perf/regression testing —
            disables image loading, background throttling dampers, translate,
            notifications, media autoplay. WARNING: reduces stealth — not for
            anti-bot work (sites can detect missing images as automation signal).
        auto_verify: if True (default), automatically detect Cloudflare /
            Turnstile challenges after the initial load and dispatch a
            CDP-level click on the checkbox. Caps at 2 attempts ~6s total —
            never loops. Set False to opt out.
        user_data_dir: launch Chrome against an EXISTING user profile root
            (e.g. "~/Library/Application Support/Google/Chrome"). Overrides
            persistent + the default MCP profile. The target Chrome instance
            (if any) MUST be closed first — locked profiles are detected
            upfront and refused with the lock-holder PID. Supports ~ expansion.
        profile_directory: when paired with user_data_dir, picks a sub-profile
            inside it (e.g. "Default", "Profile 21"). Without this, Chrome
            uses "Default". Helpful to drive a specific persona without
            cloning the profile. Use list_chrome_profiles to enumerate.
        fingerprint: explicit CDP overrides (user_agent, accept_language,
            platform, timezone). Overrides a pinned identity for this launch.
        privacy: start from an empty profile that is deleted when the browser closes,
            so nothing from this browser's history, logins or cookies is present or
            kept. The identity is still the real browser and machine unless fingerprint
            overrides it. A proxy written as a pool (a|b) picks one member. Incompatible
            with user_data_dir.
            To use a logged-in account, leave this off: the default keeps logins between
            launches, and persistent=False with privacy=False tries something without
            saving a login.
        profile_conflict: what to do when the profile is already held by another
            Chrome. "fallback" (default, legacy behaviour) uses a separate
            per-process profile and says so; "fail" refuses with the holding
            PID; "clone" launches from an integrity-checked read-only copy of
            it. Nothing on disk is ever deleted or overwritten either way.
        expect_url, expect_status: validate the initial load — see navigate().
            An unmeasured value fails the check rather than passing it.
        restore_tabs: reopen the tabs this instance had open on this profile when this server
            last closed it (browser_close, close_instance, the idle timeout, Quit, or the
            server's own exit when its client goes away). Pages open behind the app in use, as
            tab_new opens them, and the tab that was selected is selected again. Without a url
            the first saved page loads in the first tab; with a url, that page stays first and
            selected and the saved pages follow. The result lists each page as reopened (final
            URL, status) or failed (why), with secret URL parameters masked, and says plainly
            when there is no saved list. It never fails the launch. Persistent profiles only:
            persistent=False and privacy=True keep no tabs. The list is kept in
            ~/.mcp-stealth/window-state/<instance>-tabs.json, readable by you only;
            browser_close(forget_tabs=True) removes it.
        keep_alive: True leaves this browser running when this server exits (the client went
            to sleep, reconnected or closed), with its tabs and page state, and the next
            browser_launch on the same profile reattaches to it instead of starting another
            Chrome: "reattached to the running browser (pid N, K tabs)". It still ends on Quit,
            on browser_close after a reattach, and once it has had no server for
            MCP_STEALTH_KEEP_ALIVE_MAX_HOURS (24). Persistent profiles only: persistent=False
            and privacy=True ignore it and say so. Headless works too, as an invisible Chrome
            holding memory until one of those ends it. Not on Windows. Left unset it is False
            for a new browser and stays as it was on a reattach. A reattach happens whenever
            a profile is held by a browser a previous server of ours kept, whatever this
            value; it never attaches to the person's own Chrome or one a live server drives.
        browser: "chrome" (default) or "brave". Brave keeps its own Shields (ads and trackers
            blocked), farbling (canvas and audio values differ per site and per session) and
            identity (navigator.brave, userAgentData naming Brave). Its profiles are separate:
            ~/.mcp-stealth/brave-profile for main, ~/.mcp-stealth/brave-profiles/<id> for
            others. A profile belongs to the browser that made it, and opening it with the
            other one is refused, since neither can read the other's cookies. The Dock icon
            switch applies to Chrome only. Needs Brave installed.
        vertical_tabs: "left", "right" or "off" writes the tab-strip setting into the profile
            before the browser starts; None (default) leaves the profile's own setting.
            Brave has both sides; Chrome only "left", and "right" there is refused.
        block_ads: block ad and tracker requests in every tab, popup, frame and worker of this
            browser, with EasyList and EasyPrivacy (Brave's adblock-rust engine). Requests
            only: nothing is hidden or written in the page, so a blocked ad can leave an empty
            box. The lists are downloaded on first use into ~/.mcp-stealth/adblock, checked
            again at most once a day, and used offline from the last copy. Without a list the
            launch says ad blocking is off and why; it never fails over it. The result says
            whether it is on; server_status shows what was blocked. Blocked requests fail
            with net::ERR_BLOCKED_BY_CLIENT, as with any ad blocker, which a page can notice.
            Brave blocks ads itself with Shields, so there it does nothing.
        brave_lean: Brave only. True turns off what an agent has no use for (None, the default,
            does so only on a profile this server made empty; a user_data_dir, a clone or an
            older profile keeps its settings unless True is passed, and the result says which):
            Leo AI, VPN, Speedreader and Playlist for this process (--disable-features); P3A,
            the daily usage ping and Tor windows (Local State); toolbar and sidebar buttons,
            new tab widgets and sponsored images, Brave News, the wallet's page provider, and
            the Web Discovery, Wayback Machine and default-browser prompts (Preferences, written
            before launch into a profile seen free, never into the person's own Brave folder).
            Shields, farbling, navigator.brave and the brands, vertical tabs, Safe Browsing and
            filter list updates stay. Rewards, Ads and the wallet page stay as Brave ships them
            (only policy removes them, and policy would change the person's own Brave). False
            keeps Brave as it ships and puts back what an earlier lean launch changed. The result
            says what was turned off and what was not; server_status shows it. Ignored for
            Chrome, and said so when passed.
    
- **browser_close** — Close the browser and free the profile lock.

    The open tabs are saved first (persistent profiles only), so browser_launch(restore_tabs=True)
    can reopen them. forget_tabs=True closes without saving and removes the saved list.
    
- **browser_recover** — Force-recover from a stuck browser state.

    Escape hatch when browser_close() can't run (graceful shutdown depends
    on internal state that may be corrupt). Steps:
    1. Best-effort browser.stop() — ignore any errors
    2. Kill orphan Chrome PIDs whose argv references the active profile
       (SIGTERM, then SIGKILL after 2s if still alive) — only PIDs spawned
       against THIS MCP profile, never the user's daily Chrome
    3. Reset the current BrowserState (background instances keep running)
    4. Clear devtools / dialog caches
    5. Wipe stale Singleton* lock files in all known profile dirs

    Always succeeds — never raises. Use this when normal close hangs or
    returns an error you can't diagnose. After this, browser_launch()
    again to start fresh.
    
- **navigate** — Navigate the active tab to url. wait_until: load|none.

    Reports the OBSERVED postconditions — requested_url, final_url,
    redirect_chain, status, ready_state — because a redirect otherwise leaves
    the caller reading a page it never asked for while the tool claims success.

    auto_verify: if True (default), automatically detect Cloudflare /
    Turnstile challenges after load and click the checkbox naturally
    (CDP-level click, max 2 attempts). Set False to opt out.

    focus: if True, bring the tab's window to the OS foreground after navigating. Off by
    default, because raising the window takes focus from whatever the person is doing.
    tab_focus does the same on request.

    expect_url: fail when final_url does not match. Glob when the pattern
        contains * ? or [ ; otherwise a prefix match, so "https://x/admin"
        accepts "https://x/admin?tab=1". A final_url that could not be read
        FAILS the check rather than passing it.
    expect_status: fail when the document HTTP status differs. An unmeasured
        status (about:blank, same-document navigation) also fails — the tool
        will not claim an expectation it never verified.
    
- **click** — Click an element by ref (from snapshot) or CSS selector with real mouse input.

    Dispatches a trusted mouse event at the element's centre, scrolling it into
    view first if needed. Refuses and names the blocker when the point belongs to
    something else, so an overlay never produces a false "clicked". The result names
    what was used: method=cdp_mouse, or method=js_click after js_fallback.

    Args:
        ref: element ref from browser_snapshot
        selector: CSS selector
        humanize: approach along a curved path and click a random spot inside
        verify: compare the page before and after, and say so when nothing changed
        js_fallback: when the real click cannot land, call element.click() from JS
            instead of refusing. The event has isTrusted=false, which sites can
            detect, and bypasses whatever was covering the element. The result
            states when this happened. Off by default.
    
- **click_text** — Find and click the element whose text matches, and report what really happened.

    Args:
        text: text to match
        exact: True for exact match, False (default) for fuzzy best-match
        verify: compare a page fingerprint before/after and say so when nothing
            changed (default True). This is what distinguishes a real click from
            one that was dispatched into a void.

    Never claims success on finding alone: if the element is obscured, hidden,
    disabled or off-viewport, this does not pretend otherwise — it first looks
    for another element carrying the same text that IS reachable (scrolling it
    into view if needed), and only errors, naming the blocker, when there is
    genuinely nothing clickable.
    
- **fill** — Clear a field and type into it with real key presses, then read it back.
- **type_text** — Type into the focused element, one real key press per character.

    Each character sends keydown and keyup, as a keyboard does. A newline presses Enter in
    a textarea or contenteditable and is refused in a single-line field, where it would
    submit the form. Use press_key for shortcuts when no field has focus.
    Use humanize for Gaussian delays between keys.
    
- **check** — Tick a checkbox/radio (idempotent), confirming the state changed.

    Handles native inputs, labels and role=checkbox. A hidden styled input is clicked
    through its label. js_fallback=True toggles it from JS if nothing can be clicked;
    the result names the method used.
    
- **evaluate** — Execute JavaScript with an explicit bounded timeout.

    ``survive_navigation`` explicitly retries once after a navigation interruption;
    callers must only use it for idempotent expressions because arbitrary JavaScript
    may have side effects before navigation starts.
    
- **wait_for_function** — Poll a JavaScript predicate and return its truthy value.

    The expression is evaluated in the selected tab without changing active focus.
    It must be a predicate or a side-effect-free value expression.
    
- **inject_init_script** — Register a script that runs before page scripts on every navigation of
    the CURRENT tab. Scope is the active tab/target only — it is NOT auto-applied
    to other open tabs or to tabs opened later; re-run per tab if needed.
- **batch_actions** — Execute a flat list of actions in order and report each one.

    Each action: {type: click|fill|type|wait|press|navigate, ...params}, or the name
    of any workflow_run tool with its arguments alongside, such as
    {"type": "select_option", "selector": "#c", "value": "x"}.
    Add "stop_on_error": true to an action to stop there if it fails.
    Example: [{"type":"click","ref":"e3"},{"type":"fill","ref":"e4","value":"x"}]

    For branching, loops or using one step's result in another, use workflow_run.
    
- **fill_form** — Fill multiple fields then optionally submit.

    fields: [{ref: "e1", value: "..."}, {selector: "#email", value: "..."}]
    
- **navigate_and_snapshot** — Navigate then immediately snapshot — common pattern.

    The navigation's observed postconditions are kept above the snapshot: a
    snapshot of a page you were redirected to reads exactly like a snapshot of
    the page you asked for. A failed expect_url / expect_status aborts before
    the snapshot rather than describing the wrong page. See navigate().
    
- **get_viewport_size** — Return the viewport size (innerWidth, innerHeight) and scroll position.
- **set_viewport_size** — Resize the browser window, and report the viewport that results.

    The size given is the whole window, so with a visible browser the viewport comes out
    smaller by the height of its toolbars. emulate_device sets an exact viewport.
    
- **scroll** — Scroll page via REAL mouseWheel CDP events (not JS scrollBy).

    humanize=True (default): variable chunks 50-150px + micro-pauses + 20%
    reading-pause chance — bypasses DataDome/PerimeterX behavioral detection.
    humanize=False: instant scroll (faster, less stealthy).

    Directions: up | down | top | bottom

    Reports how far the window really moved. "did not move" means it is already at that
    end, cannot scroll, or the wheel went to a scrollable element under the pointer.
    
- **scroll_to** — Smooth-scroll a specific element into viewport.

    Args:
        ref: snapshot ref (e.g. "e7") from browser_snapshot
        selector: CSS selector alternative
        block: "start" | "center" | "end" | "nearest" — vertical alignment
        smooth: CSS smooth scroll (default) vs instant jump

    Works even if element is far off-screen (pages of scroll away).
    
- **dialog_handle** — Answer the next alert/confirm/prompt. Call BEFORE the action that triggers it.

    A click that opened a dialog with nothing armed reports it; call this then too, and
    the dialog that is already open gets the answer.
    
- **dialog_auto_handle** — Install a PERSISTENT auto-handler for native browser dialogs.
    Unlike dialog_handle (one-shot, action baked in at arm time), this
    one stays armed across many dialogs and reads its config at fire
    time — call again with new action/types to update without re-arming.

    Args:
        action: "accept" (Leave / OK) or "dismiss" (Cancel / Stay)
        enabled: True to arm, False to disable (config preserved)
        types: optional list to scope handling — any of:
               ["alert", "confirm", "prompt", "beforeunload"]
               None (default) = handle all types.
        text: prompt response when action="accept" on prompt() dialogs;
              also basic-auth "user:pass" for HTTP 401.

    Common patterns:
        # Form pages with "unsaved changes" guard — auto-leave forever
        dialog_auto_handle(action="accept", types=["beforeunload"])

        # Pages that spam alert() — auto-OK
        dialog_auto_handle(action="accept", types=["alert"])

        # Disable when done
        dialog_auto_handle(enabled=False)

    Native dialogs only (Chrome's own card UI). HTML/CSS modal overlays
    are regular DOM — use click_text("Cancel") / click_role for those.
    
- **accessibility_snapshot** — Return ARIA accessibility tree of current page.
- **console_start** — Begin capturing console messages + uncaught exceptions of the active tab.

    Arms the listener on THIS tab only. Call it again after switching or opening
    a tab. The Runtime domain is enabled explicitly and re-enabled on every
    navigation, so capture survives page loads instead of silently lapsing.
    
- **console_get** — Retrieve captured console messages WITH the capture status.

    Returns {attached, capturing, since, total, returned, messages} rather than a
    bare array, because an empty array alone is ambiguous: it cannot tell you
    whether the page logged nothing or nothing was ever listening. `attached`
    false + empty means NOT MONITORED — not "no errors".

    Messages are chronological (oldest first within the last `limit`).
    
- **network_start** — Begin capturing network requests + responses with full headers.

    Args:
        capture_bodies: if True (default), also indexes by request_id so
            network_get(include_body=True) can fetch response bodies on
            demand via CDP Network.getResponseBody.
    
- **network_get** — Retrieve captured network events.

    Args:
        limit: max entries returned (chronological: oldest first within the last `limit`, newest last)
        filter_url: substring filter on URL
        include_body: fetch response bodies via CDP Network.getResponseBody
            for each matching entry. Bodies are truncated to max_body_bytes.
            Requires network_start(capture_bodies=True) (default).
        max_body_bytes: cap per-body length (default 10000)
        full: if True, return entries with full headers + body fields
            from network_index (use this once you've called network_start).
            Default False = legacy flat event stream (backward compat).
        reveal_values: True returns credential headers, fields and query parameters as
            they are. By default their values read "*** (N chars)", because tool output
            lands in the transcript. Bodies other than JSON or forms cannot be read field
            by field and pass through.
    
- **server_status** — Diagnostic info about the server, browser, and CDP compatibility patches.

    `compat_patches` is the one worth reading when captures come back empty: a
    nodriver compatibility patch that failed to apply does not crash anything —
    it makes the CDP event listener die on the first mismatched payload, so
    console/network capture returns nothing and looks like a quiet page.

    `dock_icon` says whether visible browsers get their own Dock icon (macOS): off,
    beta-ready (they run from Chrome Beta with the project icon), beta-missing,
    icon-missing or unavailable, with the reason. Reading it changes nothing.

    `block_ads` lists, per browser launched with block_ads=True, the requests looked at,
    blocked and allowed, by type and host, the targets covered and any that could not be,
    and the age of the filter lists.

    `profile_gc` is the startup pass over leftover privacy-profiles/* and profile-pid<N>
    folders: what it removed, what it kept because it holds data, what was in use, and
    errors. A fallback with cookies, logins, storage, extensions or bookmarks is never
    removed by it; `fallback_profiles_left` counts those for profile_report and
    profile_cleanup.
    
- **get_page_errors** — Uncaught JS exceptions captured since console_start(), WITH the capture status.

    Returns {attached, total, errors}. `attached` false + empty means NOT MONITORED, not
    "no errors": exceptions are only seen on a tab console_start() has armed.
    
- **fingerprint_audit** — Audit THIS browser's own fingerprint for the leaks detectors look for.

    Self-diagnostic for the stealth claim: after fingerprint_rotate, behind a
    proxy, or in headless, is this browser still coherent? Runs entirely
    in-page — no third-party detector required, nothing about you leaves the
    machine.

    Reports findings by severity, and is explicit about what it CANNOT see from
    inside the page (TLS/JA3 and IP-vs-timezone need a network peer), so a clean
    report is never mistaken for a total guarantee.

    Args:
        url: navigate here first (e.g. a real target site) so the audit reflects
            that page's context. Omit to audit the current page.

    Weighs cross-field consistency heavily: detectors flag a Windows UA on a
    MacIntel platform far more reliably than any single suspicious value.
    
- **export_curl** — Turn a captured browser request into a runnable curl AND an http_request call.

    The browser→script bridge. After network_start() + the action you care about,
    hand this a request and get back the command that reproduces it outside the
    browser. Credentials are hidden unless reveal_values=True, because tool output lands
    in the transcript; the http_request form still replays the session, since it takes the
    cookies from the browser itself.

    The `http_request` variant is the one that matters here: replaying a captured
    request with plain curl sends a curl TLS fingerprint, which is exactly what
    anti-bot systems key on — the request that worked in the browser then fails
    on the command line for reasons the headers do not explain. Routing it
    through http_request(impersonate="chrome") keeps a genuine Chrome JA3, so the
    replay looks like the browser it came from.

    Args:
        request_id: id from network_get(). Omit to search by url_contains.
        url_contains: pick the most recent captured request whose URL contains
            this substring — usually easier than copying an id.
        method: additionally require this HTTP method (e.g. "POST") when searching.
        include_cookies: attach the browser's current cookies for that URL.
            Turn off to produce a shareable command with no session in it.
        reveal_values: put real cookie and credential values in the output, which makes
            the curl string runnable as shown.

    Returns the matched request, a `curl` string, and an `http_request` call.
    
- **solve_recaptcha_ai** — Solve reCAPTCHA v2 image challenge using a vision-enabled LLM.

    Supports Anthropic (Claude) or any OpenAI-compatible API (OpenAI, Groq,
    local Ollama, Together.ai, Fireworks and others).

    ⚠️ MODEL MUST BE MULTIMODAL (vision-capable) — text-only models fail silently.
    Supported: any current model that accepts images. Text-only models fail.

    Env vars (OpenAI SDK standard — priority checked if args omitted):
        OPENAI_API_KEY + OPENAI_BASE_URL + OPENAI_MODEL  → OpenAI-compat
        ANTHROPIC_API_KEY + ANTHROPIC_MODEL              → Claude
        AI_VISION_* (deprecated, still read)             → backward-compat

    Explicit override:
        provider="anthropic" | "openai"
        base_url="https://your-provider.example.com/v1"
        api_key="..."
        model="your-vision-model"

    Cost: varies by provider (~$0.005-0.03 per solve).
    
- **vision_locate** — Find an element by natural-language description using a vision LLM.

    Uses the same provider as solve_recaptcha_ai (OPENAI_* / ANTHROPIC_* env).
    Reuses solve_recaptcha_ai's vision plumbing so any vision-capable model
    works.

    Args:
        description: NL description, e.g. "the red Create button at bottom right"
        click: if True, also dispatches a CDP mouse_click at the located point
        api_key/base_url/model/provider: explicit overrides (else from env)

    Returns JSON: {"found":true/false, "x":int, "y":int, "confidence":"high|medium|low"}.
    Use when CSS selectors are unreliable (visual-only differentiator, dynamic IDs).
    
- **vision_describe** — Describe a screenshot or element; unlike vision_locate, this is captioning.
- **vision_ocr** — Extract visible text from a screenshot or element with a vision model.
- **vision_check** — Check visual criteria and return validated pass/fail JSON, never an invented pass.
- **http_request** — HTTP request with TLS-perfect browser fingerprint via curl_cffi.
    Use for API scraping after browser login — same stealth as real Chrome's JA3/JA4.

    Each call gets its own curl session, so parallel calls are safe — nothing
    shares a browser tab. Localhost / private-network targets bypass the
    environment proxy automatically.

    Every call is tracked: if it does not settle within `wait_timeout` you get a
    request_id back instead of a dead end, the request keeps running until
    `timeout`, and http_request_status / http_request_cancel take it from there.

    Args:
        url, method: target URL and HTTP verb
        impersonate: chrome, chrome124, firefox, safari, edge (default chrome)
        use_browser_cookies: snapshot cookies from the active browser instance
            BEFORE the request starts (a later switch_instance cannot leak in). On a
            redirect they follow the first host only, by their path and Secure flag;
            cookies_sent counts what each request carried
        headers, params: extra headers/query params
        data: raw body string (form-urlencoded or custom)
        json_body: JSON body dict (sets Content-Type automatically)
        timeout: total request budget in seconds, and the operation deadline —
            the request keeps running this long even after wait_timeout returns
        follow_redirects: usual HTTP option
        return_mode: auto (json if parseable else text), json, text, or meta (status+headers only)
        wait_timeout: how long THIS call blocks. Default None = the whole
            timeout. Set it lower to get a request_id back early and poll.
        connect_timeout: connect-phase budget (default 10s, capped by timeout).
            Separating it is what lets a failure say "never reached the server"
            instead of a bare timeout.
        direct: force (True) or forbid (False) the proxy-bypassing direct
            transport. Default None auto-detects loopback / private targets.
        reveal_values: True returns credential headers, JSON fields and query parameters
            as they are. By default their values read "*** (N chars)", because tool output
            lands in the transcript. Bodies other than JSON or forms pass through.
    
- **http_request_status** — Poll a tracked http_request — or list every one this session remembers.

    An http_request that outran its wait_timeout is still running. This is how
    you collect its eventual response instead of firing a duplicate.

    Args:
        request_id: which request. Omit to list all tracked requests.
        wait_timeout: block up to this long for a pending request to settle
            (0 = read the current state and return immediately)
        forget: drop the record after returning it (frees the buffer early)
    
- **http_request_cancel** — Stop waiting on a tracked http_request.

    This is a CLIENT-SIDE cancel and nothing more. If the request already went
    out, the server may have processed it in full; no rollback is performed,
    requested, or implied. The reply says which of the two it was.
    
- **http_request_retry** — Explicitly replay a tracked http_request. Nothing here ever auto-retries.

    Refused when the first attempt's outcome is UNKNOWN and the method can have
    side effects — a POST that timed out on read may already have been applied,
    and replaying it silently would double it. Pass confirm_side_effects=True to
    say you have decided that is acceptable.

    Browser cookies are re-snapshotted so an expired session does not replay a
    stale jar; everything else (headers, body, transport) is reused verbatim.

    Returns a NEW request_id — the original record is left untouched.
    
- **http_session_cookies** — Inspect which browser cookies would be sent with a request to URL.

    Helpful to verify session sharing works before making requests. `measured`
    separates "no cookies apply to this URL" from "the browser never answered",
    which is the same distinction http_request records on the request itself.
    
- **session_warmup** — Warm up session by navigating naturally before hitting target URL.
    Anti-bot systems score trust by session history — direct deep-URL hits look suspicious.

    Patterns:
      - homepage_first: goto origin → wait → goto target
      - referer_chain: goto origin → find link to target → click
      - natural_browse: homepage → scroll → random click → scroll → target
    
- **detect_anti_bot** — Analyze current page + HTTP headers to identify anti-bot system.

    Detects: Cloudflare, DataDome, PerimeterX/HUMAN, Akamai Bot Manager,
    Kasada, Imperva/Incapsula, F5 Shape, none. Returns system + recommended
    bypass strategy from our toolkit.
    
- **spawn_browser** — Create a new named browser instance running in parallel with main.
    Each instance has its own profile, cookies, tabs, logs. Use for multi-account
    scraping or isolated sessions. A headed instance the person quits, or whose windows
    are all closed, is ended by the server, and later calls on it say so.

    Args:
        instance_id: unique name (e.g., "scraper_1", "acct_alice")
        idle_timeout_seconds: auto-close after idle (0 = never, default 600s)
        profile_dir: override profile path (default: ~/.mcp-stealth/profiles/<id>/)
        desc: natural-language purpose used to find the instance by meaning later
        fingerprint: explicit user_agent/accept_language/platform/timezone overrides
        privacy: empty profile deleted when closed. The identity stays the real browser
            and machine unless fingerprint overrides it. To use a logged-in account,
            leave this off
        restore_tabs: reopen the tabs this instance had when it was last closed, as
            browser_launch(restore_tabs=True) does
        keep_alive: leave this browser running when this server exits, as
            browser_launch(keep_alive=True) does; a later spawn_browser or browser_launch on
            the same profile reattaches to it. The idle timeout still applies while a server
            holds it
        browser: "chrome" (default) or "brave", as in browser_launch. A Brave instance's
            profile defaults to ~/.mcp-stealth/brave-profiles/<id>/
        vertical_tabs: "left", "right" (Brave only) or "off", as in browser_launch
        block_ads: block ad and tracker requests in this instance, as
            browser_launch(block_ads=True) does
        brave_lean: Brave only; as in browser_launch (None: lean on a profile this server
            made empty, True: lean, False: as it ships)
        other args: same as browser_launch

    Use switch_instance(id) to route subsequent tool calls to this instance.
    
- **list_instances** — List all browser instances with status + last-active time.
    Also reports external (non-MCP) Chrome processes that may conflict with
    custom --user-data-dir launches.
- **instance_describe** — Set or append the natural-language purpose of a browser instance.
- **switch_instance** — Make instance_id the active one for subsequent tool calls.

    The previous current instance continues running in the background,
    cookies/tabs preserved. Swap back anytime.
    
- **instance_release** — Hand a running instance over so another MCP session can take it.

    Only meaningful in HTTP mode, where several sessions share one server. The
    instance keeps running, tabs and logins intact, until another session calls
    switch_instance on it or the idle timeout closes it. Switch away first if it is
    the current one.
    
- **close_instance** — Close a specific browser instance (frees profile + memory).

    Its open tabs are saved first (persistent profiles only) for restore_tabs=True on the next
    launch of that instance. forget_tabs=True closes without saving and removes the saved list.
    Closing the current instance leaves that id current, not running: the next browser_launch
    starts it again on its own profile, and the result says so. switch_instance('main') to go
    back to main.
    
- **close_all_instances** — Close every running browser instance. Useful for cleanup.
- **list_chrome_profiles** — List profiles across EVERY Chrome-family browser on this system.

    Chrome, Chromium, Edge, Brave, Vivaldi, Opera and Arc are all surveyed —
    people commonly keep their real logged-in sessions in Brave or Edge while a
    near-empty Chrome sits alongside, and reporting only the first browser found
    would hide exactly the profiles worth cloning.

    Each profile reports a `cookies_kb` figure: a profile with kilobytes of
    cookies has real sessions, one with ~0 has never been used for anything.

    Args:
        browser: restrict to one browser id (e.g. "brave", "chrome", "edge").
            Omit to survey them all.

    Reads each browser's 'Local State' JSON read-only — nothing is modified.
    
- **clone_chrome_profile** — Clone a profile from ANY Chrome-family browser into an isolated MCP location.

    SAFE: reads the source profile without modification, copies to
    ~/.mcp-stealth/profiles/<target_instance_id>/Default/, or for a Brave profile to
    ~/.mcp-stealth/brave-profiles/<target_instance_id>/Default/, which launches in Brave
    (spawn_browser(..., browser='brave')) and keeps its logins: Brave's cookies and saved
    passwords are encrypted with Brave's own key, which Chrome cannot read.

    The source browser MUST be closed (we check SingletonLock).
    Preserves: cookies, history, bookmarks, saved passwords, extensions state.
    Skips (if skip_cache=True): Cache, Code Cache, GPUCache, Media Cache (regenerable), and
    also the site data folders IndexedDB, Service Worker and File System (saves 500MB+). Those
    are not caches: web apps that keep their login or offline data there (WhatsApp Web,
    Telegram Web, many PWAs) ask to sign in again. The result lists them under not_copied.

    Args:
        source_profile: profile dir name ("Default", "Profile 1", ...).
                        Use list_chrome_profiles() to see options.
        target_instance_id: Name for the cloned instance (becomes folder name).
        skip_cache: Exclude cache dirs for fast + smaller copy (default True).
        overwrite: Delete target if exists before copying (default False).
        keep_site_data: copy IndexedDB, Service Worker and File System even with
            skip_cache=True, for a profile that will be used every day. Larger copy. With
            allow_running these LevelDB folders are copied as they lie, unchecked.
        allow_running: clone even while the browser is open. Each SQLite
            database is copied with its -wal/-shm companions and then
            integrity-checked; any that fail come back under `sqlite_suspect`
            instead of being trusted silently. Without this flag the call refuses
            while the profile is locked.
        browser: which browser to clone FROM — "brave", "chrome", "edge",
            "chromium", "vivaldi", "opera", "arc". Omit to use the first root
            found, which is NOT necessarily the one holding your sessions:
            an empty Chrome often shadows the Brave/Edge profile you actually
            log in with. Pass this explicitly when in doubt.

    After clone, launch with:
        spawn_browser(instance_id='<target_instance_id>')
        spawn_browser(instance_id='<target_instance_id>', browser='brave') for a Brave profile
    
- **performance_trace_start** — Start Chrome DevTools performance trace on the active tab.

    Use stop() to save the .json file. Only one trace can be active at a time.

    Args:
        categories: comma-separated trace categories. Default covers DevTools'
            Performance panel view:
              "devtools.timeline,v8.execute,disabled-by-default-devtools.timeline,
               disabled-by-default-devtools.timeline.frame,loading,latencyInfo,
               blink.user_timing"
        screenshots: include screenshot frames in trace (bigger file, lets you
            scrub through frames in DevTools Performance panel)
    
- **performance_trace_stop** — Stop the active performance trace and save to ~/.mcp-stealth/exports/.

    Output is a JSON array compatible with chrome://tracing and
    DevTools Performance panel (drag-drop to import).
    
- **performance_metrics** — Return Chrome's runtime Performance metrics (Nodes, JSHeap, FPS, etc).

    Wraps CDP Performance.getMetrics — use it for snapshots during a test run
    (before/after interaction) to detect regressions.
    
- **performance_timeline** — Read Navigation/Resource/Paint timing via Performance API.

    Returns TTFB, DOMContentLoaded, load, LCP candidate, FCP, resource count,
    and slowest 5 resources. Fast (no trace capture) — best for smoke tests.
    
- **web_vitals** — Collect Core Web Vitals (LCP, CLS, INP, FCP, TTFB) via web-vitals v4.

    Injects Google's official web-vitals library from CDN, listens for each
    metric, returns after all expected metrics fire or timeout elapses.

    Best practice: call after the page has been interacted with (scrolled,
    clicked) so INP and CLS have real signal.
    
- **emulate_network** — Throttle network via CDP Network.emulateNetworkConditions.

    Presets match Chrome DevTools device mode (offline/slow-3g/3g/slow-4g/4g/wifi).
    Pass preset="no-throttle" to reset. Override individual knobs with
    latency_ms / download_bps / upload_bps.
    
- **emulate_cpu** — Throttle CPU via CDP Emulation.setCPUThrottlingRate.

    rate=1 is no throttle; rate=4 makes CPU ~4× slower (matches DevTools default
    "4x slowdown"). rate=6 simulates low-end mobile. Pass 1 to reset.
    
- **emulate_device** — Emulate a device via CDP Emulation.setDeviceMetricsOverride + UA override.

    Presets: iphone-15, iphone-se, pixel-8, galaxy-s23, ipad, desktop (reset).
    Also sets the matching User-Agent string and client hints so UA-sniffing backends
    respond with the mobile variant. desktop clears the metrics and restores this
    instance's own identity, UA included.
    
- **coverage_start** — Start collecting JS/CSS code coverage.

    Wraps CDP Profiler.startPreciseCoverage + CSS.startRuleUsageTracking.
    Call coverage_stop() to get the usage report (bytes used vs unused).
    
- **coverage_stop** — Stop coverage collection and return used/unused breakdown.

    Returns per-file summary: bytes used, bytes total, unused %. Sorted by
    largest unused byte count (biggest dead-code wins first).
    
- **memory_heap_snapshot** — Capture a V8 heap snapshot (.heapsnapshot) — drag into DevTools Memory panel.

    Large pages produce 50-200MB snapshots. Saved to ~/.mcp-stealth/exports/.

    Args:
        filename: output name (default timestamped)
        stable_ms: consider snapshot complete after no new chunks for this many ms
        max_wait: hard cap on wait even if chunks keep arriving
    
- **wait_for_network_idle** — Wait until no network request has been in-flight for idle_ms.

    More robust than wait_for(selector) for JS-heavy SPAs. Counts requests from CDP
    Network events, every type including images and scripts, and also waits for
    document.readyState to reach "complete". Nothing is injected into the page.

    Limit: CDP cannot list what is already running. A request started before this call is
    noticed only through its later response, data or finish events, so one that stays
    silent for the whole idle window is not seen. To cover a click's own requests use
    click_and_wait(expect="network_idle"), which starts counting before it clicks.
    
- **console_clear** — Clear the captured console buffer + call console.clear() in the page.
- **web_search** — Web search WITHOUT a browser or paid API — replaces tavily/exa discovery.

    Escalation ladder ("use every scenario"):
      1. curl_cffi SERP (browserless, headless/API-mode, light) — Bing default
         (mkt=en-US), DuckDuckGo fallback.
      2. If that is soft-blocked/empty AND a browser is running, escalate to a
         browser-driven SERP (real Chrome fingerprint + live DOM) — set
         use_browser="on" to force it, "off" to disable.
      2b. engine="brave" → Brave's own index via the browser SERP: RICHEST results
          (AI answer + Reddit discussions with vote counts + videos). Needs a browser
          (browser_launch); best single engine for research-grade discovery.
      3. engine="exa" → Exa neural search (BYO EXA_API_KEY) — reliable + semantic.

    proxy: route through a residential/mobile proxy (or set RESEARCH_PROXY env) —
    the only thing that beats IP-level blocks (rate-limited SERPs, datacenter bans).

    Returns {query, engine, count, via:"http"|"browser", results:[{title,url,snippet}]}.
    
- **scrape_markdown** — Fetch one URL → clean LLM-ready markdown (firecrawl-scrape equivalent).

    Default path is curl_cffi (no browser — fast, light, headless). Set
    use_browser=True to render in the active tab, which leaves that tab on this page
    (needs browser_launch)
    for JS-heavy or anti-bot pages.

    Returns {url, path, status, chars, markdown}.
    
- **smart_fetch** — Dual-mode fetch: curl_cffi first, auto-escalate to the stealth browser
    ONLY when the HTTP request is anti-bot blocked. The efficiency core — high
    volume stays browserless; Chrome fires only when truly needed.

    Returns {url, path:"http"|"browser"|"http_blocked_no_browser", status, chars, markdown}.
    
- **deep_research** — One-call research: search → fetch top-N sources → clean markdown + citations.

    Replaces tavily/firecrawl "research". Fully browserless fast path (curl_cffi);
    sources that are anti-bot blocked are flagged so the caller can re-fetch them
    with smart_fetch(force_browser=True). The host LLM synthesizes from `sources`.

    Returns {query, engine, count, sources:[{title, url, snippet, blocked, content}]}.
    
- **search_page** — Grep the CURRENT page's visible text — zero LLM cost, instant.

    Use before spending vision/LLM tokens: find where a term appears (with
    surrounding context) on the already-loaded page. Needs a live browser.

    Returns {query, matches:[{index, context}], total}.
    
- **social_digest** — Enter a Reddit community and return a clean, STRUCTURED digest of its top
    posts — a reproducible, account-independent research surface (uses search/sort,
    NOT the personalized 'For you' feed, so the same call yields the same posts for
    any account). Needs a running browser (scrolls + clears JS challenges).

    Args:
      subreddit : community name ("ChatGPTCoding", "r/LocalLLaMA") or a full URL
      query     : optional — search WITHIN the subreddit instead of browsing it
      sort      : top/hot/new (browse) or relevance/top/new/comments (search)
      window    : time window for top/search (hour..all)
      scrolls   : how many times to scroll to lazy-load more posts
      max_posts : cap on returned posts

    Returns {surface, mode, sort, window, count, posts:[{title,url,votes,comments,age}], note}.
    The `surface` label states exactly what was read so results are auditable.
    
- **github_read** — Read a GitHub repo via the official API — no browser, no anti-bot needed.

    resource:
      repo     -> metadata {stars, forks, open_issues, language, topics, desc, pushed}
      readme   -> the README as raw markdown
      issues   -> recent open issues [{number,title,user,comments,created,state}]
      releases -> recent releases [{tag,name,published,prerelease}]

    Unauthenticated is rate-limited (60/hr); set GITHUB_TOKEN env for 5000/hr.
    
- **youtube_read** — Read a YouTube video's TRANSCRIPT + metadata natively (no yt-dlp, no
    browser) — parses the watch page's player response + timedtext captions.

    Returns {video_id, title, author, views, length_s, lang, transcript} (or just
    info if want='info'). Returns a clear error if the video has no captions.
    
- **social_research** — Social-media market/competitor research — WHO sells/makes X + HOW loud.

    Give a topic/niche → sweeps social platforms + the web to surface who is
    selling/making/discussing it and how busy the buzz is, using OSINT:
    Google/Bing `site:<platform>` dorks (no login, clean, NON-personalized) +
    optional NATIVE in-platform search when a browser session exists.

    STRONGLY RECOMMENDED — import your session cookies first for login-walled
    platforms (Threads / Facebook / X / Instagram):
        browser_launch()
        cookie_import(file_path="cookies.json")   # export via Cookie-Editor while logged in
    then call this with use_browser=True. Native search then returns fresher
    posts + engagement (likes/views) the logged-out `site:` dork can't reach.
    Reddit works without login.

    CRASH-RESILIENT: pass cookie_files="threads.json,x.json,fb.txt" to
    auto-(re)import those session files at the start of EVERY call. A browser
    crash/restart drops the in-memory session — this re-applies it automatically
    so you never manually re-import after a recover.

    Two lenses (use both): `site:` dork = precision + clean + non-personalized;
    native + cookies = recall + engagement + recent (but personalized to your acct).

    platforms: comma list of reddit,threads,facebook,x,instagram,tiktok,linkedin.
    scroll: how many times to scroll each native feed (default 3) to load MORE
    posts from the infinite scroll — raise it (e.g. 6-8) for deeper coverage,
    lower to 0 for a fast above-the-fold-only read.
    read_posts: 0-5 (default 0). When >0, DRILL INTO the top-N dork posts per
    platform and read each post's FULL content + visible COMMENTS/replies
    (opt-in — each post is one extra navigation, so it's slower). 0 = listings only.

    Three lenses per platform: dork_results (titles+links, clean/precise) +
    native_excerpt (feed text + ENGAGEMENT likes/votes/comments) + posts (full
    body + comments of the top posts, when read_posts>0).

    Returns {topic, platforms:[{name, dork_results:[{title,url,snippet}],
    native_excerpt, posts:[{title,url,content}], needs_cookies}], cookies_hint,
    method}.
    
- **profile_report** — Size, cache size, last use and in-use status of every profile. Changes nothing.

    `kind` is main, named or fallback. A fallback (profile-pid<N>) was created when
    another server process held the shared profile, and is `removable` only once its
    owner has exited and no browser has it open. Each fallback also lists `contents`
    (cookie count and top domains, logins, storage, extensions, bookmarks; no values)
    and what the automatic cleanup at server start does with it: an empty one goes,
    one holding any of that stays until you remove it here. Pass names from here to
    profile_cleanup. Walks every file, so a large tree takes a moment.
    
- **profile_cleanup** — Reclaim profile disk space. A preview unless confirm=True. Irreversible when it runs.

    Args:
        action:
            clear_cache: delete regenerable caches from a profile that is not in
                use. Cookies, logins, local storage and preferences stay.
            remove_fallback: delete a whole profile-pid<N> directory. Refused for
                main or named profiles, or while the directory or its owner is live.
                Any login made inside that profile goes with it, and so does the tab
                list saved for it (restore_tabs).
        names: exact names from profile_report. There is no "all", so nothing gets
            deleted that was not named.
        confirm: False (default) reports what would happen and deletes nothing.

    Only pass confirm=True when the person explicitly asked for this deletion.
    
- **describe_page** — Compact AI-friendly page summary — replaces accessibility_snapshot
    for LLM workflows. Returns JSON with the page's intent + interactable
    surface in ~10× fewer tokens than a full a11y dump.

    Args:
        wait_stable: if True, install a MutationObserver and wait until the
            DOM has been quiet for `stable_ms` before snapshotting (max
            `max_wait` seconds). Use on SPA / lazy-rendered pages so the
            LLM sees the final state, not a half-hydrated render. Cheap
            (~50-200ms typical, capped at max_wait).
        max_wait: outer cap for stability wait (default 2.5s)
        stable_ms: required quiet window in ms (default 400)

    Output shape:
      {
        "title": "...",
        "url": "...",
        "headings": [{"level":"h1","text":"..."}],
        "fields": [{"label":"...","type":"text|email|...","required":bool,"value":"...","name":"...","id":"..."}],
        "actions": [{"text":"Submit","kind":"button","disabled":false}],
        "errors": ["..."],
        "navigation": ["Dashboard","Settings",...],
        "stability": "stable|timeout|skipped"  (only present if wait_stable=True)
      }

    Use this BEFORE smart_fill so the LLM knows which labels exist.
    
- **smart_fill** — Fill form fields by label text (fuzzy match). LLM-friendly alt to
    fill_form which requires DOM refs.

    Args:
        fields: {"Label": "value", ...} — keys match form field labels
            (case-insensitive, fuzzy: exact > prefix > substring > token).
            Labels resolved from <label>, aria-label, placeholder, name.
        submit_label: optional button text to click after filling
            (e.g., "Create", "Sign in"). Fuzzy-matched on action button text.

    Behavior:
        - Each field: locates input → focus → clear → type value
        - Returns per-field result + list of available labels if missing
        - On miss: error includes candidates so the LLM can retry with
          the correct label name.
    
- **assert_text_present** — Verify text appears anywhere on page within timeout.
    Returns ok(found) or err(not found + sample of body text).
- **assert_url_matches** — Verify current URL matches regex within timeout.
    Returns ok(current_url) or err(timeout + last_url).
- **assert_element_visible** — Verify an element is visible (rendered, non-zero size, not hidden).
    Pass selector OR text — text uses fuzzy contains match.
    Returns ok(rect) or err(timeout).
- **storage_snapshot** — Capture cookies + localStorage + sessionStorage + URL into a named slot
    for later diffing. Use BEFORE an action you want to inspect.

    Areas that could not be read are reported as unmeasured rather than empty:
    a snapshot that silently failed to read cookies would make storage_diff
    announce every existing cookie as "removed" by the action under test.
    
- **storage_diff** — Compare current state vs an earlier storage_snapshot. Returns JSON
    showing what changed (added/removed/modified per area + url change).

    Diffing across a login is exactly when new values are session tokens, and this
    output lands in the transcript. So values read "*** (N chars)" unless
    reveal_values=True; whether something changed is reported either way.

    Pattern:
      storage_snapshot("before")
      <do an action e.g. click login>
      storage_diff("before")  → returns what the action actually changed
    
- **workflow_run** — Run many tool steps in one call, with branching, loops and earlier results.

    A tool step: {"tool": "fill", "args": {...}, "save_as": "x", "label": "...",
    "continue_on_error": false}

    Using earlier results: save_as stores a step's result, parsed as JSON when it
    is JSON. Any string in args may then reference it as ${x}, ${x.field} or
    ${x[0].name}; a string that is exactly one reference keeps its type. ${last.ok},
    ${last.value} and ${last.text} describe the previous step. A reference to
    something undefined fails the step and lists what is defined.

    Loop: {"foreach": "${rows}", "as": "row", "steps": [...]} sets ${row} and
    ${row_index} for each item.

    Branch: {"if": <condition>, "then": [...], "else": [...]}. Conditions are
    {"value": "${x}", "<op>": y} with op one of equals, not_equals, contains,
    not_contains, matches (regex), gt, gte, lt, lte, truthy, falsy; or
    {"exists": "${x.y}"}, {"all": [...]}, {"any": [...]}, {"not": {...}}. There is no
    expression language and nothing is evaluated as code on the server.

    Example, submitting a form once per row of data taken from the page:
      [{"tool": "evaluate", "args": {"expression": "JSON.stringify(window.rows)"},
        "save_as": "rows"},
       {"foreach": "${rows}", "as": "row", "steps": [
         {"tool": "fill", "args": {"selector": "#name", "value": "${row.name}"}},
         {"if": {"value": "${row.active}", "truthy": true}, "then": [
           {"tool": "check", "args": {"selector": "#active"}}]},
         {"tool": "click", "args": {"selector": "#save"}}]}]

    Args:
        steps: the steps above
        start_at: where to begin. A top-level index, or a dotted path from a failure
            report: "3.2.1" is step 3, item 2 of its loop, inner step 1.
        stop_on_error: stop at the first failure (default). If False, keep going and
            report every result.
        vars: starting variables. Pass the `vars` of a failure report when resuming,
            since nothing is kept between calls.

    Returns JSON with completed (capped at 200 entries, the rest counted), total and
    vars. On failure also failed_at, failed_path, failure_context and resume_with.
    With stop_on_error=False, failed_count and failed_paths list every failure even
    past that cap. Steps the failed step depended on are not re-run on resume, so check
    that any state they left on the page still holds. A start_at that does not exist
    is refused.

    Tools: navigate, reload, go_back/forward, click, click_text, click_role, fill,
    fill_form, type_text, paste_text, press_key, select_option, check, uncheck,
    hover, scroll, scroll_to, mouse_click_xy, smart_fill, wait_for*, screenshot,
    evaluate, get_text, get_attribute, get_url, get_links, get_html, search_page,
    query_selector_all, extract_table, extract_structured, browser_snapshot,
    describe_page, vision_locate, assert_*, storage_*, cookie_import,
    storage_state_load.
    
- **detect_and_bypass** — One-shot: detect anti-bot wall on current page and apply the best
    bypass we have. Returns JSON with detection + bypass result.

    Bypass routing:
      - Cloudflare Turnstile / interstitial → _auto_verify_cf (DOM + OpenCV)
      - Other walls (DataDome, PerimeterX, Akamai, Imperva, Kasada) →
        return detection + recommended-action list (no auto-bypass since
        those need session reuse / proxies / paid solvers).
      - No wall detected → returns ok with empty bypass.
    
- **paste_text** — Set field value by simulating a real paste event sequence.

    Use when fill / type_text don't register on modern frameworks (SolidJS
    runes, Svelte 5 runes, some Qwik forms) that ONLY listen for paste
    events or beforeinput with inputType:'insertFromPaste'.

    Sequence dispatched (mimics a real Cmd-V):
      1. focus
      2. ClipboardEvent('paste', {clipboardData: 'text/plain': text})
      3. InputEvent('beforeinput', {inputType: 'insertFromPaste', data: text})
      4. native value setter (HTMLInputElement / HTMLTextAreaElement)
      5. InputEvent('input', {inputType: 'insertFromPaste', data: text})
      6. Event('change')

    Args:
        text: value to paste
        ref: element ref from browser_snapshot
        selector: CSS selector
        submit: if True, simulate Enter keypress after paste
    
- **auth_capture** — Intercept the next N requests matching a URL pattern and return
    their headers (Authorization, X-CSRF-*, etc.) — useful for
    SPAs that hold bearer tokens in JS memory and never write them to
    localStorage. Their values are hidden unless reveal_values=True, because
    tool output lands in the transcript. After network_start,
    http_request_with_session reuses a token seen on the same origin without
    showing it.

    Pattern: substring match on URL (case-sensitive). For regex use
    network_get instead.

    Args:
        filter_url_pattern: e.g. "/api/" or "graphql"
        count: stop capturing after this many matches (default 1)
        timeout: max seconds to wait (default 10)
        include_response_headers: also wait for + return response headers
        reveal_values: return credential values as they are

    Returns JSON array of {url, method, request_headers, request_body,
    [response_headers, status]}.
    
- **http_request_with_session** — Authenticated HTTP request that piggybacks on the BROWSER's session.

    Combines:
      - cookies from active tab (use_browser_cookies=True in http_request)
      - Authorization header — explicit auth_header, OR auto-extracted
        from network_index (the most recent same-host request captured
        via network_start). Pages that hold bearer tokens in JS memory
        only become reachable after navigate / interaction emits a
        request — call network_start once at session begin.

    Args:
        url, method, json_body, data, impersonate, return_mode, timeout,
        wait_timeout, connect_timeout: same as http_request — including the
            tracked lifecycle, so a slow authenticated call hands back a
            request_id for http_request_status instead of a dead end
        extra_headers: merged on top of auto-detected ones
        auth_header: explicit bearer / basic value, e.g. "Bearer eyJ..."

    Returns same shape as http_request.
    
- **wait_for_request** — Block until a network request matching url_pattern is observed.
    Replaces the setTimeout(2000)+poll anti-pattern.

    Args:
        url_pattern: substring match
        method: optional HTTP verb filter (GET/POST/...)
        timeout: max seconds to wait
        require_response: also wait for the response phase (default True)
        reveal_values: return credential headers and fields as they are, not "*** (N chars)"

    Returns JSON of the matching entry (url/method/status/request_headers/
    response_headers).
    
- **click_and_wait** — Click + wait for the side-effect to land. Distinguishes a
    successful action from a silent failure (e.g. form invalid where
    click() returns success but submit never happened).

    Args:
        ref / selector / text: element to click (passed through to existing
            click tools — text uses click_text fuzzy match)
        expect: what to wait for after the click. One of:
            "navigation"     — URL changes
            "url"            — URL matches expect_url_pattern (regex)
            "text"           — page contains expect_text
            "selector"       — expect_selector becomes visible
            "request"        — outgoing request matches expect_request_pattern
            "network_idle"   — no in-flight requests for 500ms
            "auto"           — try navigation→network_idle→nothing
                           Passing one expect_* selects its mode instead.
        expect_*: target for the matching expect mode
        timeout: per-mode max wait

    Returns JSON {clicked, observed: {what, evidence}, elapsed_ms}.
    
- **form_introspect** — Detailed form analysis in a single call. Returns label,
    framework binding (react/vue/solid_or_svelte/lit), validation state,
    and constraints (pattern, min/max length, required) per field.

    Args:
        form_selector: CSS selector for a specific form (default: scan
            whole document for visible inputs)
    
- **list_external_chrome** — List Chrome processes running on this machine, with their CDP debugging
    port if any. Use before attach_to_chrome to find a target. Returns array
    of {pid, debugging_port, user_data_dir, cmd}. Chromes without a debugging
    port show port=null and cannot be attached unless restarted with
    --remote-debugging-port=<N>.
- **attach_to_chrome** — Attach to an existing Chrome instance via CDP — no new browser launch,
    no profile lock conflict. Target Chrome must have been started with
    `--remote-debugging-port=<N>`. Auto-detects port if omitted (picks lowest).

    Use cases:
    - Control your existing Chrome (e.g. Profile 21) without closing it.
    - Drive a Chrome session you launched manually with custom flags.
    - Connect to a remote/Docker Chrome via host=<remote> port=<N>.

    To detach without closing Chrome, call detach(). Calling browser_close()
    after attach DOES close the target Chrome — use detach() instead if you
    want to keep it running.
    
- **detach** — Release CDP connection to an attached Chrome WITHOUT closing it.
    Only valid for browsers connected via attach_to_chrome — for browsers
    spawned by browser_launch/spawn_browser this is equivalent to a no-op
    (use browser_close instead).

    After detach, Chrome keeps running with all tabs intact. You can
    re-attach later with attach_to_chrome(port=...).
- **cookie_list** — List cookies (optionally filtered by URL), with their values hidden by default.

    A session cookie is a credential, and whatever this returns lands in the agent's
    transcript. So each value is replaced by "***" plus `value_length`, which is enough
    to see that a cookie exists and is non-empty.

    Args:
        url: only cookies that apply to this host or URL
        reveal_values: True returns the real values. Only when the value itself is
            needed; to reuse a session, cookie_export or http_request does not need it.
    
- **cookie_set** — Set a cookie on the browser.
- **cookie_delete** — Delete cookies by name, then read back to prove they are gone.

    domain: only this domain, with or without a leading dot. Omit it to delete what
    applies to the active tab's host, including its parent domains.
    
- **cookie_import** — Bulk-import cookies. Three input modes — pick whichever is easiest:

    1. cookies=[{...}]            inline array of dicts (DevTools / EditThisCookie shape)
    2. file_path="..."            JSON file (array OR storage_state {"cookies":[...]})
    3. raw_text="..."             paste any of these and we auto-parse:
                                    • JSON array / object (same shapes as 1+2)
                                    • Header string: "name=val; name2=val2" or
                                      "Cookie: name=val; name2=val2"
                                    • Netscape cookies.txt (tab-separated)
                                    • curl --cookie / -b argument string
       NOTE: header / netscape formats lack domain — pass default_domain=".example.com"
       (or call this AFTER navigate so the active tab's URL provides it).

    Per-cookie fields (when JSON):
      {"name":"...", "value":"...", "domain":".example.com", "path":"/",
       "expires":1234567890, "secure":true, "httpOnly":false, "sameSite":"Lax"}

    Args:
        cookies: inline array
        file_path: JSON file
        raw_text: any cookie text — format auto-detected
        default_domain: fallback domain for header / netscape cookies (or auto-uses
            current tab URL's host)
        clear_first: wipe all existing cookies before import (default False)

    For full cookies + localStorage + sessionStorage restore, use storage_state_load.
    
- **cookie_export** — Export cookies to a JSON file. Cookies-only (use storage_state_save for full session).

    Output is a plain JSON array compatible with cookie_import / EditThisCookie /
    Playwright cookies format. Saved to ~/.mcp-stealth/storage-states/ with mode 600.
    This tool's response names the file and never contains a value.

    Args:
        reveal_values: True (default) writes real values, because a file without them
            cannot be imported. False writes "***" and value_length, for sharing what
            cookies exist; such a file cannot restore a session.
    
- **localstorage_get** — Get localStorage — all keys or one specific key.
- **localstorage_set** — Set a localStorage entry.
- **localstorage_clear** — Clear all localStorage for current origin.
- **sessionstorage_get** — Get sessionStorage — all keys or one.
- **sessionstorage_set** — Set a sessionStorage entry.
- **sessionstorage_clear** — Clear all sessionStorage for current origin (parity with localstorage_clear).
- **cache_clear** — Clear the browser HTTP cache (CDP Network.clearBrowserCache).

    Mirrors DevTools → Application → Clear storage → Clear site data (cache).
    Does NOT touch cookies, localStorage, or IndexedDB — use dedicated tools
    or browser_launch(persistent=False) for a full wipe.
    
- **indexeddb_list** — List IndexedDB databases for the current origin.

    Reads via CDP IndexedDB.requestDatabaseNames. Use indexeddb_delete(name)
    to drop one. Useful for clearing SPA state (many PWAs store auth / drafts
    in IndexedDB rather than localStorage).
    
- **indexeddb_delete** — Delete an IndexedDB database by name (scoped to current origin).
- **intercept_start** — See a request — and optionally stop it — BEFORE the server ever gets it.

    Answers "what would this button actually send?" without sending it. The usual
    alternative is patching window.fetch by hand, which misses XHR, misses
    anything the page captured before your script ran, and cannot stop a request
    that is already in flight. This works at the CDP layer, so it sees every
    request regardless of timing.

    Args:
        url_pattern: CDP glob, e.g. "*/api/*" or "*delete*". "*" matches all.
        action: what to do with matching requests —
            "observe" lets them through and records them;
            "cancel"  aborts them (the page sees a network failure);
            "mock"    answers them locally with mock_status/mock_body.
        methods: comma list to target, e.g. "POST,DELETE". Non-matching methods
            are always let through untouched. Omit to target every method.
        mock_status / mock_body / mock_content_type: the canned response.
        auto_disable_after: seconds before interception turns itself off. This is
            a safety net, not a nicety: an interception left on with a dead
            handler wedges the page silently. 0 disables the timer.
        max_events: ring-buffer size for the log.

    Pair with intercept_log() to read what was seen and intercept_stop() to end
    it early. See dry_run() for the common "explore without mutating" preset.
    
- **intercept_log** — Read what interception saw, with its status attached.

    Reports whether interception is still active and why it stopped, because an
    empty log means nothing on its own: it cannot otherwise be told apart from
    "never started" or "the deadline already fired".

    Credential headers, fields and query parameters read "*** (N chars)" because tool
    output lands in the transcript; reveal_values=True returns them. Bodies other than
    JSON or forms cannot be read field by field and pass through.
    
- **intercept_stop** — Stop intercepting and let the page make requests normally again.
- **dry_run** — Explore a logged-in account without changing anything.

    Blocks every mutating request (POST/PUT/PATCH/DELETE by default) and records
    what would have been sent — method, URL, headers, body. Reads still work, so
    the app is fully navigable while nothing can be created, edited or deleted.

    This is the safe way to answer "which endpoint does the delete button call?"
    on a real account: click it, read intercept_log(), and see the exact request
    that was stopped. GET and HEAD are untouched, so the page keeps working.

    Args:
        enable: False turns dry-run off (same as intercept_stop).
        url_pattern: narrow to one API surface, e.g. "*/api/*".
        methods: which methods to block. Widen or narrow as needed.
        auto_disable_after: seconds before it lifts itself, so a forgotten
            dry-run does not silently break later work.

    The page will surface blocked calls as network errors — that is the intended,
    visible signal that a mutation was prevented, not a bug.
    
- **export_har** — Export captured requests to a HAR file: URLs, headers, bodies sent, status, type.

    Needs network_start(capture_bodies=True), the default. Timings and response bodies are
    not captured. The file holds real header values, so it is written mode 600 and only its
    path is returned.
    
- **browser_snapshot** — Ref-indexed list of the interactive elements on the active tab.

    Reaches into iframes (cross-origin included) and open shadow roots; those
    elements are marked `frame=fN` / `shadow` and their refs work with click,
    fill and the rest like any other. Closed shadow roots cannot be measured.

    Refs (e0, e1, ...) live on the server, mapped to CDP node ids; the snapshot
    runs in an isolated world and writes nothing to the page. EVERY snapshot
    replaces all refs. A ref is valid until the next snapshot, and one that was
    superseded, or whose element is gone, fails with an error saying so instead
    of hitting the wrong element.

    A field carries its label as label="..." (from <label for>, a label around it, or
    aria-labelledby), and name_contains matches it.

    Modes:
      interactive_compact — default. Full fidelity, minus non-interactive
                  elements that carry no accessible name (the nameless
                  ``<img alt="">`` that made a real admin page report ~190
                  elements), and minus the row of a label whose field is listed.
                  Every drop is counted in the report.
      full      — same shape as mcp-camoufox; keeps the unnamed decorative
                  elements and the label rows compact drops.
      fast      — reduced selector, no getComputedStyle, minimal attrs (2-3×
                  faster, less info per element)
      viewport  — full fidelity, only elements inside the current scroll
                  viewport (pair with scroll for segment-by-segment reading)

    Scoping (all compose, all reported):
      max_elements      cap on RETURNED elements; 0 = no cap. Elements past the
                        cap are counted as `omitted`, never dropped in silence.
      container_selector  measure only inside the elements matching this CSS.
                        A selector that matches nothing is reported as an empty
                        scope, not as an empty page. Invalid CSS is an error —
                        note that `:has-text()` is a Playwright-ism, not CSS.
      viewport_only     drop elements fully outside the current viewport.
      role              comma-separated roles to keep, matched against the
                        explicit role or the implicit one ("button,link").
      name_contains     case-insensitive substring of the accessible name
                        (aria-label / alt / title / text / value / placeholder).
      include_hidden    also return elements that are not rendered, each marked
                        `hidden`. They are counted either way.
      include_frames    False measures the main frame only. max_elements covers
                        the whole page, main frame first. viewport_only judges
                        frame content against its own frame's viewport.

    The report always states matched / measured / eligible / returned / omitted
    for the same DOM walk that produced the list, so a filtered result can never
    be read as "this page has nothing on it".

    diff_from_last=True (default) caches the DOM hash per tab AND per option
    scope; when the same scope on the same document and URL hashes the same, the
    element list is not re-serialized. It is scoped per option set because a
    compact and a full snapshot measure different sets — sharing one cache entry
    would answer "unchanged" to a call that would have returned a different list.
    The cache also keys on each frame's loader id, so a reload or a return to the
    same URL never reports "unchanged": the refs the caller holds died with the
    old document even when the hash is identical.

    delta=True prefixes elements added or changed since this tab's previous
    snapshot IN THE SAME SCOPE with ``*``. A scope's first snapshot marks
    everything.
    
- **screenshot** — Screenshot active tab. Saves to ~/.mcp-stealth/screenshots/.

    Args:
        filename: output name (default timestamped)
        full_page: stitch entire page height (slower, larger file)
        return_base64: append base64 body to response (useful for vision models).
            Refused when the encoded body would exceed B64_INLINE_LIMIT — you get
            the path plus advice instead of a rejected tool result.
        format: "auto" (from extension, default), "png" (lossless), or "jpeg" (smaller)
        quality: JPEG quality 1-100 (default 80) — ignored for PNG
        region: clip to {x, y, width, height} in **CSS pixels relative to the
                viewport** — the same coordinate space as getBoundingClientRect()
                and mouse_click_xy, NOT device/captured pixels. Uses CDP
                Page.captureScreenshot clip (2-5× faster for small crops)
        region_selector: CSS selector to crop to — the element's bounding box is
                measured for you. Prefer this over `region`: it removes the whole
                class of manual-coordinate mistakes. Wins over `region` if both given.
        max_dimension: if either width or height exceeds this (px), the image is
            resized proportionally via OpenCV INTER_AREA. Default 1920 keeps output
            under the 2000 px per-side limit that LLM image tools (Claude/GPT) enforce
            — prevents "image exceeds dimension limit" failures on long full_page
            captures or hi-DPR device emulation. Pass 0 to disable resizing.
    
- **get_text** — Return visible text without changing active tab selection or focus.
- **get_html** — Return innerHTML of an element, its outerHTML with outer=True, or the whole document.
- **get_url** — Return current URL of active tab.
- **save_pdf** — Save current page as PDF via CDP Page.printToPDF.
- **inspect_element** — Return tag, attributes, position, text for an element.
- **get_attribute** — Get attribute value of element.
- **query_selector_all** — Return count + attrs of all elements matching CSS selector.
- **get_links** — List all <a> links on page.
- **list_frames** — List every frame on the active tab, cross-origin (out-of-process) ones included.
- **frame_evaluate** — Run JS inside the first child frame whose URL matches a regex.

    A same-origin frame runs it in the page's own context. A cross-origin frame
    (reCAPTCHA bframe, payment widgets, third-party embeds) refuses that, so it
    runs in an isolated world instead: the DOM is the same, but the frame's own
    JS globals are not visible. The result says which one happened.
    
- **detect_content_pattern** — Heuristically detect the most likely repeating container on page.

    Useful for scraping job listings, product cards, search results.
    Returns top-3 candidate CSS selectors ranked by child-similarity.
    
- **extract_structured** — Extract structured data from repeating containers.

    fields: [{name: "title", selector: ".job-title", attribute: "text|href|src|..."}]
    Only direct text nodes of element are captured for "text" (prevents child-field mixing).
    
- **extract_table** — Extract a <table> as JSON rows with optional header keys.
- **scrape_page** — Extract readable content, preserving JSON endpoints as native structured data.

    ``return_mode=json`` requires a valid JSON document and returns its parsed value;
    ``auto`` selects that mode when the document content type is JSON. ``text`` and
    ``markdown`` retain the readable envelope used by existing callers.
    
- **tab_focus** — Bring the active tab's browser window to the OS foreground.

    Programmatic CDP navigation does not raise Chrome to the front, so
    on a desktop where the user has their own Chrome already open you
    may see only the original window even though MCP successfully
    drove a different window/tab. Call this when you want to *see*
    what MCP is doing.

    Common reasons MCP's window is hidden:
      - Per-PID profile fallback: another Chrome already held
        ~/.mcp-stealth/profile/, so MCP launched into
        ~/.mcp-stealth/profile-pid<N>/ — that's a SEPARATE Chrome window.
        Run server_status to confirm (profile_dir field).
      - OAuth popup opened a new tab/window MCP now drives.
      - macOS Spaces / minimized window / behind other apps.
    
- **request_human_help** — Hand a headed local browser to the human without blocking the MCP call.

    The caller should immediately follow this with wait_for_human, optionally
    naming a completion URL fragment or selector.
    
- **wait_for_human** — Wait for objective evidence that a local human handoff completed.

    Args:
        timeout: seconds to wait. Defaults to the timeout given to
            request_human_help, or 300s when there is no pending handoff.
        done_url_contains: finish as soon as the URL contains this substring
        done_selector: finish as soon as this CSS selector appears

    With neither signal, any URL/DOM change since the handoff counts as done.
    A timeout is reported as an error — never as a silent success.
    
- **go_back** — Go back in history. Reports final_url / redirect_chain / status /
    ready_state observed afterwards; requested_url is null because history
    decides the destination. See navigate() for the expect_* rules.
- **go_forward** — Go forward in history. Reports the observed postconditions; see
    navigate() for the expect_* rules.
- **reload** — Reload the active tab. Reports the observed postconditions — a reload
    that lands on a login redirect is otherwise indistinguishable from one that
    reloaded the page you were on. See navigate() for the expect_* rules.
- **tab_list** — List all open tabs with index, URL, title.
- **tab_new** — Open a new tab and make it the active one for every later tool.

    Reports the same observed postconditions as navigate() — a new tab that
    redirects is otherwise reported as sitting on the URL you asked for.
    See navigate() for the expect_* rules.

    new_window: where it opens. Left unset: headed, its own window behind the app the
        person is using; headless, a tab. True: its own window in both. False: a tab in
        an existing window. Headed, that tab stays behind the tab its window shows, so
        Chrome never comes to the front, and focus emulation keeps the page reading as
        visible (and focused). Chrome picks the window, usually the browser's first one
        rather than the active tab's, so the result says where it landed and what the
        page reads, and says so when the page reads as hidden.
    
- **tab_select** — Make the tab at index (from tab_list) the one every later tool acts on.

    Does not raise the window, since that takes the keyboard from whatever the person is
    doing, so a headed browser may keep showing another tab. focus=True, or tab_focus,
    brings this one to the front.
    
- **tab_close** — Close tab at index (defaults to active).
- **click_role** — Click by ARIA role (e.g. button, link, textbox), optional accessible name.

    Same honesty guarantees as click_text: reports the resolved element, refuses
    when the hit-test says the click can't land, and flags a no-op click.
    
- **assert_clickable** — Check whether a click would actually reach the target — WITHOUT clicking.

    Answers "why did my click do nothing?" before you waste a call on it. Give a
    selector/ref to hit-test that element's centre, or x/y to ask what sits at a
    raw viewport point.

    Returns the resolved element, its rect, the hit-test verdict, and — when the
    point is covered — the element that is in the way.
    
- **hover** — Hover over element.
- **press_key** — Press a key and report what was observed, not only that it was sent.

    Args:
        key: a character, a name (Enter, Tab, Escape, Backspace, ArrowDown, Home, F5)
            or a combination (Control+a, Shift+Tab).
        verify: compare the page before and after. False sends the key and says the
            effect was not checked.
        settle_ms: how long to watch for an effect. A form submitted by Enter takes a
            moment to navigate, so this stops as soon as something changes.

    "NO page change detected" means nothing this tool can see moved within settle_ms.
    The key was still delivered, and a handler may have acted without touching the DOM.
    
- **select_option** — Select an <option> of a <select> by value or by its visible label.

    The native dropdown cannot be driven with page input, so this sets the option from JS
    and fires input and change. Those events have isTrusted=false, which the result states.
    Reads the select back afterwards, because a page can reject the choice.
    
- **uncheck** — Untick a checkbox, confirming the state changed. See check.
- **upload_file** — Upload a file via <input type=file>, or drop it on a drop zone.

    The file is handed over by its path, so its size does not matter (2.2 GB took 0.09 s and no
    memory). An input inside a shadow root is reached through its ref from browser_snapshot.

    Args:
        drop: False (default) sets the file on the <input type=file> named by ref or selector,
            hidden or not. True drops it on the element instead, as a file dragged from Finder:
            dragenter, dragover and drop at its centre, after the same hit test a click gets. For
            pages that take files only by dropping. The result says whether the page reacted.
    
- **mouse_click_xy** — Click at raw viewport coordinates (CSS px, relative to the viewport).

    Args:
        x, y: target point in CSS pixels, viewport-relative (same space as
            getBoundingClientRect()).
        button: "left" | "right" | "middle"
        move_first: send a mousemove to the point before pressing (default True).
            Real users hover before clicking, and menus/overlays that only render
            on hover (Canva, Figma, Notion) are unreachable without it. Set False
            only if a hover handler would interfere.
    
- **mouse_move** — Move cursor to raw coordinates. humanize=True uses Bezier path.
- **drag_and_drop** — Drag from (start_x, start_y) to (end_x, end_y) with real mouse input.

    Reports whether the page changed, since nothing else says the drop landed.
    
- **wait_for** — Wait until selector exists or text is visible on the page. With neither, just sleep.
- **wait_for_change** — Wait until the page actually CHANGES, and report what changed.

    The "click, then wait for the result" pattern belongs in one call. With no
    arguments it waits for any structural change from the moment it is called —
    useful right after a click when you don't know what the result looks like.

    Args:
        selector: wait until this CSS selector appears (or disappears if gone=True)
        text: wait until this text appears in the visible page (or disappears)
        url_contains: wait until the URL contains this substring
        gone: invert selector/text — wait for it to go away instead
        timeout: seconds to wait before giving up (returns an error saying so)
        poll: seconds between checks

    Returns what satisfied the wait and how long it took, so a timeout is never
    mistaken for a silent success.
    
- **wait_for_navigation** — Wait until document.readyState is complete, or report that it did not get there.
- **wait_for_url** — Wait until URL matches a regex pattern.
- **wait_for_response** — Wait for a network response whose URL matches regex.
- **click_turnstile** — Auto-find and click the Cloudflare Turnstile checkbox.

    Three-tier detection strategy:
      1. Primary selectors: iframe[src*=challenges.cloudflare.com], [data-sitekey], .cf-turnstile
      2. Secondary: .turnstile, input[name=cf-turnstile-response] → nearest sized container
      3. Fallback (if fallback_template=True): OpenCV template match via verify_cf
         — covers out-of-process iframe cases (e.g. nopecha.com/captcha/turnstile)

    Args:
        offset_x: pixels from widget left edge (default 30, calibrated for CF checkbox)
        offset_y: vertical offset (default = container center)
        fallback_template: if selectors fail, try OpenCV template click (default True)

    Reports what the page shows afterwards: whether the cf-turnstile-response token filled,
    the title, and whether the challenge is still there. A click landing is not a challenge
    passed. Measured: on nopecha.com/demo/cloudflare the click earned a cf_clearance cookie
    and the page still answered 403, and the 2captcha demo uses Cloudflare's test sitekey,
    whose token is a dummy. Neither shows that a real protected site lets you in.
    Does NOT work on a full-page "Just a moment..." challenge: CDP clicks failed 3 of 3
    there. Use solve_turnstile_oscursor, which clicks with the real OS cursor (needs the
    [os-cursor] extra and macOS Accessibility + Screen Recording; takes over the mouse),
    or storage_state_load with a warm session, or solve_captcha.
    
- **click_element_offset** — Click inside element at percentage position (not center).

    Examples:
      x_percent=8          → checkbox at left edge of label
      x_percent=90         → right-side toggle slider
      y_percent=20         → top portion of a card
    
- **click_at_corner** — Click at a corner of element (close X buttons, delete icons, dismiss).

    corner: top-left | top-right | bottom-left | bottom-right
    offset: inset pixels from corner (default 8px — works for most X buttons)
    
- **find_by_image** — Find an image on the current page via OpenCV template matching.

    Takes a fresh screenshot, matches against template_path image, returns
    (x, y) center of best match. Use for finding visual buttons/icons when
    DOM selectors aren't available.

    Returns JSON: {"found": true, "x": ..., "y": ..., "score": ..., "template": "..."}
    
- **click_at_image** — Find image via template matching, then click its center.

    Combines find_by_image + humanize_move + mouse_click. Useful for visual
    CAPTCHAs, custom buttons without reliable selectors, or interacting with
    canvas-based UIs.
    
- **mouse_drift** — Simulate idle mouse wandering to pass behavioral ML.

    Random Bezier segments across the viewport — mimics a user thinking.
    Call BEFORE a critical interaction (form submit, button click) to
    establish 'human' behavior pattern before the deterministic action.
    
- **mouse_record** — Record real mouse movements from the page for later replay.

    Injects a listener that captures mousemove events during duration. Move
    your mouse naturally in the Chrome window while this runs. The recorded
    path can then be played back via mouse_replay() — highest-stealth
    behavioral pattern (indistinguishable from human).

    Returns: JSON array of {t, x, y} events.
    
- **mouse_replay** — Replay a recorded mouse path (from mouse_record).

    Args:
        path_json: JSON array of {t, x, y} from mouse_record
        speed: 1.0 = original speed, 2.0 = 2x faster, 0.5 = slower
    
- **storage_state_save** — Save cookies + localStorage of current origin to JSON.

    DIFFERENTIATOR: Per research, session-reuse is THE most reliable way to
    bypass Cloudflare Turnstile — it never triggers if session valid.
    Login manually once → save state → reuse forever until expiry.
    
- **storage_state_load** — Load cookies + localStorage from a saved JSON file.

    Call BEFORE navigating to protected site so session is ready.
    
- **solve_captcha** — Solve a CAPTCHA via CapSolver HTTP API.

    kind: turnstile | recaptcha_v2 | recaptcha_v3 | hcaptcha
    Needs CAPSOLVER_KEY env var (or pass api_key). Returns solved token.
    If inject_selector given, also injects token into that form field
    (e.g. input[name='cf-turnstile-response']).
    
- **verify_cf** — Use nodriver's built-in Cloudflare challenge verification.

    Uses OpenCV template matching to find the Turnstile checkbox on a screenshot
    and click it. template_image is a path to a cropped image of the checkbox;
    without it, the bundled English default is used.

    Reports what the page shows after the click, and errors when no checkbox matched.
    Clicks go through CDP. A full-page "Just a moment..." challenge did not pass that way
    in our tests: use solve_turnstile_oscursor, or storage_state_load / solve_captcha.
    
- **identity_pin** — Persist a stable fingerprint + proxy for one browser instance.

    Future browser_launch/spawn_browser calls for that instance apply the pin
    automatically. Omitted fields preserve an existing pin. Fields never set follow
    the real browser, so pinning only a proxy leaves the identity as it is.
    
- **identity_show** — Show the persisted identity pin for an instance. A proxy password reads as ***
    unless reveal_values=True.
- **fingerprint_rotate** — Override fingerprint vectors for active tab: user_agent, accept_language,
    platform (Win32/MacIntel/Linux x86_64), timezone (Asia/Jakarta, etc).
    Applied via CDP. Persists until next tab creation. Client hints
    (navigator.userAgentData) are derived from the UA so they agree with it, and a UA
    without a platform gets the matching navigator.platform.
    
- **humanize_click** — Click with Bezier-curve mouse approach + randomized dwell.

    Targets an element (ref/selector) OR a raw viewport point (x/y, CSS px).
    The coordinate form approaches the point along a Bezier path before pressing,
    which also renders hover-only overlays on the way in.
    
- **humanize_type** — Type with Gaussian-distributed keystroke delays. See type_text.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "mcp-stealth-chrome": {
    "command": "uvx",
    "args": ["mcp-stealth-chrome@latest"]
  }
}
```

## Documentation

## What mcp-stealth-chrome does

mcp-stealth-chrome exposes 173 tools for browser automation and HTTP access through MCP. It connects to Chrome or Chromium and lets an agent navigate pages, inspect page content, interact with controls, reuse browser sessions, and make direct HTTP requests. Search and page reading can work without an API key.

The browser path is intended for sites that depend on JavaScript, authentication, or visible interaction. The HTTP path is lighter when the required data can be retrieved without rendering a page. Both modes can be used in one workflow, such as signing in through Chrome and then requesting an authenticated endpoint with the browser's cookies.

## How it works

Browser control runs through the Chrome DevTools Protocol using nodriver rather than WebDriver. HTTP requests use curl_cffi and can use a Chrome, Firefox, or Safari TLS fingerprint. Browser results include references that an agent can pass to later actions, and interaction results report what occurred.

A typical flow launches a page, takes a snapshot, then uses a returned reference to click or fill a control:

- Launch the browser with `browser_launch`.
- Inspect the page with `browser_snapshot`.
- Act on a returned reference with `click` or `fill`.

Sessions can be saved after a manual login and reused in a later headless launch. Multiple browser instances can run with separate profiles, with `spawn_browser` and `switch_instance` selecting the active account or session.

## Setup and configuration

Install `uv` and Chrome or Chromium. The package requires Python 3.11 or newer; `uvx mcp-stealth-chrome@latest` can run it without a separate application installation. The server uses stdio configuration in the documented clients, including Claude Desktop, Claude Code, Cursor, Windsurf, VS Code, Zed, Codex CLI, and Gemini CLI.

Optional features are supplied as package extras. Use the `os-cursor` extra for `solve_turnstile_oscursor`; macOS also requires Accessibility and Screen Recording permissions for the application or terminal running the client. Use the `adblock` extra for `block_ads`. The two extras can be installed together.

## Tools and capabilities

The tool set includes capabilities for:

- Launching, closing, switching, and spawning browser instances.
- Taking page snapshots and reading pages.
- Clicking controls, filling fields, and providing real mouse input.
- Saving and reusing storage state, including cookies from a browser session.
- Sending HTTP requests with selectable browser-style TLS fingerprints.
- Reusing browser cookies for HTTP requests.
- Detecting anti-bot protection and receiving recommended tools.
- Inspecting requests with `dry_run` and `intercept_log`.
- Attempting Turnstile interaction with `click_turnstile` or the optional OS-cursor tool.
- Enabling ad blocking when the optional engine is installed.

Passwords and cookies are hidden from tool output by default. `server_status` reports server and optional-feature state, including whether OS-cursor support and ad blocking are ready.

## Limitations and notes

The browser must be installed locally, and browser automation depends on Chrome or Chromium. The documented Turnstile test results differ by challenge: the Cloudflare test widget reached success with `click_turnstile`, while a full-page challenge remained unsolved in the reported test. Site behavior can change, so those results are not guarantees.

The adblock engine is not installed by default and lacks a prebuilt package for Alpine and other musl-based Linux systems or Windows on ARM. Without the extra, `block_ads=True` can still launch but reports that blocking is disabled. Windows and Linux backends for OS-cursor support exist but have not been field-tested.

Manual login followed by storage-state reuse is presented as the most reliable approach for login walls. Closing the active instance leaves its name selected, so switch back to the intended profile before launching another browser.

_Full upstream README: https://allmcps.com/mcp/mcp-stealth-chrome/readme_

