@clipy/mcp 0.8.3 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +29 -2
  2. package/dist/index.js +69 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -107,7 +107,7 @@ or the Windsurf MCP config) directly:
107
107
  | `get_agent_context` | The full agent-context bundle (summary + key moments + transcript) as markdown. |
108
108
  | `record` | **Record a web app headlessly** and upload it as a Clipy recording; returns its share + agent-context URLs. Accepts a `type` (recording kind), `viewports` (sweep several screen sizes into one video), `storageState` / `userDataDir`+`profileDirectory` / `initScript` (record behind a login), and timestamped `notes` that become the (silent) recording's transcript. Needs Playwright in this server's environment and an `ingest`-scoped key (see below). |
109
109
  | `start_recording` | **Start a recording session** that keeps recording while you work (drive the page with your own browser tools, run commands, …). Accepts `type`, `storageState` / `userDataDir`+`profileDirectory` / `initScript`, and `exposeCdp` (get a CDP endpoint + in-page `window.__clipyMark`/`window.__clipyChapter` bridge to drive the recorded page). Auto-stops + uploads at `maxSeconds` (default 600) so it can never run away. |
110
- | `add_marker` | Drop a narration marker into the active session (live clock, or backdate with `atSeconds`) — markers become the recording's transcript chapters. Can carry evidence in one of two provenances: **clipy-verified** (`assertSelector` / `assertText` / `assertUrl`) where Clipy checks the page itself, or **driver-attested** (`observed` + `verdict`) where you report what your own tooling saw. Outcomes render as a pass (✓), an explicit failure (✗, can abort via `failMode`), or **unverified** (⚠, never a silent pass), and are tallied in separate segments. Navigations + console errors are added automatically as `[auto]` marks. |
110
+ | `add_marker` | Drop a narration marker into the active session (live clock, or backdate with `atSeconds`) — markers become the recording's transcript chapters. Can carry evidence in one of two provenances: **clipy-verified** (`assertSelector` / `assertText` / `assertUrl`) where Clipy checks the page itself, or **driver-attested** (`observed` + `verdict`) where you report what your own tooling saw. Clipy-verified outcomes render with a verdict glyph (✓ pass, ✗ failure that can abort via `failMode`, ⚠ unverified — never a silent pass); driver-attested ones render with a weaker-looking **hedge glyph** (`≈`) so the two are never mistaken at a glance, and they are tallied in separate segments. Navigations + console errors are added automatically as `[auto]` marks. |
111
111
  | `add_chapter` | Drop a `=== CHAPTER: <label> ===` boundary into the active session — split a recording into named sections (ideal for before/after demos). |
112
112
  | `stop_recording` | Finish the session: close the browser, upload, return the share + agent-context URLs. |
113
113
  | `abort_recording` | Discard the active session; nothing is uploaded. |
@@ -174,6 +174,33 @@ cross-origin auth). For a full identity, pass `userDataDir` — Chrome's **user-
174
174
 
175
175
  `storageState` and `userDataDir` are mutually exclusive; `profileDirectory` requires `userDataDir`.
176
176
 
177
+ ### Check the camera before you work
178
+
179
+ `record` and `start_recording` both return a `source` object describing **what is actually
180
+ being recorded**, resolved fresh at start time — the post-redirect `url`, the page `title`,
181
+ and the recording `viewport`:
182
+
183
+ ```json
184
+ "source": {
185
+ "kind": "headless_browser",
186
+ "title": "Orders — Admin",
187
+ "url": "https://app.example.com/orders",
188
+ "viewport": { "width": 1280, "height": 720 }
189
+ }
190
+ ```
191
+
192
+ Compare it against the surface your driver is acting on **before** doing minutes of work.
193
+ This exists because driver-attested evidence proves what the *driver* observed and nothing
194
+ ties it to what the *camera* saw — it's entirely possible to produce truthful marks over
195
+ footage of the wrong thing. **Clipy will never focus or foreground a window or tab for you**;
196
+ pointing the driver and the camera at the same surface is the caller's job.
197
+
198
+ `kind` is always `headless_browser` here: these tools record a headless page Clipy owns.
199
+ Capturing a real application window or display is CLI-only
200
+ (`clipy record --source mac-screen --window "<app>"`), so no window id or window title is
201
+ reported — an empty or invented one would be exactly the kind of false confidence this
202
+ field exists to prevent.
203
+
177
204
  ### Evidence on a marker: two provenances
