@slatesvideo/mcp-server 0.5.11 → 0.5.13

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 +2 -2
  2. package/dist/server.js +432 -13
  3. package/package.json +61 -62
package/README.md CHANGED
@@ -65,9 +65,9 @@ No environment variables, no API keys to paste into config files.
65
65
 
66
66
  ## What the agent can do
67
67
 
68
- 64 tools covering the full workspace: project, folder, character, environment, style, and storyboard management (create / update / delete), image generation and surgical image editing (Nano Banana 2, FLUX.2 Max, Seedream 5 Lite — with project-asset reference images), video generation (Kling V3, Veo 3.1, Seedance 2.0), lip sync, motion transfer, background generation with status polling, timeline assembly (add / reorder / remove clips), MP4 export and FCP7 XML export for DaVinci Resolve, cost estimation, and credit balance. Bundled prompting/workflow guides are readable at runtime via the `slates_get_prompting_guide` tool — no skill installation needed for MCP-only clients.
68
+ <!-- gen:tool-count -->91<!-- /gen:tool-count --> tools covering the full workspace: project, folder, character, environment, style, and storyboard management (create / update / delete), image generation and surgical image editing (<!-- gen:image-roster -->Nano Banana 2 (Gemini 3.1 Flash Image), Nano Banana 2 Lite, Nano Banana Pro, GPT Image 2, FLUX.2 Max, Seedream 5 Lite<!-- /gen:image-roster --> — with project-asset reference images), video generation (<!-- gen:video-roster -->kling-v3.0-std, kling-v3.0-pro, kling-v3.0-omni, veo-3.1-fast, veo-3.1-standard, Seedance 2.0, Seedance 2.5, Gemini Omni Flash, MiniMax H3, MiniMax H3 Max, LTX-2.5, LTX-2.5 Pro<!-- /gen:video-roster -->), audio generation (<!-- gen:audio-roster -->Seed Audio 1.0, ElevenLabs Sound Effects v2, Inworld Realtime TTS-2<!-- /gen:audio-roster -->), lip sync, motion transfer, background generation with status polling, timeline assembly (add / reorder / remove clips), MP4 export and FCP7 XML export for DaVinci Resolve, cost estimation, and credit balance. Bundled prompting/workflow guides are readable at runtime via the `slates_get_prompting_guide` tool — no skill installation needed for MCP-only clients.
69
69
 
70
- Generation tools estimate cost first and ask for confirmation on anything over $0.50, so the agent cannot silently burn credits.
70
+ Generation tools estimate cost first and ask for confirmation on anything over <!-- gen:confirm-credits -->17<!-- /gen:confirm-credits --> credits, so the agent cannot silently burn credits. Every tool also carries MCP annotations, so a host can auto-approve a read and warn on a delete; the <!-- gen:skill-count -->34<!-- /gen:skill-count --> bundled skills are exposed as MCP **prompts**, and the manual, the model capability table and the live price list as **resources**.
71
71
 
72
72
  The timeline, export, background-generation, edit-image, and image-reference tools require a Slates desktop on agent API v2 — if a tool reports a version error, update Slates (Settings → Check for Updates) and retry.
73
73
 
package/dist/server.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
3
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
- import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
5
- import { zodToJsonSchema } from 'zod-to-json-schema';
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
6
5
  import { readFileSync } from 'node:fs';
7
6
  import { join, dirname } from 'node:path';
8
7
  import { fileURLToPath } from 'node:url';
9
- import { ALL_OPERATIONS, defaultContext, } from '@slatesvideo/shared';
8
+ import { z } from 'zod';
9
+ import { ALL_OPERATIONS, SKILLS, MODEL_CAPABILITIES, MODEL_FACTS, SlatesCloudClient, buildAgentDoctrine, defaultContext, toolDefinitions, } from '@slatesvideo/shared';
10
10
  // Slates MCP server. Stdio transport. Wires every operation in
