@clipy/mcp 0.8.1 → 0.8.2

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.
package/README.md CHANGED
@@ -40,6 +40,14 @@ immediately).
40
40
 
41
41
  Then add the server to your MCP client.
42
42
 
43
+ > **Never inline your key into the server's launch command** — e.g.
44
+ > `"command": "sh", "args": ["-c", "CLIPY_API_KEY=… npx -y @clipy/mcp"]`. Command-line
45
+ > arguments are visible to **every local process** via the process table (`ps`, `/proc`),
46
+ > so a key placed there is effectively world-readable on the machine. Always put it in the
47
+ > `env` block, exactly as every example below does. (The one-time `claude mcp add --env …` /
48
+ > `codex mcp add --env …` helpers below write that `env` block for you — they expose the key
49
+ > only in the argv of that single setup command, never in the long-running server's.)
50
+
43
51
  ### Claude Code
44
52
 
45
53
  The `--scope user` flag installs Clipy **globally** for every project. Without it,
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.1";
36
+ const SERVER_VERSION = "0.8.2";
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.
@@ -1687,6 +1687,7 @@ async function applyMark(session, text, opts) {
1687
1687
  const hasAssertion = !!(opts.assertSelector || opts.assertText || opts.assertUrl);
1688
1688
  let markText = text.trim();
1689
1689
  let assertion = null;
1690
+ let observedDriftSec;
1690
1691
  if (hasAssertion) {
1691
1692
  try {
1692
1693
  assertion = await runMarkerAssertions(session.page, {
@@ -1712,6 +1713,23 @@ async function applyMark(session, text, opts) {
1712
1713
  session.assertUnverified += 1;
1713
1714
  markText = `${markText} [ASSERT ⚠ could not evaluate — ${assertion.observed}]`;
1714
1715
  }
1716
+ // A backdated mark (atSeconds) carries an assertion that was observed NOW —
1717
+ // right after the evaluate — not at the backdated position. Without atSeconds
1718
+ // the stamp IS the observation moment (sessionMark stamps after this await),
1719
+ // so there's nothing to reconcile. But when the stamp is decoupled and the
1720
+ // two diverge by more than ~2s, annotate it: the verdict must never read as
1721
+ // if it pertained to a moment it didn't observe.
1722
+ if (opts.atSeconds != null) {
1723
+ const observedAtMs = Math.max(0, Date.now() - session.recordStartEpochMs);
1724
+ const markedAtMs = Math.max(0, Math.round(opts.atSeconds * 1000));
1725
+ const driftMs = observedAtMs - markedAtMs;
1726
+ if (Math.abs(driftMs) > 2000) {
1727
+ observedDriftSec = Math.round(driftMs / 100) / 10; // signed, 1 dp
1728
+ const dir = driftMs > 0 ? "after" : "before";
1729
+ const mag = (Math.abs(driftMs) / 1000).toFixed(1);
1730
+ markText = `${markText} (assertion observed ${mag}s ${dir} this backdated mark — the verdict is about the page at observation time, not at the marked time)`;
1731
+ }
1732
+ }
1715
1733
  }
1716
1734
  const note = sessionMark(session, markText, opts.atSeconds != null ? opts.atSeconds * 1000 : undefined);
1717
1735
  // failMode 'abort' discards the session ONLY on a definitive failure — never
@@ -1721,7 +1739,7 @@ async function applyMark(session, text, opts) {
1721
1739
  await finishSession(session, "abort").catch(() => { });
1722
1740
  aborted = true;
1723
1741
  }
1724
- return { note, assertion, aborted };
1742
+ return { note, assertion, aborted, observedDriftSec };
1725
1743
  }
1726
1744
  /** Coerce a bridge-supplied (untrusted) options object into typed mark opts. */
1727
1745
  function coerceMarkOpts(raw) {
@@ -1741,7 +1759,7 @@ server.tool("add_marker", "Drop a live-timestamped narration marker into the act
1741
1759
  .number()
1742
1760
  .min(0)
1743
1761
  .optional()
1744
- .describe("Place the mark at this point on the recording timeline (seconds from the start), instead of the live clock — e.g. to annotate something that happened a few seconds ago. Clamped to >= 0. (The CLI's relative --ago shorthand is CLI-only; compute the absolute second and pass it here.)"),
1762
+ .describe("Place the mark at this point on the recording timeline (seconds from the start), instead of the live clock — e.g. to annotate something that happened a few seconds ago. Clamped to >= 0. (The CLI's relative --ago shorthand is CLI-only; compute the absolute second and pass it here.) Note: any assertion is still evaluated NOW, against the live page — if that diverges from the backdated position by >2s, the mark is annotated so the verdict is never misread as pertaining to the backdated moment."),
1745
1763
  assertSelector: z
1746
1764
  .string()
1747
1765
  .optional()
@@ -1768,7 +1786,7 @@ server.tool("add_marker", "Drop a live-timestamped narration marker into the act
1768
1786
  return fail("assertText requires assertSelector — name the element whose text you're checking. A bare page-body text match is weak evidence, so it's rejected (same rule as the CLI's --assert-text / --assert-selector).");
1769
1787
  }
1770
1788
  const session = activeSession;
1771
- const { note, assertion, aborted } = await applyMark(session, text, {
1789
+ const { note, assertion, aborted, observedDriftSec } = await applyMark(session, text, {
1772
1790
  atSeconds,
1773
1791
  assertSelector,
1774
1792
  assertText,
@@ -1794,6 +1812,10 @@ server.tool("add_marker", "Drop a live-timestamped narration marker into the act
1794
1812
  ? { assertion: { verified: false, unverified: true, observed: assertion.observed }, unverified: true }
1795
1813
  : { assertion: { passed: assertion.status === "passed", observed: assertion.observed } }
1796
1814
  : {}),
1815
+ // Surface when a backdated mark's assertion was observed at a different
1816
+ // time than the mark position, so the caller knows the verdict is about
1817
+ // the page NOW, not at the backdated second.
1818
+ ...(observedDriftSec != null ? { assertionObservedDriftSeconds: observedDriftSec } : {}),
1797
1819
  totalMarkers: session.marks.length,
1798
1820
  });
1799
1821
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clipy/mcp",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
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",