peek

v0.1.0-alpha.24
io.github.Cubenest/peek-mcp Checked 4 days ago Published 5 months ago

Exposes recorded browser sessions (rrweb DOM, console, network) to AI coding agents, fully local

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

list_recent_sessions List recent browser sessions

List the user's recorded browser sessions, newest first — the entry point for debugging what already happened (the get_session_* and DOM tools). Returns compact JSON rows ({ sessionId, origin, url, title, startedAt, ... }); free-text fields are clipped (origin 100, url 300, title 200 chars). If the MCP client scoped roots to specific origins and no origin filter is given, results are restricted to the client's scoped origins. Start here to obtain a sessionId, then call get_session_summary.

ParameterTypeDescription
limitintegerMaximum sessions to return (1-50, newest first; default 10).
originstringFilter to one origin, e.g. 'https://app.example.com'. Omit to list across all recorded origins (subject to client roots scoping).

search_sessions Search recorded sessions

Search your recorded browser sessions by metadata and facets — free text in title/URL/origin (q), exact origin, recorded date range (createdAfter/createdBefore, ISO-8601), status (active/finalized), and whether the session has console errors (hasConsoleErrors) or network errors (hasNetworkErrors). Returns the same compact rows as list_recent_sessions, newest first. Read-only and local. Use it to find a sessionId when you don't already have one, then call get_session_summary. Matches session metadata only — not page content or error-message text. Multiple facets combine with AND (e.g. hasCo…

ParameterTypeDescription
createdAfterstringOnly sessions first recorded at or after this ISO-8601 time.
createdBeforestringOnly sessions first recorded at or before this ISO-8601 time.
hasConsoleErrorsbooleanOnly sessions with at least one console error.
hasNetworkErrorsbooleanOnly sessions with a failed/4xx-5xx network request.
limitintegerMaximum sessions to return (1-50, newest first; default 10).
originstringExact origin filter, e.g. 'https://app.example.com'.
qstringFree text matched (case-insensitive) against session title, URL, and origin.
statusstringFilter by session status.

get_session_summary Summarize a session

Get an LLM-readable narrative summary of one session — your orientation for debugging what already happened: pages visited, click/input/navigation counts, and error counts. Use this first for an overview before drilling into get_session_console_errors / get_session_network_errors. Returns a structured JSON summary.

ParameterTypeDescription
sessionId *stringSession id from list_recent_sessions.

get_session_console_errors List console errors

List console error messages recorded in a session, oldest first. Each row has a numeric id to pass to get_user_action_before_error. Returns JSON rows ({ id, ts, level, message, stack }); message clipped to 500 and stack to 800 chars. For error counts at a glance, use get_session_summary first.

ParameterTypeDescription
sessionId *stringSession id from list_recent_sessions.
limitintegerMaximum errors to return (1-200, oldest first; default 50).
sinceintegerOnly return errors with ts >= this epoch-ms timestamp (to page forward through a long session). Omit to start from the beginning.

get_session_network_errors List failed network requests

List failed or notable network requests in a session (HTTP status >= statusGte, or a transport-level network error), oldest first. Returns JSON rows ({ id, ts, method, url, status, statusText, resourceType, durationMs, errorText }); url and errorText clipped to 300 chars.

ParameterTypeDescription
sessionId *stringSession id from list_recent_sessions.
limitintegerMaximum requests to return (1-200, oldest first; default 50).
statusGteintegerMinimum HTTP status treated as notable (100-599; default 400, i.e. 4xx/5xx). Transport-level errors are always included regardless.

get_user_action_before_error Actions before an error

Pre-assembled causal chain for a console error: the user actions, DOM mutations, and network errors in the window before it, merged into one time-ordered timeline with a deterministic narrative — to explain how the error was triggered. Returns JSON { errorId, errorTs, error, windowMs, actions, domMutations, networkErrors, timeline, narrative, truncated }. Get errorId from get_session_console_errors first.

ParameterTypeDescription
errorId *integerConsole error id from get_session_console_errors.
sessionId *stringSession id from list_recent_sessions.
windowintegerHow many preceding user actions to return (1-50; default 10).
windowMsintegerTime window (ms) before the error for correlated DOM mutations + network errors (100-60000; default 5000).

generate_playwright_repro Generate Playwright repro

Generate a runnable Playwright test (TypeScript) reproducing the user actions in a session: clicks, typing, navigation, and <select> changes. Optionally limit to a [startTs, endTs] epoch-ms window. Pass errorId (from get_session_console_errors) to seed a console-error-absence regression assertion — the generated test will capture console errors and assert the given error is not reproduced. Returns the test source as text. Note: only single-value <select> is represented (rrweb captures one value per input).