11
11
  // @slatesvideo/shared as an MCP tool. Both the desktop server and the
12
12
  // cloud API are reached through env-discovered creds in
@@ -17,20 +17,200 @@ import { ALL_OPERATIONS, defaultContext, } from '@slatesvideo/shared';
17
17
  // { "command": "npx", "args": ["-y", "@slatesvideo/mcp-server"] }
18
18
  //
19
19
  // to their Claude / Cursor / Claude Desktop / Codex MCP config.
20
+ //
21
+ // 🚨 THE PROTOCOL IS THE PRODUCT SURFACE, NOT JUST THE TRANSPORT. Until
22
+ // 2026-09-02 this file used exactly one MCP feature — tools — so a host had no
23
+ // way to tell `slates_list_assets` from `slates_delete_project` (no
24
+ // annotations), no way to read a result as data (no structured content), no way
25
+ // to offer the 33 skills in its own picker (no prompts), no way to attach the
26
+ // capability table as context (no resources), and no way to show a render's
27
+ // progress (no progress notifications). All five are in the 2025-06-18 spec and
28
+ // all five are now used. Adding one is not decoration: each removes a reason
29
+ // the host has to route something through the model instead.
20
30
  const ops = ALL_OPERATIONS;
21
31
  const opsById = new Map(ops.map((o) => [o.id, o]));
22
32
  // Version comes from this package's own package.json (dist/server.js →
23
33
  // ../package.json) so the reported version never drifts from the publish.
24
34
  const pkg = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf8'));