178
205
 
179
206
  `add_marker` can carry evidence in exactly one of two provenances — they are tallied and rendered
@@ -182,7 +209,7 @@ separately, never pooled:
182
209
  | Provenance | How | What it means |
183
210
  | --- | --- | --- |
184
211
  | **clipy-verified** | `assertSelector` / `assertText` / `assertUrl` | Clipy checked the recorded page itself. Strongest evidence. Renders `[assert ✓ verified-by-clipy; …]`, or `[ASSERT ✗ verified-by-clipy; …]`, or `[ASSERT ⚠ clipy could not evaluate — …]` when it couldn't check. |
185
- | **driver-attested** | `observed` + `verdict` (both required) | *You* report what your own tooling saw. Clipy vouches only that you **said** it — not that it verified it — which is falsifiable against the recorded frames. Renders `[ASSERT ✓ driver-attested; observed=…]`. |
212
+ | **driver-attested** | `observed` + `verdict` (both required) | *You* report what your own tooling saw. Clipy vouches only that you **said** it — not that it verified it — which is falsifiable against the recorded frames. Renders with a **hedge glyph** rather than a verdict glyph: `[≈ ASSERT driver-attested; observed=…]`, or `[≈ FAILED driver-attested; observed=…]`. |
186
213
 
187
214
  Use **driver-attested** when your agent drives its own browser/tooling while Clipy records (e.g.
188
215
  `--source mac-screen` on the CLI) or when there's no Clipy-owned page to assert against. It's
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ import { Readable } from "node:stream";
33
33
  import { pipeline } from "node:stream/promises";
34
34
  const API_URL = (process.env.CLIPY_API_URL || "https://clipy.online").replace(/\/+$/, "");
35
35
  const API_KEY = process.env.CLIPY_API_KEY;
36
- const SERVER_VERSION = "0.8.3";
36
+ const SERVER_VERSION = "0.8.5";
37
37
  // The key is checked lazily (per tool call, not at startup) so the server can
38
38
  // start and answer introspection (initialize / tools/list) in keyless
39
39
  // environments like directory health checks.
@@ -709,6 +709,53 @@ function profileCopyDisclosure(copy, userDataDir) {
709
709
  ...(copy.skipped.length ? { skippedEntries: copy.skipped } : {}),
710
710
  };
711
711
  }
712
+ // --- Resolved capture source ------------------------------------------------
713
+ // Field finding (0.8.5): a window capture whose driver was driving a BACKGROUND
714
+ // TAB of that window produced perfectly truthful driver-attested marks over
715
+ // footage of the wrong tab. Attested evidence proves what the DRIVER observed;
716
+ // nothing tied it to what the CAMERA saw. The fix is to report the RESOLVED
717
+ // capture source at start time so a caller can compare it against the surface it
718
+ // is driving BEFORE doing minutes of work.
719
+ //
720
+ // REJECTED FIX — do not reopen: having the recorder foreground/activate the
721
+ // target window or tab. That fails the any-driver gate and re-imports the
722
+ // browser-ownership premise deliberately removed in 0.8.3. Clipy is a recorder;
723
+ // it reports what the camera sees and never moves the camera for you.
724
+ //
725
+ // This server only ever captures a headless Chromium page it owns — the
726
+ // window/display (mac-screen) path is CLI-only — so there is no window id or
727
+ // window title to report here. Rather than emit a {kind,id,title} shell with
728
+ // invented or empty values (exactly the false-identity failure this exists to
729
+ // prevent), we report what IS true of a headless capture: the RESOLVED post-
730
+ // redirect URL, the page title, and the recording viewport.
731
+ /** Resolve what the camera is actually pointed at, read fresh at start time —
732
+ * never a stale or caller-supplied value. */
733
+ async function resolveHeadlessSource(page, viewport) {
734
+ let url = "";
735
+ try {
736
+ url = page.url();
737
+ }
738
+ catch {
739
+ url = "";
740
+ }
741
+ let title = "";
742
+ try {
743
+ // Bounded: a wedged page must not hold up the tool result.
744
+ title = (await withTimeout(page.title(), 2_000, "title read timed out")).trim().slice(0, 200);
745
+ }
746
+ catch {
747
+ title = "";
748
+ }
749
+ return {
750
+ kind: "headless_browser",
751
+ ...(title ? { title } : {}),
752
+ url,
753
+ viewport: { width: viewport.width, height: viewport.height },
754
+ note: "This is the surface Clipy is recording. Compare it with what your driver is acting on — " +
755
+ "matching it is YOUR job: Clipy never focuses or foregrounds a window or tab. " +
756
+ "Window/display capture (a real app window) is CLI-only: clipy record --source mac-screen.",
757
+ };
758
+ }
712
759
  /** First line of an error message, trimmed — keeps annotations/logs one-line. */