ParameterTypeDescription
sessionId *stringSession id from list_recent_sessions.
endTsintegerOnly include actions at or before this epoch-ms timestamp. Omit to run through the session end.
errorIdintegerConsole error id (from get_session_console_errors) to seed a console-error-absence regression assertion.
startTsintegerOnly include actions at or after this epoch-ms timestamp. Omit to start at the session beginning.

get_dom_snapshot Reconstruct DOM at a time

Reconstruct the page DOM as it existed at a timestamp (or a selector subtree within it) and return it as HTML. Applies structural/attribute/text mutations on top of the nearest full snapshot at or before ts. Returns JSON { baseSnapshotTs, mutationsApplied, html }; html clipped to 24000 chars. Fails if no full snapshot exists at or before ts.

ParameterTypeDescription
sessionId *stringSession id from list_recent_sessions.
ts *integerEpoch-ms timestamp to reconstruct the DOM at. Use timestamps from get_session_summary, error rows, or get_user_action_before_error.
selectorstringCSS selector to return only that subtree. Omit to return the full document.

query_dom_history DOM change timeline

Timeline of DOM changes in a session. Two modes: (1) selector mode — pass `selector` to track one node's attribute/text history (use `op` to restrict). (2) window mode — pass `ts` (and optional `windowMs`) instead, to get ALL DOM changes in [ts - windowMs, ts] with per-change `target` hints, no selector needed. Returns JSON { selector, changes } or { ts, windowMs, changes }.

ParameterTypeDescription
sessionId *stringSession id from list_recent_sessions.
limitintegerMaximum changes to return (1-500; default 100). Selector mode keeps the earliest matches; window mode keeps the most recent (closest to `ts`).
opstringSelector mode only: restrict to 'attributeChanges' or 'innerText'. Omit for both.
selectorstringSelector mode: CSS selector to track one node, e.g. '#status'. Omit and pass `ts` for window mode.
tsintegerWindow mode: anchor (epoch-ms). Returns DOM changes in [ts - windowMs, ts]. Ignored if `selector` is given.
windowMsintegerWindow mode size in ms (100-60000; default 5000).

request_authorization Request action authorization

Ask the user to authorize a browser action via the side-panel banner (Level-3 act-with-confirm). On Allow, returns a one-shot confirmToken to pass to execute_action; on Deny, returns the denial. Every call - allowed or denied - is recorded to ~/.peek/audit.log. Use before execute_action when the origin is at permission Level 3, or to pre-authorize.

ParameterTypeDescription
action *The browser action to authorize (e.g. click/type/navigate; see the action schema).
sessionId *stringSession id (origin context) from list_recent_sessions; determines the per-origin permission level.

execute_action Execute a browser action

Execute an action (click/type/navigate/...) in the user's live browser. Requires per-origin permission Level 3+: Level 3 raises a confirm banner unless a valid confirmToken from request_authorization is passed; Level 4 auto-allows non-destructive actions; Level <3 denies. The destructive-action override (delete/remove/transfer/send/pay/purchase/buy/confirm/subscribe/logout/sign out/unsubscribe/cancel subscription/wire/withdraw) always prompts, even at Level 4. Every call is recorded to ~/.peek/audit.log. After a mutating action, re-read to confirm it took: get_element_detail on the target (its…

ParameterTypeDescription
action *The browser action to execute (e.g. click/type/navigate; see the action schema).
sessionId *stringSession id (origin context) from list_recent_sessions; determines the per-origin permission level.
confirmTokenstringOne-shot token from a prior request_authorization Allow, to skip the Level-3 banner. Omit to trigger the banner (Level 3) or rely on Level-4 auto-allow.
connectorSecretstringSP4: paired-connector secret; presented by connectors, ignored for direct clients.

suggest_element Highlight an element in the live browser

Draw a non-destructive highlight overlay on a CSS selector in the user's live browser, with an optional label, to point something out. Available at per-origin permission Level 2 (Suggest) and above; it never clicks, types, or navigates. The overlay persists until clear_highlight is called. Every call is recorded to ~/.peek/audit.log.

ParameterTypeDescription
selector *stringCSS selector of the element to highlight.
sessionId *stringSession id (origin context) from list_recent_sessions; determines the per-origin permission level.
labelstringOptional short text shown in a badge next to the highlight (<=120 chars).

clear_highlight Clear the highlight overlay

Remove the highlight overlay previously drawn by suggest_element in the user's live browser. Available at per-origin permission Level 2 (Suggest) and above. Idempotent. Recorded to ~/.peek/audit.log.

ParameterTypeDescription
sessionId *stringSession id (origin context) from list_recent_sessions; determines the per-origin permission level.

