cdpilot

v0.9.13
io.github.mehmetnadir/cdpilot Checked 10 hours ago Published 16 days ago

Zero-npm-dependency browser automation over raw CDP — no Puppeteer, Playwright, or Selenium.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

browser_navigate

Navigate to a URL and return the first 10000 chars of visible text after waiting for page load.

ParameterTypeDescription
url *stringFull URL to navigate to (must include https://)

browser_screenshot

Save a viewport screenshot and return the file path (image enters context only if the file is read). Defaults to CSS pixels on HiDPI displays (env CDPILOT_SHOT_SCALE=device keeps device pixels). A w x h image costs ceil(w/28)*ceil(h/28) vision tokens: crop with element to cut pixels; format and quality change only file size.

ParameterTypeDescription
elementstringCSS selector to crop to element bounding box
filenamestringOutput file path (.png, .jpg, .webp)
qualitynumberJPEG quality 1-100 (.jpg only; default 80): file size only, same vision tokens

browser_click

Click an element by CSS selector, scrolling into view and auto-waiting up to 5 seconds (MutationObserver). Returns clicked tag name and text. When a mouse click press lands but the page changes before release so the target is missed, nothing is clicked again and the first line is JSON {"clicked": false, "reason": "moved"|"gone"|"unknown"} (isError stays false): check page state before retrying.

ParameterTypeDescription
selector *stringCSS selector; chain into an iframe or shadow root with '>>>' (e.g. 'iframe#card >>> .inner')

browser_type

Type text into an input or textarea using React-compatible value setting (native setter + input/change events), auto-waiting up to 5 seconds. Alias of browser_fill.

ParameterTypeDescription
selector *stringCSS selector; chain into an iframe or shadow root with '>>>' (e.g. 'iframe#card >>> .inner')
text *stringText value to type into the element

browser_content

Get visible text of current page (document.body.innerText) up to 10000 characters without HTML markup. Prefer browser_a11y for structured navigation data.

browser_html

Get full HTML source of current page (document.documentElement.outerHTML) up to 50000 characters. Prefer browser_content or browser_a11y for smaller, more targeted data.

browser_eval

Execute JavaScript in the page context via Runtime.evaluate and return the result.

ParameterTypeDescription
expression *stringJavaScript expression to evaluate

browser_eval_batch

Evaluate multiple JavaScript expressions in a single CDP round-trip, returning an array of {ok, value} or {ok:false, error} objects without aborting on individual failures.

ParameterTypeDescription
expressions *arrayArray of JavaScript expressions (each runs in its own try/catch)

browser_tabs

List all open browser tabs with their IDs, URLs, and titles.

browser_console

Navigate to a URL and capture all console messages (log, warn, error, info) and uncaught exceptions.

ParameterTypeDescription
urlstringURL to navigate to while capturing console output

browser_network

Navigate to a URL and monitor network requests and responses, returning each request's URL, HTTP status code, and MIME type.

ParameterTypeDescription
urlstringURL to navigate to while monitoring network traffic

browser_a11y

Get page accessibility tree as structured data with @N element references usable with browser_click (preferred for page structure). Use 'summary' mode for interactive elements only.

ParameterTypeDescription
modestringDetail level: 'full' for complete tree, 'summary' for interactive elements only

browser_fill

Set an input or textarea value via native descriptor setter and change events, auto-waiting up to 5 seconds. Works with regular inputs and React controlled components.

ParameterTypeDescription
selector *stringCSS selector; chain into an iframe or shadow root with '>>>' (e.g. 'iframe#card >>> .inner')
value *stringValue to set in the input field

browser_launch

Launch an isolated browser instance with Chrome DevTools Protocol enabled using local Brave/Chrome/Chromium (no download) and an isolated profile: the user's own browser data is never touched.

browser_close

Close all tabs opened by cdpilot, and gracefully quit the browser only if no user-opened tabs remain. Set force=true to quit even if user tabs remain; set keep_browser=true to close cdpilot tabs and keep browser running.

ParameterTypeDescription
forcebooleanClose the browser application even if user-opened tabs remain.
keep_browserbooleanOnly close cdpilot's own tabs; never quit the browser.

browser_extract

Extract structured DOM data matching a CSS selector without an LLM: returns text, JSON (tag, text, attrs, href, src), or list. Limits: 100 elements for JSON, 200 for text.

ParameterTypeDescription
selector *stringCSS selector to match elements
formatstringOutput format: 'text' (one per line), 'json' (with attributes), 'list' (numbered)

browser_observe

List all interactive elements on current page with available actions (CLICK, FILL, NAVIGATE, TOGGLE, SELECT, SUBMIT, UPLOAD) deterministically without an LLM.

browser_agent_observe

Token-budget page state for an agent: numbered @refs (role, name, value) for actionable elements, headings and clickable items (full=true lists every entry), text summary, `frames` (visible iframes; blocking=true: inspect with frame=<i>), token_estimate, and known_flows for this host. With CDPILOT_OBSERVE_FORMAT=rows entries are [ref, role, name, value?] arrays (role is "" when equal to previous row). With diff=true returns only changes since last observe/act (added descriptors, removed refs, value changes, text delta). injection_suspect marks page text that addresses the model, not the user (…

ParameterTypeDescription
allbooleanBypass the 400-entry limit (CDPILOT_OBSERVE_MAX) in default view
diffbooleanOnly changes since the last agent observe/act
frameintegerIframe index from `frames` to read
fullbooleanEvery entry without filtering or size limits

browser_agent_find

Find entries by accessible name substring (any case) and optional role across the whole page, including entries cut off by observe limits. Returns matches [{ref, role, name}] (at most max, default 20) and total_matches for use with browser_agent_act without writing a trail.

ParameterTypeDescription
text *stringName substring to match (case-insensitive)
maxintegerMaximum matches to return (default 20)
rolestringFilter by role (e.g. link, button, textbox)

browser_agent_act

Act on an observe @ref (click, fill/type with text, hover, submit) or navigate to url, returning state diffs (changed.added descriptors, changed.removed refs, value changes, text delta). Actions are recorded for browser_agent_flow_save. Navigation triggers guard checks: guard {rule, host, mode} in result indicates secret_in_url (other site cookie), url_from_hidden (host only in hidden/suspect text), or outside_origins (CDPILOT_AGENT_ORIGINS); navigation still ran (warn) — stop and ask user before proceeding. Detected cookies are «redacted» in url.

ParameterTypeDescription
actionstringAction to perform (default: click)
refstringElement @ref from browser_agent_observe (e.g. @3)
textstringText value for fill or type actions
urlstringURL to navigate to instead of acting on a ref

browser_agent_flow_save

Save agent acts since the last navigation (or the last N) as a replayable flow for this project using role, name, and position anchors, with passwords replaced by {{placeholders}}. Replay later with browser_agent_run without a model.

ParameterTypeDescription
name *stringFlow name (slugified)
lastintegerSave only the last N actions

browser_agent_run

Replay a saved flow by anchors without a model in the loop, returning {status:'ok', steps, url, title, ms, tokens_avoided}. On drift (missing anchor or host change), returns status:'drift' with full observation to act with browser_agent_act and repair via browser_agent_flow_save with the same name. Requires vars {name: value} for {{placeholders}} (fails before execution if missing). dry_run previews steps without browser action. A navigation step that browser_agent_act would guard returns guard {rule, host, mode, step} (warn: the step still ran).

ParameterTypeDescription
flow *stringFlow name (see known_flows in browser_agent_observe)
dry_runboolean
varsobjectValues for the flow's {{placeholders}}

browser_smart_click

Click an element by visible text without selectors, using fuzzy matching across text, aria-label, title, placeholder, and value. Returns match score and alternatives. Use when the exact selector is unknown.

ParameterTypeDescription
text *stringVisible text of element to click (e.g. 'Login', 'Submit Order')

browser_dismiss

Find and click modal dismiss buttons ('Stay signed out', 'No thanks', 'Skip', etc. in EN/TR), explicitly excluding destructive lookalikes (Delete account, Sign out, Subscribe). Pass repeat=1-10 or 'aggressive' (up to 5) for chained modals.

ParameterTypeDescription
repeatstringDismiss attempts (1-10) or 'aggressive' (up to 5 chained modals)

browser_captcha_solve

Solve Amazon classic image CAPTCHAs (opt-in) via OCR, input filling, and submission, returning JSON status. Providers: 'amazon-local' (offline OCR; pip install amazoncaptcha), or API providers 'capsolver' / '2captcha' (CAPSOLVER_API_KEY / TWOCAPTCHA_API_KEY). For token CAPTCHAs (reCAPTCHA, hCaptcha, Turnstile) use the captcha config/auto CLI.

ParameterTypeDescription
providerstringSolver provider: 'amazon-local' (offline OCR), 'capsolver', or '2captcha'

browser_press_hold

Solve PerimeterX/HUMAN behavioural 'Press & Hold' challenges (opt-in) via humanized CDP Input events (Gaussian-randomized ~3-7s hold with +/-1-2px micro-jitter). Auto-locates #px-captcha unless selector is specified. Returns JSON with solved status, hold_ms, and attempts. Use when browser_friction reports perimeterx.

ParameterTypeDescription
selectorstringOptional CSS selector for hold target (auto-locates #px-captcha if omitted)

browser_friction

Detect active anti-bot friction rung via bilingual (EN/TR) heuristics and return recommended policy as JSON: none, rate_limited (exponential backoff), soft_captcha (use captcha tools), or login_wall/otp_sms/hard_block (flagged for human handoff). Read-only; does not bypass defenses.

browser_smart_fill

Fill an input by associated label, placeholder, aria-label, name, or id using React-compatible value setting. Use when the exact selector is unknown.

ParameterTypeDescription
label *stringLabel or placeholder text (e.g. 'Email', 'Password', 'Search')
value *stringValue to fill in the input

browser_smart_select

Select a dropdown option by label/name and option text without knowing CSS selectors.

ParameterTypeDescription
label *stringLabel or name of the select dropdown
option *stringText of the option to select

browser_describe

Get a comprehensive page description combining accessibility tree (@N references), saved PNG screenshot, and visible text. Vision fallback for Canvas/WebGL, visual verification, or when browser_a11y is insufficient.

browser_assert

Assert that an element matching CSS selector exists and optionally contains expected text substring, returning PASS or FAIL with details. Checks visibility by default.

ParameterTypeDescription
selector *stringCSS selector to check
textstringExpected text substring match
visiblebooleanCheck that element is visible (not hidden or zero-size)

browser_wait_for

Wait for a CSS selector element to appear in the DOM via MutationObserver up to timeout, returning its tag and text or TIMEOUT.

ParameterTypeDescription
selector *stringCSS selector to wait for
timeoutnumberMaximum wait time in milliseconds

browser_wait_for_text

Wait for text to appear in document.body via MutationObserver (subtree + characterData) up to timeout, returning surrounding context immediately upon render. Ideal for streaming AI responses, toasts, and banners without selectors.

ParameterTypeDescription
text *stringText substring to wait for in document.body.innerText
timeoutnumberMaximum wait time in milliseconds

browser_check

Run a batch of assertions verifying element existence and optional text content, returning a summary report with PASS/FAIL counts.

ParameterTypeDescription
checks *arrayArray of check objects with required 'selector' and optional 'text'

browser_assert_url

Assert current page URL contains expected substring, returning PASS with full URL or FAIL.

ParameterTypeDescription
expected_url *stringExpected substring in current URL

browser_assert_title

Assert page title contains expected substring, returning PASS with full title or FAIL.

ParameterTypeDescription
expected_title *stringExpected substring in page title

browser_assert_count

Assert count of elements matching CSS selector equals expected count, returning PASS with count or FAIL with actual vs expected.

ParameterTypeDescription
expected_count *integerExpected number of matching elements
selector *stringCSS selector to count matching elements

browser_assert_value

Assert an input, textarea, or select element's value equals expected string, returning PASS or FAIL with actual value.

ParameterTypeDescription
expected_value *stringExpected exact value of the element
selector *stringCSS selector for the input, textarea, or select element

browser_assert_attr

Assert an element's HTML attribute contains expected substring, returning PASS with actual value or FAIL.

ParameterTypeDescription
attr *stringAttribute name (e.g. 'href', 'src', 'data-id', 'aria-label')
expected *stringExpected substring in attribute value
selector *stringCSS selector for the element

browser_assert_visible

Assert an element is visible on page (checking display, visibility, opacity, and bounding rect), returning PASS or FAIL.

ParameterTypeDescription
selector *stringCSS selector for element to check for visibility

browser_assert_hidden

Assert an element exists but is hidden (display:none, visibility:hidden, opacity:0, or zero size), returning PASS or FAIL.

ParameterTypeDescription
selector *stringCSS selector for element expected to be hidden

browser_screenshot_diff

Compare two screenshot PNG files byte-by-byte for visual regression, returning MATCH or DIFF with file sizes.

ParameterTypeDescription
path1 *stringAbsolute path to first (baseline) screenshot PNG
path2 *stringAbsolute path to second (current) screenshot PNG

browser_watch_start

Start a continuous JPEG screencast to disk via CDP Page.startScreencast (10-30 fps) for multimodal analysis of animations and visual events. Spawns a background daemon writing to a per-project ring buffer (default 300s retention, 100MB cap).

ParameterTypeDescription
disk_cap_mbintegerMaximum total frame size in MB before oldest-first eviction.
fpsintegerFrames per second (1-30).
max_widthintegerMaximum frame width in pixels (shrinks proportionally).
qualityintegerJPEG quality 1-100.
retention_sintegerSeconds to keep frames before eviction.
seekstringOptional MM:SS or seconds to seek page first <video> element before recording.
urlstringURL or file path to load, or '-' to attach to active page.

browser_watch_stop

Stop background screencast daemon and delete captured frames by default. Pass keep_frames=true to retain ring buffer on disk.

ParameterTypeDescription
keep_framesbooleanKeep captured frames on disk instead of deleting them.

browser_watch_query

Return file paths of screencast JPEG frames around a target time window for multimodal vision analysis. Choose ONE mode: at+window (centered on video time from start), last (duration before newest frame), or since_last (frames since previous query). Returns at most max frames (default 16), downsampled with high-motion preference when Pillow is available.

ParameterTypeDescription
atstringVideo timestamp to center on (MM:SS or seconds from screencast start).
laststringDuration before newest frame on disk (e.g. '5s').
maxintegerMaximum frame paths to return (downsampled if window has more).
since_lastbooleanReturn only frames captured after previous watch_query call.
windowstringWindow duration around `at` (e.g. '5s', '500ms').

browser_watch_status

Report screencast daemon state: running flag, frame count, total disk usage, and oldest/newest timestamps.

browser_mode

Get or set 3-tier stealth mode, applied on next navigation. Tiers: 'regular' (default; no anti-fingerprint patches), 'stealth' (light: navigator.webdriver, chrome.runtime, permissions), 'undetected' (full: plugins, WebGL vendor, Worker patch). Omit tier to read current mode. 'regular' suits most sites; escalate to 'undetected' (most fingerprint entropy) only for hard anti-bot targets.

ParameterTypeDescription
tierstringStealth tier to set ('regular', 'stealth', 'undetected'). Omit to read current tier.

browser_log

Read this project's local session log (read-only; reading does not add to it). Records commands, redacted secrets and inputs, exit codes, durations, URLs, titles, summaries, errors, and output files. Formats: 'table' (default compact table), 'md' (Markdown report of visits, actions, errors, files), or 'json' (raw JSON lines). Covers today unless 'days' is specified. Call it when a browser task is finished to report what was done.

ParameterTypeDescription
daysintegerInclude the last N days (1 = today).
formatstringOutput format ('table', 'md', or 'json').

browser_connect

Connect this project to a Chrome/Chromium the user started with --remote-debugging-port=<p> --user-data-dir=<dir> (CAPTCHAs, logins); 127.0.0.1/localhost only. Refused unless this server runs with CDPILOT_MCP_ALLOW_CONNECT=1 (or the user runs `cdpilot connect`). Then every tool runs in that browser, with its cookies and logins, until browser_disconnect; cdpilot never closes it.

ParameterTypeDescription
target *stringCDP port number, ws:// URL, or '--auto' to auto-detect.

browser_disconnect

Disconnect from connected external browser, removing its registration while leaving the browser running. Only way to drop connection.