@sketric/favstash-mcp 0.3.0 → 0.4.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 +8 -0
- package/LICENSE +21 -0
- package/README.md +85 -91
- package/bin/auth.js +322 -0
- package/bin/bridge.js +118 -0
- package/bin/config.js +39 -0
- package/bin/contracts.js +142 -0
- package/bin/contracts.json +10249 -0
- package/bin/credential-store.js +198 -0
- package/bin/favstash-mcp.js +3 -562
- package/bin/favstash.js +175 -0
- package/bin/local-media-upload.js +19 -11
- package/bin/remote.js +94 -0
- package/bin/setup.js +145 -0
- package/bin/social-post-schema.js +33 -308
- package/package.json +25 -4
- package/skills/favstash/SKILL.md +17 -0
- package/bin/schema-registration.js +0 -28
|
@@ -1,308 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return z
|
|
17
|
-
.array(nonEmptyString)
|
|
18
|
-
.max(maxItems)
|
|
19
|
-
.refine((values) => new Set(values).size === values.length, {
|
|
20
|
-
message: "Values must be unique.",
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function mediaItemSchema() {
|
|
25
|
-
return z
|
|
26
|
-
.object({
|
|
27
|
-
url: httpsUrl.optional(),
|
|
28
|
-
localPath: localPath.optional(),
|
|
29
|
-
kind: z.enum(["image", "video", "document"]).optional(),
|
|
30
|
-
title: z.string().min(1).max(200).optional(),
|
|
31
|
-
thumbnailUrl: httpsUrl.optional(),
|
|
32
|
-
thumbnailPath: localPath.optional(),
|
|
33
|
-
thumbnailTimestampMs: z.number().int().min(0).optional(),
|
|
34
|
-
altText: z.string().max(2_200).optional(),
|
|
35
|
-
durationSeconds: z.number().positive().optional(),
|
|
36
|
-
width: z.number().int().positive().optional(),
|
|
37
|
-
height: z.number().int().positive().optional(),
|
|
38
|
-
})
|
|
39
|
-
.strict()
|
|
40
|
-
.superRefine((value, context) => {
|
|
41
|
-
if (Boolean(value.url) === Boolean(value.localPath)) {
|
|
42
|
-
context.addIssue({
|
|
43
|
-
code: z.ZodIssueCode.custom,
|
|
44
|
-
message: "Provide exactly one of media[].url or media[].localPath.",
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
if (value.thumbnailUrl && value.thumbnailPath) {
|
|
48
|
-
context.addIssue({
|
|
49
|
-
code: z.ZodIssueCode.custom,
|
|
50
|
-
message:
|
|
51
|
-
"Provide at most one of media[].thumbnailUrl or media[].thumbnailPath.",
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const instagramSettings = z
|
|
58
|
-
.object({
|
|
59
|
-
contentType: z
|
|
60
|
-
.enum(["auto", "feed_image", "reel", "story", "carousel"])
|
|
61
|
-
.optional(),
|
|
62
|
-
shareToFeed: z.boolean().optional(),
|
|
63
|
-
isAiGenerated: z.boolean().optional(),
|
|
64
|
-
collaborators: uniqueStrings(3).optional(),
|
|
65
|
-
userTags: z
|
|
66
|
-
.array(
|
|
67
|
-
z
|
|
68
|
-
.object({
|
|
69
|
-
username: nonEmptyString,
|
|
70
|
-
x: normalizedPosition.optional(),
|
|
71
|
-
y: normalizedPosition.optional(),
|
|
72
|
-
mediaIndex: mediaIndex.optional(),
|
|
73
|
-
})
|
|
74
|
-
.strict(),
|
|
75
|
-
)
|
|
76
|
-
.max(20)
|
|
77
|
-
.optional(),
|
|
78
|
-
locationId: nonEmptyString.optional(),
|
|
79
|
-
productTags: z
|
|
80
|
-
.array(
|
|
81
|
-
z
|
|
82
|
-
.object({
|
|
83
|
-
productId: nonEmptyString,
|
|
84
|
-
x: normalizedPosition.optional(),
|
|
85
|
-
y: normalizedPosition.optional(),
|
|
86
|
-
mediaIndex: mediaIndex.optional(),
|
|
87
|
-
})
|
|
88
|
-
.strict(),
|
|
89
|
-
)
|
|
90
|
-
.max(20)
|
|
91
|
-
.optional(),
|
|
92
|
-
brandedContentSponsorIds: uniqueStrings(2).optional(),
|
|
93
|
-
trialReel: z
|
|
94
|
-
.object({
|
|
95
|
-
enabled: z.boolean(),
|
|
96
|
-
graduationStrategy: z.enum(["MANUAL", "SS_PERFORMANCE"]).optional(),
|
|
97
|
-
})
|
|
98
|
-
.strict()
|
|
99
|
-
.optional(),
|
|
100
|
-
audio: z
|
|
101
|
-
.object({
|
|
102
|
-
id: nonEmptyString,
|
|
103
|
-
audioVolume: z.number().min(0).optional(),
|
|
104
|
-
videoVolume: z.number().min(0).optional(),
|
|
105
|
-
})
|
|
106
|
-
.strict()
|
|
107
|
-
.optional(),
|
|
108
|
-
})
|
|
109
|
-
.strict();
|
|
110
|
-
|
|
111
|
-
const youtubeSettingsFields = {
|
|
112
|
-
title: z
|
|
113
|
-
.string()
|
|
114
|
-
.min(2)
|
|
115
|
-
.max(100)
|
|
116
|
-
.regex(/^[^<>]*$/),
|
|
117
|
-
visibility: z.enum(["public", "private", "unlisted"]),
|
|
118
|
-
madeForKids: z.boolean(),
|
|
119
|
-
uploadCertified: z.boolean(),
|
|
120
|
-
tags: z.array(nonEmptyString).max(100),
|
|
121
|
-
thumbnailUrl: httpsUrl,
|
|
122
|
-
categoryId: z.string().regex(/^[0-9]+$/),
|
|
123
|
-
containsSyntheticMedia: z.boolean(),
|
|
124
|
-
notifySubscribers: z.boolean(),
|
|
125
|
-
};
|
|
126
|
-
const youtubeDraftSettings = z
|
|
127
|
-
.object(
|
|
128
|
-
Object.fromEntries(
|
|
129
|
-
Object.entries(youtubeSettingsFields).map(([key, schema]) => [
|
|
130
|
-
key,
|
|
131
|
-
schema.optional(),
|
|
132
|
-
]),
|
|
133
|
-
),
|
|
134
|
-
)
|
|
135
|
-
.strict();
|
|
136
|
-
const youtubePublishSettings = youtubeDraftSettings.extend({
|
|
137
|
-
title: youtubeSettingsFields.title,
|
|
138
|
-
madeForKids: youtubeSettingsFields.madeForKids,
|
|
139
|
-
uploadCertified: z.literal(true),
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
const tiktokSettingsFields = {
|
|
143
|
-
postingMethod: z.enum(["UPLOAD", "DIRECT_POST"]),
|
|
144
|
-
privacy: z.enum([
|
|
145
|
-
"PUBLIC_TO_EVERYONE",
|
|
146
|
-
"MUTUAL_FOLLOW_FRIENDS",
|
|
147
|
-
"FOLLOWER_OF_CREATOR",
|
|
148
|
-
"SELF_ONLY",
|
|
149
|
-
]),
|
|
150
|
-
allowComments: z.boolean(),
|
|
151
|
-
allowDuets: z.boolean(),
|
|
152
|
-
allowStitches: z.boolean(),
|
|
153
|
-
aiGenerated: z.boolean(),
|
|
154
|
-
acceptTerms: z.boolean(),
|
|
155
|
-
commercialContent: z.boolean(),
|
|
156
|
-
promotesOwnBrand: z.boolean(),
|
|
157
|
-
brandedContent: z.boolean(),
|
|
158
|
-
autoAddMusic: z.boolean(),
|
|
159
|
-
title: z.string().max(90),
|
|
160
|
-
};
|
|
161
|
-
const tiktokDraftSettings = z
|
|
162
|
-
.object(
|
|
163
|
-
Object.fromEntries(
|
|
164
|
-
Object.entries(tiktokSettingsFields).map(([key, schema]) => [
|
|
165
|
-
key,
|
|
166
|
-
schema.optional(),
|
|
167
|
-
]),
|
|
168
|
-
),
|
|
169
|
-
)
|
|
170
|
-
.strict();
|
|
171
|
-
const tiktokPublishSettings = tiktokDraftSettings
|
|
172
|
-
.extend({ postingMethod: tiktokSettingsFields.postingMethod })
|
|
173
|
-
.superRefine((value, context) => {
|
|
174
|
-
if (value.postingMethod === "DIRECT_POST") {
|
|
175
|
-
if (!value.privacy) {
|
|
176
|
-
context.addIssue({
|
|
177
|
-
code: z.ZodIssueCode.custom,
|
|
178
|
-
path: ["privacy"],
|
|
179
|
-
message: "TikTok Direct Post requires privacy.",
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
if (value.acceptTerms !== true) {
|
|
183
|
-
context.addIssue({
|
|
184
|
-
code: z.ZodIssueCode.custom,
|
|
185
|
-
path: ["acceptTerms"],
|
|
186
|
-
message: "TikTok Direct Post requires acceptTerms=true.",
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
if (
|
|
191
|
-
value.commercialContent === true &&
|
|
192
|
-
value.promotesOwnBrand !== true &&
|
|
193
|
-
value.brandedContent !== true
|
|
194
|
-
) {
|
|
195
|
-
context.addIssue({
|
|
196
|
-
code: z.ZodIssueCode.custom,
|
|
197
|
-
path: ["commercialContent"],
|
|
198
|
-
message:
|
|
199
|
-
"Commercial TikTok content must promote the creator's brand or identify branded content.",
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
if (value.privacy === "SELF_ONLY" && value.brandedContent === true) {
|
|
203
|
-
context.addIssue({
|
|
204
|
-
code: z.ZodIssueCode.custom,
|
|
205
|
-
path: ["brandedContent"],
|
|
206
|
-
message: "TikTok branded content cannot use SELF_ONLY privacy.",
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
const linkedinSettings = z.object({}).strict();
|
|
212
|
-
|
|
213
|
-
function targetSchema(platform, settings, { requiredSettings = false } = {}) {
|
|
214
|
-
return z
|
|
215
|
-
.object({
|
|
216
|
-
connectionId: nonEmptyString,
|
|
217
|
-
platform: z.literal(platform),
|
|
218
|
-
settings: requiredSettings ? settings : settings.optional(),
|
|
219
|
-
content: z.string().max(5_000).optional(),
|
|
220
|
-
media: z
|
|
221
|
-
.array(mediaItemSchema())
|
|
222
|
-
.max(platform === "linkedin" ? 20 : 10)
|
|
223
|
-
.optional(),
|
|
224
|
-
})
|
|
225
|
-
.strict();
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export const draftPostTarget = z.discriminatedUnion("platform", [
|
|
229
|
-
targetSchema("instagram", instagramSettings),
|
|
230
|
-
targetSchema("youtube", youtubeDraftSettings),
|
|
231
|
-
targetSchema("tiktok", tiktokDraftSettings),
|
|
232
|
-
targetSchema("linkedin", linkedinSettings),
|
|
233
|
-
]);
|
|
234
|
-
|
|
235
|
-
const publishPostTarget = z.discriminatedUnion("platform", [
|
|
236
|
-
targetSchema("instagram", instagramSettings),
|
|
237
|
-
targetSchema("youtube", youtubePublishSettings, { requiredSettings: true }),
|
|
238
|
-
targetSchema("tiktok", tiktokPublishSettings, { requiredSettings: true }),
|
|
239
|
-
targetSchema("linkedin", linkedinSettings),
|
|
240
|
-
]);
|
|
241
|
-
|
|
242
|
-
const clearableSettings = {
|
|
243
|
-
instagram: [
|
|
244
|
-
"collaborators",
|
|
245
|
-
"userTags",
|
|
246
|
-
"locationId",
|
|
247
|
-
"productTags",
|
|
248
|
-
"brandedContentSponsorIds",
|
|
249
|
-
"trialReel",
|
|
250
|
-
"audio",
|
|
251
|
-
],
|
|
252
|
-
youtube: ["tags", "thumbnailUrl"],
|
|
253
|
-
tiktok: [
|
|
254
|
-
"privacy",
|
|
255
|
-
"title",
|
|
256
|
-
"autoAddMusic",
|
|
257
|
-
"acceptTerms",
|
|
258
|
-
"promotesOwnBrand",
|
|
259
|
-
"brandedContent",
|
|
260
|
-
],
|
|
261
|
-
linkedin: [],
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
function updateTargetSchema(platform, settings) {
|
|
265
|
-
const allowedClearSettings = clearableSettings[platform];
|
|
266
|
-
return z
|
|
267
|
-
.object({
|
|
268
|
-
connectionId: nonEmptyString,
|
|
269
|
-
platform: z.literal(platform),
|
|
270
|
-
settings: settings.optional(),
|
|
271
|
-
content: z.string().max(5_000).optional(),
|
|
272
|
-
media: z
|
|
273
|
-
.array(mediaItemSchema())
|
|
274
|
-
.max(platform === "linkedin" ? 20 : 10)
|
|
275
|
-
.optional(),
|
|
276
|
-
...(allowedClearSettings.length
|
|
277
|
-
? {
|
|
278
|
-
clearSettings: z
|
|
279
|
-
.array(z.enum(allowedClearSettings))
|
|
280
|
-
.max(allowedClearSettings.length)
|
|
281
|
-
.refine((values) => new Set(values).size === values.length, {
|
|
282
|
-
message: "clearSettings values must be unique.",
|
|
283
|
-
})
|
|
284
|
-
.optional(),
|
|
285
|
-
}
|
|
286
|
-
: {}),
|
|
287
|
-
})
|
|
288
|
-
.strict();
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export const updateTarget = z.discriminatedUnion("platform", [
|
|
292
|
-
updateTargetSchema("instagram", instagramSettings),
|
|
293
|
-
updateTargetSchema("youtube", youtubeDraftSettings),
|
|
294
|
-
updateTargetSchema("tiktok", tiktokDraftSettings),
|
|
295
|
-
updateTargetSchema("linkedin", linkedinSettings),
|
|
296
|
-
]);
|
|
297
|
-
|
|
298
|
-
export const postClientRequestId = z
|
|
299
|
-
.string()
|
|
300
|
-
.min(16)
|
|
301
|
-
.max(128)
|
|
302
|
-
.regex(/^[A-Za-z0-9][A-Za-z0-9._:-]*$/)
|
|
303
|
-
.describe(
|
|
304
|
-
"Stable request key for this post creation. Start with a letter or number and reuse the exact same value only when retrying the same complete request.",
|
|
305
|
-
);
|
|
1
|
+
import { contracts, withLocalMedia, schemaAdapter } from "./contracts.js";
|
|
2
|
+
const social = contracts.social;
|
|
3
|
+
export const draftPostTarget = schemaAdapter(
|
|
4
|
+
withLocalMedia(social.SOCIAL_POST_DRAFT_TARGET_SCHEMA),
|
|
5
|
+
);
|
|
6
|
+
const publishPostTarget = schemaAdapter(
|
|
7
|
+
withLocalMedia(social.SOCIAL_POST_TARGET_SCHEMA),
|
|
8
|
+
);
|
|
9
|
+
export const updateTarget = schemaAdapter(
|
|
10
|
+
withLocalMedia(social.SOCIAL_POST_UPDATE_TARGET_SCHEMA),
|
|
11
|
+
);
|
|
12
|
+
export const postClientRequestId = schemaAdapter(
|
|
13
|
+
contracts.validation.find(({ name }) => name === "create_social_post")
|
|
14
|
+
.inputSchema.properties.clientRequestId,
|
|
15
|
+
);
|
|
306
16
|
|
|
307
17
|
export function hasMeaningfulPostContent(value) {
|
|
308
18
|
if (typeof value.content === "string" && value.content.trim()) return true;
|
|
@@ -333,7 +43,7 @@ function inferredMediaKind(item) {
|
|
|
333
43
|
if (normalized.endsWith(".mp4") || normalized.endsWith(".mov")) {
|
|
334
44
|
return "video";
|
|
335
45
|
}
|
|
336
|
-
if (/\.(?:jpe?g|png|webp)$/.test(normalized)) return "image";
|
|
46
|
+
if (/\.(?:jpe?g|png|webp|gif)$/.test(normalized)) return "image";
|
|
337
47
|
return undefined;
|
|
338
48
|
}
|
|
339
49
|
|
|
@@ -353,6 +63,7 @@ function mediaExtension(item) {
|
|
|
353
63
|
}
|
|
354
64
|
|
|
355
65
|
function captionLengthForPlatform(platform, content) {
|
|
66
|
+
if (platform === "x") return [...content].length;
|
|
356
67
|
if (platform !== "linkedin") return content.length;
|
|
357
68
|
const mentionPattern = /@\[.+?]\(urn:li:organization.+?\)/g;
|
|
358
69
|
const mentions = content.match(mentionPattern) ?? [];
|
|
@@ -369,6 +80,19 @@ function captionLengthForPlatform(platform, content) {
|
|
|
369
80
|
|
|
370
81
|
function liveMediaError(platform, media, settings = {}) {
|
|
371
82
|
const kinds = media.map(inferredMediaKind);
|
|
83
|
+
if (platform !== "x" && media.some((item) => mediaExtension(item) === "gif"))
|
|
84
|
+
return "GIF publishing is supported only on X.";
|
|
85
|
+
if (platform === "x") {
|
|
86
|
+
if (kinds.includes("document")) return "X does not support documents.";
|
|
87
|
+
const special = media.filter(
|
|
88
|
+
(item) =>
|
|
89
|
+
inferredMediaKind(item) === "video" || mediaExtension(item) === "gif",
|
|
90
|
+
);
|
|
91
|
+
if (special.length && media.length !== 1)
|
|
92
|
+
return "X accepts one GIF or one video, without other media.";
|
|
93
|
+
if (media.some((item) => mediaExtension(item) === "mov"))
|
|
94
|
+
return "X videos must be MP4.";
|
|
95
|
+
}
|
|
372
96
|
if (platform === "instagram") {
|
|
373
97
|
if (!media.length) return "Instagram requires at least one media item.";
|
|
374
98
|
if (kinds.includes("document")) {
|
|
@@ -475,12 +199,13 @@ export function validatePublishTargetsBeforeUpload(value, context) {
|
|
|
475
199
|
youtube: 5_000,
|
|
476
200
|
tiktok: 2_200,
|
|
477
201
|
linkedin: 3_000,
|
|
202
|
+
x: 280,
|
|
478
203
|
}[target.platform];
|
|
479
204
|
if (
|
|
480
205
|
captionLengthForPlatform(target.platform, effectiveContent) > captionLimit
|
|
481
206
|
) {
|
|
482
207
|
context.addIssue({
|
|
483
|
-
code:
|
|
208
|
+
code: "custom",
|
|
484
209
|
path:
|
|
485
210
|
target.content === undefined
|
|
486
211
|
? ["content"]
|
|
@@ -492,7 +217,7 @@ export function validatePublishTargetsBeforeUpload(value, context) {
|
|
|
492
217
|
const mediaError = liveMediaError(target.platform, media, target.settings);
|
|
493
218
|
if (mediaError) {
|
|
494
219
|
context.addIssue({
|
|
495
|
-
code:
|
|
220
|
+
code: "custom",
|
|
496
221
|
path: ["targets", index, "media"],
|
|
497
222
|
message: mediaError,
|
|
498
223
|
});
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sketric/favstash-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "FavStash MCP
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "FavStash CLI: browser OAuth, agent setup, and a local MCP bridge with file uploads.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
+
"favstash": "./bin/favstash.js",
|
|
7
8
|
"favstash-mcp": "./bin/favstash-mcp.js"
|
|
8
9
|
},
|
|
9
10
|
"files": [
|
|
10
11
|
"bin",
|
|
11
|
-
"
|
|
12
|
+
"skills",
|
|
13
|
+
"README.md",
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"LICENSE"
|
|
12
16
|
],
|
|
13
17
|
"scripts": {
|
|
14
18
|
"test": "node --test test/*.test.js",
|
|
@@ -16,6 +20,10 @@
|
|
|
16
20
|
},
|
|
17
21
|
"dependencies": {
|
|
18
22
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
23
|
+
"ajv": "8.17.1",
|
|
24
|
+
"ajv-formats": "3.0.1",
|
|
25
|
+
"cross-spawn": "7.0.6",
|
|
26
|
+
"proper-lockfile": "4.1.2",
|
|
19
27
|
"zod": "3.25.76"
|
|
20
28
|
},
|
|
21
29
|
"devDependencies": {
|
|
@@ -25,5 +33,18 @@
|
|
|
25
33
|
"engines": {
|
|
26
34
|
"node": ">=20"
|
|
27
35
|
},
|
|
28
|
-
"private": false
|
|
36
|
+
"private": false,
|
|
37
|
+
"optionalDependencies": {
|
|
38
|
+
"@napi-rs/keyring": "2.1.0"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://www.favstash.app/cli",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/alisadiq-ai/FavStash.git",
|
|
44
|
+
"directory": "packages/favstash-mcp"
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
}
|
|
29
50
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: favstash
|
|
3
|
+
description: Search saved inspiration, inspect social analytics, and draft or schedule content through an already connected FavStash MCP server.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# FavStash workflows
|
|
7
|
+
|
|
8
|
+
If FavStash tools are unavailable, read https://www.favstash.app/INSTALL_FOR_AGENTS.md and complete the host-specific setup. Never ask for bearer tokens in chat. This skill does not grant permission to install, connect, or publish.
|
|
9
|
+
|
|
10
|
+
1. Discover the live tools and schemas before using them. Use the CLI bridge for local media; use HTTPS sources with remote MCP.
|
|
11
|
+
2. For inspiration, list collections before choosing a collection ID, then search the stash. Fetch full content only for relevant results. For inventory counts use the summary tool.
|
|
12
|
+
3. For analytics and publishing, list connected social accounts first. Use IDs and platform names from that response. Discover publishing options rather than assuming provider capabilities.
|
|
13
|
+
4. Draft by default when publishing authorization is unclear. Publishing or scheduling needs the user’s instruction. Inspect media, target settings, and planned/publish timestamps before a write. Use a unique clientRequestId for each intended create operation and preserve it when checking/retrying that same operation.
|
|
14
|
+
5. For local files, inspect the local schema (favstash tools). Pass localPath only through the local bridge. Do not call internal upload routes or copy private provider credentials.
|
|
15
|
+
6. Report returned status honestly. A queued job is not a published post; an empty successful read is not an authentication failure. After an ambiguous write failure, inspect the calendar/status before retrying.
|
|
16
|
+
|
|
17
|
+
Reference: https://www.favstash.app/docs/tools-reference
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Return the raw object shape the MCP SDK expects for tool registration.
|
|
3
|
-
*
|
|
4
|
-
* Zod 3 wraps object schemas in ZodEffects after `refine`/`superRefine`.
|
|
5
|
-
* Those wrappers intentionally have no public `.shape`, while the SDK needs
|
|
6
|
-
* the underlying object shape to publish an accurate JSON Schema descriptor.
|
|
7
|
-
* Execution still parses with the original refined schema.
|
|
8
|
-
*/
|
|
9
|
-
export function registrationShape(schema) {
|
|
10
|
-
let current = schema;
|
|
11
|
-
const visited = new Set();
|
|
12
|
-
|
|
13
|
-
while (current && typeof current === "object" && !visited.has(current)) {
|
|
14
|
-
visited.add(current);
|
|
15
|
-
if (
|
|
16
|
-
current.shape &&
|
|
17
|
-
typeof current.shape === "object" &&
|
|
18
|
-
!Array.isArray(current.shape)
|
|
19
|
-
) {
|
|
20
|
-
return current.shape;
|
|
21
|
-
}
|
|
22
|
-
current = current._def?.schema ?? current._def?.innerType;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
throw new TypeError(
|
|
26
|
-
"FavStash MCP tool input must resolve to a Zod object schema.",
|
|
27
|
-
);
|
|
28
|
-
}
|