set_intent Set the control-shield banner text

Set the agent's status banner shown on the control shield (e.g. 'Applying to Senior Frontend · step 2/4'), so the user can follow what you're doing. Up to 80 chars, plain text. Requires the origin at Level 4 with the shield up; auto-allowed. Recorded to ~/.peek/audit.log. Advance the step only after the previous step verified (re-read it took); on a failure, set a 'stopped — <what> didn't take' status instead of advancing. End an assisted-apply loop by calling set_intent with a short summary text plus status:'done' (success) or status:'failed' (with a brief reason), so the user sees a clear…

ParameterTypeDescription
sessionId *stringSession id (origin context) from list_recent_sessions; determines the per-origin permission level.
text *stringStatus text shown in the shield banner (<=80 chars). Pass an empty string to clear it.
statusstringSet 'done' when the task is fully complete, or 'failed' when you stopped because a step didn't take, to show a terminal banner on the shield. Omit for an ongoing status update.

request_user_input Pause and ask the user to fill something in on the page

Pause the agent and hand the keyboard back to the user for ONE editable, non-destructive field (or a free-text prompt), then resume. Requires the origin at Level 4 with the control shield up. Blocks until the user clicks Done, a timeout fires, or the run is stopped. Returns { resumed:true, value? } or { resumed:false, reason }. The returned value is only included when readBack:true and the field isn't a password/OTP/credit-card field. Recorded to ~/.peek/audit.log (prompt + selector only — never the value).

ParameterTypeDescription
prompt *stringWhat to ask the user to do (shown in the card, below a peek-authored framing line).
sessionId *stringSession id (origin context) from list_recent_sessions; determines the per-origin permission level.
readBackbooleanIf true, return what the user typed to the agent (never for password/OTP/cc fields). Default false.
scopestring'field' (default) unlocks one editable field; 'page' hands full page control back (CAPTCHAs, native widgets, final review) until Resume. Inherits the handoff recording-suspension.
selectorstringCSS selector of the editable field to unlock for the user. Omit for a free-text prompt card.
timeoutMsintegerHow long to wait for the user (default 120000, max 600000).

get_page_view Get a live, ref-tagged view of the current page

Return a compact, masked snapshot of the user's LIVE page as a list of interactive/labeled elements, each with a stable `ref` (e.g. e5). Pass a `ref` to execute_action / request_authorization (click/type/scroll/enter/dblclick) instead of authoring a CSS selector — deterministic and far cheaper than reading get_dom_snapshot's HTML. Refs expire on navigation; re-call after navigating. Available at per-origin Level 1+; non-mutating; recorded to ~/.peek/audit.log. Password/email/tel and PII-autofill (card/address/etc.) input values, and fields marked private, are masked; structured PII is scrubb…

ParameterTypeDescription
sessionId *stringSession id (origin context) from list_recent_sessions; determines the per-origin permission level.
maxElementsintegerCap on elements returned (1-500; default 200).
selectorstringScope the snapshot to a CSS subtree. Omit for the whole page.

get_element_detail Get full masked detail for one element by ref

Given a `ref` from get_page_view, return the FULL masked detail of that single element (role, accessible name, accessible description, all aria-*, effective aria-hidden/disabled, a curated computed-style bag, state, value, href, position, nearby heading, and its interactive descendants with their refs, capped). The compact get_page_view stays cheap; call this only for the one element you need to disambiguate or act on. Refs expire on navigation. Level 1+; non-mutating; audited. Values for password/email/PII inputs are masked; free-text values may be returned (like the recorder). For live conso…

ParameterTypeDescription
ref *stringAn element ref (e.g. "e5") from a recent get_page_view.
sessionId *stringSession id (origin context) from list_recent_sessions.

verify_audit_log Verify the action audit log

Verify the integrity of peek's local action audit log (~/.peek/audit.log) — the append-only, hash-chained record of every browser action peek authorized or attempted. Returns JSON { logPresent, status, entriesVerified, prelude, headPresent, brokenAtLine?, expected?, got?, gaps?, summary }. status is one of intact | broken | truncated | tail-tampered | prefix-tampered | incomplete-final | gaps | head-missing. Local and read-only. The log is tamper-EVIDENT, not tamper-proof: it has no cryptographic signature and no external timestamp anchor. Use it to confirm the action trail on this machine h…

request_pairing Request connector pairing

Initiate a connector-pairing handshake: present a pairing code and receive a one-shot secret on approval. The connecting client name is taken from the MCP connection identity. Returns JSON { approved, secret? }. Every attempt is recorded to ~/.peek/audit.log; the secret is never written to the log.

ParameterTypeDescription
code *stringThe pairing code generated by the connector for this handshake.