25
- const server = new Server({ name: 'slates-studio', version: pkg.version }, { capabilities: { tools: {} } });
35
+ // The MCP protocol carries a field for exactly this, and it sat unused: a
36
+ // Claude Code / Cursor / Codex user got tool descriptions and nothing else —
37
+ // no working method, no REAL NUMBERS rule, no guide index, while the desktop
38
+ // Studio Agent had 37K characters of all three. Same doctrine, one source
39
+ // (@slatesvideo/shared → prompts/agent-doctrine.ts), surface-aware only where
40
+ // the mechanism genuinely differs.
41
+ //
42
+ // ⚠️ SIZE IS DELIBERATE. This is injected into EVERY client session and some
43
+ // clients truncate or ignore long instructions, so it ships the working method
44
+ // + hard rules + guide index and leaves the long-form skills to
45
+ // slates_get_prompting_guide. scripts/agent-surface-lockstep-check.mjs pins the
46
+ // byte count so growth is a review decision, not an accident.
47
+ const instructions = buildAgentDoctrine({ surface: 'mcp' });
48
+ const server = new Server({ name: 'slates-studio', version: pkg.version }, {
49
+ capabilities: {
50
+ tools: {},
51
+ // The 33 bundled skills, offered in the host's own picker rather than
52
+ // only through a tool call the model has to decide to make.
53
+ prompts: {},
54
+ // Stable documents a client can attach as context instead of spending a
55
+ // turn fetching them.
56
+ resources: {},
57
+ // Server-side warnings a host can surface without the model relaying them.
58
+ logging: {},
59
+ },
60
+ instructions,
61
+ });
62
+ // ── Tools ───────────────────────────────────────────────────────────────────
63
+ //
64
+ // 🚨 ONE RENDERER, SHARED WITH THE DESKTOP. This used to call zodToJsonSchema
65
+ // with `target: 'openApi3'` while `slate/src/main/studio-agent/ops.ts` used
66
+ // `$refStrategy: 'none'` — so "both surfaces expose the same tools" was proven
67
+ // of the ID SET and unproven of the BYTES. `toolDefinitions()` in shared is now
68
+ // the only renderer either one calls, and the lockstep check compares them.
69
+ //
70
+ // `surface: 'mcp'` sends every op: a stdio server has no run to append to, and
71
+ // Claude Code already defers stdio tool schemas through its own tool search.
72
+ const TOOLS = toolDefinitions(ops, { surface: 'mcp' });
73
+ /**
74
+ * Output schemas for the ops whose result shape is STABLE.
75
+ *
76
+ * Deliberately not every op: an `outputSchema` a result can violate is worse
77
+ * than none, because a client may validate against it. These five shapes are
78
+ * fixed by the op's own code paths, and every one of them is a number or an id
79
+ * a client would otherwise have to parse back out of prose.
80
+ */
81
+ const OUTPUT_SCHEMAS = {
82
+ slates_estimate_generation_cost: {
83
+ type: 'object',
84
+ properties: {
85
+ model: { type: 'string' },
86
+ cost_key: { type: 'string' },
87
+ quantity: { type: 'integer' },
88
+ cost_per_credits: { type: 'number' },
89
+ total_credits: { type: 'number' },
90
+ requires_confirm: { type: 'boolean' },
91
+ craft_card: { type: 'string', description: 'How to prompt this model — the levers block.' },
92
+ banned_tokens: { type: 'string' },
93
+ requires_clarification: { type: 'boolean' },
94
+ missing: { type: 'array', items: { type: 'string' } },
95
+ message: { type: 'string' },
96
+ },
97
+ },
98
+ slates_get_generation_status: {
99
+ type: 'object',
100
+ properties: {
101
+ status: { type: 'string', enum: ['pending', 'processing', 'completed', 'failed', 'cancelled'] },
102
+ error: { type: 'string' },
103
+ asset: { type: 'object' },
104
+ cost_credits: { type: 'number' },
105
+ },
106
+ },
107
+ slates_get_credit_balance: {
108
+ type: 'object',
109
+ properties: { success: { type: 'boolean' }, credit_balance: { type: 'number' } },
110
+ },
111
+ slates_list_assets: {
112
+ type: 'object',
113
+ properties: {
114
+ assets: { type: 'array', items: { type: 'object' } },
115
+ total_matching: { type: 'integer' },
116
+ total_in_project: { type: 'integer' },
117
+ truncated: { type: 'boolean' },
118
+ },
119
+ },
120
+ slates_get_workspace_state: {
121
+ type: 'object',
122
+ properties: {
123
+ projects: { type: 'array', items: { type: 'object' } },
124
+ project_count: { type: 'integer' },
125
+ activeProject: { type: 'object' },
126
+ },
127
+ },
128
+ };
26
129
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
27
- tools: ops.map((op) => ({
28
- name: op.id,
29
- description: op.description,
30
- inputSchema: zodToJsonSchema(op.input, { target: 'openApi3' }),
130
+ tools: TOOLS.map((t) => ({
131
+ name: t.name,
132
+ description: t.description,
133
+ inputSchema: t.inputSchema,
134
+ // readOnlyHint / destructiveHint / idempotentHint / openWorldHint. Derived
135
+ // in shared from the op id and re-derived independently by the lockstep
136
+ // check from the op's own transport verbs — a read-only claim on an op that
137
+ // posts is the one lie that would let a host auto-approve a mutation.
138
+ annotations: t.annotations,
139
+ ...(OUTPUT_SCHEMAS[t.name] ? { outputSchema: OUTPUT_SCHEMAS[t.name] } : {}),
31
140
  })),
32
141
  }));