713
760
  function firstLine(message) {
714
761
  return (message ?? "").split("\n")[0].trim();
@@ -1290,7 +1337,7 @@ server.tool("get_agent_context", "ONE-CALL CONTEXT BUNDLE for a recording: metad
1290
1337
  return fail(e.message);
1291
1338
  }
1292
1339
  });
1293
- server.tool("record", "Record a web app HEADLESSLY and upload it as a Clipy recording, then return its share link + agent-context URL. Use this to capture the outcome of work you just did — e.g. after building a feature, record the running app so it can be shared or read back. Opens the given URL in a headless Chromium (works in cloud sandboxes, no display needed), records for `durationSeconds`, and streams the video into Clipy's pipeline. Set `type` so the summary reads the recording correctly, `viewports` to sweep multiple screen sizes into one video, and `storageState`/`initScript`/`userDataDir` to record behind a login. Requires (1) Playwright installed in this MCP server's environment (`npm i -g playwright && npx playwright install chromium`) and (2) the CLIPY_API_KEY to carry the 'ingest' scope. Recording the REAL Mac screen or a specific window (ScreenCaptureKit, real logged-in browser) is CLI-only — `clipy record --source mac-screen --window \"<app>\"` — and not available via MCP. Quick per-cookie / per-localStorage-key injection (the CLI's `--cookie` / `--local-storage`) is a CLI-only convenience; `storageState` covers the same need here. Auth note: `storageState` seeds exactly what it contains (cookies + localStorage) but can't reproduce a whole browser identity (IndexedDB, service workers, some cross-origin auth); for those, produce a storageState via an interactive `npx playwright open --save-storage=state.json <login-url>` first, or use `userDataDir` pointed at a DEDICATED (never live) profile directory. After it returns, call wait_for_artifacts then get_agent_context to read the transcript/summary.", {
1340
+ server.tool("record", "Record a web app HEADLESSLY and upload it as a Clipy recording, then return its share link + agent-context URL. Use this to capture the outcome of work you just did — e.g. after building a feature, record the running app so it can be shared or read back. Opens the given URL in a headless Chromium (works in cloud sandboxes, no display needed), records for `durationSeconds`, and streams the video into Clipy's pipeline. Set `type` so the summary reads the recording correctly, `viewports` to sweep multiple screen sizes into one video, and `storageState`/`initScript`/`userDataDir` to record behind a login. Requires (1) Playwright installed in this MCP server's environment (`npm i -g playwright && npx playwright install chromium`) and (2) the CLIPY_API_KEY to carry the 'ingest' scope. Recording the REAL Mac screen or a specific window (ScreenCaptureKit, real logged-in browser) is CLI-only — `clipy record --source mac-screen --window \"<app>\"` — and not available via MCP. Quick per-cookie / per-localStorage-key injection (the CLI's `--cookie` / `--local-storage`) is a CLI-only convenience; `storageState` covers the same need here. The result reports the RESOLVED capture source (`source`: the post-redirect URL, page title and viewport actually being recorded) — compare it against the surface your driver is acting on BEFORE doing minutes of work, because Clipy will never focus or foreground a window or tab for you. Auth note: `storageState` seeds exactly what it contains (cookies + localStorage) but can't reproduce a whole browser identity (IndexedDB, service workers, some cross-origin auth); for those, produce a storageState via an interactive `npx playwright open --save-storage=state.json <login-url>` first, or use `userDataDir` pointed at a DEDICATED (never live) profile directory. After it returns, call wait_for_artifacts then get_agent_context to read the transcript/summary.", {
1294
1341
  url: z.string().describe("The http(s) URL to open and record (e.g. http://localhost:3000)."),
1295
1342
  durationSeconds: z
1296
1343
  .number()
@@ -1425,6 +1472,7 @@ server.tool("record", "Record a web app HEADLESSLY and upload it as a Clipy reco
1425
1472
  let publicId = "";
1426
1473
  let sizeBytes = 0;
1427
1474
  const autoNotes = [];
1475
+ let capturedSource;
1428
1476
  try {
1429
1477
  // ── Capture ──
1430
1478
  let videoPath;
@@ -1453,6 +1501,9 @@ server.tool("record", "Record a web app HEADLESSLY and upload it as a Clipy reco
1453
1501
  if (i === 0) {
1454
1502
  await waitForFirstPaint(page, frame);
1455
1503
  captureStart = Date.now();
1504
+ // Resolve the capture source once the first real frame is up, so the
1505
+ // reported URL/title are post-redirect truth, not the requested URL.
1506
+ capturedSource = await resolveHeadlessSource(page, frame);
1456
1507
  }
1457
1508
  if (viewports) {
1458
1509
  autoNotes.push({
@@ -1529,6 +1580,7 @@ server.tool("record", "Record a web app HEADLESSLY and upload it as a Clipy reco
1529
1580
  agentContextUrl: `${API_URL}/api/agent-context/${publicId}`,
1530
1581
  sizeBytes,
1531
1582
  recordedSeconds: forSec * passes.length,
1583
+ ...(capturedSource ? { source: capturedSource } : {}),
1532
1584
  ...(recordingKind ? { recordingKind } : {}),
1533
1585
  ...(viewports ? { viewports: passes.map((p) => p.label) } : {}),
1534
1586
  ...(profileCopy ? { profileCopy: profileCopyDisclosure(profileCopy, userDataDir) } : {}),
@@ -1650,7 +1702,7 @@ function finishSession(session, mode) {
1650
1702
  })();
1651
1703
  return session.finishing;
1652
1704
  }
1653
- server.tool("start_recording", "Start a RECORDING SESSION: opens the given URL in a headless Chromium that keeps recording in the background while you continue working. Use add_marker to narrate (and optionally ASSERT on-screen state) at each step, add_chapter for before/after boundaries, then stop_recording to upload and get the share link. Set `type` for the recording kind, `storageState`/`initScript` to record behind a login, and `exposeCdp` to get a CDP endpoint you can drive with your own Playwright while it records. The session auto-stops and uploads by itself at maxSeconds (default 600) so a forgotten session can never run away. One session at a time. Requires Playwright + an ingest-scoped CLIPY_API_KEY (like the record tool). Recording the REAL Mac screen or a specific window (ScreenCaptureKit, real logged-in browser) is CLI-only — `clipy session start --source mac-screen --window \"<app>\"` — and not available via MCP. Quick per-cookie / per-localStorage-key injection (the CLI's `--cookie` / `--local-storage`) is CLI-only — use `storageState` here; and backdating a mark by a relative offset (the CLI's `--ago`) is CLI-only — use add_marker's `atSeconds`.", {
1705
+ server.tool("start_recording", "Start a RECORDING SESSION: opens the given URL in a headless Chromium that keeps recording in the background while you continue working. Use add_marker to narrate (and optionally ASSERT on-screen state) at each step, add_chapter for before/after boundaries, then stop_recording to upload and get the share link. Set `type` for the recording kind, `storageState`/`initScript` to record behind a login, and `exposeCdp` to get a CDP endpoint you can drive with your own Playwright while it records. The session auto-stops and uploads by itself at maxSeconds (default 600) so a forgotten session can never run away. One session at a time. Requires Playwright + an ingest-scoped CLIPY_API_KEY (like the record tool). Recording the REAL Mac screen or a specific window (ScreenCaptureKit, real logged-in browser) is CLI-only — `clipy session start --source mac-screen --window \"<app>\"` — and not available via MCP. Quick per-cookie / per-localStorage-key injection (the CLI's `--cookie` / `--local-storage`) is CLI-only — use `storageState` here; and backdating a mark by a relative offset (the CLI's `--ago`) is CLI-only — use add_marker's `atSeconds`. The result reports the RESOLVED capture source (`source`: the post-redirect URL, page title and viewport actually being recorded) — compare it against the surface your driver is acting on BEFORE doing minutes of work, because Clipy will never focus or foreground a window or tab for you. This call waits for the initial navigation to settle before replying (bounded by the same 30s page-load timeout) so that reported source is measured rather than guessed — recording and the auto-stop rail both start immediately, so only the reply waits.", {
1654
1706
  url: z.string().describe("The http(s) URL to open and record (e.g. http://localhost:3000)."),
1655
1707
  name: z.string().optional().describe("Optional title for the recording."),
1656
1708
  description: z.string().optional().describe("Optional description for the recording."),
@@ -1897,11 +1949,15 @@ server.tool("start_recording", "Start a RECORDING SESSION: opens the given URL i
1897
1949
  }));
1898
1950
  activeSession = session;
1899
1951
  autoStoppedResult = null;
1900
- page
1901
- .goto(target.href, { waitUntil: "load", timeout: 30_000 })
1902
- .catch(() => {
1952
+ // AWAITED (changed in 0.8.5): the result reports the RESOLVED capture
1953
+ // source, which can only be read after navigation settles. The recording
1954
+ // is already running and the auto-stop rail is already armed, so this only
1955
+ // delays the reply — bounded by the same 30s goto timeout, and a timeout
1956
+ // still yields whatever the page actually is rather than a guess.
1957
+ await page.goto(target.href, { waitUntil: "load", timeout: 30_000 }).catch(() => {
1903
1958
  // slow SPA — the recording is running regardless
1904
1959
  });
1960
+ const capturedSource = await resolveHeadlessSource(page, { width: w, height: h });
1905
1961
  // Describe the CDP outcome precisely: disabled-by-env, requested-but-
1906
1962
  // unreachable, or ready with the endpoints + driver gotchas.
1907
1963
  const cdpResult = cdpHttpUrl
@@ -1914,6 +1970,7 @@ server.tool("start_recording", "Start a RECORDING SESSION: opens the given URL i
1914
1970
  return ok({
1915
1971
  state: "recording",
1916
1972
  url: target.href,
1973
+ source: capturedSource,
1917
1974
  maxSeconds: maxSec,
1918
1975
  ...(recordingKind ? { recordingKind } : {}),
1919
1976
  ...(profileCopy ? { profileCopy: profileCopyDisclosure(profileCopy, userDataDir) } : {}),
@@ -2037,16 +2094,18 @@ async function applyMark(session, text, opts) {
2037
2094
  let failedForAbort = false;
2038
2095
  if (hasAttest) {
2039
2096
  // Driver-attested: Clipy vouches the agent SAID this, not that Clipy verified
2040
- // it — falsifiable against the frames, weaker than clipy-verified.
2097
+ // it — falsifiable against the frames, weaker than clipy-verified. The lane
2098
+ // leads with a HEDGE glyph (≈) instead of ✓/✗ so a skimming reviewer reads it
2099
+ // as weaker at a glance, not just on inspection. Byte-identical to the CLI.
2041
2100
  const observedStr = String(opts.observed).slice(0, 500);
2042
2101
  attestation = { verdict: opts.verdict, observed: observedStr };
2043
2102
  if (opts.verdict === "pass") {
2044
2103
  session.attestPassed += 1;
2045
- markText = `${markText} [ASSERT ✓ driver-attested; observed=${observedStr}]`;
2104
+ markText = `${markText} [≈ ASSERT driver-attested; observed=${observedStr}]`;
2046
2105
  }
2047
2106
  else {
2048
2107
  session.attestFailed += 1;
2049
- markText = `${markText} [ASSERT ✗ driver-attested; observed=${observedStr}]`;
2108
+ markText = `${markText} [≈ FAILED driver-attested; observed=${observedStr}]`;
2050
2109
  failedForAbort = true;
2051
2110
  }
2052
2111
  }
@@ -2120,7 +2179,7 @@ function coerceMarkOpts(raw) {
2120
2179
  verdict,
2121
2180
  };
2122
2181
  }
2123
- server.tool("add_marker", "Drop a live-timestamped narration marker into the active recording session ('reproduced the bug', 'the fix renders correctly at mobile width'). Markers become the recording's transcript chapters, so narrate as you work — they are how the recording stays agent-readable despite having no audio. A mark can carry evidence in ONE of two provenances, never both. (1) CLIPY-VERIFIED — assertSelector (element must exist), assertText (that element must contain the text; requires assertSelector), assertUrl (glob on the live URL): Clipy itself checks the recorded page, so this is the strongest evidence. (2) DRIVER-ATTESTED — observed + verdict (both required together): you report what YOUR tooling saw and whether it passed. Clipy vouches only that you SAID it — it did NOT verify it — which is falsifiable against the recorded frames: weaker than clipy-verified, far stronger than plain prose. Use driver-attested when your agent drives its OWN browser/tooling while Clipy records (e.g. via mac-screen) or when there is no Clipy-owned page to assert against. Failures are annotated into the mark as explicit FAILURES (never written as fact), tallied in their own segment of the recording's verification summary, and — with failMode 'abort' — discard the whole session. Marks default to the live recording clock; pass atSeconds to backdate one.", {
2182
+ server.tool("add_marker", "Drop a live-timestamped narration marker into the active recording session ('reproduced the bug', 'the fix renders correctly at mobile width'). Markers become the recording's transcript chapters, so narrate as you work — they are how the recording stays agent-readable despite having no audio. A mark can carry evidence in ONE of two provenances, never both. (1) CLIPY-VERIFIED — assertSelector (element must exist), assertText (that element must contain the text; requires assertSelector), assertUrl (glob on the live URL): Clipy itself checks the recorded page, so this is the strongest evidence. (2) DRIVER-ATTESTED — observed + verdict (both required together): you report what YOUR tooling saw and whether it passed. Clipy vouches only that you SAID it — it did NOT verify it — which is falsifiable against the recorded frames: weaker than clipy-verified, far stronger than plain prose. Use driver-attested when your agent drives its OWN browser/tooling while Clipy records (e.g. via mac-screen) or when there is no Clipy-owned page to assert against. The two lanes are rendered so the weaker one LOOKS weaker at a glance: clipy-verified marks lead with a verdict glyph (`[assert ✓ verified-by-clipy; …]` / `[ASSERT ✗ verified-by-clipy; …]`), while driver-attested marks lead with a HEDGE glyph instead (`[≈ ASSERT driver-attested; observed=…]` / `[≈ FAILED driver-attested; observed=…]`) — a skimming reviewer must never mistake an attestation for a verification. Failures are annotated into the mark as explicit FAILURES (never written as fact), tallied in their own segment of the recording's verification summary, and — with failMode 'abort' — discard the whole session. Marks default to the live recording clock; pass atSeconds to backdate one.", {
2124
2183
  text: z.string().min(1).max(1000).describe("What is happening right now."),
2125
2184
  atSeconds: z
2126
2185
  .number()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipy/mcp",
3
- "version": "0.8.3",
3
+ "version": "0.8.5",
4
4
  "mcpName": "online.clipy/mcp",
5
5
  "description": "Model Context Protocol (MCP) server for Clipy — give Claude, Cursor, and other AI agents read access to your screen recordings' transcripts, AI summaries, and key moments with frames.",
6
6
  "license": "MIT",