@sketric/favstash-mcp 0.6.3 → 0.7.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/CHANGELOG.md +10 -0
- package/bin/contracts.json +2 -2
- package/bin/editing.js +257 -0
- package/bin/favstash.js +18 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @sketric/favstash-mcp
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ef3c339: Add `favstash doctor --editing` (private beta): checks this computer's setup for the FavStash editing skills pack and syncs availability and versions (never paths or names) to the account's AI Edit. It does nothing on accounts without the beta.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- dbd6bff: Radar tool descriptions now state each plan's limits (Free: 3 creators and 5 lookups a day; Doom Scroller: 25 and 10; Creator Pro and Team: 100 and 30), and `save_content_url` names the Radar save exception.
|
|
12
|
+
|
|
3
13
|
## 0.6.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/bin/contracts.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"contractHash": "
|
|
2
|
+
"contractHash": "9992ade5678dd5b86a0eccf30667d71ce589d0b4acf29b009fee48377c537064",
|
|
3
3
|
"tools": [
|
|
4
4
|
{
|
|
5
5
|
"name": "list_connected_social_accounts",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
{
|
|
124
124
|
"name": "save_content_url",
|
|
125
125
|
"title": "Save content URL",
|
|
126
|
-
"description": "Saving through MCP is temporarily app-only: this returns APP_SAVE_REQUIRED with a prefilled saveUrl the user opens to finish the save; do not retry. Save one public Instagram, TikTok, YouTube, LinkedIn, or X post URL to the user's FavStash without a stash-size cap. Full transcript and AI enrichment follows the account's plan allowance when available; X saves index available public post text with the user's note and collection, but do not copy X media or use AI visual analysis. Use get_saved_content with the returned item id to check status. This changes the user's stash and requires confirmation unless the user already asked to save that exact URL.",
|
|
126
|
+
"description": "Saving through MCP is temporarily app-only: this returns APP_SAVE_REQUIRED with a prefilled saveUrl the user opens to finish the save; do not retry. One exception saves directly: a FavStash Radar post, passed with its url and its saveRequestId (from get_radar or find_trending_posts) as clientRequestId. Save one public Instagram, TikTok, YouTube, LinkedIn, or X post URL to the user's FavStash without a stash-size cap. Full transcript and AI enrichment follows the account's plan allowance when available; X saves index available public post text with the user's note and collection, but do not copy X media or use AI visual analysis. Use get_saved_content with the returned item id to check status. This changes the user's stash and requires confirmation unless the user already asked to save that exact URL.",
|
|
127
127
|
"inputSchema": {
|
|
128
128
|
"type": "object",
|
|
129
129
|
"properties": {
|
package/bin/editing.js
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { randomBytes } from "node:crypto";
|
|
3
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { arch as osArch, platform } from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import {
|
|
7
|
+
CallToolResultSchema,
|
|
8
|
+
InitializeResultSchema,
|
|
9
|
+
ListToolsResultSchema,
|
|
10
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
11
|
+
import { PACKAGE, configDirectory } from "./config.js";
|
|
12
|
+
import { remoteClient } from "./remote.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* `favstash doctor --editing`: check this computer's video-editing setup for
|
|
16
|
+
* the FavStash editing skills pack and sync it to the account (AI Edit).
|
|
17
|
+
*
|
|
18
|
+
* AI Edit is a private beta. The server lists report_editing_setup only for
|
|
19
|
+
* accounts that have it, so this command asks first and does nothing else
|
|
20
|
+
* when the tool is absent. Only availability and versions leave the computer:
|
|
21
|
+
* never paths, locations, error text, user or host names, or file names.
|
|
22
|
+
* Field names mirror artifacts/web/lib/editingSetup.ts.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export const PACK_DOCTOR = "skills/3-editing/edit-video/scripts/doctor.mjs";
|
|
26
|
+
export const REPORT_TOOL = "report_editing_setup";
|
|
27
|
+
const CHECK_IDS = [
|
|
28
|
+
"node",
|
|
29
|
+
"npm",
|
|
30
|
+
"ffmpeg",
|
|
31
|
+
"ffprobe",
|
|
32
|
+
"ytDlp",
|
|
33
|
+
"hyperframes",
|
|
34
|
+
"gsap",
|
|
35
|
+
"python",
|
|
36
|
+
"pythonNumpy",
|
|
37
|
+
"pythonOpenCv",
|
|
38
|
+
"pythonPdq",
|
|
39
|
+
"pythonPlaywright",
|
|
40
|
+
"swiftc",
|
|
41
|
+
"favstashCli",
|
|
42
|
+
];
|
|
43
|
+
const CAPABILITY_IDS = [
|
|
44
|
+
"coreReady",
|
|
45
|
+
"referenceAnalysisReady",
|
|
46
|
+
"renderReady",
|
|
47
|
+
"glassReady",
|
|
48
|
+
"productMotionAdsReady",
|
|
49
|
+
"paperGridReady",
|
|
50
|
+
"breakoutCardReady",
|
|
51
|
+
"duplicateCheckReady",
|
|
52
|
+
];
|
|
53
|
+
const AGENTS = ["claude-code", "codex", "cursor", "other"];
|
|
54
|
+
|
|
55
|
+
/** A random id for this computer, kept in the CLI config directory. */
|
|
56
|
+
export function machineId(directory = configDirectory()) {
|
|
57
|
+
const file = path.join(directory, "machine-id");
|
|
58
|
+
try {
|
|
59
|
+
const saved = readFileSync(file, "utf8").trim();
|
|
60
|
+
if (/^[a-f0-9]{32}$/.test(saved)) return saved;
|
|
61
|
+
} catch {
|
|
62
|
+
// First run on this computer.
|
|
63
|
+
}
|
|
64
|
+
const id = randomBytes(16).toString("hex");
|
|
65
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
66
|
+
writeFileSync(file, `${id}\n`, { mode: 0o600 });
|
|
67
|
+
return id;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function osName(value = platform()) {
|
|
71
|
+
return value === "darwin"
|
|
72
|
+
? "macos"
|
|
73
|
+
: value === "win32"
|
|
74
|
+
? "windows"
|
|
75
|
+
: value === "linux"
|
|
76
|
+
? "linux"
|
|
77
|
+
: "other";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** The pack checkout: --pack, the workspace's default clone, or the env. */
|
|
81
|
+
export function findPack({ pack, workspace, env = process.env } = {}) {
|
|
82
|
+
const candidates = [
|
|
83
|
+
pack,
|
|
84
|
+
workspace && path.join(workspace, ".favstash-studio", "skills-source"),
|
|
85
|
+
env.FAVSTASH_SKILLS_PACK,
|
|
86
|
+
].filter(Boolean);
|
|
87
|
+
for (const candidate of candidates) {
|
|
88
|
+
const dir = path.resolve(candidate);
|
|
89
|
+
if (existsSync(path.join(dir, PACK_DOCTOR))) return dir;
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function probe(command, args) {
|
|
95
|
+
const result = spawnSync(command, args, {
|
|
96
|
+
encoding: "utf8",
|
|
97
|
+
timeout: 15_000,
|
|
98
|
+
shell: process.platform === "win32",
|
|
99
|
+
});
|
|
100
|
+
if (result.error || result.status !== 0)
|
|
101
|
+
return { available: false, version: null };
|
|
102
|
+
const version = `${result.stdout ?? ""}${result.stderr ?? ""}`.match(
|
|
103
|
+
/\d+(?:\.\d+){1,3}/,
|
|
104
|
+
);
|
|
105
|
+
return { available: true, version: version?.[0] ?? null };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** Without the pack, the tools every style needs, probed directly. */
|
|
109
|
+
export function basicChecks() {
|
|
110
|
+
return {
|
|
111
|
+
node: {
|
|
112
|
+
available: Number(process.versions.node.split(".")[0]) >= 22,
|
|
113
|
+
version: process.versions.node,
|
|
114
|
+
},
|
|
115
|
+
npm: probe("npm", ["--version"]),
|
|
116
|
+
ffmpeg: probe("ffmpeg", ["-version"]),
|
|
117
|
+
ffprobe: probe("ffprobe", ["-version"]),
|
|
118
|
+
ytDlp: probe("yt-dlp", ["--version"]),
|
|
119
|
+
favstashCli: { available: true, version: PACKAGE.version },
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export function runPackDoctor(packDir, workspace) {
|
|
124
|
+
const result = spawnSync(
|
|
125
|
+
process.execPath,
|
|
126
|
+
[path.join(packDir, PACK_DOCTOR), "--workspace", workspace, "--json"],
|
|
127
|
+
{ encoding: "utf8", timeout: 120_000, maxBuffer: 4_000_000 },
|
|
128
|
+
);
|
|
129
|
+
if (result.error) throw result.error;
|
|
130
|
+
try {
|
|
131
|
+
return JSON.parse(result.stdout);
|
|
132
|
+
} catch {
|
|
133
|
+
throw new Error(
|
|
134
|
+
"The skills pack doctor did not return JSON. Update the pack (git pull) and try again.",
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function packVersion(packDir) {
|
|
140
|
+
try {
|
|
141
|
+
const version = JSON.parse(
|
|
142
|
+
readFileSync(path.join(packDir, "package.json"), "utf8"),
|
|
143
|
+
).version;
|
|
144
|
+
return typeof version === "string" ? version.slice(0, 32) : null;
|
|
145
|
+
} catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const cleanVersion = (value) =>
|
|
151
|
+
typeof value === "string"
|
|
152
|
+
? (value.match(/\d+(?:\.\d+){0,3}[0-9A-Za-z.+_-]*/)?.[0]?.slice(0, 32) ??
|
|
153
|
+
null)
|
|
154
|
+
: null;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* The report sent to FavStash: an allowlist of the doctor's facts. Paths,
|
|
158
|
+
* locations, notes and error text in the doctor JSON never get copied.
|
|
159
|
+
*/
|
|
160
|
+
export function editingReport({ doctor, packDir, id, label, agent }) {
|
|
161
|
+
const checks = {};
|
|
162
|
+
for (const key of CHECK_IDS) {
|
|
163
|
+
const check = doctor?.checks?.[key];
|
|
164
|
+
if (check && typeof check.available === "boolean")
|
|
165
|
+
checks[key] = {
|
|
166
|
+
available: check.available,
|
|
167
|
+
version: cleanVersion(check.version),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
const capabilities = {};
|
|
171
|
+
for (const key of CAPABILITY_IDS)
|
|
172
|
+
if (typeof doctor?.[key] === "boolean") capabilities[key] = doctor[key];
|
|
173
|
+
return {
|
|
174
|
+
machineId: id,
|
|
175
|
+
...(label ? { label: String(label).slice(0, 60) } : {}),
|
|
176
|
+
os: osName(),
|
|
177
|
+
arch: osArch().toLowerCase().slice(0, 16),
|
|
178
|
+
...(AGENTS.includes(agent) ? { agent } : {}),
|
|
179
|
+
cliVersion: PACKAGE.version,
|
|
180
|
+
pack: packDir
|
|
181
|
+
? { installed: true, version: packVersion(packDir) ?? undefined }
|
|
182
|
+
: { installed: false },
|
|
183
|
+
studioInitialized: doctor?.studioInitialized === true,
|
|
184
|
+
checks,
|
|
185
|
+
capabilities,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function toolResult(result) {
|
|
190
|
+
const parsed = CallToolResultSchema.parse(result);
|
|
191
|
+
const text = parsed.content?.find((item) => item.type === "text")?.text;
|
|
192
|
+
if (parsed.isError) throw new Error(text || "FavStash rejected the report.");
|
|
193
|
+
if (parsed.structuredContent) return parsed.structuredContent;
|
|
194
|
+
try {
|
|
195
|
+
return JSON.parse(text ?? "{}");
|
|
196
|
+
} catch {
|
|
197
|
+
return {};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export async function editingDoctor(
|
|
202
|
+
{ workspace, pack, label, agent, dryRun = false } = {},
|
|
203
|
+
remote = remoteClient(),
|
|
204
|
+
) {
|
|
205
|
+
InitializeResultSchema.parse(
|
|
206
|
+
await remote.rpc("initialize", {
|
|
207
|
+
protocolVersion: "2025-11-25",
|
|
208
|
+
capabilities: {},
|
|
209
|
+
clientInfo: { name: "favstash-cli-editing-doctor", version: PACKAGE.version },
|
|
210
|
+
}),
|
|
211
|
+
);
|
|
212
|
+
await remote.notify("notifications/initialized");
|
|
213
|
+
const { tools } = ListToolsResultSchema.parse(await remote.rpc("tools/list"));
|
|
214
|
+
if (!tools.some((tool) => tool.name === REPORT_TOOL))
|
|
215
|
+
return {
|
|
216
|
+
enabled: false,
|
|
217
|
+
message:
|
|
218
|
+
"AI Edit is in private beta and not available on this account yet. Nothing was checked or sent.",
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const root = path.resolve(workspace || process.cwd());
|
|
222
|
+
const packDir = findPack({ pack, workspace: root });
|
|
223
|
+
const doctor = packDir
|
|
224
|
+
? runPackDoctor(packDir, root)
|
|
225
|
+
: { checks: basicChecks(), studioInitialized: false };
|
|
226
|
+
const report = editingReport({
|
|
227
|
+
doctor,
|
|
228
|
+
packDir,
|
|
229
|
+
id: machineId(),
|
|
230
|
+
label,
|
|
231
|
+
agent,
|
|
232
|
+
});
|
|
233
|
+
if (dryRun) return { enabled: true, dryRun: true, report };
|
|
234
|
+
|
|
235
|
+
const synced = toolResult(
|
|
236
|
+
await remote.rpc("tools/call", { name: REPORT_TOOL, arguments: report }),
|
|
237
|
+
);
|
|
238
|
+
if (synced.enabled === false)
|
|
239
|
+
return { enabled: false, message: synced.notes ?? "AI Edit is not available on this account." };
|
|
240
|
+
return {
|
|
241
|
+
enabled: true,
|
|
242
|
+
synced: true,
|
|
243
|
+
status: synced.status,
|
|
244
|
+
machine: synced.machine
|
|
245
|
+
? { label: synced.machine.label, os: synced.machine.os }
|
|
246
|
+
: null,
|
|
247
|
+
machines: synced.machines,
|
|
248
|
+
missing: synced.missing ?? [],
|
|
249
|
+
optionalMissing: synced.optionalMissing ?? [],
|
|
250
|
+
...(packDir
|
|
251
|
+
? {}
|
|
252
|
+
: {
|
|
253
|
+
next: "The FavStash editing skills are not installed here. Ask your agent to follow https://github.com/alisadiq-ai/favstash-ai-video-editing-skills/blob/main/INSTALL_FOR_AGENTS.md, or pass --pack <checkout>.",
|
|
254
|
+
}),
|
|
255
|
+
prompts: synced.prompts ?? [],
|
|
256
|
+
};
|
|
257
|
+
}
|
package/bin/favstash.js
CHANGED
|
@@ -7,6 +7,7 @@ import { login, logout, authStatus } from "./auth.js";
|
|
|
7
7
|
import { setupAgent } from "./setup.js";
|
|
8
8
|
import { contracts, localTools } from "./contracts.js";
|
|
9
9
|
import { remoteClient } from "./remote.js";
|
|
10
|
+
import { editingDoctor } from "./editing.js";
|
|
10
11
|
import {
|
|
11
12
|
CallToolResultSchema,
|
|
12
13
|
InitializeResultSchema,
|
|
@@ -127,6 +128,12 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
127
128
|
"local-only": { type: "boolean" },
|
|
128
129
|
agent: { type: "string" },
|
|
129
130
|
"dry-run": { type: "boolean" },
|
|
131
|
+
// AI Edit (private beta, not in HELP): favstash doctor --editing
|
|
132
|
+
// [--workspace <dir>] [--pack <checkout>] [--label <name>] [--agent <id>]
|
|
133
|
+
editing: { type: "boolean" },
|
|
134
|
+
workspace: { type: "string" },
|
|
135
|
+
pack: { type: "string" },
|
|
136
|
+
label: { type: "string" },
|
|
130
137
|
},
|
|
131
138
|
});
|
|
132
139
|
if (values.help || (!positionals.length && !values.version)) {
|
|
@@ -154,7 +161,17 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
154
161
|
result = await logout({ localOnly: values["local-only"] });
|
|
155
162
|
else if (command === "setup")
|
|
156
163
|
result = await setupAgent(values.agent, { dryRun: values["dry-run"] });
|
|
157
|
-
else if (command === "doctor") {
|
|
164
|
+
else if (command === "doctor" && values.editing) {
|
|
165
|
+
result = await editingDoctor({
|
|
166
|
+
workspace: values.workspace,
|
|
167
|
+
pack: values.pack,
|
|
168
|
+
label: values.label,
|
|
169
|
+
agent: values.agent,
|
|
170
|
+
dryRun: values["dry-run"],
|
|
171
|
+
});
|
|
172
|
+
if (result.enabled && result.synced && result.status !== "healthy")
|
|
173
|
+
process.exitCode = 2;
|
|
174
|
+
} else if (command === "doctor") {
|
|
158
175
|
result = await doctor();
|
|
159
176
|
if (!result.ready) process.exitCode = 2;
|
|
160
177
|
} else if (command === "tools")
|