33
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
142
+ /**
143
+ * Zod's default error is a JSON blob of issue objects. The model has to parse
144
+ * prose out of it to learn that `aspectRatio` was the problem and what the
145
+ * legal values are — so flatten to one line per issue, and print the legal set
146
+ * whenever an enum was the thing that failed.
147
+ */
148
+ function flattenZodError(err) {
149
+ return err.issues
150
+ .map((issue) => {
151
+ const path = issue.path.length > 0 ? issue.path.join('.') : '(root)';
152
+ if (issue.code === 'invalid_enum_value') {
153
+ const legal = issue.options ?? [];
154
+ return `${path}: ${issue.message}. Legal values: ${legal.join(', ')}`;
155
+ }
156
+ if (issue.code === 'unrecognized_keys') {
157
+ const keys = issue.keys ?? [];
158
+ return `${path}: unknown parameter(s) ${keys.join(', ')} — check the tool schema`;
159
+ }
160
+ return `${path}: ${issue.message}`;
161
+ })
162
+ .join('\n');
163
+ }
164
+ /** Fire-and-forget: a host that has not enabled logging must not break a call. */
165
+ function warn(message) {
166
+ if (!server.getClientCapabilities()?.['logging'])
167
+ return;
168
+ void server.sendLoggingMessage({ level: 'warning', logger: 'slates', data: message }).catch(() => { });
169
+ }
170
+ /**
171
+ * Elicitation (spec 2025-06-18): ask the USER, through the host's own UI,
172
+ * rather than making the model notice a `requires_confirm` string and decide to
173
+ * re-call. Behind a capability check, with a timeout — the text path stays the
174
+ * default for every client that does not advertise it, and a client that
175
+ * half-supports it must not hang the call.
176
+ */
177
+ const ELICIT_TIMEOUT_MS = 60_000;
178
+ function clientSupportsElicitation() {
179
+ return !!server.getClientCapabilities()?.elicitation;
180
+ }
181
+ /** Does this op actually have a `confirm` gate to satisfy? */
182
+ function opTakesConfirm(op) {
183
+ const def = op.input._def;
184
+ const shape = typeof def?.shape === 'function' ? def.shape() : undefined;
185
+ return !!shape && 'confirm' in shape;
186
+ }
187
+ async function elicitConfirm(message) {
188
+ try {
189
+ const res = await server.elicitInput({
190
+ message,
191
+ requestedSchema: {
192
+ type: 'object',
193
+ properties: {
194
+ confirm: {
195
+ type: 'boolean',
196
+ title: 'Spend the credits',
197
+ description: 'Yes proceeds and charges the account.',
198
+ },
199
+ },
200
+ required: ['confirm'],
201
+ },
202
+ }, { timeout: ELICIT_TIMEOUT_MS });
203
+ if (res.action !== 'accept')
204
+ return false;
205
+ return res.content?.confirm === true;
206
+ }
207
+ catch {
208
+ // Declined, timed out, or a host that advertised the capability and then
209
+ // failed it. Fall back to the text path rather than failing the call.
210
+ return null;
211
+ }
212
+ }
213
+ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
34
214
  const op = opsById.get(request.params.name);
35
215
  if (!op) {
36
216
  return {
@@ -39,28 +219,267 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
39
219
  };
40
220
  }
