@clipwright/mcp-server 0.3.0 → 0.5.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 +2 -0
- package/SKILL.md +7 -7
- package/dist/server.js +32 -1
- package/dist/server.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -30,6 +30,8 @@ Any MCP host works — the server speaks JSON-RPC over stdio.
|
|
|
30
30
|
- `make_ugc` — **renders a clip; this is the call that costs money.** Returns a
|
|
31
31
|
`run_id` immediately instead of blocking, because a render takes minutes.
|
|
32
32
|
- `get_run` — status of a run. Free; poll it every few seconds.
|
|
33
|
+
- `upload_image` — a local PNG/JPEG → signed https url to pass as `image`. Free;
|
|
34
|
+
20 per day, the url lives 24 hours. Set `aspect_ratio` explicitly afterwards.
|
|
33
35
|
|
|
34
36
|
Call `quote_ugc` before `make_ugc`: the quote is where the contract tells you
|
|
35
37
|
what it will and will not honor. Anything the API cannot deliver comes back in
|
package/SKILL.md
CHANGED
|
@@ -98,7 +98,7 @@ at the end of this section; it differs only in `command`/`args`.
|
|
|
98
98
|
"args": ["/absolute/path/to/clipwright/packages/mcp-server/dist/index.js"],
|
|
99
99
|
"env": {
|
|
100
100
|
"CLIPWRIGHT_API_KEY": "cw_...",
|
|
101
|
-
"CLIPWRIGHT_API_URL": "https://api
|
|
101
|
+
"CLIPWRIGHT_API_URL": "https://api.clipwright.io",
|
|
102
102
|
"CLIPWRIGHT_CLIENT_ID": "<see section 2 — generate BEFORE the first run>"
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -111,7 +111,7 @@ at the end of this section; it differs only in `command`/`args`.
|
|
|
111
111
|
```bash
|
|
112
112
|
claude mcp add clipwright \
|
|
113
113
|
-e CLIPWRIGHT_API_KEY=cw_... \
|
|
114
|
-
-e CLIPWRIGHT_API_URL=https://api
|
|
114
|
+
-e CLIPWRIGHT_API_URL=https://api.clipwright.io \
|
|
115
115
|
-e CLIPWRIGHT_CLIENT_ID="$(node -e "console.log(crypto.randomUUID().replaceAll('-',''))")" \
|
|
116
116
|
-- node /absolute/path/to/clipwright/packages/mcp-server/dist/index.js
|
|
117
117
|
```
|
|
@@ -128,7 +128,7 @@ claude mcp add clipwright \
|
|
|
128
128
|
"args": ["-y", "-p", "@clipwright/mcp-server@latest", "clipwright-mcp"],
|
|
129
129
|
"env": {
|
|
130
130
|
"CLIPWRIGHT_API_KEY": "cw_...",
|
|
131
|
-
"CLIPWRIGHT_API_URL": "https://api
|
|
131
|
+
"CLIPWRIGHT_API_URL": "https://api.clipwright.io",
|
|
132
132
|
"CLIPWRIGHT_CLIENT_ID": "<see section 2 — generate BEFORE the first run>"
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -141,7 +141,7 @@ As a single command:
|
|
|
141
141
|
```bash
|
|
142
142
|
claude mcp add clipwright \
|
|
143
143
|
-e CLIPWRIGHT_API_KEY=cw_... \
|
|
144
|
-
-e CLIPWRIGHT_API_URL=https://api
|
|
144
|
+
-e CLIPWRIGHT_API_URL=https://api.clipwright.io \
|
|
145
145
|
-e CLIPWRIGHT_CLIENT_ID="$(node -e "console.log(crypto.randomUUID().replaceAll('-',''))")" \
|
|
146
146
|
-- npx -y -p @clipwright/mcp-server@latest clipwright-mcp
|
|
147
147
|
```
|
|
@@ -156,11 +156,11 @@ Environment variables:
|
|
|
156
156
|
| Variable | Required | Meaning |
|
|
157
157
|
|---|---|---|
|
|
158
158
|
| `CLIPWRIGHT_API_KEY` | YES | Bearer token shaped `cw_*`. Without it the process exits immediately with an error (`src/index.ts`). The token is ISSUED TO YOU PERSONALLY: it lives in the `api_tokens` table, is bound to an account, and is revoked independently of anyone else's. Do not forward it — a second person gets their own. What separates people is the ACCOUNT, not the token: accounts cannot see each other's runs, each has its own daily cap and its own idempotency axis, and several tokens on one account share all of it. |
|
|
159
|
-
| `CLIPWRIGHT_API_URL` | no | Production URL. Left unset, the SDK supplies `https://api
|
|
159
|
+
| `CLIPWRIGHT_API_URL` | no | Production URL. Left unset, the SDK supplies `https://api.clipwright.io` itself. Set it explicitly only when you target another environment. |
|
|
160
160
|
| `CLIPWRIGHT_CLIENT_ID` | YES (see section 2) | Unique identifier of this INSTALLATION. |
|
|
161
161
|
|
|
162
162
|
After connecting, restart or reopen the MCP host and confirm that `tools/list`
|
|
163
|
-
returns
|
|
163
|
+
returns five tools: `make_ugc`, `get_run`, `quote_ugc`, `list_voices`, `upload_image`.
|
|
164
164
|
|
|
165
165
|
## 2. `CLIPWRIGHT_CLIENT_ID` — required, and WHY
|
|
166
166
|
|
|
@@ -594,7 +594,7 @@ carries no scripts):
|
|
|
594
594
|
|
|
595
595
|
```bash
|
|
596
596
|
TOKEN=cw_... # the same value as CLIPWRIGHT_API_KEY, section 1.3
|
|
597
|
-
API=https://api
|
|
597
|
+
API=https://api.clipwright.io
|
|
598
598
|
|
|
599
599
|
# 1. Start a run. The idempotency key is required and must be UNIQUE per call:
|
|
600
600
|
# a repeated key returns the earlier run instead of a new one (section 2).
|
package/dist/server.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
1
2
|
import { createRequire } from "node:module";
|
|
2
3
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
import { z } from "zod";
|
|
3
5
|
// Схемы приходят из barrel `@clipwright/core` (единый источник правды, правило №2),
|
|
4
6
|
// а НЕ из `/idempotency` — там живёт только ключ идемпотентности, не shape.
|
|
5
7
|
// `offeredUgcInputShape`, а НЕ полный `makeUgcInputShape`: поля с диспозицией
|
|
6
8
|
// `rejected` не должны предлагаться вызывателю, которого мы за их использование
|
|
7
9
|
// накажем четырёхсотым (блокер B4). Множество выводится из реестра диспозиций,
|
|
8
10
|
// поэтому смена решения по полю переносит его между поверхностями одной строкой.
|
|
9
|
-
import { offeredUgcInputShape, agentRetryShape, runId, MAKE_UGC_DESCRIPTION, MAKE_UGC_AGENT_PROTOCOL, } from "@clipwright/core";
|
|
11
|
+
import { offeredUgcInputShape, agentRetryShape, runId, MAKE_UGC_DESCRIPTION, MAKE_UGC_AGENT_PROTOCOL, UPLOAD_IMAGE_DESCRIPTION, UPLOAD_MAX_BYTES, sniffUploadMediaType, } from "@clipwright/core";
|
|
10
12
|
import { formatGetRun, withFailureReport } from "./format.js";
|
|
11
13
|
// Версия — из манифеста: литерал расходился с ним молча, а импорт JSON не проходит `rootDir`.
|
|
12
14
|
const packageVersion = () => createRequire(import.meta.url)("../package.json").version;
|
|
@@ -63,6 +65,35 @@ export function createServer(client) {
|
|
|
63
65
|
const quote = await client.quoteUgc(args);
|
|
64
66
|
return { content: [{ type: "text", text: JSON.stringify(quote) }] };
|
|
65
67
|
}));
|
|
68
|
+
server.registerTool("upload_image", {
|
|
69
|
+
description: UPLOAD_IMAGE_DESCRIPTION,
|
|
70
|
+
inputSchema: {
|
|
71
|
+
path: z.string().min(1).describe("Absolute or cwd-relative path to a PNG or JPEG file"),
|
|
72
|
+
},
|
|
73
|
+
}, async ({ path }) => withFailureReport(async () => {
|
|
74
|
+
const bytes = new Uint8Array(await readFile(path));
|
|
75
|
+
const mediaType = sniffUploadMediaType(bytes);
|
|
76
|
+
if (mediaType === null || bytes.byteLength > UPLOAD_MAX_BYTES) {
|
|
77
|
+
throw new Error(mediaType === null
|
|
78
|
+
? `${path} is not a PNG or JPEG file (checked by signature, not by extension)`
|
|
79
|
+
: `${path} is ${bytes.byteLength} bytes; the ceiling is ${UPLOAD_MAX_BYTES}`);
|
|
80
|
+
}
|
|
81
|
+
const upload = await client.uploadImage(bytes, mediaType);
|
|
82
|
+
return {
|
|
83
|
+
content: [
|
|
84
|
+
{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: JSON.stringify({
|
|
87
|
+
...upload,
|
|
88
|
+
next_action: "Pass `url` as `image` to quote_ugc, then make_ugc. Set `aspect_ratio` explicitly " +
|
|
89
|
+
`to the picture's shape (${upload.width}x${upload.height}); the url expires at ` +
|
|
90
|
+
`${upload.expires_at} — upload again after that.`,
|
|
91
|
+
}),
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
isError: false,
|
|
95
|
+
};
|
|
96
|
+
}));
|
|
66
97
|
server.registerTool("list_voices", {
|
|
67
98
|
description: "List the curated voice catalog available for make_ugc's `voice` field. Presets are the " +
|
|
68
99
|
"RECOMMENDED path: pick one by name (e.g. voice=\"george\"). `voice_id` is an escape hatch for " +
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oFAAoF;AACpF,4EAA4E;AAC5E,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,iFAAiF;AACjF,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,KAAK,EACL,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE9D,8FAA8F;AAC9F,MAAM,cAAc,GAAG,GAAW,EAAE,CACjC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAyB,CAAC,OAAO,CAAC;AAErF;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,M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AAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,GAAG,MAAM;wBACT,WAAW,EACT,mFAAmF;4BACnF,2BAA2B,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,wBAAwB;4BAChF,GAAG,MAAM,CAAC,UAAU,6BAA6B;qBACpD,CAAC;iBACH;aACF;YACD,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC,CAAC,CACL,CAAC;IACF,MAAM,CAAC,YAAY,CACjB,aAAa,EACb;QACE,WAAW,EACT,yFAAyF;YACzF,gGAAgG;YAChG,kGAAkG;YAClG,kGAAkG;YAClG,gGAAgG;YAChG,gGAAgG;YAChG,gDAAgD;QAClD,WAAW,EAAE,EAAE;KAChB,EACD,KAAK,IAAI,EAAE,CACT,iBAAiB,CAAC,KAAK,IAAI,EAAE;QAC3B,0EAA0E;QAC1E,kEAAkE;QAClE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QACzC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;IAC3E,CAAC,CAAC,CACL,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clipwright/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "MCP server for Clipwright: generate UGC videos from your coding agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
30
30
|
"zod": "^4.4.3",
|
|
31
|
-
"@clipwright/core": "0.
|
|
32
|
-
"@clipwright/sdk": "0.
|
|
31
|
+
"@clipwright/core": "0.5.0",
|
|
32
|
+
"@clipwright/sdk": "0.5.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^26.1.1"
|