@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 CHANGED
@@ -1,3 +1,130 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @imageconvertit/mcp-server
2
+
3
+ **One** local **stdio** MCP package — two meters:
4
+
5
+ | Meter | Tools | Gate |
6
+ |-------|-------|------|
7
+ | **Core** (E-Commerce + Format) | Folder batch tools | Automation `$19` / `$29` / `$49` via `POST /api/mcp/authorize` |
8
+ | **Cloud AI** (12 tools) | Single-image AI tools | Same **credit wallet** as the website via `POST /api/run-ai` |
9
+
10
+ There is **not** a second MCP package. Claude / Cursor / VS Code / Codex / Gemini CLI all use this same `@imageconvertit/mcp-server`.
11
+
12
+ **Provider keys never ship to clients.** FAL / FASHN / GROQ stay on Cloudflare. MCP only uses `ICI_LICENSE_KEY` → mints `api_token` → calls our API.
13
+
14
+ Version **0.3.1**
15
+
16
+ ## Requirements
17
+
18
+ - Node 20+
19
+ - `ICI_LICENSE_KEY` = LemonSqueezy key (Automation for Core batches; any key with credits / Automation Pro for Cloud AI)
20
+ - Optional: `ICI_DEVICE_ID` (stable seat id; auto-persisted under `~/.imageconvertit/` if omitted)
21
+ - First rembg call downloads ONNX models (cached)
22
+
23
+ ## Tools
24
+
25
+ ### Format & Conversion
26
+ | Product | MCP tool |
27
+ |---------|----------|
28
+ | Bulk Image Compressor | `batch_compress` |
29
+ | Bulk Image Cropper | `batch_crop` |
30
+ | Bulk Image Resizer | `batch_resize` |
31
+ | Bulk Image Converter | `batch_convert` |
32
+ | PNG to WebP Converter | `batch_png_to_webp` |
33
+ | HEIC → PNG / JPG / PDF | `batch_heic_convert` |
34
+ | Bulk Image Upscale (Lanczos) | `batch_upscale` |
35
+ | Bulk Image to PDF | `batch_images_to_pdf` |
36
+ | Bulk PDF to Image | `batch_pdf_to_images` |
37
+ | AI Vectorize (local potrace) | `batch_vectorize` |
38
+ | Bulk Black and White | `batch_grayscale` |
39
+ | Bulk Image Rotator | `batch_rotate` |
40
+ | Book Cover Bleed Checker | `batch_bleed_checker` (+ `bleed-report.json`) |
41
+
42
+ ### E-Commerce & Creators
43
+ | Product | MCP tool |
44
+ |---------|----------|
45
+ | Bulk Background Remover | `batch_remove_background` |
46
+ | Amazon/Shopify White Background | `batch_white_background` |
47
+ | Bulk Background Colour Changer | `batch_background_color` |
48
+ | Bulk Catalog Watermarking | `batch_watermark` (text and/or `watermarkPath`) |
49
+ | Add Text to Product Photos | `batch_text_overlay` |
50
+ | Adjust Product Photos In Bulk | `batch_adjust` |
51
+ | Align Product Photos In Bulk | `batch_align_center` |
52
+ | Add Logo to Product Photos In Bulk | `batch_logo_overlay` |
53
+ | Add Reflections to Product Photos In Bulk | `batch_reflection` |
54
+ | Add Shadow to Product Photos | `batch_add_shadow` |
55
+ | Bulk Blur Background | `batch_blur_background` |
56
+ | Barcode & QR Code Generator | `generate_barcode_qr` |
57
+
58
+ ### Cloud AI (credit-strict)
59
+ | Product | MCP tool | Server slug |
60
+ |---------|----------|-------------|
61
+ | AI Fashion Model | `ai_fashion_model` | `ai-fashion-model` |
62
+ | AI Virtual Try-On | `ai_virtual_try_on` | `ai-virtual-try-on` |
63
+ | AI Fashion Model Swap | `ai_fashion_model_swap` | `ai-fashion-model-swap` |
64
+ | AI Fashion Model Creation | `ai_fashion_model_creation` | `ai-fashion-model-creation` |
65
+ | AI Remove Object | `ai_remove_object` | `ai-remove-object` |
66
+ | AI Watermark Remover | `ai_watermark_remover` | `watermark-remover` |
67
+ | AI Lifestyle Product Photos | `ai_lifestyle_product_photos` | `ai-lifestyle-product-photos` |
68
+ | AI Product Backgrounds | `ai_product_backgrounds` | `ai-product-backgrounds` |
69
+ | 8K Image Upscaler | `ai_8k_upscaler` | `8k-texture-upscaler` |
70
+ | AI Product Beautifier | `ai_product_beautifier` | `ai-product-beautifier` |
71
+ | AI Image Colorizer | `ai_image_colorizer` | `image-colorizer` |
72
+ | AI Uncrop | `ai_uncrop` | `ai-uncrop` |
73
+
74
+ Cloud AI tools take absolute **file paths** (`inputPath` / `outputPath`). Without credits the API returns **402** — no free Cloud AI via MCP.
75
+
76
+ Also: `mcp_status`, legacy `batch_resize_compress` / `batch_amazon_prep`.
77
+
78
+ ## Client setup (verified 2026-11-17)
79
+
80
+ | Client | Config file | Format |
81
+ |--------|-------------|--------|
82
+ | Claude Desktop | `claude_desktop_config.json` | `mcpServers` JSON |
83
+ | Cursor | `~/.cursor/mcp.json` or `.cursor/mcp.json` | `mcpServers` JSON |
84
+ | VS Code | `.vscode/mcp.json` | `servers` + `"type":"stdio"` |
85
+ | Codex / ChatGPT desktop | `~/.codex/config.toml` | `[mcp_servers.imageconvertit]` |
86
+ | Gemini CLI | `~/.gemini/settings.json` | `mcpServers` JSON |
87
+
88
+ ```json
89
+ {
90
+ "mcpServers": {
91
+ "imageconvertit": {
92
+ "command": "npx",
93
+ "args": ["-y", "@imageconvertit/mcp-server"],
94
+ "env": {
95
+ "ICI_LICENSE_KEY": "YOUR_LEMONSQUEEZY_LICENSE_KEY",
96
+ "ICI_API_BASE": "https://imageconvertit.com"
97
+ }
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ **Do not** put `FAL_API_KEY`, `FASHN_API_KEY`, or `GROQ_API_KEY` in MCP env — they are rejected by design (unused) and must stay on the server.
104
+
105
+ Codex / ChatGPT desktop TOML:
106
+
107
+ ```toml
108
+ [mcp_servers.imageconvertit]
109
+ command = "npx"
110
+ args = ["-y", "@imageconvertit/mcp-server"]
111
+
112
+ [mcp_servers.imageconvertit.env]
113
+ ICI_LICENSE_KEY = "YOUR_LEMONSQUEEZY_LICENSE_KEY"
114
+ ICI_API_BASE = "https://imageconvertit.com"
115
+ ```
116
+
117
+ ## Dev smoke (local Core ops, no Cloud AI network)
118
+
119
+ ```bash
120
+ cd packages/mcp-server && npm run smoke
121
+ ```
122
+
123
+ ## Notes
124
+
125
+ - **One package, two meters** — Core = Automation files; Cloud AI = credits
126
+ - Paths only for Core — never send image bytes through the model
127
+ - Cloud AI: MCP reads the file locally, POSTs to `/api/run-ai`, writes the result path
128
+ - Max 50 files/pages per Core authorize call · concurrency ≤ 3
129
+ - Publish this package to npm before relying on `npx -y`
130
+ - Deploy `/api/mcp/authorize` + `/api/run-ai` for live metering
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
- {
2
- "name": "@imageconvertit/mcp-server",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@imageconvertit/mcp-server",
3
+ "version": "0.3.1",
4
+ "description": "ImageConvertIt local MCP — Core (E-Commerce + Format, Automation file meter) + Cloud AI (12 tools, website credit wallet). Provider keys never leave the server.",
5
+ "type": "module",
6
+ "bin": {
7
+ "imageconvertit-mcp": "src/index.js"
8
+ },
9
+ "main": "./src/index.js",
10
+ "files": [
11
+ "src",
12
+ "README.md"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "engines": {
18
+ "node": ">=20"
19
+ },
20
+ "scripts": {
21
+ "start": "node ./src/index.js",
22
+ "smoke": "node ./scripts/smoke-ops.mjs",
23
+ "audit:cloud-ai": "node ./scripts/audit-cloud-ai.mjs"
24
+ },
25
+ "dependencies": {
26
+ "@imgly/background-removal-node": "^1.4.5",
27
+ "@modelcontextprotocol/sdk": "^1.12.1",
28
+ "@napi-rs/canvas": "^0.1.65",
29
+ "bwip-js": "^4.5.1",
30
+ "heic-convert": "^2.1.0",
31
+ "pdf-lib": "^1.17.1",
32
+ "pdfjs-dist": "^4.10.38",
33
+ "potrace": "^2.1.8",
34
+ "sharp": "^0.34.1",
35
+ "zod": "^3.24.2"
36
+ },
37
+ "keywords": [
38
+ "mcp",
39
+ "imageconvertit",
40
+ "image",
41
+ "sharp",
42
+ "ecommerce",
43
+ "cloud-ai"
44
+ ],
45
+ "license": "MIT",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "https://github.com/imageconvertit/imageconvertit"
49
+ }
50
+ }
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Call ImageConvertIt /api/mcp/authorize before each Core batch.
3
+ * Supports charge (default), status, and refund (failed files after charge).
4
+ */
5
+
6
+ const DEFAULT_BASE = 'https://imageconvertit.com';
7
+
8
+ /**
9
+ * @param {{
10
+ * licenseKey: string,
11
+ * fileCount?: number,
12
+ * apiBase?: string,
13
+ * action?: 'charge'|'status'|'refund',
14
+ * }} opts
15
+ * @returns {Promise<{
16
+ * allowed: boolean,
17
+ * error?: string,
18
+ * remaining?: number,
19
+ * limit?: number,
20
+ * plan?: string,
21
+ * used?: number,
22
+ * month?: string,
23
+ * }>}
24
+ */
25
+ export async function authorizeBatch({
26
+ licenseKey,
27
+ fileCount = 1,
28
+ apiBase = DEFAULT_BASE,
29
+ action = 'charge',
30
+ }) {
31
+ if (!licenseKey || typeof licenseKey !== 'string') {
32
+ return { allowed: false, error: 'ICI_LICENSE_KEY is required (MCP plan).' };
33
+ }
34
+ const base = (apiBase || DEFAULT_BASE).replace(/\/$/, '');
35
+ const act = action === 'status' || action === 'refund' ? action : 'charge';
36
+ let res;
37
+ try {
38
+ res = await fetch(`${base}/api/mcp/authorize`, {
39
+ method: 'POST',
40
+ headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
41
+ body: JSON.stringify({
42
+ license_key: licenseKey.trim(),
43
+ action: act,
44
+ file_count: Math.min(50, Math.max(1, Number(fileCount) || 1)),
45
+ }),
46
+ });
47
+ } catch (e) {
48
+ return { allowed: false, error: `Network error: ${e?.message ?? e}` };
49
+ }
50
+ let json = null;
51
+ try {
52
+ json = await res.json();
53
+ } catch {
54
+ return { allowed: false, error: `Authorize failed (${res.status}).` };
55
+ }
56
+ if (!res.ok || !json?.allowed) {
57
+ return {
58
+ allowed: false,
59
+ error: json?.error ?? `Authorize denied (${res.status}).`,
60
+ remaining: json?.remaining,
61
+ limit: json?.limit,
62
+ plan: json?.plan,
63
+ used: json?.used,
64
+ };
65
+ }
66
+ return {
67
+ allowed: true,
68
+ remaining: json.remaining,
69
+ limit: json.limit,
70
+ plan: json.plan,
71
+ month: json.month,
72
+ used: json.used,
73
+ };
74
+ }