41
221
  try {
42
- const args = op.input.parse(request.params.arguments ?? {});
43
- const result = await op.run(args, defaultContext());
222
+ let args;
223
+ try {
224
+ args = op.input.parse(request.params.arguments ?? {});
225
+ }
226
+ catch (err) {
227
+ if (err instanceof z.ZodError) {
228
+ return {
229
+ content: [
230
+ {
231
+ type: 'text',
232
+ text: `Invalid arguments for ${op.id}:\n${flattenZodError(err)}`,
233
+ },
234
+ ],
235
+ isError: true,
236
+ };
237
+ }
238
+ throw err;
239
+ }
240
+ // Progress notifications: a background render is invisible to the host
241
+ // until the model polls. When the client sent a progress token, tick while
242
+ // the long-poll is in flight so the host can show something moving.
243
+ const progressToken = request.params._meta?.progressToken;
244
+ let ticker;
245
+ if (progressToken !== undefined && op.id === 'slates_get_generation_status') {
246
+ const started = Date.now();
247
+ ticker = setInterval(() => {
248
+ void server
249
+ .notification({
250
+ method: 'notifications/progress',
251
+ params: {
252
+ progressToken,
253
+ progress: Math.round((Date.now() - started) / 1000),
254
+ message: `rendering — ${Math.round((Date.now() - started) / 1000)}s`,
255
+ },
256
+ })
257
+ .catch(() => { });
258
+ }, 5_000);
259
+ ticker.unref?.();
260
+ }
261
+ let result;
262
+ try {
263
+ result = await op.run(args, { ...defaultContext(), signal: extra?.signal });
264
+ }
265
+ finally {
266
+ if (ticker)
267
+ clearInterval(ticker);
268
+ }
269
+ const data = result.data;
270
+ // The one place the server can ask the USER instead of the model.
271
+ //
272
+ // 🚨 GATED ON THE OP HAVING A `confirm` INPUT, not merely on the flag.
273
+ // `slates_estimate_generation_cost` returns `requires_confirm: true` as
274
+ // INFORMATION — "the generation this quotes will trip the gate" — and takes
275
+ // no `confirm` param at all. Eliciting there would ask the user to approve
276
+ // a spend that is not happening, on a read-only pre-flight quote, and then
277
+ // re-run the quote with a parameter it does not have.
278
+ if (data?.requires_confirm === true && opTakesConfirm(op) && clientSupportsElicitation()) {
279
+ const answer = await elicitConfirm(typeof data.message === 'string' ? data.message : result.text);
280
+ if (answer === true) {
281
+ result = await op.run({ ...args, confirm: true }, {
282
+ ...defaultContext(),
283
+ signal: extra?.signal,
284
+ });
285
+ }
286
+ else if (answer === false) {
287
+ return {
288
+ content: [{ type: 'text', text: 'The user declined the spend. Do not re-call without new instructions.' }],
289
+ };
290
+ }
291
+ // null → the host could not answer; the text path below still applies.
292
+ }
293
+ if (typeof data?.prompt_warning === 'string' && data.prompt_warning) {
294
+ warn(data.prompt_warning);
295
+ }
44
296
  const content = [
45
297
  { type: 'text', text: result.text },
46
298
  ];
47
299
  for (const img of result.images ?? []) {
48
300
  content.push({ type: 'image', data: img.data, mimeType: img.mimeType });
49
301
  }
50
- return { content };
302
+ return {
303
+ content,
304
+ // `data` beside the prose, so a client can read cost_credits, asset codes
305
+ // and status as VALUES rather than regexing them back out of a sentence.
306
+ ...(data !== undefined && data !== null && typeof data === 'object'
307
+ ? { structuredContent: data }
308
+ : {}),
309
+ };
51
310
  }
52
311
  catch (err) {
53
312
  const message = err instanceof Error ? err.message : String(err);
313
+ if (/not reachable|Agent Control/i.test(message))
314
+ warn(message);
54
315
  return {
55
316
  content: [{ type: 'text', text: `Error: ${message}` }],
56
317
  isError: true,
57
318
  };
58
319
  }
59
320
  });
