@clipy/mcp 0.1.0 → 0.2.0
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 +1 -0
- package/dist/index.js +60 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,7 @@ Add the same block to `~/.cursor/mcp.json` (or the Windsurf MCP config).
|
|
|
49
49
|
| `get_transcript` | The full timestamped transcript + plaintext. |
|
|
50
50
|
| `get_summary` | The AI summary: TL;DR, key points, action items. |
|
|
51
51
|
| `wait_for_artifacts` | Poll until a recording's transcript/summary finish processing. |
|
|
52
|
+
| `download_recording` | Download the MP4 locally so you can clip it or extract frames yourself (e.g. with ffmpeg). |
|
|
52
53
|
|
|
53
54
|
All tools accept a recording's **public id** (the slug in its share URL) or the full
|
|
54
55
|
`https://clipy.online/video/<id>` URL.
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
20
20
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
21
21
|
import { z } from "zod";
|
|
22
|
+
import { createWriteStream, statSync } from "node:fs";
|
|
23
|
+
import { tmpdir } from "node:os";
|
|
24
|
+
import { join, resolve } from "node:path";
|
|
25
|
+
import { Readable } from "node:stream";
|
|
26
|
+
import { pipeline } from "node:stream/promises";
|
|
22
27
|
const API_URL = (process.env.CLIPY_API_URL || "https://clipy.online").replace(/\/+$/, "");
|
|
23
28
|
const API_KEY = process.env.CLIPY_API_KEY;
|
|
24
29
|
if (!API_KEY) {
|
|
@@ -37,7 +42,7 @@ async function api(path) {
|
|
|
37
42
|
headers: {
|
|
38
43
|
Authorization: `Bearer ${API_KEY}`,
|
|
39
44
|
Accept: "application/json",
|
|
40
|
-
"User-Agent": "clipy-mcp/0.
|
|
45
|
+
"User-Agent": "clipy-mcp/0.2.0",
|
|
41
46
|
},
|
|
42
47
|
signal: controller.signal,
|
|
43
48
|
});
|
|
@@ -76,7 +81,7 @@ function fail(message) {
|
|
|
76
81
|
};
|
|
77
82
|
}
|
|
78
83
|
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
79
|
-
const server = new McpServer({ name: "clipy", version: "0.
|
|
84
|
+
const server = new McpServer({ name: "clipy", version: "0.2.0" });
|
|
80
85
|
const recordingIdSchema = z
|
|
81
86
|
.string()
|
|
82
87
|
.describe("The recording's public id (the slug in its share URL, e.g. 'a1b2c3d4e5f6') or the full https://clipy.online/video/<id> URL.");
|
|
@@ -221,6 +226,59 @@ server.tool("wait_for_artifacts", "Poll until a recording's transcript (and opti
|
|
|
221
226
|
return fail(e.message);
|
|
222
227
|
}
|
|
223
228
|
});
|
|
229
|
+
server.tool("download_recording", "Download a recording's MP4 to a local file so YOU can process it — clip a segment, extract frames, transcode, etc. with your own tools (e.g. ffmpeg). Clipy does NOT clip/extract server-side; you operate on the downloaded file. Returns the local path.", {
|
|
230
|
+
id: recordingIdSchema,
|
|
231
|
+
outputPath: z
|
|
232
|
+
.string()
|
|
233
|
+
.optional()
|
|
234
|
+
.describe("Absolute path to save the .mp4 to. Defaults to the OS temp dir."),
|
|
235
|
+
}, async ({ id, outputPath }) => {
|
|
236
|
+
try {
|
|
237
|
+
const pid = normalizeId(id);
|
|
238
|
+
const meta = await api(`/api/v1/recordings/${encodeURIComponent(pid)}`);
|
|
239
|
+
const rec = meta.recording;
|
|
240
|
+
const url = rec?.videoUrl;
|
|
241
|
+
if (!url) {
|
|
242
|
+
return fail(`Recording ${pid} has no downloadable video yet (status: ${rec?.status ?? "unknown"}).`);
|
|
243
|
+
}
|
|
244
|
+
// Resolve to an absolute path so a relative outputPath can't land
|
|
245
|
+
// somewhere surprising relative to the agent's cwd.
|
|
246
|
+
const dest = outputPath
|
|
247
|
+
? resolve(outputPath)
|
|
248
|
+
: join(tmpdir(), `clipy-${pid}.mp4`);
|
|
249
|
+
// Only follow http(s); resolve relative video URLs against the API base.
|
|
250
|
+
const target = new URL(url, API_URL);
|
|
251
|
+
if (target.protocol !== "http:" && target.protocol !== "https:") {
|
|
252
|
+
return fail(`Refusing to download non-http(s) URL: ${target.protocol}`);
|
|
253
|
+
}
|
|
254
|
+
// The CDN URL is public — download it directly, no API key needed.
|
|
255
|
+
// Bound the whole download with an AbortController.
|
|
256
|
+
const dlController = new AbortController();
|
|
257
|
+
const dlTimer = setTimeout(() => dlController.abort(), 300_000);
|
|
258
|
+
try {
|
|
259
|
+
const res = await fetch(target, { signal: dlController.signal });
|
|
260
|
+
if (!res.ok || !res.body) {
|
|
261
|
+
return fail(`Failed to download video (HTTP ${res.status}).`);
|
|
262
|
+
}
|
|
263
|
+
// Stream to disk so large recordings don't buffer fully in memory.
|
|
264
|
+
await pipeline(Readable.fromWeb(res.body), createWriteStream(dest));
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
clearTimeout(dlTimer);
|
|
268
|
+
}
|
|
269
|
+
const bytes = statSync(dest).size;
|
|
270
|
+
return ok({
|
|
271
|
+
id: pid,
|
|
272
|
+
path: dest,
|
|
273
|
+
bytes,
|
|
274
|
+
videoUrl: url,
|
|
275
|
+
hint: "Use your own tooling on `path` — e.g. `ffmpeg -ss 00:00:05 -t 10 -i <path> clip.mp4` to clip, or `ffmpeg -i <path> -vf fps=1 frame_%03d.png` to extract frames.",
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
catch (e) {
|
|
279
|
+
return fail(e.message);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
224
282
|
async function main() {
|
|
225
283
|
const transport = new StdioServerTransport();
|
|
226
284
|
await server.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clipy/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Model Context Protocol (MCP) server for Clipy — give Claude, Cursor, and other AI agents read access to your screen recordings' transcripts and AI summaries.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|