@clipy/mcp 0.1.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.
Files changed (3) hide show
  1. package/README.md +67 -0
  2. package/dist/index.js +232 -0
  3. package/package.json +43 -0
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # @clipy/mcp
2
+
3
+ Give your AI agent access to your [Clipy](https://clipy.online) screen recordings.
4
+
5
+ This is a [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server. It lets
6
+ Claude, Cursor, Windsurf, and other MCP-capable agents **search your recordings and read
7
+ their transcripts and AI summaries** — so you can do things like _"turn this bug-report
8
+ recording into a Linear ticket"_ without leaving your agent.
9
+
10
+ It is **read-only**: it can never create, edit, or delete your recordings.
11
+
12
+ ## Setup
13
+
14
+ 1. Create a free API key at **https://clipy.online/settings/api-keys** (it looks like
15
+ `clipy_sk_live_…`). Copy it — it's shown only once.
16
+ 2. Add the server to your MCP client.
17
+
18
+ ### Claude Desktop / Claude Code
19
+
20
+ ```bash
21
+ claude mcp add clipy --env CLIPY_API_KEY=clipy_sk_live_xxx -- npx -y @clipy/mcp
22
+ ```
23
+
24
+ Or edit your config (`claude_desktop_config.json`) directly:
25
+
26
+ ```json
27
+ {
28
+ "mcpServers": {
29
+ "clipy": {
30
+ "command": "npx",
31
+ "args": ["-y", "@clipy/mcp"],
32
+ "env": { "CLIPY_API_KEY": "clipy_sk_live_xxx" }
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ### Cursor / Windsurf
39
+
40
+ Add the same block to `~/.cursor/mcp.json` (or the Windsurf MCP config).
41
+
42
+ ## Tools
43
+
44
+ | Tool | What it does |
45
+ | --- | --- |
46
+ | `search_recordings` | Search your recordings by keyword (title + description). |
47
+ | `list_recordings` | List your most recent recordings. |
48
+ | `get_recording` | Metadata for one recording (status, duration, transcript/summary status). |
49
+ | `get_transcript` | The full timestamped transcript + plaintext. |
50
+ | `get_summary` | The AI summary: TL;DR, key points, action items. |
51
+ | `wait_for_artifacts` | Poll until a recording's transcript/summary finish processing. |
52
+
53
+ All tools accept a recording's **public id** (the slug in its share URL) or the full
54
+ `https://clipy.online/video/<id>` URL.
55
+
56
+ ## Config
57
+
58
+ | Env var | Required | Default | Notes |
59
+ | --- | --- | --- | --- |
60
+ | `CLIPY_API_KEY` | yes | — | Your personal key from `/settings/api-keys`. |
61
+ | `CLIPY_API_URL` | no | `https://clipy.online` | Override for self-hosted/staging. |
62
+
63
+ ## Privacy
64
+
65
+ Your key only ever reads **your own** recordings. Revoke it any time at
66
+ `/settings/api-keys`. The server runs locally on your machine; your key is never sent
67
+ anywhere except to the Clipy API over HTTPS.
package/dist/index.js ADDED
@@ -0,0 +1,232 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @clipy/mcp — Model Context Protocol server for Clipy.
4
+ *
5
+ * Gives an AI agent (Claude Desktop/Code, Cursor, Windsurf, …) read access to
6
+ * the signed-in user's Clipy screen recordings: search the library, and read
7
+ * any recording's transcript and AI summary. The headline use case is turning a
8
+ * bug-report recording into a ticket — the agent reads the transcript + summary
9
+ * and drafts the issue.
10
+ *
11
+ * Auth: a personal API key (`CLIPY_API_KEY`, looks like `clipy_sk_live_…`),
12
+ * minted at https://clipy.online/settings/api-keys. The server is read-only;
13
+ * it can never create, modify, or delete recordings.
14
+ *
15
+ * Config (env):
16
+ * CLIPY_API_KEY (required) your personal key
17
+ * CLIPY_API_URL (optional) base URL, defaults to https://clipy.online
18
+ */
19
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
20
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
21
+ import { z } from "zod";
22
+ const API_URL = (process.env.CLIPY_API_URL || "https://clipy.online").replace(/\/+$/, "");
23
+ const API_KEY = process.env.CLIPY_API_KEY;
24
+ if (!API_KEY) {
25
+ process.stderr.write("[clipy-mcp] Missing CLIPY_API_KEY. Create one at " +
26
+ `${API_URL}/settings/api-keys and set it in your MCP client config.\n`);
27
+ process.exit(1);
28
+ }
29
+ const FETCH_TIMEOUT_MS = 20_000;
30
+ /** Calls the Clipy v1 API with the API key. Throws on non-2xx or timeout. */
31
+ async function api(path) {
32
+ const controller = new AbortController();
33
+ const timer = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
34
+ let res;
35
+ try {
36
+ res = await fetch(`${API_URL}${path}`, {
37
+ headers: {
38
+ Authorization: `Bearer ${API_KEY}`,
39
+ Accept: "application/json",
40
+ "User-Agent": "clipy-mcp/0.1.0",
41
+ },
42
+ signal: controller.signal,
43
+ });
44
+ }
45
+ catch (e) {
46
+ if (e.name === "AbortError") {
47
+ throw new Error(`Clipy API request timed out after ${FETCH_TIMEOUT_MS / 1000}s`);
48
+ }
49
+ throw e;
50
+ }
51
+ finally {
52
+ clearTimeout(timer);
53
+ }
54
+ const text = await res.text();
55
+ let body = {};
56
+ try {
57
+ body = text ? JSON.parse(text) : {};
58
+ }
59
+ catch {
60
+ body = { raw: text };
61
+ }
62
+ if (!res.ok) {
63
+ const msg = (typeof body.error === "string" && body.error) ||
64
+ `Clipy API error ${res.status}`;
65
+ throw new Error(msg);
66
+ }
67
+ return body;
68
+ }
69
+ function ok(data) {
70
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
71
+ }
72
+ function fail(message) {
73
+ return {
74
+ isError: true,
75
+ content: [{ type: "text", text: `Error: ${message}` }],
76
+ };
77
+ }
78
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
79
+ const server = new McpServer({ name: "clipy", version: "0.1.0" });
80
+ const recordingIdSchema = z
81
+ .string()
82
+ .describe("The recording's public id (the slug in its share URL, e.g. 'a1b2c3d4e5f6') or the full https://clipy.online/video/<id> URL.");
83
+ // Hosts we'll extract an id from when handed a full URL. Anything else is
84
+ // treated as a bare id (and will simply 404 if it isn't one).
85
+ const ALLOWED_HOSTS = new Set(["clipy.online", "www.clipy.online"]);
86
+ try {
87
+ ALLOWED_HOSTS.add(new URL(API_URL).hostname.toLowerCase());
88
+ }
89
+ catch {
90
+ // API_URL is validated implicitly by fetch; ignore here.
91
+ }
92
+ /** Accepts a bare public id OR a full Clipy watch/share URL and returns the id. */
93
+ function normalizeId(input) {
94
+ const trimmed = input.trim().replace(/\/+$/, "");
95
+ try {
96
+ const u = new URL(trimmed);
97
+ if (ALLOWED_HOSTS.has(u.hostname.toLowerCase())) {
98
+ const m = u.pathname.match(/\/(?:video|embed)\/([A-Za-z0-9_-]+)/);
99
+ if (m)
100
+ return m[1];
101
+ }
102
+ }
103
+ catch {
104
+ // not a URL — treat as a bare id
105
+ }
106
+ return trimmed;
107
+ }
108
+ server.tool("search_recordings", "Search the user's Clipy screen recordings by keyword (matches title + description). Returns recordings with their processing/transcript/summary status so you can pick one to read.", {
109
+ query: z.string().describe("Keywords to search recording titles and descriptions."),
110
+ status: z
111
+ .enum(["ready", "processing", "failed", "pending", "queued"])
112
+ .optional()
113
+ .describe("Optional filter by processing status. Usually 'ready'."),
114
+ limit: z.number().int().min(1).max(100).optional().describe("Max results (default 20)."),
115
+ }, async ({ query, status, limit }) => {
116
+ try {
117
+ const params = new URLSearchParams({ q: query });
118
+ if (status)
119
+ params.set("status", status);
120
+ if (limit)
121
+ params.set("limit", String(limit));
122
+ return ok(await api(`/api/v1/recordings?${params.toString()}`));
123
+ }
124
+ catch (e) {
125
+ return fail(e.message);
126
+ }
127
+ });
128
+ server.tool("list_recordings", "List the user's most recent Clipy screen recordings (newest first). Use this to browse when you don't have a search term.", {
129
+ status: z
130
+ .enum(["ready", "processing", "failed", "pending", "queued"])
131
+ .optional()
132
+ .describe("Optional filter by processing status."),
133
+ limit: z.number().int().min(1).max(100).optional().describe("Max results (default 20)."),
134
+ }, async ({ status, limit }) => {
135
+ try {
136
+ const params = new URLSearchParams();
137
+ if (status)
138
+ params.set("status", status);
139
+ if (limit)
140
+ params.set("limit", String(limit));
141
+ const qs = params.toString();
142
+ return ok(await api(`/api/v1/recordings${qs ? `?${qs}` : ""}`));
143
+ }
144
+ catch (e) {
145
+ return fail(e.message);
146
+ }
147
+ });
148
+ server.tool("get_recording", "Get a single recording's metadata: title, description, duration, status, and the statuses of its transcript and AI summary.", { id: recordingIdSchema }, async ({ id }) => {
149
+ try {
150
+ return ok(await api(`/api/v1/recordings/${encodeURIComponent(normalizeId(id))}`));
151
+ }
152
+ catch (e) {
153
+ return fail(e.message);
154
+ }
155
+ });
156
+ server.tool("get_transcript", "Get a recording's full transcript: timestamped segments plus the flattened plaintext. If it isn't ready yet, returns the current status so you can poll (or call wait_for_artifacts).", { id: recordingIdSchema }, async ({ id }) => {
157
+ try {
158
+ return ok(await api(`/api/v1/recordings/${encodeURIComponent(normalizeId(id))}/transcript`));
159
+ }
160
+ catch (e) {
161
+ return fail(e.message);
162
+ }
163
+ });
164
+ server.tool("get_summary", "Get a recording's AI summary: a TL;DR, key points, and any action items. If it isn't ready yet, returns the current status.", { id: recordingIdSchema }, async ({ id }) => {
165
+ try {
166
+ return ok(await api(`/api/v1/recordings/${encodeURIComponent(normalizeId(id))}/summary`));
167
+ }
168
+ catch (e) {
169
+ return fail(e.message);
170
+ }
171
+ });
172
+ server.tool("wait_for_artifacts", "Poll until a recording's transcript (and optionally its AI summary) finishes processing, then return them. Useful right after a recording is made. Returns the current status if it times out — just call again.", {
173
+ id: recordingIdSchema,
174
+ require: z
175
+ .enum(["transcript", "summary", "both"])
176
+ .optional()
177
+ .describe("Which artifact(s) to wait for. Default 'transcript'."),
178
+ timeoutSeconds: z
179
+ .number()
180
+ .int()
181
+ .min(5)
182
+ .max(55)
183
+ .optional()
184
+ .describe("How long to wait before returning the current status (default 45s). Returns a resumable status if it times out — call again to keep waiting."),
185
+ }, async ({ id, require, timeoutSeconds }) => {
186
+ const pid = encodeURIComponent(normalizeId(id));
187
+ const need = require ?? "transcript";
188
+ const deadline = Date.now() + (timeoutSeconds ?? 45) * 1000;
189
+ const terminal = new Set(["ready", "failed", "none"]);
190
+ try {
191
+ // Poll loop. We return as soon as the required artifact(s) reach a
192
+ // terminal state, or when we hit the timeout (status, not an error).
193
+ // eslint-disable-next-line no-constant-condition
194
+ while (true) {
195
+ const transcript = await api(`/api/v1/recordings/${pid}/transcript`);
196
+ const tStatus = String(transcript.status);
197
+ let summary = null;
198
+ let sStatus = "skipped";
199
+ if (need === "summary" || need === "both") {
200
+ summary = await api(`/api/v1/recordings/${pid}/summary`);
201
+ sStatus = String(summary.status);
202
+ }
203
+ const transcriptDone = need === "summary" || terminal.has(tStatus);
204
+ const summaryDone = need === "transcript" || terminal.has(sStatus);
205
+ if (transcriptDone && summaryDone) {
206
+ return ok({ id: normalizeId(id), transcript, ...(summary ? { summary } : {}) });
207
+ }
208
+ if (Date.now() >= deadline) {
209
+ return ok({
210
+ id: normalizeId(id),
211
+ timedOut: true,
212
+ transcriptStatus: tStatus,
213
+ ...(need !== "transcript" ? { summaryStatus: sStatus } : {}),
214
+ hint: "Not ready yet. Call wait_for_artifacts again to keep waiting.",
215
+ });
216
+ }
217
+ await sleep(3000);
218
+ }
219
+ }
220
+ catch (e) {
221
+ return fail(e.message);
222
+ }
223
+ });
224
+ async function main() {
225
+ const transport = new StdioServerTransport();
226
+ await server.connect(transport);
227
+ process.stderr.write(`[clipy-mcp] connected — API base ${API_URL}\n`);
228
+ }
229
+ main().catch((err) => {
230
+ process.stderr.write(`[clipy-mcp] fatal: ${err.message}\n`);
231
+ process.exit(1);
232
+ });
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@clipy/mcp",
3
+ "version": "0.1.0",
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
+ "license": "MIT",
6
+ "type": "module",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "bin": {
11
+ "clipy-mcp": "dist/index.js"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md"
16
+ ],
17
+ "engines": {
18
+ "node": ">=18"
19
+ },
20
+ "keywords": [
21
+ "mcp",
22
+ "model-context-protocol",
23
+ "clipy",
24
+ "screen-recording",
25
+ "transcript",
26
+ "ai-agent",
27
+ "claude",
28
+ "cursor",
29
+ "loom-alternative"
30
+ ],
31
+ "scripts": {
32
+ "build": "tsc",
33
+ "prepublishOnly": "npm run build",
34
+ "start": "node dist/index.js"
35
+ },
36
+ "dependencies": {
37
+ "@modelcontextprotocol/sdk": "^1.12.0",
38
+ "zod": "^3.23.8"
39
+ },
40
+ "devDependencies": {
41
+ "typescript": "^5.5.0"
42
+ }
43
+ }