321
+ // ── Prompts: the 33 bundled skills ──────────────────────────────────────────
322
+ //
323
+ // This is exactly what MCP prompts are for, and the only path before now was a
324
+ // tool call the model had to decide to make — measured at 13% compliance. As a
325
+ // prompt, the skill shows up in the host's own picker and the USER can invoke
326
+ // it, which is a completely different actor making the decision.
327
+ /** First sentence of the frontmatter description — the picker's one-liner. */
328
+ function skillSummary(name) {
329
+ const body = SKILLS[name] ?? '';
330
+ const fm = /^---\n([\s\S]*?)\n---/.exec(body);
331
+ const desc = fm ? /^description:\s*(.+)$/m.exec(fm[1])?.[1] : undefined;
332
+ const first = (desc ?? name).split(/(?<=\.)\s/)[0];
333
+ return first.length > 300 ? `${first.slice(0, 297)}…` : first;
334
+ }
335
+ const SKILL_NAMES = Object.keys(SKILLS).sort();
336
+ server.setRequestHandler(ListPromptsRequestSchema, async () => ({
337
+ prompts: SKILL_NAMES.map((name) => ({
338
+ name,
339
+ title: name.replace(/^slates-/, '').replace(/-/g, ' '),
340
+ description: skillSummary(name),
341
+ })),
342
+ }));
343
+ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
344
+ const name = request.params.name;
345
+ const content = SKILLS[name];
346
+ if (content === undefined) {
347
+ throw new Error(`Unknown prompt: ${name}. Available: ${SKILL_NAMES.join(', ')}`);
348
+ }
349
+ return {
350
+ description: skillSummary(name),
351
+ messages: [{ role: 'user', content: { type: 'text', text: content } }],
352
+ };
353
+ });
354
+ // ── Resources: the stable documents ─────────────────────────────────────────
355
+ const MANUAL_URI = 'slates://manual';
356
+ const CAPABILITIES_URI = 'slates://capabilities';
357
+ const PRICES_URI = 'slates://prices';
358
+ server.setRequestHandler(ListResourcesRequestSchema, async () => ({
359
+ resources: [
360
+ {
361
+ uri: MANUAL_URI,
362
+ name: 'Slates agent manual',
363
+ description: 'The working method, the hard rules and the guide index — the same doctrine this server sends as instructions.',
364
+ mimeType: 'text/markdown',
365
+ },
366
+ {
367
+ uri: CAPABILITIES_URI,
368
+ name: 'Model capabilities',
369
+ description: 'What every model ACCEPTS: aspect ratios, video resolutions, duration windows and reference caps, generated from the capability SSOT.',
370
+ mimeType: 'text/markdown',
371
+ },
372
+ {
373
+ uri: PRICES_URI,
374
+ name: 'Credit price list',
375
+ description: 'Live per-generation credit cost for every registry key. Read from the account, never cached — a stale price is a wrong quote.',
376
+ mimeType: 'text/markdown',
377
+ },
378
+ ],
379
+ }));
380
+ server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => ({
381
+ resourceTemplates: [
382
+ {
383
+ uriTemplate: 'slates://skill/{name}',
384
+ name: 'Prompting or workflow guide',
385
+ description: `One bundled skill, whole. Names: ${SKILL_NAMES.join(', ')}`,
386
+ mimeType: 'text/markdown',
387
+ },
388
+ {
389
+ uriTemplate: 'slates://project/{projectId}/shots',
390
+ name: 'Shot list',
391
+ description: 'Every Shot in a project, with the variety distribution the counts are read from.',
392
+ mimeType: 'application/json',
393
+ },
394
+ ],
395
+ }));
396
+ /** Generated from MODEL_CAPABILITIES + MODEL_FACTS — never hand-written. */
397
+ function renderCapabilities() {
398
+ const lines = ['# Slates model capabilities', '', 'Generated from the capability SSOT. Never quote a number from memory.', ''];
399
+ for (const [model, cap] of Object.entries(MODEL_CAPABILITIES)) {
400
+ const fact = MODEL_FACTS.find((f) => f.id === model);
401
+ lines.push(`## ${model}${fact ? ` — ${fact.kind}` : ''}`);
402
+ if (cap.aspectRatios)
403
+ lines.push(`- Aspect ratios: ${cap.aspectRatios.join(', ')}`);
404
+ if (cap.videoResolution) {
405
+ const vr = cap.videoResolution;
406
+ lines.push(`- Video resolutions: ${vr.fixed ? `${vr.fixed} (fixed)` : (vr.options ?? []).join(', ')}${vr.default ? ` (default ${vr.default})` : ''}`);
407
+ }
408
+ if (cap.duration) {
409
+ const d = cap.duration;
410
+ lines.push(`- Duration: ${d.values ? d.values.join(' / ') : `${d.min}-${d.max}`}s`);
411
+ }
412
+ const refs = [];
413
+ if (cap.maxRefImages != null)
414
+ refs.push(`${cap.maxRefImages} images (create)`);
415
+ if (cap.maxIngredientImages != null)
416
+ refs.push(`${cap.maxIngredientImages} ingredient images`);
417
+ if (cap.maxReferenceVideos)
418
+ refs.push(`${cap.maxReferenceVideos} videos`);
419
+ if (cap.maxReferenceAudio)
420
+ refs.push(`${cap.maxReferenceAudio} audio clips`);
421
+ if (cap.maxReferenceFilesTotal != null)
422
+ refs.push(`${cap.maxReferenceFilesTotal} files total`);
423
+ if (refs.length > 0)
424
+ lines.push(`- Reference caps: ${refs.join(' · ')}`);
425
+ lines.push('');
426
+ }
427
+ return lines.join('\n');
428
+ }
429
+ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
430
+ const uri = request.params.uri;
431
+ const text = async () => {
432
+ if (uri === MANUAL_URI) {
433
+ return `${instructions}\n\n---\n\nFull product manual: https://slates.video/slates-reference.md`;
434
+ }
435
+ if (uri === CAPABILITIES_URI)
436
+ return renderCapabilities();
437
+ if (uri === PRICES_URI) {
438
+ // 🚨 READ LIVE, NEVER EMBEDDED. A price baked into the package at build
439
+ // time is wrong on the next rate change, and REAL NUMBERS ONLY exists to
440
+ // stop exactly that number reaching a user.
441
+ const registry = await new SlatesCloudClient().get('/api/agent/models');
442
+ return [
443
+ '# Slates credit prices (live)',
444
+ '',
445
+ 'Credits per generation, by registry cost key.',
446
+ '',
447
+ ...registry.models.map((m) => `${m.model} ${m.cost_credits ?? m.cost_cents ?? 0}`),
448
+ ].join('\n');
449
+ }
450
+ const skill = /^slates:\/\/skill\/(.+)$/.exec(uri);
451
+ if (skill) {
452
+ const content = SKILLS[decodeURIComponent(skill[1])];
453
+ if (content === undefined)
454
+ throw new Error(`Unknown skill: ${skill[1]}`);
455
+ return content;
456
+ }
457
+ const shots = /^slates:\/\/project\/([^/]+)\/shots$/.exec(uri);
458
+ if (shots) {
459
+ const op = opsById.get('slates_list_shots');
460
+ if (!op)
461
+ throw new Error('slates_list_shots is not registered');
462
+ const r = await op.run({ projectId: decodeURIComponent(shots[1]) }, defaultContext());
463
+ return JSON.stringify(r.data ?? {}, null, 2);
464
+ }
465
+ throw new Error(`Unknown resource: ${uri}`);
466
+ };
467
+ return {
468
+ contents: [
469
+ {
470
+ uri,
471
+ mimeType: uri.endsWith('/shots') ? 'application/json' : 'text/markdown',
472
+ text: await text(),
473
+ },
474
+ ],
475
+ };
476
+ });
60
477
  async function main() {
61
478
  const transport = new StdioServerTransport();
62
479
  await server.connect(transport);
63
- console.error(`[slates-mcp] server started, ${ops.length} tools registered`);
480
+ console.error(`[slates-mcp] server started, ${ops.length} tools registered, ` +
481
+ `${SKILL_NAMES.length} skills as prompts, 3 resources + 2 templates, ` +
482
+ `${instructions.length} chars of agent doctrine sent as instructions`);
64
483
  }
