@imageconvertit/mcp-server 0.0.0-stage → 0.3.1
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/README.md +130 -3
- package/package.json +50 -6
- package/src/authorize.js +74 -0
- package/src/index.js +734 -0
- package/src/lib/batch.js +150 -0
- package/src/lib/cloudAuth.js +177 -0
- package/src/lib/imageOps.js +272 -0
- package/src/lib/rembg.js +38 -0
- package/src/lib/runAi.js +312 -0
- package/src/tools/ai.js +319 -0
- package/src/tools/core.js +7 -0
- package/src/tools/ecommerce.js +607 -0
- package/src/tools/format.js +534 -0
package/src/index.js
ADDED
|
@@ -0,0 +1,734 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @imageconvertit/mcp-server
|
|
4
|
+
*
|
|
5
|
+
* ONE local stdio MCP package — two meters:
|
|
6
|
+
* 1) Core (E-Commerce + Format) — Automation file meter via /api/mcp/authorize
|
|
7
|
+
* 2) Cloud AI (12 tools) — same credit wallet as the website via /api/run-ai
|
|
8
|
+
*
|
|
9
|
+
* Provider keys (FAL / FASHN / GROQ) never leave Cloudflare. MCP only holds
|
|
10
|
+
* ICI_LICENSE_KEY (and optional ICI_DEVICE_ID). Paths only for Core batches;
|
|
11
|
+
* Cloud AI reads local files and POSTs base64 to our API — never through the LLM.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
15
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
16
|
+
import { z } from 'zod';
|
|
17
|
+
|
|
18
|
+
import * as format from './tools/format.js';
|
|
19
|
+
import * as ecom from './tools/ecommerce.js';
|
|
20
|
+
import * as ai from './tools/ai.js';
|
|
21
|
+
|
|
22
|
+
const PKG_VERSION = '0.3.1';
|
|
23
|
+
|
|
24
|
+
const env = {
|
|
25
|
+
ICI_LICENSE_KEY: process.env.ICI_LICENSE_KEY || '',
|
|
26
|
+
ICI_API_BASE: process.env.ICI_API_BASE || 'https://imageconvertit.com',
|
|
27
|
+
ICI_DEVICE_ID: process.env.ICI_DEVICE_ID || '',
|
|
28
|
+
ICI_API_TOKEN: process.env.ICI_API_TOKEN || '',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const server = new McpServer({
|
|
32
|
+
name: 'imageconvertit',
|
|
33
|
+
version: PKG_VERSION,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
function textResult(obj) {
|
|
37
|
+
return { content: [{ type: 'text', text: JSON.stringify(obj, null, 2) }] };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const dirIn = z.string().describe('Absolute path to input folder');
|
|
41
|
+
const dirOut = z.string().describe('Absolute path to output folder');
|
|
42
|
+
const fileIn = z.string().describe('Absolute path to input image');
|
|
43
|
+
const fileOut = z.string().optional().describe('Absolute path for output image (optional)');
|
|
44
|
+
|
|
45
|
+
// ── Status ───────────────────────────────────────────────────────────────────
|
|
46
|
+
server.registerTool(
|
|
47
|
+
'mcp_status',
|
|
48
|
+
{
|
|
49
|
+
description:
|
|
50
|
+
'Show license + API base + live MCP file meter (status only — does not spend files or credits).',
|
|
51
|
+
inputSchema: {},
|
|
52
|
+
},
|
|
53
|
+
async () => {
|
|
54
|
+
const configured = Boolean(env.ICI_LICENSE_KEY && !env.ICI_LICENSE_KEY.startsWith('eyJ'));
|
|
55
|
+
let meter = null;
|
|
56
|
+
if (configured) {
|
|
57
|
+
try {
|
|
58
|
+
const { authorizeBatch } = await import('./authorize.js');
|
|
59
|
+
meter = await authorizeBatch({
|
|
60
|
+
licenseKey: env.ICI_LICENSE_KEY,
|
|
61
|
+
apiBase: env.ICI_API_BASE,
|
|
62
|
+
action: 'status',
|
|
63
|
+
});
|
|
64
|
+
} catch (e) {
|
|
65
|
+
meter = { allowed: false, error: e?.message ?? String(e) };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return textResult({
|
|
69
|
+
license_configured: configured,
|
|
70
|
+
api_base: env.ICI_API_BASE,
|
|
71
|
+
version: PKG_VERSION,
|
|
72
|
+
one_mcp_package: true,
|
|
73
|
+
mcp_file_meter: meter,
|
|
74
|
+
meters: {
|
|
75
|
+
core_batch: 'MCP $19/$29/$49 — /api/mcp/authorize file meter (no free quota)',
|
|
76
|
+
cloud_ai: 'Same credit wallet as website — /api/run-ai (402 if insufficient credits)',
|
|
77
|
+
},
|
|
78
|
+
provider_keys: 'never in MCP — FAL/FASHN/GROQ stay server-side only',
|
|
79
|
+
categories: ['ecommerce_creators', 'format_conversion', 'cloud_ai'],
|
|
80
|
+
clients: ['claude_desktop', 'cursor', 'vscode', 'codex', 'chatgpt_desktop', 'gemini_cli'],
|
|
81
|
+
not_supported: ['chatgpt.com', 'gemini.google.com', 'openai_plugin_directory'],
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
// ── Format & Conversion ──────────────────────────────────────────────────────
|
|
87
|
+
server.registerTool(
|
|
88
|
+
'batch_resize',
|
|
89
|
+
{
|
|
90
|
+
description: 'Bulk Image Resizer — resize folder locally (paths only). Automation license required.',
|
|
91
|
+
inputSchema: {
|
|
92
|
+
inputDir: dirIn,
|
|
93
|
+
outputDir: dirOut,
|
|
94
|
+
longestSide: z.number().int().min(16).max(8000).optional(),
|
|
95
|
+
width: z.number().int().min(1).max(8000).optional(),
|
|
96
|
+
height: z.number().int().min(1).max(8000).optional(),
|
|
97
|
+
format: z.enum(['jpeg', 'png', 'webp', 'tiff', 'avif']).optional(),
|
|
98
|
+
quality: z.number().int().min(40).max(100).optional(),
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
async (args) => textResult(await format.batchResize(env, args)),
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
server.registerTool(
|
|
105
|
+
'batch_compress',
|
|
106
|
+
{
|
|
107
|
+
description: 'Bulk Image Compressor — recompress folder locally. Automation license required.',
|
|
108
|
+
inputSchema: {
|
|
109
|
+
inputDir: dirIn,
|
|
110
|
+
outputDir: dirOut,
|
|
111
|
+
format: z.enum(['jpeg', 'png', 'webp']).optional(),
|
|
112
|
+
quality: z.number().int().min(40).max(100).optional(),
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
async (args) => textResult(await format.batchCompress(env, args)),
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
server.registerTool(
|
|
119
|
+
'batch_crop',
|
|
120
|
+
{
|
|
121
|
+
description: 'Bulk Image Cropper — crop rectangle (left, top, width, height). Automation license required.',
|
|
122
|
+
inputSchema: {
|
|
123
|
+
inputDir: dirIn,
|
|
124
|
+
outputDir: dirOut,
|
|
125
|
+
left: z.number().int().min(0),
|
|
126
|
+
top: z.number().int().min(0),
|
|
127
|
+
width: z.number().int().min(1),
|
|
128
|
+
height: z.number().int().min(1),
|
|
129
|
+
format: z.enum(['jpeg', 'png', 'webp']).optional(),
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
async (args) => textResult(await format.batchCrop(env, args)),
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
server.registerTool(
|
|
136
|
+
'batch_convert',
|
|
137
|
+
{
|
|
138
|
+
description:
|
|
139
|
+
'Bulk Image Converter (JPG/PNG/WebP/TIFF/AVIF). For PNG→WebP use format=webp or batch_png_to_webp. Automation license required.',
|
|
140
|
+
inputSchema: {
|
|
141
|
+
inputDir: dirIn,
|
|
142
|
+
outputDir: dirOut,
|
|
143
|
+
format: z.enum(['jpeg', 'png', 'webp', 'tiff', 'avif']),
|
|
144
|
+
quality: z.number().int().min(40).max(100).optional(),
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
async (args) => textResult(await format.batchConvert(env, args)),
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
server.registerTool(
|
|
151
|
+
'batch_png_to_webp',
|
|
152
|
+
{
|
|
153
|
+
description: 'PNG to WebP Converter — convert folder images to WebP. Automation license required.',
|
|
154
|
+
inputSchema: {
|
|
155
|
+
inputDir: dirIn,
|
|
156
|
+
outputDir: dirOut,
|
|
157
|
+
quality: z.number().int().min(40).max(100).optional(),
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
async (args) => textResult(await format.batchPngToWebp(env, args)),
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
server.registerTool(
|
|
164
|
+
'batch_rotate',
|
|
165
|
+
{
|
|
166
|
+
description: 'Bulk Image Rotator — 90 / 180 / 270 degrees. Automation license required.',
|
|
167
|
+
inputSchema: {
|
|
168
|
+
inputDir: dirIn,
|
|
169
|
+
outputDir: dirOut,
|
|
170
|
+
angle: z.union([z.literal(90), z.literal(180), z.literal(270)]),
|
|
171
|
+
format: z.enum(['jpeg', 'png', 'webp']).optional(),
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
async (args) => textResult(await format.batchRotate(env, args)),
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
server.registerTool(
|
|
178
|
+
'batch_grayscale',
|
|
179
|
+
{
|
|
180
|
+
description: 'Bulk Black and White. Automation license required.',
|
|
181
|
+
inputSchema: {
|
|
182
|
+
inputDir: dirIn,
|
|
183
|
+
outputDir: dirOut,
|
|
184
|
+
format: z.enum(['jpeg', 'png', 'webp']).optional(),
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
async (args) => textResult(await format.batchGrayscale(env, args)),
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
server.registerTool(
|
|
191
|
+
'batch_upscale',
|
|
192
|
+
{
|
|
193
|
+
description:
|
|
194
|
+
'Bulk Image Upscale (up to 4× toward 4K) — high-quality Lanczos, not generative AI. Automation license required.',
|
|
195
|
+
inputSchema: {
|
|
196
|
+
inputDir: dirIn,
|
|
197
|
+
outputDir: dirOut,
|
|
198
|
+
scale: z.union([z.literal(2), z.literal(3), z.literal(4)]).optional(),
|
|
199
|
+
format: z.enum(['jpeg', 'png', 'webp']).optional(),
|
|
200
|
+
sharpen: z.boolean().optional(),
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
async (args) => textResult(await format.batchUpscale(env, args)),
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
server.registerTool(
|
|
207
|
+
'batch_heic_convert',
|
|
208
|
+
{
|
|
209
|
+
description: 'HEIC/HEIF → PNG, JPEG, or PDF. Automation license required.',
|
|
210
|
+
inputSchema: {
|
|
211
|
+
inputDir: dirIn,
|
|
212
|
+
outputDir: dirOut,
|
|
213
|
+
format: z.enum(['png', 'jpeg', 'pdf']),
|
|
214
|
+
quality: z.number().int().min(40).max(100).optional(),
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
async (args) => textResult(await format.batchHeicConvert(env, args)),
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
server.registerTool(
|
|
221
|
+
'batch_images_to_pdf',
|
|
222
|
+
{
|
|
223
|
+
description: 'Bulk Image to PDF — one PDF per image, or combine=true for a single PDF. Automation license required.',
|
|
224
|
+
inputSchema: {
|
|
225
|
+
inputDir: dirIn,
|
|
226
|
+
outputDir: dirOut,
|
|
227
|
+
combine: z.boolean().optional(),
|
|
228
|
+
filename: z.string().optional().describe('Output name when combine=true (default images.pdf)'),
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
async (args) => textResult(await format.batchImagesToPdf(env, args)),
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
server.registerTool(
|
|
235
|
+
'batch_pdf_to_images',
|
|
236
|
+
{
|
|
237
|
+
description: 'Bulk PDF to Image — rasterize pages to PNG or JPEG. Automation license required. Max 50 pages/call.',
|
|
238
|
+
inputSchema: {
|
|
239
|
+
inputDir: dirIn,
|
|
240
|
+
outputDir: dirOut,
|
|
241
|
+
scale: z.number().min(1).max(3).optional(),
|
|
242
|
+
format: z.enum(['png', 'jpeg']).optional(),
|
|
243
|
+
quality: z.number().int().min(40).max(100).optional(),
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
async (args) => textResult(await format.batchPdfToImages(env, args)),
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
server.registerTool(
|
|
250
|
+
'batch_vectorize',
|
|
251
|
+
{
|
|
252
|
+
description:
|
|
253
|
+
'AI Vectorize (PNG/JPG → SVG) via local potrace — not Cloud AI credits. Best on high-contrast artwork. Automation license required.',
|
|
254
|
+
inputSchema: {
|
|
255
|
+
inputDir: dirIn,
|
|
256
|
+
outputDir: dirOut,
|
|
257
|
+
threshold: z.number().int().min(0).max(255).optional(),
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
async (args) => textResult(await format.batchVectorize(env, args)),
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
server.registerTool(
|
|
264
|
+
'batch_bleed_checker',
|
|
265
|
+
{
|
|
266
|
+
description:
|
|
267
|
+
'Book Cover Bleed Checker — preview with trim/bleed guides + bleed-report.json. Optional trimWidthInches/trimHeightInches for size warnings. Automation license required.',
|
|
268
|
+
inputSchema: {
|
|
269
|
+
inputDir: dirIn,
|
|
270
|
+
outputDir: dirOut,
|
|
271
|
+
bleedInches: z.number().min(0).max(1).optional(),
|
|
272
|
+
dpi: z.number().int().min(72).max(600).optional(),
|
|
273
|
+
trimWidthInches: z.number().positive().optional(),
|
|
274
|
+
trimHeightInches: z.number().positive().optional(),
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
async (args) => textResult(await format.batchBleedChecker(env, args)),
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
// Keep legacy aliases used in older docs/configs
|
|
281
|
+
server.registerTool(
|
|
282
|
+
'batch_resize_compress',
|
|
283
|
+
{
|
|
284
|
+
description: 'Legacy alias — resize + compress (same as batch_resize with longestSide). Prefer batch_resize / batch_compress.',
|
|
285
|
+
inputSchema: {
|
|
286
|
+
inputDir: dirIn,
|
|
287
|
+
outputDir: dirOut,
|
|
288
|
+
longestSide: z.number().int().min(64).max(4000).optional(),
|
|
289
|
+
format: z.enum(['jpeg', 'png', 'webp']).optional(),
|
|
290
|
+
quality: z.number().int().min(40).max(100).optional(),
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
async (args) => textResult(await format.batchResize(env, {
|
|
294
|
+
...args,
|
|
295
|
+
longestSide: args.longestSide ?? 2000,
|
|
296
|
+
})),
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
server.registerTool(
|
|
300
|
+
'batch_amazon_prep',
|
|
301
|
+
{
|
|
302
|
+
description: 'Legacy alias for Amazon/Shopify white background prep. Prefer batch_white_background.',
|
|
303
|
+
inputSchema: {
|
|
304
|
+
inputDir: dirIn,
|
|
305
|
+
outputDir: dirOut,
|
|
306
|
+
size: z.number().int().min(500).max(4000).optional(),
|
|
307
|
+
quality: z.number().int().min(40).max(100).optional(),
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
async (args) => textResult(await ecom.batchWhiteBackground(env, {
|
|
311
|
+
...args,
|
|
312
|
+
size: args.size ?? args.longestSide ?? 2000,
|
|
313
|
+
})),
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
// ── E-Commerce & Creators ────────────────────────────────────────────────────
|
|
317
|
+
server.registerTool(
|
|
318
|
+
'batch_remove_background',
|
|
319
|
+
{
|
|
320
|
+
description: 'Bulk Background Remover — local ONNX cutout → transparent PNG. Automation license required.',
|
|
321
|
+
inputSchema: { inputDir: dirIn, outputDir: dirOut },
|
|
322
|
+
},
|
|
323
|
+
async (args) => textResult(await ecom.batchRemoveBackground(env, args)),
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
server.registerTool(
|
|
327
|
+
'batch_white_background',
|
|
328
|
+
{
|
|
329
|
+
description:
|
|
330
|
+
'Amazon/Shopify White Background — rembg cutout, content bbox, pad to square (1000/2000/2400 typical). Default PNG. Automation license required.',
|
|
331
|
+
inputSchema: {
|
|
332
|
+
inputDir: dirIn,
|
|
333
|
+
outputDir: dirOut,
|
|
334
|
+
size: z.number().int().min(500).max(4000).optional(),
|
|
335
|
+
padding: z.number().min(0).max(0.4).optional(),
|
|
336
|
+
background: z.string().optional().describe('Hex color, default #FFFFFF'),
|
|
337
|
+
format: z.enum(['png', 'jpeg']).optional(),
|
|
338
|
+
quality: z.number().int().min(40).max(100).optional(),
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
async (args) => textResult(await ecom.batchWhiteBackground(env, args)),
|
|
342
|
+
);
|
|
343
|
+
|
|
344
|
+
server.registerTool(
|
|
345
|
+
'batch_background_color',
|
|
346
|
+
{
|
|
347
|
+
description: 'Bulk Background Colour Changer — rembg + pad to target size on solid color. Automation license required.',
|
|
348
|
+
inputSchema: {
|
|
349
|
+
inputDir: dirIn,
|
|
350
|
+
outputDir: dirOut,
|
|
351
|
+
color: z.string().describe('Hex background e.g. #F5F5F5'),
|
|
352
|
+
size: z.number().int().min(256).max(4000).optional(),
|
|
353
|
+
padding: z.number().min(0).max(0.4).optional(),
|
|
354
|
+
format: z.enum(['jpeg', 'png']).optional(),
|
|
355
|
+
quality: z.number().int().min(40).max(100).optional(),
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
async (args) => textResult(await ecom.batchBackgroundColor(env, args)),
|
|
359
|
+
);
|
|
360
|
+
|
|
361
|
+
server.registerTool(
|
|
362
|
+
'batch_watermark',
|
|
363
|
+
{
|
|
364
|
+
description:
|
|
365
|
+
'Bulk Catalog Watermarking — diagonal tiled text and/or image watermarkPath. Automation license required.',
|
|
366
|
+
inputSchema: {
|
|
367
|
+
inputDir: dirIn,
|
|
368
|
+
outputDir: dirOut,
|
|
369
|
+
text: z.string().optional(),
|
|
370
|
+
watermarkPath: z.string().optional().describe('Absolute path to watermark image'),
|
|
371
|
+
opacity: z.number().min(0.05).max(1).optional(),
|
|
372
|
+
fontSize: z.number().int().min(12).max(120).optional(),
|
|
373
|
+
tile: z.boolean().optional(),
|
|
374
|
+
color: z.string().optional(),
|
|
375
|
+
position: z.string().optional(),
|
|
376
|
+
imageSizePct: z.number().min(5).max(40).optional(),
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
async (args) => textResult(await ecom.batchWatermark(env, args)),
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
server.registerTool(
|
|
383
|
+
'batch_text_overlay',
|
|
384
|
+
{
|
|
385
|
+
description: 'Add Text to Product Photos — 9-grid positions + optional backgroundBox hex. Automation license required.',
|
|
386
|
+
inputSchema: {
|
|
387
|
+
inputDir: dirIn,
|
|
388
|
+
outputDir: dirOut,
|
|
389
|
+
text: z.string(),
|
|
390
|
+
fontSize: z.number().int().min(10).max(200).optional(),
|
|
391
|
+
position: z.enum([
|
|
392
|
+
'top', 'top-left', 'top-center', 'top-right',
|
|
393
|
+
'center', 'middle-left', 'middle-center', 'middle-right',
|
|
394
|
+
'bottom', 'bottom-left', 'bottom-center', 'bottom-right',
|
|
395
|
+
]).optional(),
|
|
396
|
+
color: z.string().optional(),
|
|
397
|
+
backgroundBox: z.string().optional().describe('Optional hex pill behind text'),
|
|
398
|
+
opacity: z.number().min(0.1).max(1).optional(),
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
async (args) => textResult(await ecom.batchTextOverlay(env, args)),
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
server.registerTool(
|
|
405
|
+
'batch_adjust',
|
|
406
|
+
{
|
|
407
|
+
description:
|
|
408
|
+
'Adjust Product Photos In Bulk — brightness/contrast/saturation (−50..50 / −50..50 / −100..100 like website) + optional hue/sharpen. Automation license required.',
|
|
409
|
+
inputSchema: {
|
|
410
|
+
inputDir: dirIn,
|
|
411
|
+
outputDir: dirOut,
|
|
412
|
+
brightness: z.number().min(-50).max(50).optional(),
|
|
413
|
+
contrast: z.number().min(-50).max(50).optional(),
|
|
414
|
+
saturation: z.number().min(-100).max(100).optional(),
|
|
415
|
+
hue: z.number().min(-180).max(180).optional(),
|
|
416
|
+
sharpen: z.boolean().optional(),
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
async (args) => textResult(await ecom.batchAdjust(env, args)),
|
|
420
|
+
);
|
|
421
|
+
|
|
422
|
+
server.registerTool(
|
|
423
|
+
'batch_align_center',
|
|
424
|
+
{
|
|
425
|
+
description:
|
|
426
|
+
'Align Product Photos In Bulk — rembg, alpha bbox crop, pad to square with alignment (website canvas_align_centre). Automation license required.',
|
|
427
|
+
inputSchema: {
|
|
428
|
+
inputDir: dirIn,
|
|
429
|
+
outputDir: dirOut,
|
|
430
|
+
size: z.number().int().min(256).max(4000).optional(),
|
|
431
|
+
padding: z.number().min(0).max(0.4).optional(),
|
|
432
|
+
alignment: z.enum([
|
|
433
|
+
'center', 'top-left', 'top-center', 'top-right',
|
|
434
|
+
'middle-left', 'middle-right',
|
|
435
|
+
'bottom-left', 'bottom-center', 'bottom-right',
|
|
436
|
+
]).optional(),
|
|
437
|
+
background: z.string().optional(),
|
|
438
|
+
format: z.enum(['png', 'jpeg']).optional(),
|
|
439
|
+
},
|
|
440
|
+
},
|
|
441
|
+
async (args) => textResult(await ecom.batchAlignCenter(env, args)),
|
|
442
|
+
);
|
|
443
|
+
|
|
444
|
+
server.registerTool(
|
|
445
|
+
'batch_logo_overlay',
|
|
446
|
+
{
|
|
447
|
+
description: 'Add Logo to Product Photos In Bulk — logoPath is a local image file. Automation license required.',
|
|
448
|
+
inputSchema: {
|
|
449
|
+
inputDir: dirIn,
|
|
450
|
+
outputDir: dirOut,
|
|
451
|
+
logoPath: z.string().describe('Absolute path to logo image'),
|
|
452
|
+
sizePct: z.number().min(1).max(100).optional(),
|
|
453
|
+
position: z.enum(['top-left', 'top-right', 'bottom-left', 'bottom-right', 'center']).optional(),
|
|
454
|
+
opacity: z.number().min(0.1).max(1).optional(),
|
|
455
|
+
padding: z.number().int().min(0).max(200).optional(),
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
async (args) => textResult(await ecom.batchLogoOverlay(env, args)),
|
|
459
|
+
);
|
|
460
|
+
|
|
461
|
+
server.registerTool(
|
|
462
|
+
'batch_reflection',
|
|
463
|
+
{
|
|
464
|
+
description:
|
|
465
|
+
'Add Reflections to Product Photos In Bulk — content-bottom detect + gradient fade (website canvas_add_reflection). Automation license required.',
|
|
466
|
+
inputSchema: {
|
|
467
|
+
inputDir: dirIn,
|
|
468
|
+
outputDir: dirOut,
|
|
469
|
+
intensity: z.number().min(10).max(100).optional(),
|
|
470
|
+
height: z.number().min(10).max(80).optional(),
|
|
471
|
+
offset: z.number().int().min(0).max(40).optional(),
|
|
472
|
+
background: z.string().optional(),
|
|
473
|
+
format: z.enum(['png', 'jpeg']).optional(),
|
|
474
|
+
},
|
|
475
|
+
},
|
|
476
|
+
async (args) => textResult(await ecom.batchReflection(env, args)),
|
|
477
|
+
);
|
|
478
|
+
|
|
479
|
+
server.registerTool(
|
|
480
|
+
'batch_add_shadow',
|
|
481
|
+
{
|
|
482
|
+
description:
|
|
483
|
+
'Add Shadow to Product Photos — rembg + drop|floating|long shadow (website canvas_add_shadow). Automation license required.',
|
|
484
|
+
inputSchema: {
|
|
485
|
+
inputDir: dirIn,
|
|
486
|
+
outputDir: dirOut,
|
|
487
|
+
shadowType: z.enum(['drop', 'floating', 'long']).optional(),
|
|
488
|
+
intensity: z.number().min(0).max(100).optional(),
|
|
489
|
+
blur: z.number().min(0).max(100).optional(),
|
|
490
|
+
angle: z.number().min(0).max(360).optional(),
|
|
491
|
+
distance: z.number().min(0).max(50).optional(),
|
|
492
|
+
outputSize: z.number().int().min(400).max(4000).optional(),
|
|
493
|
+
background: z.string().optional(),
|
|
494
|
+
shadowColor: z.string().optional(),
|
|
495
|
+
format: z.enum(['png', 'jpeg']).optional(),
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
async (args) => textResult(await ecom.batchAddShadow(env, args)),
|
|
499
|
+
);
|
|
500
|
+
|
|
501
|
+
server.registerTool(
|
|
502
|
+
'batch_blur_background',
|
|
503
|
+
{
|
|
504
|
+
description: 'Bulk Blur Background — subject kept sharp via local cutout. Automation license required.',
|
|
505
|
+
inputSchema: {
|
|
506
|
+
inputDir: dirIn,
|
|
507
|
+
outputDir: dirOut,
|
|
508
|
+
sigma: z.number().min(2).max(40).optional(),
|
|
509
|
+
},
|
|
510
|
+
},
|
|
511
|
+
async (args) => textResult(await ecom.batchBlurBackground(env, args)),
|
|
512
|
+
);
|
|
513
|
+
|
|
514
|
+
server.registerTool(
|
|
515
|
+
'generate_barcode_qr',
|
|
516
|
+
{
|
|
517
|
+
description: 'Barcode & QR Code Generator — writes PNGs to outputDir. Automation license required.',
|
|
518
|
+
inputSchema: {
|
|
519
|
+
outputDir: dirOut,
|
|
520
|
+
value: z.string().optional(),
|
|
521
|
+
values: z.array(z.string()).optional(),
|
|
522
|
+
type: z.string().optional().describe('bwip-js bcid, default qrcode (also code128, ean13, …)'),
|
|
523
|
+
scale: z.number().int().min(1).max(10).optional(),
|
|
524
|
+
includeText: z.boolean().optional(),
|
|
525
|
+
},
|
|
526
|
+
},
|
|
527
|
+
async (args) => textResult(await ecom.generateBarcodeQr(env, args)),
|
|
528
|
+
);
|
|
529
|
+
|
|
530
|
+
// ── Cloud AI (credit wallet — same as website; no FAL/FASHN keys in MCP) ──────
|
|
531
|
+
const qualityTierFashion = z.enum(['standard', 'quality', 'hero']).optional();
|
|
532
|
+
|
|
533
|
+
server.registerTool(
|
|
534
|
+
'ai_fashion_model',
|
|
535
|
+
{
|
|
536
|
+
description:
|
|
537
|
+
'AI Fashion Model — product/garment → on-model photo. Spends Cloud AI credits (not Automation file meter). Requires credits or Automation Pro 100 AI/mo.',
|
|
538
|
+
inputSchema: {
|
|
539
|
+
inputPath: fileIn,
|
|
540
|
+
outputPath: fileOut,
|
|
541
|
+
mode: z.enum(['on_model', 'try_on']).optional(),
|
|
542
|
+
qualityTier: qualityTierFashion,
|
|
543
|
+
modelPreset: z.string().optional(),
|
|
544
|
+
posePreset: z.string().optional(),
|
|
545
|
+
backgroundPreset: z.string().optional(),
|
|
546
|
+
facePath: z.string().optional().describe('Optional face reference image path'),
|
|
547
|
+
faceMode: z.enum(['match_reference', 'match_base']).optional(),
|
|
548
|
+
personPath: z.string().optional().describe('Required when mode=try_on'),
|
|
549
|
+
poseRefPath: z.string().optional(),
|
|
550
|
+
backgroundRefPath: z.string().optional(),
|
|
551
|
+
extraPrompt: z.string().optional(),
|
|
552
|
+
},
|
|
553
|
+
},
|
|
554
|
+
async (args) => textResult(await ai.aiFashionModel(env, args)),
|
|
555
|
+
);
|
|
556
|
+
|
|
557
|
+
server.registerTool(
|
|
558
|
+
'ai_virtual_try_on',
|
|
559
|
+
{
|
|
560
|
+
description:
|
|
561
|
+
'AI Virtual Try-On — garment + person photo. Spends Cloud AI credits. personPath required.',
|
|
562
|
+
inputSchema: {
|
|
563
|
+
inputPath: fileIn.describe('Absolute path to garment / product photo'),
|
|
564
|
+
personPath: z.string().describe('Absolute path to person photo'),
|
|
565
|
+
outputPath: fileOut,
|
|
566
|
+
qualityTier: qualityTierFashion,
|
|
567
|
+
extraPrompt: z.string().optional(),
|
|
568
|
+
},
|
|
569
|
+
},
|
|
570
|
+
async (args) => textResult(await ai.aiVirtualTryOn(env, args)),
|
|
571
|
+
);
|
|
572
|
+
|
|
573
|
+
server.registerTool(
|
|
574
|
+
'ai_fashion_model_swap',
|
|
575
|
+
{
|
|
576
|
+
description:
|
|
577
|
+
'AI Fashion Model Swap — keep outfit, change person identity. Spends Cloud AI credits.',
|
|
578
|
+
inputSchema: {
|
|
579
|
+
inputPath: fileIn.describe('On-model or mannequin photo'),
|
|
580
|
+
outputPath: fileOut,
|
|
581
|
+
qualityTier: qualityTierFashion,
|
|
582
|
+
identityPreset: z.string().optional(),
|
|
583
|
+
facePath: z.string().optional(),
|
|
584
|
+
faceMode: z.enum(['match_reference', 'match_base']).optional(),
|
|
585
|
+
extraPrompt: z.string().optional(),
|
|
586
|
+
},
|
|
587
|
+
},
|
|
588
|
+
async (args) => textResult(await ai.aiFashionModelSwap(env, args)),
|
|
589
|
+
);
|
|
590
|
+
|
|
591
|
+
server.registerTool(
|
|
592
|
+
'ai_fashion_model_creation',
|
|
593
|
+
{
|
|
594
|
+
description:
|
|
595
|
+
'AI Fashion Model Creation — generate a model from presets / notes. Image optional (pose ref). Spends Cloud AI credits.',
|
|
596
|
+
inputSchema: {
|
|
597
|
+
inputPath: z.string().optional().describe('Optional pose / composition reference path'),
|
|
598
|
+
outputPath: fileOut,
|
|
599
|
+
qualityTier: qualityTierFashion,
|
|
600
|
+
modelPreset: z.string().optional(),
|
|
601
|
+
posePreset: z.string().optional(),
|
|
602
|
+
backgroundPreset: z.string().optional(),
|
|
603
|
+
aspectRatio: z.enum(['1:1', '3:4', '4:5', '2:3', '9:16', '4:3', '16:9']).optional(),
|
|
604
|
+
clothingNotes: z.string().optional(),
|
|
605
|
+
facePath: z.string().optional(),
|
|
606
|
+
faceMode: z.enum(['match_reference', 'match_base']).optional(),
|
|
607
|
+
poseRefPath: z.string().optional(),
|
|
608
|
+
extraPrompt: z.string().optional(),
|
|
609
|
+
},
|
|
610
|
+
},
|
|
611
|
+
async (args) => textResult(await ai.aiFashionModelCreation(env, args)),
|
|
612
|
+
);
|
|
613
|
+
|
|
614
|
+
server.registerTool(
|
|
615
|
+
'ai_remove_object',
|
|
616
|
+
{
|
|
617
|
+
description:
|
|
618
|
+
'AI Remove Object — remove by removePrompt and/or maskPath. Spends Cloud AI credits.',
|
|
619
|
+
inputSchema: {
|
|
620
|
+
inputPath: fileIn,
|
|
621
|
+
outputPath: fileOut,
|
|
622
|
+
removePrompt: z.string().optional(),
|
|
623
|
+
maskPath: z.string().optional().describe('Optional brush-mask image path'),
|
|
624
|
+
qualityModel: z.enum(['low_quality', 'medium_quality', 'high_quality', 'best_quality']).optional(),
|
|
625
|
+
maskExpansion: z.number().int().min(0).max(50).optional(),
|
|
626
|
+
},
|
|
627
|
+
},
|
|
628
|
+
async (args) => textResult(await ai.aiRemoveObject(env, args)),
|
|
629
|
+
);
|
|
630
|
+
|
|
631
|
+
server.registerTool(
|
|
632
|
+
'ai_watermark_remover',
|
|
633
|
+
{
|
|
634
|
+
description: 'AI Watermark Remover — auto-detect text/watermarks. Spends Cloud AI credits.',
|
|
635
|
+
inputSchema: { inputPath: fileIn, outputPath: fileOut },
|
|
636
|
+
},
|
|
637
|
+
async (args) => textResult(await ai.aiWatermarkRemover(env, args)),
|
|
638
|
+
);
|
|
639
|
+
|
|
640
|
+
server.registerTool(
|
|
641
|
+
'ai_lifestyle_product_photos',
|
|
642
|
+
{
|
|
643
|
+
description:
|
|
644
|
+
'AI Lifestyle Product Photos — place product in a real-life scene. Spends Cloud AI credits.',
|
|
645
|
+
inputSchema: {
|
|
646
|
+
inputPath: fileIn,
|
|
647
|
+
outputPath: fileOut,
|
|
648
|
+
scenePreset: z.string().optional(),
|
|
649
|
+
qualityTier: z.enum(['standard', 'best']).optional(),
|
|
650
|
+
imageSize: z.string().optional(),
|
|
651
|
+
sceneDetails: z.string().optional(),
|
|
652
|
+
placementMode: z.enum(['on_surface', 'in_use']).optional(),
|
|
653
|
+
generateTwo: z.boolean().optional(),
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
async (args) => textResult(await ai.aiLifestyleProductPhotos(env, args)),
|
|
657
|
+
);
|
|
658
|
+
|
|
659
|
+
server.registerTool(
|
|
660
|
+
'ai_product_backgrounds',
|
|
661
|
+
{
|
|
662
|
+
description:
|
|
663
|
+
'AI Product Backgrounds — replace backdrop, keep product. Spends Cloud AI credits.',
|
|
664
|
+
inputSchema: {
|
|
665
|
+
inputPath: fileIn,
|
|
666
|
+
outputPath: fileOut,
|
|
667
|
+
backdropPreset: z.string().optional(),
|
|
668
|
+
qualityTier: z.enum(['standard', 'best']).optional(),
|
|
669
|
+
backdropDetails: z.string().optional(),
|
|
670
|
+
negativeDetails: z.string().optional(),
|
|
671
|
+
generateTwo: z.boolean().optional(),
|
|
672
|
+
},
|
|
673
|
+
},
|
|
674
|
+
async (args) => textResult(await ai.aiProductBackgrounds(env, args)),
|
|
675
|
+
);
|
|
676
|
+
|
|
677
|
+
server.registerTool(
|
|
678
|
+
'ai_8k_upscaler',
|
|
679
|
+
{
|
|
680
|
+
description:
|
|
681
|
+
'8K Image Upscaler — ESRGAN super-resolution via Cloud AI (slug 8k-texture-upscaler). Spends credits.',
|
|
682
|
+
inputSchema: { inputPath: fileIn, outputPath: fileOut },
|
|
683
|
+
},
|
|
684
|
+
async (args) => textResult(await ai.ai8kUpscaler(env, args)),
|
|
685
|
+
);
|
|
686
|
+
|
|
687
|
+
server.registerTool(
|
|
688
|
+
'ai_product_beautifier',
|
|
689
|
+
{
|
|
690
|
+
description:
|
|
691
|
+
'AI Product Beautifier — polish lighting/backdrop while preserving SKU identity. Spends Cloud AI credits.',
|
|
692
|
+
inputSchema: {
|
|
693
|
+
inputPath: fileIn,
|
|
694
|
+
outputPath: fileOut,
|
|
695
|
+
style: z.enum(['product_photography', 'minimal_white', 'lifestyle']).optional(),
|
|
696
|
+
},
|
|
697
|
+
},
|
|
698
|
+
async (args) => textResult(await ai.aiProductBeautifier(env, args)),
|
|
699
|
+
);
|
|
700
|
+
|
|
701
|
+
server.registerTool(
|
|
702
|
+
'ai_image_colorizer',
|
|
703
|
+
{
|
|
704
|
+
description: 'AI Image Colorizer — colorize B&W / faded photos. Spends Cloud AI credits.',
|
|
705
|
+
inputSchema: { inputPath: fileIn, outputPath: fileOut },
|
|
706
|
+
},
|
|
707
|
+
async (args) => textResult(await ai.aiImageColorizer(env, args)),
|
|
708
|
+
);
|
|
709
|
+
|
|
710
|
+
server.registerTool(
|
|
711
|
+
'ai_uncrop',
|
|
712
|
+
{
|
|
713
|
+
description:
|
|
714
|
+
'AI Uncrop — generative outpaint / expand canvas. Spends Cloud AI credits (Light 4 · Medium 5 · Strong 6).',
|
|
715
|
+
inputSchema: {
|
|
716
|
+
inputPath: fileIn,
|
|
717
|
+
outputPath: fileOut,
|
|
718
|
+
framePreset: z.enum(['around', 'horizontal', 'vertical', 'zoom_out', '1:1', '4:5', '9:16', '16:9', '3:2']).optional(),
|
|
719
|
+
expandAmount: z.enum(['light', 'medium', 'strong']).optional(),
|
|
720
|
+
expandPrompt: z.string().optional(),
|
|
721
|
+
},
|
|
722
|
+
},
|
|
723
|
+
async (args) => textResult(await ai.aiUncrop(env, args)),
|
|
724
|
+
);
|
|
725
|
+
|
|
726
|
+
async function main() {
|
|
727
|
+
const transport = new StdioServerTransport();
|
|
728
|
+
await server.connect(transport);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
main().catch((err) => {
|
|
732
|
+
console.error('[imageconvertit-mcp]', err?.message ?? err);
|
|
733
|
+
process.exit(1);
|
|
734
|
+
});
|