@slatesvideo/mcp-server 0.6.5 → 0.6.7
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/dist/server.js +69 -5
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
-
import {
|
|
5
|
+
import { spawn } from 'node:child_process';
|
|
6
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
6
7
|
import { join, dirname } from 'node:path';
|
|
7
8
|
import { fileURLToPath } from 'node:url';
|
|
8
9
|
import { z } from 'zod';
|
|
9
|
-
import { ALL_OPERATIONS, ARCHIVE_AFTER_DAYS, brainSkills, parseSkillMetadata, MODEL_CAPABILITIES, MODEL_FACTS, SlatesCloudClient, buildMcpInstructions, BRAIN_ROUTER, MY_BRAIN_TOPIC, ROUTER_NOTICE, archiveUnusedDaily, refreshServedBrain, myBrainPreload, noteUsed, APP_MANUAL, defaultContext, toolDefinitions, cachedLatestVersion, refreshLatestVersion, updateNotice, } from '@slatesvideo/shared';
|
|
10
|
+
import { ALL_OPERATIONS, ARCHIVE_AFTER_DAYS, brainSkills, parseSkillMetadata, MODEL_CAPABILITIES, MODEL_FACTS, SlatesCloudClient, buildMcpInstructions, BRAIN_ROUTER, MY_BRAIN_TOPIC, ROUTER_NOTICE, archiveUnusedDaily, refreshServedBrain, myBrainPreload, noteUsed, APP_MANUAL, defaultContext, toolDefinitions, cachedLatestVersion, refreshLatestVersion, updateNotice, readMcpLauncher, setDesktopClientIdentity, } from '@slatesvideo/shared';
|
|
10
11
|
// Slates MCP server. Stdio transport. Wires every operation in
|
|
11
12
|
// @slatesvideo/shared as an MCP tool. Both the desktop server and the
|
|
12
13
|
// cloud API are reached through env-discovered creds in
|
|
@@ -46,15 +47,25 @@ const pkg = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url))
|
|
|
46
47
|
// scripts/agent-surface-lockstep-check.mjs pins the byte count so growth is a
|
|
47
48
|
// review decision, not an accident.
|
|
48
49
|
const PKG_NAME = '@slatesvideo/mcp-server';
|
|
50
|
+
// 🚨 THE COPY INSIDE THE SLATES APP (since 0.6.7, 2026-10-31). The desktop app carries this server,
|
|
51
|
+
// started by the app's own binary as Node with SLATES_MCP_BUNDLED=1 (slate
|
|
52
|
+
// `src/main/agent/mcpLauncher.ts`), so it is always the version that matches the app and updates
|
|
53
|
+
// with it. That copy never checks npm: the app's own update is its update. Its version line is no
|
|
54
|
+
// longer than the npm one, so the instructions' ceiling (check 2) holds for both.
|
|
55
|
+
const BUNDLED = process.env.SLATES_MCP_BUNDLED === '1';
|
|
56
|
+
setDesktopClientIdentity(`mcp-server/${pkg.version}${BUNDLED ? ' bundled' : ''}`);
|
|
49
57
|
// The first line names the running version so an agent can answer "what
|
|
50
58
|
// version am I on"; the notice appears only when the on-disk cache (refreshed
|
|
51
59
|
// in main(), for the NEXT launch) says a newer package is published. Read the
|
|
52
60
|
// design note in @slatesvideo/shared update-check.ts before changing either.
|
|
53
|
-
const updateAdvice = updateNotice(PKG_NAME, pkg.version, cachedLatestVersion(PKG_NAME), 'Newer models are missing until it updates. Tell the user in your FIRST reply: fully quit and reopen the MCP client so npx fetches it; a global install needs `npm i -g @slatesvideo/mcp-server@latest` first.');
|
|
61
|
+
const updateAdvice = BUNDLED ? null : updateNotice(PKG_NAME, pkg.version, cachedLatestVersion(PKG_NAME), 'Newer models are missing until it updates. Tell the user in your FIRST reply: fully quit and reopen the MCP client so npx fetches it; a global install needs `npm i -g @slatesvideo/mcp-server@latest` first.');
|
|
62
|
+
const versionLine = BUNDLED
|
|
63
|
+
? `Slates MCP server v${pkg.version} (inside the Slates app).`
|
|
64
|
+
: `Slates MCP server v${pkg.version} (${PKG_NAME}).`;
|
|
54
65
|
const doctrine = buildMcpInstructions();
|
|
55
66
|
const firstParagraphEnd = doctrine.indexOf('\n\n');
|
|
56
67
|
const instructions = [
|
|
57
|
-
|
|
68
|
+
versionLine,
|
|
58
69
|
doctrine.slice(0, firstParagraphEnd),
|
|
59
70
|
updateAdvice,
|
|
60
71
|
doctrine.slice(firstParagraphEnd + 2),
|
|
@@ -545,7 +556,59 @@ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
|
545
556
|
],
|
|
546
557
|
};
|
|
547
558
|
});
|
|
559
|
+
/**
|
|
560
|
+
* 🚨 AN npm COPY HANDS OFF TO THE APP'S OWN. Started from npm (`npx -y @slatesvideo/mcp-server`, a
|
|
561
|
+
* global install, a directory plugin pinned to an old version) on a computer whose Slates app
|
|
562
|
+
* carries this server, this process starts the app's copy on the same stdin and stdout and only
|
|
563
|
+
* relays its exit. The client then always talks to the server that matches the installed app,
|
|
564
|
+
* whatever it was configured with, which ends the drift a customer hit on 2026-10-31 (an old npm
|
|
565
|
+
* copy without the transition tools, an app that had them).
|
|
566
|
+
*
|
|
567
|
+
* Only a copy with no `src/` beside its `dist/` hands off (the npm package and the Claude Desktop
|
|
568
|
+
* `.mcpb` bundle ship none): a server built in this repo (the checks, a developer's own client
|
|
569
|
+
* config) runs as itself. SLATES_MCP_NO_HANDOFF=1 keeps any copy as itself. Resolves to
|
|
570
|
+
* the exit code to leave with, or null to run here (no app copy, or it could not start).
|
|
571
|
+
*/
|
|
572
|
+
function handOffToApp() {
|
|
573
|
+
if (BUNDLED || process.env.SLATES_MCP_NO_HANDOFF === '1')
|
|
574
|
+
return null;
|
|
575
|
+
if (existsSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'src')))
|
|
576
|
+
return null;
|
|
577
|
+
const launcher = readMcpLauncher();
|
|
578
|
+
if (!launcher)
|
|
579
|
+
return null;
|
|
580
|
+
console.error(`[slates-mcp] v${pkg.version}: starting the Slates app's own server, v${launcher.version}`);
|
|
581
|
+
return new Promise((resolve) => {
|
|
582
|
+
const child = spawn(launcher.command, launcher.args, {
|
|
583
|
+
stdio: 'inherit',
|
|
584
|
+
env: { ...process.env, ...launcher.env },
|
|
585
|
+
windowsHide: true,
|
|
586
|
+
});
|
|
587
|
+
let started = false;
|
|
588
|
+
child.on('spawn', () => {
|
|
589
|
+
started = true;
|
|
590
|
+
// Only once the app's copy runs: a copy that falls back to itself keeps Node's own exit on a signal.
|
|
591
|
+
for (const signal of ['SIGINT', 'SIGTERM'])
|
|
592
|
+
process.on(signal, () => child.kill(signal));
|
|
593
|
+
});
|
|
594
|
+
// A launch that fails before it starts (the app moved since it wrote the file) runs this copy:
|
|
595
|
+
// nothing has read stdin yet, so the client is none the wiser.
|
|
596
|
+
child.on('error', (err) => {
|
|
597
|
+
if (started)
|
|
598
|
+
return;
|
|
599
|
+
console.error(`[slates-mcp] the app's server did not start (${err.message}); running v${pkg.version} instead`);
|
|
600
|
+
resolve(null);
|
|
601
|
+
});
|
|
602
|
+
child.on('exit', (code, signal) => resolve(code ?? (signal ? 1 : 0)));
|
|
603
|
+
});
|
|
604
|
+
}
|
|
548
605
|
async function main() {
|
|
606
|
+
const handoff = handOffToApp();
|
|
607
|
+
if (handoff) {
|
|
608
|
+
const code = await handoff;
|
|
609
|
+
if (code !== null)
|
|
610
|
+
process.exit(code);
|
|
611
|
+
}
|
|
549
612
|
if (process.argv.includes('--tools=compact'))
|
|
550
613
|
console.error('[slates-mcp] --tools=compact is deprecated; the server always exposes the full fixed tool list. Clients control selective loading.');
|
|
551
614
|
const transport = new StdioServerTransport();
|
|
@@ -553,7 +616,8 @@ async function main() {
|
|
|
553
616
|
if (updateAdvice)
|
|
554
617
|
console.error(`[slates-mcp] ${updateAdvice}`);
|
|
555
618
|
// Background refresh; the result is read by the next launch, never awaited.
|
|
556
|
-
|
|
619
|
+
if (!BUNDLED)
|
|
620
|
+
void refreshLatestVersion(PKG_NAME);
|
|
557
621
|
// The playbooks, rules and model guides by the account's tier (shared skills/served.ts): the cache serves this
|
|
558
622
|
// session at once, and the first guide answer waits for this check if it is still in flight.
|
|
559
623
|
void refreshServedBrain(() => new SlatesCloudClient()).then((brain) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slatesvideo/mcp-server",
|
|
3
3
|
"mcpName": "io.github.EricDisero/slates",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.7",
|
|
5
5
|
"description": "MCP server for the Slates desktop app. Your AI agent (ChatGPT via Codex, Claude, Cursor, or another local MCP client) drives a local AI video studio: projects, characters, storyboards, image and video generation. Files land on disk.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
53
|
-
"@slatesvideo/shared": "^0.7.
|
|
53
|
+
"@slatesvideo/shared": "^0.7.11",
|
|
54
54
|
"zod": "^3.23.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|