65
484
  main().catch((err) => {
66
485
  console.error('[slates-mcp] fatal:', err);
package/package.json CHANGED
@@ -1,62 +1,61 @@
1
- {
2
- "name": "@slatesvideo/mcp-server",
3
- "version": "0.5.11",
4
- "description": "MCP server for the Slates desktop app. Your AI agent (Claude, Cursor, or any MCP client) drives a local AI video studio: projects, characters, storyboards, image and video generation. Files land on disk.",
5
- "license": "MIT",
6
- "type": "module",
7
- "bin": {
8
- "slates-mcp-server": "./dist/server.js"
9
- },
10
- "main": "./dist/server.js",
11
- "files": [
12
- "dist",
13
- "!dist/**/*.map",
14
- "README.md"
15
- ],
16
- "scripts": {
17
- "build": "tsc",
18
- "start": "node dist/server.js",
19
- "typecheck": "tsc --noEmit",
20
- "prepublishOnly": "npm run build",
21
- "build:mcpb": "npm run build --prefix ../shared && npm run build && node scripts/stage-mcpb.mjs && npx -y @anthropic-ai/mcpb pack dist-mcpb/staging dist-mcpb/slates.mcpb"
22
- },
23
- "repository": {
24
- "type": "git",
25
- "url": "git+https://github.com/EricDisero/slates-mcp.git",
26
- "directory": "packages/mcp"
27
- },
28
- "homepage": "https://slates.video",
29
- "bugs": {
30
- "url": "https://github.com/EricDisero/slates-mcp/issues"
31
- },
32
- "keywords": [
33
- "mcp",
34
- "model-context-protocol",
35
- "mcp-server",
36
- "ai-video",
37
- "video-generation",
38
- "image-generation",
39
- "claude",
40
- "claude-desktop",
41
- "cursor",
42
- "slates",
43
- "veo",
44
- "kling",
45
- "seedance",
46
- "storyboard"
47
- ],
48
- "engines": {
49
- "node": ">=18"
50
- },
51
- "dependencies": {
52
- "@modelcontextprotocol/sdk": "^1.0.0",
53
- "@slatesvideo/shared": "^0.6.2",
54
- "zod": "^3.23.0",
55
- "zod-to-json-schema": "^3.23.0"
56
- },
57
- "devDependencies": {
58
- "@anthropic-ai/mcpb": "^2.1.2",
59
- "@types/node": "^20.0.0",
60
- "typescript": "^5.7.0"
61
- }
62
- }
1
+ {
2
+ "name": "@slatesvideo/mcp-server",
3
+ "version": "0.5.13",
4
+ "description": "MCP server for the Slates desktop app. Your AI agent (Claude, Cursor, or any MCP client) drives a local AI video studio: projects, characters, storyboards, image and video generation. Files land on disk.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "slates-mcp-server": "./dist/server.js"
9
+ },
10
+ "main": "./dist/server.js",
11
+ "files": [
12
+ "dist",
13
+ "!dist/**/*.map",
14
+ "README.md"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc",
18
+ "start": "node dist/server.js",
19
+ "typecheck": "tsc --noEmit",
20
+ "prepublishOnly": "npm run build",
21
+ "build:mcpb": "npm run build --prefix ../shared && npm run build && node scripts/stage-mcpb.mjs && npx -y @anthropic-ai/mcpb pack dist-mcpb/staging dist-mcpb/slates.mcpb"
22
+ },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/EricDisero/slates-mcp.git",
26
+ "directory": "packages/mcp"
27
+ },
28
+ "homepage": "https://slates.video",
29
+ "bugs": {
30
+ "url": "https://github.com/EricDisero/slates-mcp/issues"
31
+ },
32
+ "keywords": [
33
+ "mcp",
34
+ "model-context-protocol",
35
+ "mcp-server",
36
+ "ai-video",
37
+ "video-generation",
38
+ "image-generation",
39
+ "claude",
40
+ "claude-desktop",
41
+ "cursor",
42
+ "slates",
43
+ "veo",
44
+ "kling",
45
+ "seedance",
46
+ "storyboard"
47
+ ],
48
+ "engines": {
49
+ "node": ">=18"
50
+ },
51
+ "dependencies": {
52
+ "@modelcontextprotocol/sdk": "^1.0.0",
53
+ "@slatesvideo/shared": "^0.6.4",
54
+ "zod": "^3.23.0"
55
+ },
56
+ "devDependencies": {
57
+ "@anthropic-ai/mcpb": "^2.1.2",
58
+ "@types/node": "^20.0.0",
59
+ "typescript": "^5.7.0"
60
+ }
61
+ }