@icogenie/mcp 0.2.0 → 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/dist/index.js +87 -7
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -6,6 +6,86 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
6
6
|
// src/server.ts
|
|
7
7
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
8
8
|
|
|
9
|
+
// ../icogenie-shared/src/credits.ts
|
|
10
|
+
var CREDIT_CONFIG = {
|
|
11
|
+
// Purchase rates
|
|
12
|
+
pricing: {
|
|
13
|
+
dollarsPerPurchase: 1,
|
|
14
|
+
// $1 minimum purchase
|
|
15
|
+
creditsPerDollar: 10
|
|
16
|
+
// 10 credits per $1
|
|
17
|
+
},
|
|
18
|
+
// Consumption costs
|
|
19
|
+
costs: {
|
|
20
|
+
preview: 1,
|
|
21
|
+
// 1 credit per preview generation
|
|
22
|
+
vectorDownload: 5,
|
|
23
|
+
// 5 credits per SVG/vector download
|
|
24
|
+
// Bundle costs (per icon in bundle)
|
|
25
|
+
bundlePreview: 1,
|
|
26
|
+
// 1 credit per icon preview in bundle
|
|
27
|
+
bundleDownload: 4
|
|
28
|
+
// 4 credits per icon download in bundle (20% discount)
|
|
29
|
+
},
|
|
30
|
+
// Free tier
|
|
31
|
+
freeTier: {
|
|
32
|
+
signupCredits: 8
|
|
33
|
+
// 8 free credits on account creation
|
|
34
|
+
// This allows: 1 full icon (preview + download = 6) + 2 extra previews
|
|
35
|
+
// Or: 8 previews to explore before purchasing
|
|
36
|
+
},
|
|
37
|
+
// Bulk purchase bonuses
|
|
38
|
+
bulkBonuses: [
|
|
39
|
+
{ minDollars: 5, bonusPercent: 10 },
|
|
40
|
+
// $5 → 55 credits (50 + 5 bonus)
|
|
41
|
+
{ minDollars: 10, bonusPercent: 20 },
|
|
42
|
+
// $10 → 120 credits (100 + 20 bonus)
|
|
43
|
+
{ minDollars: 25, bonusPercent: 30 }
|
|
44
|
+
// $25 → 325 credits (250 + 75 bonus)
|
|
45
|
+
],
|
|
46
|
+
// Purchase packages for checkout UI
|
|
47
|
+
packages: [
|
|
48
|
+
{ dollars: 1, description: "Perfect for trying out" },
|
|
49
|
+
{ dollars: 5, description: "+10% bonus" },
|
|
50
|
+
{ dollars: 10, description: "+20% bonus" },
|
|
51
|
+
{ dollars: 25, description: "+30% bonus" }
|
|
52
|
+
],
|
|
53
|
+
// Bundle discount tiers
|
|
54
|
+
bundleDiscounts: [
|
|
55
|
+
{ minIcons: 5, discountPercent: 20 },
|
|
56
|
+
{ minIcons: 10, discountPercent: 30 }
|
|
57
|
+
],
|
|
58
|
+
// Rate limits (abuse prevention)
|
|
59
|
+
rateLimits: {
|
|
60
|
+
previewsPerMinute: 10,
|
|
61
|
+
// Max 10 previews per minute
|
|
62
|
+
downloadsPerMinute: 5,
|
|
63
|
+
// Max 5 downloads per minute
|
|
64
|
+
maxCreditsPerDay: 1e3
|
|
65
|
+
// Max credit consumption per day
|
|
66
|
+
},
|
|
67
|
+
// Observability thresholds
|
|
68
|
+
alerts: {
|
|
69
|
+
lowBalanceWarning: 5,
|
|
70
|
+
// Warn when balance drops below 5 credits
|
|
71
|
+
highUsageThreshold: 100,
|
|
72
|
+
// Flag accounts using >100 credits/day
|
|
73
|
+
unusualPatternWindow: 3600
|
|
74
|
+
// Time window (seconds) for pattern detection
|
|
75
|
+
},
|
|
76
|
+
// Referral program
|
|
77
|
+
referral: {
|
|
78
|
+
referrerReward: 20,
|
|
79
|
+
// Credits for referrer when referee activates
|
|
80
|
+
refereeBonus: 20,
|
|
81
|
+
// Credits for referee on activation
|
|
82
|
+
activationGate: "first_generation",
|
|
83
|
+
// What counts as activation
|
|
84
|
+
attributionWindow: 30
|
|
85
|
+
// Days to track referral attribution
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
9
89
|
// src/tools/generate.ts
|
|
10
90
|
import { z } from "zod";
|
|
11
91
|
|
|
@@ -268,7 +348,7 @@ async function generateBundle(options) {
|
|
|
268
348
|
// src/tools/generate.ts
|
|
269
349
|
var generateIconSchema = {
|
|
270
350
|
prompt: z.string().describe("Description of the icon to generate"),
|
|
271
|
-
style: z.enum(["solid", "outline"]).default("solid").describe("Icon style"),
|
|
351
|
+
style: z.enum(["solid", "outline", "illustration"]).default("solid").describe("Icon style: solid (filled shapes), outline (stroked lines), or illustration (colorful, detailed)"),
|
|
272
352
|
variations: z.union([z.literal(1), z.literal(2), z.literal(4)]).default(1).describe("Number of variations (1, 2, or 4)"),
|
|
273
353
|
referenceImagePath: z.string().optional().describe("Local file path to reference image for style extraction"),
|
|
274
354
|
referenceImage: z.object({
|
|
@@ -372,7 +452,7 @@ import { z as z4 } from "zod";
|
|
|
372
452
|
var normalizeBundleSchema = {
|
|
373
453
|
description: z4.string().describe("Description of the icon bundle to create"),
|
|
374
454
|
targetCount: z4.number().optional().describe("Target number of icons (2-20)"),
|
|
375
|
-
style: z4.enum(["solid", "outline"]).optional().describe("Preferred icon style")
|
|
455
|
+
style: z4.enum(["solid", "outline", "illustration"]).optional().describe("Preferred icon style")
|
|
376
456
|
};
|
|
377
457
|
async function normalizeBundleTool(args) {
|
|
378
458
|
const result = await normalizeBundle({
|
|
@@ -400,7 +480,7 @@ var generateBundleSchema = {
|
|
|
400
480
|
).optional().describe("Icon list from normalize_bundle or custom"),
|
|
401
481
|
description: z5.string().optional().describe("Alternative: describe the bundle to auto-generate icon list"),
|
|
402
482
|
targetCount: z5.number().optional().describe("Target icon count when using description"),
|
|
403
|
-
style: z5.enum(["solid", "outline"]).default("solid").describe("Icon style"),
|
|
483
|
+
style: z5.enum(["solid", "outline", "illustration"]).default("solid").describe("Icon style: solid (filled shapes), outline (stroked lines), or illustration (colorful, detailed)"),
|
|
404
484
|
referenceImagePath: z5.string().optional().describe("Local file path to reference image"),
|
|
405
485
|
referenceImage: z5.object({
|
|
406
486
|
data: z5.string(),
|
|
@@ -446,7 +526,7 @@ function createServer() {
|
|
|
446
526
|
"generate_icon",
|
|
447
527
|
{
|
|
448
528
|
title: "Generate Icon",
|
|
449
|
-
description:
|
|
529
|
+
description: `Generate an AI-powered icon preview from a text description. Costs ${CREDIT_CONFIG.costs.preview} credit. Returns a generationId for download. After generation, save the preview image to the user's working directory and display it.`,
|
|
450
530
|
inputSchema: generateIconSchema
|
|
451
531
|
},
|
|
452
532
|
async (args) => {
|
|
@@ -461,7 +541,7 @@ function createServer() {
|
|
|
461
541
|
"regenerate_icon",
|
|
462
542
|
{
|
|
463
543
|
title: "Regenerate Icon",
|
|
464
|
-
description:
|
|
544
|
+
description: `Regenerate a specific icon variation with an optional custom prompt. Costs ${CREDIT_CONFIG.costs.preview} credit. Use with generationId (single) or bundleId (bundle). After regeneration, save and display the new preview.`,
|
|
465
545
|
inputSchema: regenerateIconSchema
|
|
466
546
|
},
|
|
467
547
|
async (args) => {
|
|
@@ -491,7 +571,7 @@ function createServer() {
|
|
|
491
571
|
"download_icon",
|
|
492
572
|
{
|
|
493
573
|
title: "Download Icon",
|
|
494
|
-
description:
|
|
574
|
+
description: `Download the final SVG + PNG package for an icon. Costs ${CREDIT_CONFIG.costs.vectorDownload} credits (single) or ${CREDIT_CONFIG.costs.bundleDownload} credits/icon (bundle). Provide outputPath to save to file. Always save to the user's working directory with a descriptive filename.`,
|
|
495
575
|
inputSchema: downloadIconSchema
|
|
496
576
|
},
|
|
497
577
|
async (args) => {
|
|
@@ -521,7 +601,7 @@ function createServer() {
|
|
|
521
601
|
"generate_bundle",
|
|
522
602
|
{
|
|
523
603
|
title: "Generate Bundle",
|
|
524
|
-
description:
|
|
604
|
+
description: `Generate a bundle of icons from an icon list. Costs ${CREDIT_CONFIG.costs.bundlePreview} credit per icon. Use normalize_bundle first to plan, or provide icons directly. After generation, save preview images to the user's working directory and display them.`,
|
|
525
605
|
inputSchema: generateBundleSchema
|
|
526
606
|
},
|
|
527
607
|
async (args) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icogenie/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "MCP server for IcoGenie - Enable AI agents to generate icons programmatically",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
19
19
|
"conf": "^12.0.0",
|
|
20
20
|
"open": "^10.0.0",
|
|
21
|
-
"zod": "^3.23.0"
|
|
21
|
+
"zod": "^3.23.0",
|
|
22
|
+
"@icogenie/shared": "0.1.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"@types/node": "^20.0.0",
|
|
@@ -55,7 +56,7 @@
|
|
|
55
56
|
"registry": "https://registry.npmjs.org/"
|
|
56
57
|
},
|
|
57
58
|
"scripts": {
|
|
58
|
-
"build": "tsup
|
|
59
|
+
"build": "tsup",
|
|
59
60
|
"dev": "tsup src/index.ts --format esm --target node18 --watch",
|
|
60
61
|
"type-check": "tsc --noEmit",
|
|
61
62
|
"start": "node dist/index.js",
|