thumbnail-generator-mcp 1.0.13 → 1.0.15
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/index.gemini.d.ts +3 -0
- package/dist/index.gemini.d.ts.map +1 -0
- package/dist/index.gemini.js +401 -0
- package/dist/index.gemini.js.map +1 -0
- package/dist/index.js +200 -124
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.gemini.d.ts","sourceRoot":"","sources":["../src/index.gemini.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { GoogleGenerativeAI } from "@google/generative-ai";
|
|
6
|
+
import nodeMachineId from "node-machine-id";
|
|
7
|
+
const { machineIdSync } = nodeMachineId;
|
|
8
|
+
import * as fs from "fs";
|
|
9
|
+
import * as path from "path";
|
|
10
|
+
import * as os from "os";
|
|
11
|
+
// ─── Config ─────────────────────────────────────────────────────────────────
|
|
12
|
+
const LICENSE_KEY = (process.env.LICENSE_KEY ?? "").trim().toUpperCase();
|
|
13
|
+
const GEMINI_API_KEY = process.env.GEMINI_API_KEY ?? "";
|
|
14
|
+
const VALIDATE_URL = process.env.VALIDATE_URL ??
|
|
15
|
+
"https://thumbnail.automationhackers.net/api/licenses/validate";
|
|
16
|
+
const IMAGE_MODEL = "gemini-3-pro-image-preview";
|
|
17
|
+
let cachedProducts = null;
|
|
18
|
+
async function validateLicense() {
|
|
19
|
+
if (cachedProducts)
|
|
20
|
+
return cachedProducts;
|
|
21
|
+
let machineId;
|
|
22
|
+
try {
|
|
23
|
+
machineId = machineIdSync(true); // hashed, privacy-safe
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
machineId = `fallback-${os.hostname()}-${os.userInfo().username}`;
|
|
27
|
+
}
|
|
28
|
+
let res;
|
|
29
|
+
try {
|
|
30
|
+
res = await fetch(VALIDATE_URL, {
|
|
31
|
+
method: "POST",
|
|
32
|
+
headers: { "Content-Type": "application/json" },
|
|
33
|
+
body: JSON.stringify({ license_key: LICENSE_KEY, machine_id: machineId }),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
throw new Error(`Could not reach license server. Check your internet connection. (${err instanceof Error ? err.message : err})`);
|
|
38
|
+
}
|
|
39
|
+
const data = (await res.json());
|
|
40
|
+
if (!data.valid) {
|
|
41
|
+
const msg = data.message ??
|
|
42
|
+
(data.reason === "machine_limit"
|
|
43
|
+
? "License already activated on 2 devices. Contact support to transfer."
|
|
44
|
+
: data.reason === "revoked"
|
|
45
|
+
? "License revoked. Contact support."
|
|
46
|
+
: "Invalid license key. Check your LICENSE_KEY and try again.");
|
|
47
|
+
throw new Error(msg);
|
|
48
|
+
}
|
|
49
|
+
cachedProducts = data.products ?? ["front_end"];
|
|
50
|
+
return cachedProducts;
|
|
51
|
+
}
|
|
52
|
+
// ─── Prompt builders ─────────────────────────────────────────────────────────
|
|
53
|
+
function buildPhotoEditPrompt(opts) {
|
|
54
|
+
const { background, textOverlay, textPosition, textColor, outfitChange, expression, lightingStyle, mood, videoTopic, styleReferenceIntent } = opts;
|
|
55
|
+
const lightingDirective = lightingStyle === "bright"
|
|
56
|
+
? "Bright, even studio lighting — soft shadows, no harsh contrast, clean and professional"
|
|
57
|
+
: lightingStyle === "moody"
|
|
58
|
+
? "Low-key moody lighting — one side lit, deep shadows on the other, atmospheric and dramatic"
|
|
59
|
+
: lightingStyle === "natural"
|
|
60
|
+
? "Natural daylight — soft diffused light, no artificial feel, warm and organic"
|
|
61
|
+
: "Cinematic dramatic lighting — strong rim light from top-behind, high contrast punchy shadows, light source top-front. This is the default for high-performing thumbnails.";
|
|
62
|
+
return `TASK: Transform this selfie into a professional YouTube thumbnail.
|
|
63
|
+
${videoTopic ? `\nVideo context: This thumbnail is for a video about "${videoTopic}". Use this to inform the mood, background details, and overall composition.\n` : ""}
|
|
64
|
+
${styleReferenceIntent ? `STYLE REFERENCE: A reference thumbnail is attached as an additional image. Your instructions for what to take from it:\n"${styleReferenceIntent}"\nFollow these instructions precisely — copy only what is specified above from the reference, and compose everything else fresh based on the details below. Do NOT copy the reference thumbnail's person, face, or text content.\n` : ""}
|
|
65
|
+
=== PRESERVE EXACTLY — DO NOT CHANGE THESE ===
|
|
66
|
+
- Face: exact facial structure, bone structure, skin tone, eye color, eyebrows, nose shape, mouth shape, jawline — this is NON-NEGOTIABLE
|
|
67
|
+
- Hair: exact color, length, texture, and style
|
|
68
|
+
- Any accessories already visible (glasses, earrings, jewelry, etc.)
|
|
69
|
+
- Approximate body position and pose from the original photo
|
|
70
|
+
|
|
71
|
+
=== EXPRESSION ===
|
|
72
|
+
${expression
|
|
73
|
+
? `Required expression: ${expression}. Intensify this significantly — push it further than in the original. Exaggerate it. Big expressions win clicks on YouTube.`
|
|
74
|
+
: "Intensify the existing expression dramatically — push it much further than in the original photo. Exaggerate it. Big, bold, unambiguous expressions win clicks. Do NOT neutralize or soften the expression."}
|
|
75
|
+
|
|
76
|
+
=== CHANGE ===
|
|
77
|
+
Background: ${background}
|
|
78
|
+
Lighting: ${lightingDirective}
|
|
79
|
+
Skin: smooth, professional retouching — keep natural skin tone, remove blemishes, no heavy filters or airbrushing
|
|
80
|
+
${outfitChange ? `Outfit: ${outfitChange}` : "Outfit: keep the original outfit as-is — ensure it looks sharp and intentional"}
|
|
81
|
+
${mood ? `Overall mood/vibe: ${mood}` : ""}
|
|
82
|
+
|
|
83
|
+
=== ADD ===
|
|
84
|
+
Text overlay: "${textOverlay}" — massive bold block letters (Impact or Bebas Neue), ${textColor} fill, thick black outline 4–5px, hard drop shadow offset bottom-right. Place text ${textPosition} of image. Text must be readable at 320×180px (small thumbnail size).
|
|
85
|
+
Composition: person fills 60–70% of frame, positioned to leave clear negative space for the text. Face is the undisputed focal point of the entire image.
|
|
86
|
+
|
|
87
|
+
=== OUTPUT REQUIREMENTS ===
|
|
88
|
+
- Dimensions: exactly 1280×720 pixels (16:9 widescreen)
|
|
89
|
+
- Style: hyper-realistic photograph — NOT illustrated, NOT painted, NOT AI-art stylized
|
|
90
|
+
- Quality: ultra-sharp, vibrant saturated colors, professional broadcast quality
|
|
91
|
+
- Do NOT add watermarks, logos, borders, or decorative frames`;
|
|
92
|
+
}
|
|
93
|
+
function buildTextOnlyPrompt(opts) {
|
|
94
|
+
const { subject, background, textOverlay, textPosition, textColor, lightingStyle, mood, videoTopic } = opts;
|
|
95
|
+
const lightingDirective = lightingStyle === "bright"
|
|
96
|
+
? "Bright even studio lighting — soft shadows, clean professional look"
|
|
97
|
+
: lightingStyle === "moody"
|
|
98
|
+
? "Low-key moody lighting — deep shadows, single-sided light source, atmospheric"
|
|
99
|
+
: lightingStyle === "natural"
|
|
100
|
+
? "Natural daylight, soft and diffused, warm and organic"
|
|
101
|
+
: "Cinematic dramatic lighting — strong rim light, high contrast, punchy shadows, light source from top-front";
|
|
102
|
+
return `Create a professional YouTube thumbnail (1280×720, 16:9).
|
|
103
|
+
${videoTopic ? `\nVideo topic: "${videoTopic}"\n` : ""}
|
|
104
|
+
Subject: ${subject}
|
|
105
|
+
Background: ${background}
|
|
106
|
+
Lighting: ${lightingDirective}
|
|
107
|
+
${mood ? `Mood/vibe: ${mood}` : ""}
|
|
108
|
+
|
|
109
|
+
Text overlay: "${textOverlay}" — massive bold block letters (Impact or Bebas Neue), ${textColor} fill, thick black outline 4–5px, hard drop shadow. Place text ${textPosition} of image. Must be readable at small thumbnail size.
|
|
110
|
+
|
|
111
|
+
Requirements:
|
|
112
|
+
- Hyper-realistic photograph style — NOT illustrated or painted
|
|
113
|
+
- Ultra-sharp, vibrant, professional YouTube thumbnail quality
|
|
114
|
+
- Subject must be the clear focal point
|
|
115
|
+
- Text must be large and immediately readable at 320×180px
|
|
116
|
+
- Do NOT add watermarks, borders, or decorative frames`;
|
|
117
|
+
}
|
|
118
|
+
// ─── Gemini image call ────────────────────────────────────────────────────────
|
|
119
|
+
async function generateImage(prompt, imageBase64, imageMimeType, refBase64, refMimeType) {
|
|
120
|
+
const genAI = new GoogleGenerativeAI(GEMINI_API_KEY);
|
|
121
|
+
const model = genAI.getGenerativeModel({
|
|
122
|
+
model: IMAGE_MODEL,
|
|
123
|
+
generationConfig: {
|
|
124
|
+
// @ts-expect-error — responseModalities not yet in types
|
|
125
|
+
responseModalities: ["Text", "Image"],
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
const parts = [];
|
|
129
|
+
if (imageBase64 && imageMimeType) {
|
|
130
|
+
parts.push({
|
|
131
|
+
inlineData: { data: imageBase64, mimeType: imageMimeType },
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
if (refBase64 && refMimeType) {
|
|
135
|
+
parts.push({
|
|
136
|
+
inlineData: { data: refBase64, mimeType: refMimeType },
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
parts.push({ text: prompt });
|
|
140
|
+
const result = await model.generateContent(parts);
|
|
141
|
+
const response = result.response;
|
|
142
|
+
for (const part of response.candidates?.[0]?.content?.parts ?? []) {
|
|
143
|
+
if (part.inlineData?.data) {
|
|
144
|
+
return {
|
|
145
|
+
base64: part.inlineData.data,
|
|
146
|
+
mimeType: part.inlineData.mimeType ?? "image/png",
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
throw new Error("Gemini returned no image. Check your API key and billing.");
|
|
151
|
+
}
|
|
152
|
+
// ─── Path resolver ────────────────────────────────────────────────────────────
|
|
153
|
+
// Accepts a full absolute path or just a filename (resolved to ~/Desktop).
|
|
154
|
+
// When the exact filename isn't found, falls back to fuzzy matching against
|
|
155
|
+
// Desktop contents — handles Claude Desktop's habit of normalizing special
|
|
156
|
+
// characters (spaces, parentheses, etc.) to underscores when reporting filenames.
|
|
157
|
+
function resolveImagePath(input) {
|
|
158
|
+
if (path.isAbsolute(input)) {
|
|
159
|
+
// If the absolute path exists (e.g. a real local path), use it directly.
|
|
160
|
+
if (fs.existsSync(input))
|
|
161
|
+
return input;
|
|
162
|
+
// Otherwise it's likely Claude Desktop's internal upload staging path
|
|
163
|
+
// (e.g. /mnt/user-data/uploads/photo.jpg) which the native MCP process
|
|
164
|
+
// cannot access. Fall back to Desktop resolution using just the filename.
|
|
165
|
+
return resolveImagePath(path.basename(input));
|
|
166
|
+
}
|
|
167
|
+
const desktop = path.join(os.homedir(), "Desktop");
|
|
168
|
+
const exact = path.join(desktop, input);
|
|
169
|
+
if (fs.existsSync(exact))
|
|
170
|
+
return exact;
|
|
171
|
+
// Normalize a filename for fuzzy comparison:
|
|
172
|
+
// lowercase, collapse any run of non-alphanumeric chars to a single underscore,
|
|
173
|
+
// strip leading/trailing underscores.
|
|
174
|
+
const normalize = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
175
|
+
const inputExt = path.extname(input).toLowerCase();
|
|
176
|
+
const inputBase = normalize(path.basename(input, path.extname(input)));
|
|
177
|
+
try {
|
|
178
|
+
const files = fs.readdirSync(desktop);
|
|
179
|
+
const matches = files.filter((f) => {
|
|
180
|
+
const fExt = path.extname(f).toLowerCase();
|
|
181
|
+
const extMatch = fExt === inputExt ||
|
|
182
|
+
(fExt === ".jpeg" && inputExt === ".jpg") ||
|
|
183
|
+
(fExt === ".jpg" && inputExt === ".jpeg");
|
|
184
|
+
if (!extMatch)
|
|
185
|
+
return false;
|
|
186
|
+
return normalize(path.basename(f, path.extname(f))) === inputBase;
|
|
187
|
+
});
|
|
188
|
+
if (matches.length === 1)
|
|
189
|
+
return path.join(desktop, matches[0]);
|
|
190
|
+
if (matches.length > 1) {
|
|
191
|
+
// Ambiguous — throw so the caller surfaces a clear error rather than picking silently
|
|
192
|
+
throw new Error(`Multiple files on your Desktop match "${input}": ${matches.join(", ")}. ` +
|
|
193
|
+
`Please rename the one you want to use so it has a unique name, then try again.`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
// Re-throw ambiguity errors; swallow readdirSync failures
|
|
198
|
+
if (err instanceof Error && err.message.includes("Multiple files"))
|
|
199
|
+
throw err;
|
|
200
|
+
}
|
|
201
|
+
return exact; // return original path so the error message is meaningful
|
|
202
|
+
}
|
|
203
|
+
// ─── Save to desktop ──────────────────────────────────────────────────────────
|
|
204
|
+
function saveToDesktop(base64, mimeType) {
|
|
205
|
+
const ext = mimeType.split("/")[1] ?? "png";
|
|
206
|
+
const timestamp = new Date()
|
|
207
|
+
.toISOString()
|
|
208
|
+
.replace(/[:.]/g, "-")
|
|
209
|
+
.slice(0, 19);
|
|
210
|
+
const filename = `thumbnail-${timestamp}.${ext}`;
|
|
211
|
+
const desktop = path.join(os.homedir(), "Desktop");
|
|
212
|
+
const outPath = path.join(desktop, filename);
|
|
213
|
+
fs.writeFileSync(outPath, Buffer.from(base64, "base64"));
|
|
214
|
+
return outPath;
|
|
215
|
+
}
|
|
216
|
+
// ─── MCP Server ───────────────────────────────────────────────────────────────
|
|
217
|
+
const server = new Server({ name: "thumbnail-generator", version: "1.0.0" }, { capabilities: { tools: {} } });
|
|
218
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
219
|
+
tools: [
|
|
220
|
+
{
|
|
221
|
+
name: "generate_thumbnail",
|
|
222
|
+
description: `Generates a YouTube thumbnail via Gemini and saves it to the user's Desktop. Called by the youtube-thumbnail-generator skill after the full intake conversation is complete. Do not call this tool directly — use the skill to collect all parameters first.`,
|
|
223
|
+
inputSchema: {
|
|
224
|
+
type: "object",
|
|
225
|
+
properties: {
|
|
226
|
+
background: {
|
|
227
|
+
type: "string",
|
|
228
|
+
description: "Cinematic, specific background description. Must include scene details, colors, time of day, and mood. Not just 'dark' — e.g. 'Dark luxury office at night, single desk lamp casting a warm pool of light, blurred city skyline visible through rain-streaked windows behind me'",
|
|
229
|
+
},
|
|
230
|
+
text_overlay: {
|
|
231
|
+
type: "string",
|
|
232
|
+
description: "The exact text to display on the thumbnail in massive bold letters. Short and punchy — 2–5 words, ALL CAPS (e.g. 'I LOST EVERYTHING', 'STEAL THIS FROM ME', '$10K IN 30 DAYS')",
|
|
233
|
+
},
|
|
234
|
+
text_position: {
|
|
235
|
+
type: "string",
|
|
236
|
+
enum: ["left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"],
|
|
237
|
+
description: "Where to place the text overlay — choose based on where the person is NOT positioned to avoid overlap",
|
|
238
|
+
default: "left",
|
|
239
|
+
},
|
|
240
|
+
text_color: {
|
|
241
|
+
type: "string",
|
|
242
|
+
description: "Text color. 'white' is most readable, 'yellow' pops on dark backgrounds, 'red' creates urgency. Always paired with a thick black outline.",
|
|
243
|
+
default: "white",
|
|
244
|
+
},
|
|
245
|
+
photo_path: {
|
|
246
|
+
type: "string",
|
|
247
|
+
description: "Absolute file path to the selfie/photo to use as the base image (e.g. /Users/jordan/Desktop/selfie.jpg). If omitted, Gemini generates the subject from subject_description.",
|
|
248
|
+
},
|
|
249
|
+
subject_description: {
|
|
250
|
+
type: "string",
|
|
251
|
+
description: "Only when photo_path is omitted. Describe the person and their expression in detail (e.g. 'professional man in his 30s, dark stubble, wearing a navy suit, jaw dropped in shock, eyes wide open, pointing at camera').",
|
|
252
|
+
},
|
|
253
|
+
expression: {
|
|
254
|
+
type: "string",
|
|
255
|
+
description: "The expression to apply or intensify on the person's face. Be very specific — Gemini performs better with explicit direction (e.g. 'jaw dropped, eyes wide, eyebrows raised as high as possible', 'huge grin, teeth showing, eyebrows up', 'disgusted face, nose wrinkled, one eyebrow raised')",
|
|
256
|
+
},
|
|
257
|
+
lighting_style: {
|
|
258
|
+
type: "string",
|
|
259
|
+
enum: ["dramatic", "bright", "moody", "natural"],
|
|
260
|
+
description: "Lighting mood: 'dramatic' = cinematic rim light + high contrast (default, best for most thumbnails), 'bright' = clean even studio light, 'moody' = low-key one-sided, 'natural' = soft daylight",
|
|
261
|
+
default: "dramatic",
|
|
262
|
+
},
|
|
263
|
+
mood: {
|
|
264
|
+
type: "string",
|
|
265
|
+
description: "Optional overall vibe description to guide Gemini's artistic choices (e.g. 'high-stakes and urgent', 'aspirational and premium', 'shocking and alarming', 'confident and authoritative')",
|
|
266
|
+
},
|
|
267
|
+
video_topic: {
|
|
268
|
+
type: "string",
|
|
269
|
+
description: "The video title or topic — helps Gemini make contextually appropriate decisions about composition and mood (e.g. 'How I made $10k in one month dropshipping', 'I quit my corporate job — here is what happened')",
|
|
270
|
+
},
|
|
271
|
+
style_reference_path: {
|
|
272
|
+
type: "string",
|
|
273
|
+
description: "Optional. Absolute path to a reference thumbnail image. Must be paired with style_reference_intent — do not pass this without also passing style_reference_intent.",
|
|
274
|
+
},
|
|
275
|
+
style_reference_intent: {
|
|
276
|
+
type: "string",
|
|
277
|
+
description: "Required when style_reference_path is provided. Plain-language description of exactly what to copy from the reference and what to leave fresh. Ranges from narrow ('copy only the text style: bold yellow Impact letters with black outline on the right') to complete ('exact copy of the full layout — person left, dark background with orange glow, yellow text right — swap in user face and new text'). This is derived from a conversation with the user about what they want from the reference.",
|
|
278
|
+
},
|
|
279
|
+
outfit_change: {
|
|
280
|
+
type: "string",
|
|
281
|
+
description: "Optional outfit to swap onto the person in photo mode (e.g. 'dark navy slim-fit suit, no tie, white shirt', 'casual grey hoodie, relaxed fit'). Omit to keep original outfit.",
|
|
282
|
+
},
|
|
283
|
+
variations: {
|
|
284
|
+
type: "number",
|
|
285
|
+
description: "Number of variations to generate (1–4). Default 1. Use 2–3 for A/B testing.",
|
|
286
|
+
minimum: 1,
|
|
287
|
+
maximum: 4,
|
|
288
|
+
default: 1,
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
required: ["background", "text_overlay"],
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
}));
|
|
296
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
297
|
+
if (request.params.name !== "generate_thumbnail") {
|
|
298
|
+
return { content: [{ type: "text", text: `Unknown tool: ${request.params.name}` }], isError: true };
|
|
299
|
+
}
|
|
300
|
+
// Validate license (cached after first call)
|
|
301
|
+
try {
|
|
302
|
+
await validateLicense();
|
|
303
|
+
}
|
|
304
|
+
catch (err) {
|
|
305
|
+
return {
|
|
306
|
+
content: [{ type: "text", text: `License error: ${err instanceof Error ? err.message : err}` }],
|
|
307
|
+
isError: true,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
const args = request.params.arguments;
|
|
311
|
+
const { background, text_overlay, text_position = "left", text_color = "white", photo_path, subject_description, style_reference_path, style_reference_intent, outfit_change, expression, lighting_style, mood, video_topic, variations = 1, } = args;
|
|
312
|
+
if (!photo_path && !subject_description) {
|
|
313
|
+
return {
|
|
314
|
+
content: [{ type: "text", text: "Provide either photo_path (selfie) or subject_description." }],
|
|
315
|
+
isError: true,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
const savedPaths = [];
|
|
319
|
+
const count = Math.min(Math.max(Math.floor(variations), 1), 4);
|
|
320
|
+
// Load reference photo once outside the loop — same for all variations
|
|
321
|
+
let refBase64;
|
|
322
|
+
let refMimeType;
|
|
323
|
+
if (style_reference_path) {
|
|
324
|
+
const resolvedRefPath = resolveImagePath(style_reference_path);
|
|
325
|
+
try {
|
|
326
|
+
const buf = fs.readFileSync(resolvedRefPath);
|
|
327
|
+
refBase64 = buf.toString("base64");
|
|
328
|
+
const ext = path.extname(resolvedRefPath).toLowerCase().replace(".", "");
|
|
329
|
+
refMimeType = ext === "jpg" ? "image/jpeg" : ext === "png" ? "image/png" : "image/jpeg";
|
|
330
|
+
}
|
|
331
|
+
catch (err) {
|
|
332
|
+
return {
|
|
333
|
+
content: [{ type: "text", text: `Could not read style reference thumbnail at ${resolvedRefPath}: ${err instanceof Error ? err.message : err}` }],
|
|
334
|
+
isError: true,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
for (let i = 0; i < count; i++) {
|
|
339
|
+
let imageBase64;
|
|
340
|
+
let imageMimeType;
|
|
341
|
+
if (photo_path) {
|
|
342
|
+
const resolvedPhotoPath = resolveImagePath(photo_path);
|
|
343
|
+
try {
|
|
344
|
+
const buf = fs.readFileSync(resolvedPhotoPath);
|
|
345
|
+
imageBase64 = buf.toString("base64");
|
|
346
|
+
const ext = path.extname(resolvedPhotoPath).toLowerCase().replace(".", "");
|
|
347
|
+
imageMimeType = ext === "jpg" ? "image/jpeg" : ext === "png" ? "image/png" : "image/jpeg";
|
|
348
|
+
}
|
|
349
|
+
catch (err) {
|
|
350
|
+
return {
|
|
351
|
+
content: [{ type: "text", text: `Could not read photo at ${resolvedPhotoPath}: ${err instanceof Error ? err.message : err}` }],
|
|
352
|
+
isError: true,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
const prompt = photo_path
|
|
357
|
+
? buildPhotoEditPrompt({ background, textOverlay: text_overlay, textPosition: text_position, textColor: text_color, outfitChange: outfit_change, expression, lightingStyle: lighting_style, mood, videoTopic: video_topic, styleReferenceIntent: refBase64 ? style_reference_intent : undefined })
|
|
358
|
+
: buildTextOnlyPrompt({ subject: subject_description, background, textOverlay: text_overlay, textPosition: text_position, textColor: text_color, lightingStyle: lighting_style, mood, videoTopic: video_topic });
|
|
359
|
+
let result;
|
|
360
|
+
try {
|
|
361
|
+
result = await generateImage(prompt, imageBase64, imageMimeType, refBase64, refMimeType);
|
|
362
|
+
}
|
|
363
|
+
catch (err) {
|
|
364
|
+
return {
|
|
365
|
+
content: [{ type: "text", text: `Gemini error: ${err instanceof Error ? err.message : err}` }],
|
|
366
|
+
isError: true,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
const savedPath = saveToDesktop(result.base64, result.mimeType);
|
|
370
|
+
savedPaths.push(savedPath);
|
|
371
|
+
}
|
|
372
|
+
const pathList = savedPaths.map((p) => `• ${p}`).join("\n");
|
|
373
|
+
return {
|
|
374
|
+
content: [
|
|
375
|
+
{
|
|
376
|
+
type: "text",
|
|
377
|
+
text: `Thumbnail${savedPaths.length > 1 ? "s" : ""} saved to your Desktop:\n${pathList}\n\nOpen the file${savedPaths.length > 1 ? "s" : ""} to review. Ask me to regenerate with different text, background, or position if needed.`,
|
|
378
|
+
},
|
|
379
|
+
],
|
|
380
|
+
};
|
|
381
|
+
});
|
|
382
|
+
// ─── Startup ─────────────────────────────────────────────────────────────────
|
|
383
|
+
async function main() {
|
|
384
|
+
if (!LICENSE_KEY) {
|
|
385
|
+
console.error("ERROR: LICENSE_KEY environment variable is not set.");
|
|
386
|
+
console.error("Add it to your Claude Desktop config under the thumbnail-generator mcpServer env block.");
|
|
387
|
+
process.exit(1);
|
|
388
|
+
}
|
|
389
|
+
if (!GEMINI_API_KEY) {
|
|
390
|
+
console.error("ERROR: GEMINI_API_KEY environment variable is not set.");
|
|
391
|
+
console.error("Get a free key at https://aistudio.google.com/app/apikey");
|
|
392
|
+
process.exit(1);
|
|
393
|
+
}
|
|
394
|
+
const transport = new StdioServerTransport();
|
|
395
|
+
await server.connect(transport);
|
|
396
|
+
}
|
|
397
|
+
main().catch((err) => {
|
|
398
|
+
console.error("Fatal:", err instanceof Error ? err.message : err);
|
|
399
|
+
process.exit(1);
|
|
400
|
+
});
|
|
401
|
+
//# sourceMappingURL=index.gemini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.gemini.js","sourceRoot":"","sources":["../src/index.gemini.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAk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AAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;QACxE,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAC1E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
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, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
-
import { GoogleGenerativeAI } from "@google/generative-ai";
|
|
6
5
|
import nodeMachineId from "node-machine-id";
|
|
7
6
|
const { machineIdSync } = nodeMachineId;
|
|
8
7
|
import * as fs from "fs";
|
|
@@ -10,17 +9,20 @@ import * as path from "path";
|
|
|
10
9
|
import * as os from "os";
|
|
11
10
|
// ─── Config ─────────────────────────────────────────────────────────────────
|
|
12
11
|
const LICENSE_KEY = (process.env.LICENSE_KEY ?? "").trim().toUpperCase();
|
|
13
|
-
const
|
|
12
|
+
const KIE_API_KEY = process.env.KIE_API_KEY ?? "";
|
|
14
13
|
const VALIDATE_URL = process.env.VALIDATE_URL ??
|
|
15
14
|
"https://thumbnail.automationhackers.net/api/licenses/validate";
|
|
16
|
-
const
|
|
15
|
+
const KIE_BASE = "https://api.kie.ai/api/v1";
|
|
16
|
+
const KIE_MODEL = "nano-banana-pro";
|
|
17
|
+
const POLL_INTERVAL_MS = 4000;
|
|
18
|
+
const POLL_TIMEOUT_MS = 3 * 60 * 1000; // 3 minutes
|
|
17
19
|
let cachedProducts = null;
|
|
18
20
|
async function validateLicense() {
|
|
19
21
|
if (cachedProducts)
|
|
20
22
|
return cachedProducts;
|
|
21
23
|
let machineId;
|
|
22
24
|
try {
|
|
23
|
-
machineId = machineIdSync(true);
|
|
25
|
+
machineId = machineIdSync(true);
|
|
24
26
|
}
|
|
25
27
|
catch {
|
|
26
28
|
machineId = `fallback-${os.hostname()}-${os.userInfo().username}`;
|
|
@@ -49,9 +51,94 @@ async function validateLicense() {
|
|
|
49
51
|
cachedProducts = data.products ?? ["front_end"];
|
|
50
52
|
return cachedProducts;
|
|
51
53
|
}
|
|
52
|
-
// ───
|
|
54
|
+
// ─── Image upload ─────────────────────────────────────────────────────────────
|
|
55
|
+
// Uploads a local file to 0x0.st (free temporary hosting) to get a public URL
|
|
56
|
+
// that kie.ai can fetch. Files persist for at least 30 days.
|
|
57
|
+
async function uploadImageForUrl(filePath) {
|
|
58
|
+
const fileBuffer = fs.readFileSync(filePath);
|
|
59
|
+
const filename = path.basename(filePath);
|
|
60
|
+
const ext = path.extname(filename).toLowerCase();
|
|
61
|
+
const mimeType = ext === ".png" ? "image/png" :
|
|
62
|
+
ext === ".webp" ? "image/webp" :
|
|
63
|
+
"image/jpeg";
|
|
64
|
+
const formData = new FormData();
|
|
65
|
+
formData.append("file", new Blob([fileBuffer], { type: mimeType }), filename);
|
|
66
|
+
const res = await fetch("https://0x0.st", {
|
|
67
|
+
method: "POST",
|
|
68
|
+
body: formData,
|
|
69
|
+
});
|
|
70
|
+
if (!res.ok) {
|
|
71
|
+
throw new Error(`Image upload failed (${res.status}): ${await res.text()}`);
|
|
72
|
+
}
|
|
73
|
+
return (await res.text()).trim();
|
|
74
|
+
}
|
|
75
|
+
// ─── kie.ai API ───────────────────────────────────────────────────────────────
|
|
76
|
+
async function createKieTask(opts) {
|
|
77
|
+
const res = await fetch(`${KIE_BASE}/jobs/createTask`, {
|
|
78
|
+
method: "POST",
|
|
79
|
+
headers: {
|
|
80
|
+
"Content-Type": "application/json",
|
|
81
|
+
"Authorization": `Bearer ${KIE_API_KEY}`,
|
|
82
|
+
},
|
|
83
|
+
body: JSON.stringify({
|
|
84
|
+
model: KIE_MODEL,
|
|
85
|
+
input: {
|
|
86
|
+
prompt: opts.prompt,
|
|
87
|
+
image_input: opts.imageUrls ?? [],
|
|
88
|
+
aspect_ratio: "16:9",
|
|
89
|
+
resolution: "4K",
|
|
90
|
+
output_format: "jpg",
|
|
91
|
+
},
|
|
92
|
+
}),
|
|
93
|
+
});
|
|
94
|
+
const data = (await res.json());
|
|
95
|
+
if (data.code !== 200 || !data.data?.taskId) {
|
|
96
|
+
throw new Error(`kie.ai task creation failed (${data.code}): ${data.msg}`);
|
|
97
|
+
}
|
|
98
|
+
return data.data.taskId;
|
|
99
|
+
}
|
|
100
|
+
async function pollKieTask(taskId) {
|
|
101
|
+
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
102
|
+
while (Date.now() < deadline) {
|
|
103
|
+
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
104
|
+
const res = await fetch(`${KIE_BASE}/jobs/recordInfo?taskId=${encodeURIComponent(taskId)}`, { headers: { "Authorization": `Bearer ${KIE_API_KEY}` } });
|
|
105
|
+
const data = (await res.json());
|
|
106
|
+
if (data.code !== 200 || !data.data) {
|
|
107
|
+
throw new Error(`kie.ai poll failed (${data.code}): ${data.msg}`);
|
|
108
|
+
}
|
|
109
|
+
const { state, resultJson, failMsg, failCode } = data.data;
|
|
110
|
+
if (state === "fail") {
|
|
111
|
+
throw new Error(`kie.ai generation failed: ${failMsg ?? failCode ?? "unknown error"}`);
|
|
112
|
+
}
|
|
113
|
+
if (state === "success" && resultJson) {
|
|
114
|
+
const result = JSON.parse(resultJson);
|
|
115
|
+
if (!result.resultUrls?.length) {
|
|
116
|
+
throw new Error("kie.ai returned success but no result URLs");
|
|
117
|
+
}
|
|
118
|
+
return result.resultUrls;
|
|
119
|
+
}
|
|
120
|
+
// state === "waiting" — keep polling
|
|
121
|
+
}
|
|
122
|
+
throw new Error("kie.ai generation timed out after 3 minutes");
|
|
123
|
+
}
|
|
124
|
+
// ─── Download and save ────────────────────────────────────────────────────────
|
|
125
|
+
async function downloadToDesktop(url) {
|
|
126
|
+
const res = await fetch(url);
|
|
127
|
+
if (!res.ok) {
|
|
128
|
+
throw new Error(`Failed to download result image (${res.status})`);
|
|
129
|
+
}
|
|
130
|
+
const buffer = Buffer.from(await res.arrayBuffer());
|
|
131
|
+
const timestamp = new Date()
|
|
132
|
+
.toISOString()
|
|
133
|
+
.replace(/[:.]/g, "-")
|
|
134
|
+
.slice(0, 19);
|
|
135
|
+
const outPath = path.join(os.homedir(), "Desktop", `thumbnail-${timestamp}.jpg`);
|
|
136
|
+
fs.writeFileSync(outPath, buffer);
|
|
137
|
+
return outPath;
|
|
138
|
+
}
|
|
139
|
+
// ─── Prompt builders ──────────────────────────────────────────────────────────
|
|
53
140
|
function buildPhotoEditPrompt(opts) {
|
|
54
|
-
const { background, textOverlay, textPosition, textColor, outfitChange, expression, lightingStyle, mood, videoTopic, styleReferenceIntent } = opts;
|
|
141
|
+
const { background, textOverlay, textPosition, textColor, hasReference, outfitChange, expression, lightingStyle, mood, videoTopic, styleReferenceIntent, } = opts;
|
|
55
142
|
const lightingDirective = lightingStyle === "bright"
|
|
56
143
|
? "Bright, even studio lighting — soft shadows, no harsh contrast, clean and professional"
|
|
57
144
|
: lightingStyle === "moody"
|
|
@@ -59,11 +146,11 @@ function buildPhotoEditPrompt(opts) {
|
|
|
59
146
|
: lightingStyle === "natural"
|
|
60
147
|
? "Natural daylight — soft diffused light, no artificial feel, warm and organic"
|
|
61
148
|
: "Cinematic dramatic lighting — strong rim light from top-behind, high contrast punchy shadows, light source top-front. This is the default for high-performing thumbnails.";
|
|
62
|
-
return `TASK: Transform
|
|
63
|
-
|
|
64
|
-
${
|
|
149
|
+
return `TASK: Transform the provided selfie into a professional YouTube thumbnail.
|
|
150
|
+
The first image is the selfie/photo of the person to feature.${hasReference ? `\nThe second image is a style reference thumbnail.` : ""}
|
|
151
|
+
${videoTopic ? `\nVideo context: This thumbnail is for a video about "${videoTopic}". Use this to inform the mood, background details, and overall composition.\n` : ""}${styleReferenceIntent && hasReference ? `STYLE REFERENCE INSTRUCTIONS: "${styleReferenceIntent}"\nFollow these precisely — copy only what is specified above from the reference, and compose everything else fresh. Do NOT copy the reference thumbnail's person, face, or text content.\n` : ""}
|
|
65
152
|
=== PRESERVE EXACTLY — DO NOT CHANGE THESE ===
|
|
66
|
-
- Face: exact facial structure, bone structure, skin tone, eye color, eyebrows, nose shape, mouth shape, jawline —
|
|
153
|
+
- Face: exact facial structure, bone structure, skin tone, eye color, eyebrows, nose shape, mouth shape, jawline — NON-NEGOTIABLE
|
|
67
154
|
- Hair: exact color, length, texture, and style
|
|
68
155
|
- Any accessories already visible (glasses, earrings, jewelry, etc.)
|
|
69
156
|
- Approximate body position and pose from the original photo
|
|
@@ -82,7 +169,7 @@ ${mood ? `Overall mood/vibe: ${mood}` : ""}
|
|
|
82
169
|
|
|
83
170
|
=== ADD ===
|
|
84
171
|
Text overlay: "${textOverlay}" — massive bold block letters (Impact or Bebas Neue), ${textColor} fill, thick black outline 4–5px, hard drop shadow offset bottom-right. Place text ${textPosition} of image. Text must be readable at 320×180px (small thumbnail size).
|
|
85
|
-
Composition: person fills 60–70% of frame, positioned to leave clear negative space for the text. Face is the undisputed focal point
|
|
172
|
+
Composition: person fills 60–70% of frame, positioned to leave clear negative space for the text. Face is the undisputed focal point.
|
|
86
173
|
|
|
87
174
|
=== OUTPUT REQUIREMENTS ===
|
|
88
175
|
- Dimensions: exactly 1280×720 pixels (16:9 widescreen)
|
|
@@ -115,55 +202,17 @@ Requirements:
|
|
|
115
202
|
- Text must be large and immediately readable at 320×180px
|
|
116
203
|
- Do NOT add watermarks, borders, or decorative frames`;
|
|
117
204
|
}
|
|
118
|
-
// ─── Gemini image call ────────────────────────────────────────────────────────
|
|
119
|
-
async function generateImage(prompt, imageBase64, imageMimeType, refBase64, refMimeType) {
|
|
120
|
-
const genAI = new GoogleGenerativeAI(GEMINI_API_KEY);
|
|
121
|
-
const model = genAI.getGenerativeModel({
|
|
122
|
-
model: IMAGE_MODEL,
|
|
123
|
-
generationConfig: {
|
|
124
|
-
// @ts-expect-error — responseModalities not yet in types
|
|
125
|
-
responseModalities: ["Text", "Image"],
|
|
126
|
-
},
|
|
127
|
-
});
|
|
128
|
-
const parts = [];
|
|
129
|
-
if (imageBase64 && imageMimeType) {
|
|
130
|
-
parts.push({
|
|
131
|
-
inlineData: { data: imageBase64, mimeType: imageMimeType },
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
if (refBase64 && refMimeType) {
|
|
135
|
-
parts.push({
|
|
136
|
-
inlineData: { data: refBase64, mimeType: refMimeType },
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
parts.push({ text: prompt });
|
|
140
|
-
const result = await model.generateContent(parts);
|
|
141
|
-
const response = result.response;
|
|
142
|
-
for (const part of response.candidates?.[0]?.content?.parts ?? []) {
|
|
143
|
-
if (part.inlineData?.data) {
|
|
144
|
-
return {
|
|
145
|
-
base64: part.inlineData.data,
|
|
146
|
-
mimeType: part.inlineData.mimeType ?? "image/png",
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
throw new Error("Gemini returned no image. Check your API key and billing.");
|
|
151
|
-
}
|
|
152
205
|
// ─── Path resolver ────────────────────────────────────────────────────────────
|
|
153
|
-
// Accepts a full absolute path or just a filename (resolved to ~/Desktop).
|
|
154
|
-
// When the exact filename isn't found, falls back to fuzzy matching against
|
|
155
|
-
// Desktop contents — handles Claude Desktop's habit of normalizing special
|
|
156
|
-
// characters (spaces, parentheses, etc.) to underscores when reporting filenames.
|
|
157
206
|
function resolveImagePath(input) {
|
|
158
|
-
if (path.isAbsolute(input))
|
|
159
|
-
|
|
207
|
+
if (path.isAbsolute(input)) {
|
|
208
|
+
if (fs.existsSync(input))
|
|
209
|
+
return input;
|
|
210
|
+
return resolveImagePath(path.basename(input));
|
|
211
|
+
}
|
|
160
212
|
const desktop = path.join(os.homedir(), "Desktop");
|
|
161
213
|
const exact = path.join(desktop, input);
|
|
162
214
|
if (fs.existsSync(exact))
|
|
163
215
|
return exact;
|
|
164
|
-
// Normalize a filename for fuzzy comparison:
|
|
165
|
-
// lowercase, collapse any run of non-alphanumeric chars to a single underscore,
|
|
166
|
-
// strip leading/trailing underscores.
|
|
167
216
|
const normalize = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
168
217
|
const inputExt = path.extname(input).toLowerCase();
|
|
169
218
|
const inputBase = normalize(path.basename(input, path.extname(input)));
|
|
@@ -181,30 +230,15 @@ function resolveImagePath(input) {
|
|
|
181
230
|
if (matches.length === 1)
|
|
182
231
|
return path.join(desktop, matches[0]);
|
|
183
232
|
if (matches.length > 1) {
|
|
184
|
-
// Ambiguous — throw so the caller surfaces a clear error rather than picking silently
|
|
185
233
|
throw new Error(`Multiple files on your Desktop match "${input}": ${matches.join(", ")}. ` +
|
|
186
234
|
`Please rename the one you want to use so it has a unique name, then try again.`);
|
|
187
235
|
}
|
|
188
236
|
}
|
|
189
237
|
catch (err) {
|
|
190
|
-
// Re-throw ambiguity errors; swallow readdirSync failures
|
|
191
238
|
if (err instanceof Error && err.message.includes("Multiple files"))
|
|
192
239
|
throw err;
|
|
193
240
|
}
|
|
194
|
-
return exact;
|
|
195
|
-
}
|
|
196
|
-
// ─── Save to desktop ──────────────────────────────────────────────────────────
|
|
197
|
-
function saveToDesktop(base64, mimeType) {
|
|
198
|
-
const ext = mimeType.split("/")[1] ?? "png";
|
|
199
|
-
const timestamp = new Date()
|
|
200
|
-
.toISOString()
|
|
201
|
-
.replace(/[:.]/g, "-")
|
|
202
|
-
.slice(0, 19);
|
|
203
|
-
const filename = `thumbnail-${timestamp}.${ext}`;
|
|
204
|
-
const desktop = path.join(os.homedir(), "Desktop");
|
|
205
|
-
const outPath = path.join(desktop, filename);
|
|
206
|
-
fs.writeFileSync(outPath, Buffer.from(base64, "base64"));
|
|
207
|
-
return outPath;
|
|
241
|
+
return exact;
|
|
208
242
|
}
|
|
209
243
|
// ─── MCP Server ───────────────────────────────────────────────────────────────
|
|
210
244
|
const server = new Server({ name: "thumbnail-generator", version: "1.0.0" }, { capabilities: { tools: {} } });
|
|
@@ -212,70 +246,70 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
212
246
|
tools: [
|
|
213
247
|
{
|
|
214
248
|
name: "generate_thumbnail",
|
|
215
|
-
description: `Generates a YouTube thumbnail via
|
|
249
|
+
description: `Generates a YouTube thumbnail via kie.ai (Nano Banana Pro) and saves it to the user's Desktop. Called by the youtube-thumbnail-generator skill after the full intake conversation is complete. Do not call this tool directly — use the skill to collect all parameters first.`,
|
|
216
250
|
inputSchema: {
|
|
217
251
|
type: "object",
|
|
218
252
|
properties: {
|
|
219
253
|
background: {
|
|
220
254
|
type: "string",
|
|
221
|
-
description: "Cinematic, specific background description. Must include scene details, colors, time of day, and mood.
|
|
255
|
+
description: "Cinematic, specific background description. Must include scene details, colors, time of day, and mood.",
|
|
222
256
|
},
|
|
223
257
|
text_overlay: {
|
|
224
258
|
type: "string",
|
|
225
|
-
description: "The exact text to display on the thumbnail
|
|
259
|
+
description: "The exact text to display on the thumbnail. Short, punchy, ALL CAPS, 2–5 words.",
|
|
226
260
|
},
|
|
227
261
|
text_position: {
|
|
228
262
|
type: "string",
|
|
229
263
|
enum: ["left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"],
|
|
230
|
-
description: "Where to place the text overlay
|
|
264
|
+
description: "Where to place the text overlay.",
|
|
231
265
|
default: "left",
|
|
232
266
|
},
|
|
233
267
|
text_color: {
|
|
234
268
|
type: "string",
|
|
235
|
-
description: "Text color
|
|
269
|
+
description: "Text color: 'white', 'yellow', or 'red'.",
|
|
236
270
|
default: "white",
|
|
237
271
|
},
|
|
238
272
|
photo_path: {
|
|
239
273
|
type: "string",
|
|
240
|
-
description: "
|
|
274
|
+
description: "Filename of the selfie on the user's Desktop (e.g. IMG_5068.jpg). The MCP resolves it to ~/Desktop automatically.",
|
|
241
275
|
},
|
|
242
276
|
subject_description: {
|
|
243
277
|
type: "string",
|
|
244
|
-
description: "
|
|
278
|
+
description: "Used when no photo is provided. Describe the person and expression in detail.",
|
|
245
279
|
},
|
|
246
280
|
expression: {
|
|
247
281
|
type: "string",
|
|
248
|
-
description: "The expression to apply or intensify
|
|
282
|
+
description: "The expression to apply or intensify. Be very specific.",
|
|
249
283
|
},
|
|
250
284
|
lighting_style: {
|
|
251
285
|
type: "string",
|
|
252
286
|
enum: ["dramatic", "bright", "moody", "natural"],
|
|
253
|
-
description: "Lighting mood:
|
|
287
|
+
description: "Lighting mood: dramatic (default), bright, moody, or natural.",
|
|
254
288
|
default: "dramatic",
|
|
255
289
|
},
|
|
256
290
|
mood: {
|
|
257
291
|
type: "string",
|
|
258
|
-
description: "Optional overall vibe description
|
|
292
|
+
description: "Optional overall vibe description.",
|
|
259
293
|
},
|
|
260
294
|
video_topic: {
|
|
261
295
|
type: "string",
|
|
262
|
-
description: "The video title or topic
|
|
296
|
+
description: "The video title or topic.",
|
|
263
297
|
},
|
|
264
298
|
style_reference_path: {
|
|
265
299
|
type: "string",
|
|
266
|
-
description: "
|
|
300
|
+
description: "Filename of a reference thumbnail on the Desktop. Must be paired with style_reference_intent.",
|
|
267
301
|
},
|
|
268
302
|
style_reference_intent: {
|
|
269
303
|
type: "string",
|
|
270
|
-
description: "Required when style_reference_path is provided. Plain-language description of exactly what to copy from the reference
|
|
304
|
+
description: "Required when style_reference_path is provided. Plain-language description of exactly what to copy from the reference.",
|
|
271
305
|
},
|
|
272
306
|
outfit_change: {
|
|
273
307
|
type: "string",
|
|
274
|
-
description: "Optional outfit to swap onto the person
|
|
308
|
+
description: "Optional outfit to swap onto the person (photo mode only).",
|
|
275
309
|
},
|
|
276
310
|
variations: {
|
|
277
311
|
type: "number",
|
|
278
|
-
description: "Number of variations to generate (1–4). Default 1.
|
|
312
|
+
description: "Number of variations to generate (1–4). Default 1.",
|
|
279
313
|
minimum: 1,
|
|
280
314
|
maximum: 4,
|
|
281
315
|
default: 1,
|
|
@@ -288,9 +322,11 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
288
322
|
}));
|
|
289
323
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
290
324
|
if (request.params.name !== "generate_thumbnail") {
|
|
291
|
-
return {
|
|
325
|
+
return {
|
|
326
|
+
content: [{ type: "text", text: `Unknown tool: ${request.params.name}` }],
|
|
327
|
+
isError: true,
|
|
328
|
+
};
|
|
292
329
|
}
|
|
293
|
-
// Validate license (cached after first call)
|
|
294
330
|
try {
|
|
295
331
|
await validateLicense();
|
|
296
332
|
}
|
|
@@ -308,59 +344,100 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
308
344
|
isError: true,
|
|
309
345
|
};
|
|
310
346
|
}
|
|
311
|
-
const savedPaths = [];
|
|
312
347
|
const count = Math.min(Math.max(Math.floor(variations), 1), 4);
|
|
313
|
-
//
|
|
314
|
-
let
|
|
315
|
-
let
|
|
348
|
+
// Upload images once — same URLs reused across all variation tasks
|
|
349
|
+
let photoUrl;
|
|
350
|
+
let referenceUrl;
|
|
351
|
+
if (photo_path) {
|
|
352
|
+
const resolvedPath = resolveImagePath(photo_path);
|
|
353
|
+
try {
|
|
354
|
+
photoUrl = await uploadImageForUrl(resolvedPath);
|
|
355
|
+
}
|
|
356
|
+
catch (err) {
|
|
357
|
+
return {
|
|
358
|
+
content: [{ type: "text", text: `Could not upload selfie: ${err instanceof Error ? err.message : err}` }],
|
|
359
|
+
isError: true,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
}
|
|
316
363
|
if (style_reference_path) {
|
|
317
364
|
const resolvedRefPath = resolveImagePath(style_reference_path);
|
|
318
365
|
try {
|
|
319
|
-
|
|
320
|
-
refBase64 = buf.toString("base64");
|
|
321
|
-
const ext = path.extname(resolvedRefPath).toLowerCase().replace(".", "");
|
|
322
|
-
refMimeType = ext === "jpg" ? "image/jpeg" : ext === "png" ? "image/png" : "image/jpeg";
|
|
366
|
+
referenceUrl = await uploadImageForUrl(resolvedRefPath);
|
|
323
367
|
}
|
|
324
368
|
catch (err) {
|
|
325
369
|
return {
|
|
326
|
-
content: [{ type: "text", text: `Could not
|
|
370
|
+
content: [{ type: "text", text: `Could not upload style reference: ${err instanceof Error ? err.message : err}` }],
|
|
327
371
|
isError: true,
|
|
328
372
|
};
|
|
329
373
|
}
|
|
330
374
|
}
|
|
375
|
+
// Image order: selfie first, reference second
|
|
376
|
+
const imageUrls = [];
|
|
377
|
+
if (photoUrl)
|
|
378
|
+
imageUrls.push(photoUrl);
|
|
379
|
+
if (referenceUrl)
|
|
380
|
+
imageUrls.push(referenceUrl);
|
|
381
|
+
const prompt = photo_path
|
|
382
|
+
? buildPhotoEditPrompt({
|
|
383
|
+
background,
|
|
384
|
+
textOverlay: text_overlay,
|
|
385
|
+
textPosition: text_position,
|
|
386
|
+
textColor: text_color,
|
|
387
|
+
hasReference: !!referenceUrl,
|
|
388
|
+
outfitChange: outfit_change,
|
|
389
|
+
expression,
|
|
390
|
+
lightingStyle: lighting_style,
|
|
391
|
+
mood,
|
|
392
|
+
videoTopic: video_topic,
|
|
393
|
+
styleReferenceIntent: referenceUrl ? style_reference_intent : undefined,
|
|
394
|
+
})
|
|
395
|
+
: buildTextOnlyPrompt({
|
|
396
|
+
subject: subject_description,
|
|
397
|
+
background,
|
|
398
|
+
textOverlay: text_overlay,
|
|
399
|
+
textPosition: text_position,
|
|
400
|
+
textColor: text_color,
|
|
401
|
+
lightingStyle: lighting_style,
|
|
402
|
+
mood,
|
|
403
|
+
videoTopic: video_topic,
|
|
404
|
+
});
|
|
405
|
+
// Create all variation tasks, then poll them sequentially
|
|
406
|
+
const taskIds = [];
|
|
331
407
|
for (let i = 0; i < count; i++) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
408
|
+
try {
|
|
409
|
+
const taskId = await createKieTask({ prompt, imageUrls });
|
|
410
|
+
taskIds.push(taskId);
|
|
411
|
+
}
|
|
412
|
+
catch (err) {
|
|
413
|
+
return {
|
|
414
|
+
content: [{ type: "text", text: `kie.ai error creating task: ${err instanceof Error ? err.message : err}` }],
|
|
415
|
+
isError: true,
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
const savedPaths = [];
|
|
420
|
+
for (const taskId of taskIds) {
|
|
421
|
+
let urls;
|
|
422
|
+
try {
|
|
423
|
+
urls = await pollKieTask(taskId);
|
|
424
|
+
}
|
|
425
|
+
catch (err) {
|
|
426
|
+
return {
|
|
427
|
+
content: [{ type: "text", text: `kie.ai error: ${err instanceof Error ? err.message : err}` }],
|
|
428
|
+
isError: true,
|
|
429
|
+
};
|
|
348
430
|
}
|
|
349
|
-
const prompt = photo_path
|
|
350
|
-
? buildPhotoEditPrompt({ background, textOverlay: text_overlay, textPosition: text_position, textColor: text_color, outfitChange: outfit_change, expression, lightingStyle: lighting_style, mood, videoTopic: video_topic, styleReferenceIntent: refBase64 ? style_reference_intent : undefined })
|
|
351
|
-
: buildTextOnlyPrompt({ subject: subject_description, background, textOverlay: text_overlay, textPosition: text_position, textColor: text_color, lightingStyle: lighting_style, mood, videoTopic: video_topic });
|
|
352
|
-
let result;
|
|
353
431
|
try {
|
|
354
|
-
|
|
432
|
+
const savedPath = await downloadToDesktop(urls[0]);
|
|
433
|
+
savedPaths.push(savedPath);
|
|
355
434
|
}
|
|
356
435
|
catch (err) {
|
|
357
436
|
return {
|
|
358
|
-
content: [{ type: "text", text: `
|
|
437
|
+
content: [{ type: "text", text: `Download error: ${err instanceof Error ? err.message : err}` }],
|
|
359
438
|
isError: true,
|
|
360
439
|
};
|
|
361
440
|
}
|
|
362
|
-
const savedPath = saveToDesktop(result.base64, result.mimeType);
|
|
363
|
-
savedPaths.push(savedPath);
|
|
364
441
|
}
|
|
365
442
|
const pathList = savedPaths.map((p) => `• ${p}`).join("\n");
|
|
366
443
|
return {
|
|
@@ -376,12 +453,11 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
376
453
|
async function main() {
|
|
377
454
|
if (!LICENSE_KEY) {
|
|
378
455
|
console.error("ERROR: LICENSE_KEY environment variable is not set.");
|
|
379
|
-
console.error("Add it to your Claude Desktop config under the thumbnail-generator mcpServer env block.");
|
|
380
456
|
process.exit(1);
|
|
381
457
|
}
|
|
382
|
-
if (!
|
|
383
|
-
console.error("ERROR:
|
|
384
|
-
console.error("Get
|
|
458
|
+
if (!KIE_API_KEY) {
|
|
459
|
+
console.error("ERROR: KIE_API_KEY environment variable is not set.");
|
|
460
|
+
console.error("Get your API key at https://kie.ai/api-key");
|
|
385
461
|
process.exit(1);
|
|
386
462
|
}
|
|
387
463
|
const transport = new StdioServerTransport();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAQ,MAAM,uBAAuB,CAA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,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACrE,OAAO,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thumbnail-generator-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"description": "YouTube thumbnail generator MCP server for Claude Desktop",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"start": "node dist/index.js"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@google/generative-ai": "^0.21.0",
|
|
17
16
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
18
17
|
"node-machine-id": "^1.1.12"
|
|
19
18
|
},
|