@snowcone-app/mcp 0.9.0 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @snowcone-app/mcp
2
2
 
3
+ ## 0.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2973](https://github.com/snowcone-app/snowcone-monorepo/pull/2973) [`6910bc9`](https://github.com/snowcone-app/snowcone-monorepo/commit/6910bc9c88dbdcc5974d45ee93d2b2e17fff3bcf) Thanks [@kevinsproles](https://github.com/kevinsproles)! - The SDK owns Snowcone's hostnames. New `SNOWCONE_HOSTS` export (`api`, `img`, `buy`, `search`, `cdn`, `sign`, `raws`, `docs`) and `SNOWCONE_REALTIME_WS_URL` — every default host in the SDK, MCP server, canvas, and ui now reads from this one registry, so a host move ships as a version bump instead of breaking integrations. For an endpoint the SDK doesn't wrap, build the URL from `SNOWCONE_HOSTS.api` rather than hardcoding `https://api.snowcone.app`.
8
+
9
+ ## 0.9.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#4283](https://github.com/snowcone-app/snowcone-monorepo/pull/4283) [`4fbaaf1`](https://github.com/snowcone-app/snowcone-monorepo/commit/4fbaaf161d0c580a1c56790a9a4c54f676a92abc) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Examples and tool descriptions use live demo products: the iPhone 17 Pro Max Case (`BC43BE`), the Canvas Tote (`CAXHQC`) and the All-Over Print Zip Hoodie (`XTNA6J`), in place of the Framed Canvas (`BEEB77`) and Women's Tee (`KMYKUK`), which are no longer for sale. No API change.
14
+
3
15
  ## 0.9.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -57,7 +57,7 @@ URL builder is bundled in).
57
57
  ## The happy path
58
58
 
59
59
  1. `snowcone_mint_shop` once → get a `shop_id` (reuse it everywhere).
60
- 2. `snowcone_get_product` to pick a product code (`BEEB77` is a good demo).
60
+ 2. `snowcone_get_product` to pick a product code (`BC43BE` is a good demo).
61
61
  3. `snowcone_render_mockup` with the code, your `shop_id`, and a **publicly
62
62
  fetchable** image URL → an image URL you can drop anywhere.
63
63
  4. `snowcone_buy_url` to sell it; hand `claim.verification_uri_complete` to your
package/dist/index.js CHANGED
@@ -7,11 +7,232 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
7
7
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
8
8
  import { z } from "zod";
9
9
 
10
+ // ../mockup-url/src/index.ts
11
+ var SNOWCONE_HOSTS = {
12
+ /** REST API: shops, orders, AI generation, realtime grants. */
13
+ api: "https://api.snowcone.app",
14
+ /** Public mockup-image resolver (`/{productCode}?shop=…&asset=…`). */
15
+ img: "https://img.snowcone.app",
16
+ /** Hosted buy page (same grammar as `img`, opens checkout). */
17
+ buy: "https://buy.snowcone.app",
18
+ /** Public product / designs catalog (Meilisearch-compatible). */
19
+ search: "https://search.snowcone.app",
20
+ /** Render CDN — signed render URLs and the realtime socket. */
21
+ cdn: "https://cdn.snowcone.app",
22
+ /** Legacy URL signer. */
23
+ sign: "https://s.snowcone.app",
24
+ /** Content-addressed artwork store (ingest handles). */
25
+ raws: "https://raws.snowcone.app",
26
+ /** Developer docs. */
27
+ docs: "https://developers.snowcone.app"
28
+ };
29
+ var SNOWCONE_REALTIME_WS_URL = `${SNOWCONE_HOSTS.cdn.replace(/^http/, "ws")}/realtime`;
30
+ var PARAMS = {
31
+ shop: "shop",
32
+ asset: "asset",
33
+ assets: "assets",
34
+ /**
35
+ * Render a catalog design by reference (ADR-0086): `design=<pairingId|slug>`.
36
+ * The resolver looks the design up in the public `snowcone-designs` index
37
+ * (membership = license) and injects its asset components server-side, so no
38
+ * raw asset URL crosses the wire and no origin allowlisting is involved.
39
+ * Catalog renders are FREE — mutually exclusive with `asset`/`asset.<key>`/
40
+ * `color.<key>` (free = the design as published).
41
+ */
42
+ design: "design",
43
+ placement: "placement",
44
+ /**
45
+ * Album page selector (ADR-0086 §5): `page=N` (positive integer) picks which
46
+ * page/spread of an album product a mockup renders. Only valid on products
47
+ * whose catalog entry carries an `album` block — the edge resolver maps page
48
+ * N onto the repeating page placement (`page_N` → the geometry of
49
+ * `album.pagePlacement`); the catalog never enumerates `page_1…page_100` and
50
+ * the render server is unchanged.
51
+ */
52
+ page: "page",
53
+ variant: "variant",
54
+ mockup: "mockup",
55
+ width: "width",
56
+ grain: "grain",
57
+ aspect: "aspect",
58
+ /**
59
+ * Background color (6-hex, no '#') painted behind the mockup — visible only
60
+ * where the mockup itself has transparency (studio-cutout shots) — or the
61
+ * reserved `transparent` token, which suppresses the shop default for this
62
+ * one render. Absent = the shop's configured default, else transparent.
63
+ */
64
+ bg: "bg",
65
+ /** Live preview/calibration mask overrides (not cached). */
66
+ maskOverrides: "maskOverrides",
67
+ /**
68
+ * Render-only option picks (the `affectsCombinations:false` attributes), as a
69
+ * base64 JSON map `{ attributeName: choiceLabel }`. The render server already parses
70
+ * this and resolves per-choice underlays from it; the builder emits it so the
71
+ * edge resolver can forward render-only picks (e.g. a cap's Crown/Strap color)
72
+ * without changing the server grammar.
73
+ */
74
+ optionSelections: "optionSelections",
75
+ signature: "signature",
76
+ seal: "seal"
77
+ };
78
+ var BG_TRANSPARENT = "transparent";
79
+ function normalizeBgColor(raw) {
80
+ const value = raw.trim().replace(/^#/, "").toLowerCase();
81
+ if (value === BG_TRANSPARENT) return BG_TRANSPARENT;
82
+ return /^[0-9a-f]{6}$/.test(value) ? value : null;
83
+ }
84
+ function requireBgColor(raw) {
85
+ const bg = normalizeBgColor(raw);
86
+ if (bg === null) {
87
+ throw new Error(
88
+ `[snowcone] bg must be a 6-digit hex color ('#' optional, e.g. "f5f0ea") or "transparent", got "${raw}"`
89
+ );
90
+ }
91
+ return bg;
92
+ }
93
+ var MAX_RENDER_URL_LENGTH = 12 * 1024;
94
+ var INGEST_HANDLE_BASE = `${SNOWCONE_HOSTS.raws}/art-ingest/`;
95
+ var PARAM_PREFIX = {
96
+ asset: "asset.",
97
+ color: "color.",
98
+ tile: "tile.",
99
+ align: "align.",
100
+ opt: "opt.",
101
+ /** ADR-0099 bundles: `variant.<role>=<gvid>` — one SKU per member slot. */
102
+ variant: "variant.",
103
+ /** ADR-0099 bundles: `pick.<role>=<productCode>` — which alternative fills a slot. */
104
+ pick: "pick."
105
+ };
106
+ var DEFAULT_PUBLIC_BASE_URL = SNOWCONE_HOSTS.img;
107
+ function buildPublicMockupUrl(options, cfg = {}) {
108
+ const base = (cfg.baseUrl ?? DEFAULT_PUBLIC_BASE_URL).replace(/\/+$/, "");
109
+ const path = `/${encodeURIComponent(options.productCode)}`;
110
+ const enc = encodeURIComponent;
111
+ const parts = [];
112
+ parts.push(`${PARAMS.shop}=${enc(options.shop)}`);
113
+ if (options.designRef !== void 0) {
114
+ parts.push(`${PARAMS.design}=${enc(options.designRef)}`);
115
+ } else {
116
+ if (options.assetUrl !== void 0) {
117
+ parts.push(`${PARAMS.asset}=${enc(options.assetUrl)}`);
118
+ }
119
+ const overrides = options.design || options.placements ? { ...options.design ?? {}, ...options.placements ?? {} } : void 0;
120
+ if (overrides) {
121
+ for (const key of Object.keys(overrides).sort()) {
122
+ const fill = overrides[key];
123
+ const k = enc(key);
124
+ if (typeof fill === "string") {
125
+ parts.push(`${PARAM_PREFIX.asset}${k}=${enc(fill)}`);
126
+ } else if ("color" in fill) {
127
+ parts.push(`${PARAM_PREFIX.color}${k}=${enc(fill.color)}`);
128
+ } else {
129
+ parts.push(`${PARAM_PREFIX.asset}${k}=${enc(fill.src)}`);
130
+ if (fill.tile !== void 0) {
131
+ parts.push(`${PARAM_PREFIX.tile}${k}=${fill.tile}`);
132
+ }
133
+ if (fill.align !== void 0) {
134
+ parts.push(`${PARAM_PREFIX.align}${k}=${enc(fill.align)}`);
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
140
+ if (options.placement !== void 0) {
141
+ parts.push(`${PARAMS.placement}=${enc(options.placement)}`);
142
+ }
143
+ if (options.page !== void 0) {
144
+ parts.push(`${PARAMS.page}=${options.page}`);
145
+ }
146
+ if (options.options) {
147
+ for (const attr of Object.keys(options.options).sort()) {
148
+ parts.push(`${PARAM_PREFIX.opt}${enc(attr)}=${enc(options.options[attr])}`);
149
+ }
150
+ }
151
+ if (options.variant !== void 0) {
152
+ parts.push(`${PARAMS.variant}=${enc(options.variant)}`);
153
+ }
154
+ if (options.mockup !== void 0) {
155
+ parts.push(`${PARAMS.mockup}=${enc(options.mockup)}`);
156
+ }
157
+ if (options.width !== void 0) parts.push(`${PARAMS.width}=${options.width}`);
158
+ if (options.aspect !== void 0 && options.aspect !== "16:9") {
159
+ parts.push(`${PARAMS.aspect}=${enc(options.aspect)}`);
160
+ }
161
+ if (options.bg) {
162
+ parts.push(`${PARAMS.bg}=${requireBgColor(options.bg)}`);
163
+ }
164
+ return `${base}${path}?${parts.join("&")}`;
165
+ }
166
+ var PUBLIC_PARAM_NAMES = [
167
+ PARAMS.asset,
168
+ PARAMS.design,
169
+ PARAMS.shop,
170
+ PARAMS.placement,
171
+ PARAMS.page,
172
+ PARAMS.variant,
173
+ PARAMS.mockup,
174
+ PARAMS.width,
175
+ PARAMS.aspect,
176
+ PARAMS.bg,
177
+ PARAMS.signature
178
+ ];
179
+ function canonicalForSig(url) {
180
+ const hashIdx = url.indexOf("#");
181
+ const noHash = hashIdx === -1 ? url : url.slice(0, hashIdx);
182
+ const qIdx = noHash.indexOf("?");
183
+ const beforeQuery = qIdx === -1 ? noHash : noHash.slice(0, qIdx);
184
+ const rawQuery = qIdx === -1 ? "" : noHash.slice(qIdx + 1);
185
+ let pathname;
186
+ const schemeMatch = beforeQuery.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//);
187
+ if (schemeMatch) {
188
+ const afterScheme = beforeQuery.slice(schemeMatch[0].length);
189
+ const slashIdx = afterScheme.indexOf("/");
190
+ pathname = slashIdx === -1 ? "/" : afterScheme.slice(slashIdx);
191
+ } else {
192
+ pathname = beforeQuery;
193
+ }
194
+ const pairs = [];
195
+ if (rawQuery.length > 0) {
196
+ for (const segment of rawQuery.split("&")) {
197
+ if (segment.length === 0) continue;
198
+ const eq = segment.indexOf("=");
199
+ const rawKey = eq === -1 ? segment : segment.slice(0, eq);
200
+ const rawValue = eq === -1 ? "" : segment.slice(eq + 1);
201
+ const key = decodeURIComponent(rawKey);
202
+ if (key === "signature") continue;
203
+ if (key === "debug") continue;
204
+ pairs.push({ key, raw: rawValue });
205
+ }
206
+ }
207
+ pairs.sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0);
208
+ const canonicalQuery = pairs.map((p) => `${p.key}=${p.raw}`).join("&");
209
+ return `${pathname}?${canonicalQuery}`;
210
+ }
211
+ function toHex(bytes) {
212
+ let out = "";
213
+ for (let i = 0; i < bytes.length; i++) {
214
+ out += bytes[i].toString(16).padStart(2, "0");
215
+ }
216
+ return out;
217
+ }
218
+ async function signDevSig(canonical, secret) {
219
+ const encoder = new TextEncoder();
220
+ const key = await crypto.subtle.importKey(
221
+ "raw",
222
+ encoder.encode(secret),
223
+ { name: "HMAC", hash: "SHA-256" },
224
+ false,
225
+ ["sign"]
226
+ );
227
+ const sigBuf = await crypto.subtle.sign("HMAC", key, encoder.encode(canonical));
228
+ return toHex(new Uint8Array(sigBuf)).slice(0, 16);
229
+ }
230
+
10
231
  // src/constants.ts
11
- var API_BASE = stripSlash(process.env.SNOWCONE_API_BASE ?? "https://api.snowcone.app");
12
- var IMG_BASE = stripSlash(process.env.SNOWCONE_IMG_BASE ?? "https://img.snowcone.app");
13
- var BUY_BASE = stripSlash(process.env.SNOWCONE_BUY_BASE ?? "https://buy.snowcone.app");
14
- var MEILI_HOST = stripSlash(process.env.SNOWCONE_MEILI_HOST ?? "https://search.snowcone.app");
232
+ var API_BASE = stripSlash(process.env.SNOWCONE_API_BASE ?? SNOWCONE_HOSTS.api);
233
+ var IMG_BASE = stripSlash(process.env.SNOWCONE_IMG_BASE ?? SNOWCONE_HOSTS.img);
234
+ var BUY_BASE = stripSlash(process.env.SNOWCONE_BUY_BASE ?? SNOWCONE_HOSTS.buy);
235
+ var MEILI_HOST = stripSlash(process.env.SNOWCONE_MEILI_HOST ?? SNOWCONE_HOSTS.search);
15
236
  var MEILI_KEY = process.env.SNOWCONE_MEILI_KEY ?? "73f573ead9be75531c56ee89d104caa49d79154db387f119a013d33eccfe654b";
16
237
  var MEILI_INDEX = process.env.SNOWCONE_MEILI_INDEX ?? "snowcone";
17
238
  var MEILI_DESIGNS_INDEX = process.env.SNOWCONE_MEILI_DESIGNS_INDEX ?? "snowcone-designs";
@@ -335,7 +556,7 @@ image URL. There is nothing to install to render or sell.
335
556
 
336
557
  2. **Find a product** \u2014 \`snowcone_search_catalog\` to browse, or
337
558
  \`snowcone_get_product\` for placements/mockups/options. Every tool takes the
338
- code as \`product\` (e.g. \`{ product: "BEEB77" }\`). \`BEEB77\` is a known
559
+ code as \`product\` (e.g. \`{ product: "BC43BE" }\`). \`BC43BE\` is a known
339
560
  good demo product code.
340
561
 
341
562
  3. **Render a mockup** \u2014 \`snowcone_render_mockup\` with the product code, your
@@ -445,207 +666,6 @@ function releaseShop(shopId, shopSecret) {
445
666
  });
446
667
  }
447
668
 
448
- // ../mockup-url/src/index.ts
449
- var PARAMS = {
450
- shop: "shop",
451
- asset: "asset",
452
- assets: "assets",
453
- /**
454
- * Render a catalog design by reference (ADR-0086): `design=<pairingId|slug>`.
455
- * The resolver looks the design up in the public `snowcone-designs` index
456
- * (membership = license) and injects its asset components server-side, so no
457
- * raw asset URL crosses the wire and no origin allowlisting is involved.
458
- * Catalog renders are FREE — mutually exclusive with `asset`/`asset.<key>`/
459
- * `color.<key>` (free = the design as published).
460
- */
461
- design: "design",
462
- placement: "placement",
463
- /**
464
- * Album page selector (ADR-0086 §5): `page=N` (positive integer) picks which
465
- * page/spread of an album product a mockup renders. Only valid on products
466
- * whose catalog entry carries an `album` block — the edge resolver maps page
467
- * N onto the repeating page placement (`page_N` → the geometry of
468
- * `album.pagePlacement`); the catalog never enumerates `page_1…page_100` and
469
- * the render server is unchanged.
470
- */
471
- page: "page",
472
- variant: "variant",
473
- mockup: "mockup",
474
- width: "width",
475
- grain: "grain",
476
- aspect: "aspect",
477
- /**
478
- * Background color (6-hex, no '#') painted behind the mockup — visible only
479
- * where the mockup itself has transparency (studio-cutout shots) — or the
480
- * reserved `transparent` token, which suppresses the shop default for this
481
- * one render. Absent = the shop's configured default, else transparent.
482
- */
483
- bg: "bg",
484
- /** Live preview/calibration mask overrides (not cached). */
485
- maskOverrides: "maskOverrides",
486
- /**
487
- * Render-only option picks (the `affectsCombinations:false` attributes), as a
488
- * base64 JSON map `{ attributeName: choiceLabel }`. The render server already parses
489
- * this and resolves per-choice underlays from it; the builder emits it so the
490
- * edge resolver can forward render-only picks (e.g. a cap's Crown/Strap color)
491
- * without changing the server grammar.
492
- */
493
- optionSelections: "optionSelections",
494
- signature: "signature",
495
- seal: "seal"
496
- };
497
- var BG_TRANSPARENT = "transparent";
498
- function normalizeBgColor(raw) {
499
- const value = raw.trim().replace(/^#/, "").toLowerCase();
500
- if (value === BG_TRANSPARENT) return BG_TRANSPARENT;
501
- return /^[0-9a-f]{6}$/.test(value) ? value : null;
502
- }
503
- function requireBgColor(raw) {
504
- const bg = normalizeBgColor(raw);
505
- if (bg === null) {
506
- throw new Error(
507
- `[snowcone] bg must be a 6-digit hex color ('#' optional, e.g. "f5f0ea") or "transparent", got "${raw}"`
508
- );
509
- }
510
- return bg;
511
- }
512
- var MAX_RENDER_URL_LENGTH = 12 * 1024;
513
- var PARAM_PREFIX = {
514
- asset: "asset.",
515
- color: "color.",
516
- tile: "tile.",
517
- align: "align.",
518
- opt: "opt.",
519
- /** ADR-0099 bundles: `variant.<role>=<gvid>` — one SKU per member slot. */
520
- variant: "variant.",
521
- /** ADR-0099 bundles: `pick.<role>=<productCode>` — which alternative fills a slot. */
522
- pick: "pick."
523
- };
524
- var DEFAULT_PUBLIC_BASE_URL = "https://img.snowcone.app";
525
- function buildPublicMockupUrl(options, cfg = {}) {
526
- const base = (cfg.baseUrl ?? DEFAULT_PUBLIC_BASE_URL).replace(/\/+$/, "");
527
- const path = `/${encodeURIComponent(options.productCode)}`;
528
- const enc = encodeURIComponent;
529
- const parts = [];
530
- parts.push(`${PARAMS.shop}=${enc(options.shop)}`);
531
- if (options.designRef !== void 0) {
532
- parts.push(`${PARAMS.design}=${enc(options.designRef)}`);
533
- } else {
534
- if (options.assetUrl !== void 0) {
535
- parts.push(`${PARAMS.asset}=${enc(options.assetUrl)}`);
536
- }
537
- const overrides = options.design || options.placements ? { ...options.design ?? {}, ...options.placements ?? {} } : void 0;
538
- if (overrides) {
539
- for (const key of Object.keys(overrides).sort()) {
540
- const fill = overrides[key];
541
- const k = enc(key);
542
- if (typeof fill === "string") {
543
- parts.push(`${PARAM_PREFIX.asset}${k}=${enc(fill)}`);
544
- } else if ("color" in fill) {
545
- parts.push(`${PARAM_PREFIX.color}${k}=${enc(fill.color)}`);
546
- } else {
547
- parts.push(`${PARAM_PREFIX.asset}${k}=${enc(fill.src)}`);
548
- if (fill.tile !== void 0) {
549
- parts.push(`${PARAM_PREFIX.tile}${k}=${fill.tile}`);
550
- }
551
- if (fill.align !== void 0) {
552
- parts.push(`${PARAM_PREFIX.align}${k}=${enc(fill.align)}`);
553
- }
554
- }
555
- }
556
- }
557
- }
558
- if (options.placement !== void 0) {
559
- parts.push(`${PARAMS.placement}=${enc(options.placement)}`);
560
- }
561
- if (options.page !== void 0) {
562
- parts.push(`${PARAMS.page}=${options.page}`);
563
- }
564
- if (options.options) {
565
- for (const attr of Object.keys(options.options).sort()) {
566
- parts.push(`${PARAM_PREFIX.opt}${enc(attr)}=${enc(options.options[attr])}`);
567
- }
568
- }
569
- if (options.variant !== void 0) {
570
- parts.push(`${PARAMS.variant}=${enc(options.variant)}`);
571
- }
572
- if (options.mockup !== void 0) {
573
- parts.push(`${PARAMS.mockup}=${enc(options.mockup)}`);
574
- }
575
- if (options.width !== void 0) parts.push(`${PARAMS.width}=${options.width}`);
576
- if (options.aspect !== void 0 && options.aspect !== "16:9") {
577
- parts.push(`${PARAMS.aspect}=${enc(options.aspect)}`);
578
- }
579
- if (options.bg) {
580
- parts.push(`${PARAMS.bg}=${requireBgColor(options.bg)}`);
581
- }
582
- return `${base}${path}?${parts.join("&")}`;
583
- }
584
- var PUBLIC_PARAM_NAMES = [
585
- PARAMS.asset,
586
- PARAMS.design,
587
- PARAMS.shop,
588
- PARAMS.placement,
589
- PARAMS.page,
590
- PARAMS.variant,
591
- PARAMS.mockup,
592
- PARAMS.width,
593
- PARAMS.aspect,
594
- PARAMS.bg,
595
- PARAMS.signature
596
- ];
597
- function canonicalForSig(url) {
598
- const hashIdx = url.indexOf("#");
599
- const noHash = hashIdx === -1 ? url : url.slice(0, hashIdx);
600
- const qIdx = noHash.indexOf("?");
601
- const beforeQuery = qIdx === -1 ? noHash : noHash.slice(0, qIdx);
602
- const rawQuery = qIdx === -1 ? "" : noHash.slice(qIdx + 1);
603
- let pathname;
604
- const schemeMatch = beforeQuery.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//);
605
- if (schemeMatch) {
606
- const afterScheme = beforeQuery.slice(schemeMatch[0].length);
607
- const slashIdx = afterScheme.indexOf("/");
608
- pathname = slashIdx === -1 ? "/" : afterScheme.slice(slashIdx);
609
- } else {
610
- pathname = beforeQuery;
611
- }
612
- const pairs = [];
613
- if (rawQuery.length > 0) {
614
- for (const segment of rawQuery.split("&")) {
615
- if (segment.length === 0) continue;
616
- const eq = segment.indexOf("=");
617
- const rawKey = eq === -1 ? segment : segment.slice(0, eq);
618
- const rawValue = eq === -1 ? "" : segment.slice(eq + 1);
619
- const key = decodeURIComponent(rawKey);
620
- if (key === "signature") continue;
621
- if (key === "debug") continue;
622
- pairs.push({ key, raw: rawValue });
623
- }
624
- }
625
- pairs.sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0);
626
- const canonicalQuery = pairs.map((p) => `${p.key}=${p.raw}`).join("&");
627
- return `${pathname}?${canonicalQuery}`;
628
- }
629
- function toHex(bytes) {
630
- let out = "";
631
- for (let i = 0; i < bytes.length; i++) {
632
- out += bytes[i].toString(16).padStart(2, "0");
633
- }
634
- return out;
635
- }
636
- async function signDevSig(canonical, secret) {
637
- const encoder = new TextEncoder();
638
- const key = await crypto.subtle.importKey(
639
- "raw",
640
- encoder.encode(secret),
641
- { name: "HMAC", hash: "SHA-256" },
642
- false,
643
- ["sign"]
644
- );
645
- const sigBuf = await crypto.subtle.sign("HMAC", key, encoder.encode(canonical));
646
- return toHex(new Uint8Array(sigBuf)).slice(0, 16);
647
- }
648
-
649
669
  // src/urls.ts
650
670
  async function buildUrl(input, base) {
651
671
  const opts = {
@@ -682,7 +702,7 @@ var fillSchema = z.union([
682
702
  z.object({ color: z.string().describe("Solid color hex, e.g. '#ff0000'.") })
683
703
  ]);
684
704
  var urlShape = {
685
- product: z.string().min(1).describe("Product code (the catalog document id), e.g. 'BEEB77'."),
705
+ product: z.string().min(1).describe("Product code (the catalog document id), e.g. 'BC43BE'."),
686
706
  shop: z.string().min(1).describe("Your public Shop ID from snowcone_mint_shop."),
687
707
  asset: z.string().optional().describe(
688
708
  "A single publicly-fetchable image URL. This is the BASE design \u2014 it is painted on EVERY placement of the product by default (front, back, sleeves, \u2026), so one image covers the whole product with no extra work. Add 'design' to override specific placements; omit it for the same image everywhere."
@@ -954,7 +974,7 @@ server.registerTool(
954
974
  // spelled it `id_or_slug` cost every cold agent a guaranteed failed
955
975
  // round-trip. `product` is the canonical name; `id_or_slug` stays as a
956
976
  // silent alias so agents that learned the old name keep working.
957
- product: z.string().min(1).optional().describe("Product code (the catalog document id) or slug, e.g. 'BEEB77'. Same name as every other tool."),
977
+ product: z.string().min(1).optional().describe("Product code (the catalog document id) or slug, e.g. 'BC43BE'. Same name as every other tool."),
958
978
  id_or_slug: z.string().min(1).optional().describe("Deprecated alias of 'product' \u2014 accepted for back-compat; prefer 'product'.")
959
979
  },
960
980
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }
@@ -964,7 +984,7 @@ server.registerTool(
964
984
  const code = args.product ?? args.id_or_slug;
965
985
  if (!code) {
966
986
  return fail(
967
- "E_MISSING_PRODUCT: pass product (the product code or slug, e.g. { product: 'BEEB77' }) \u2014 the same 'product' argument snowcone_render_mockup and snowcone_buy_url take."
987
+ "E_MISSING_PRODUCT: pass product (the product code or slug, e.g. { product: 'BC43BE' }) \u2014 the same 'product' argument snowcone_render_mockup and snowcone_buy_url take."
968
988
  );
969
989
  }
970
990
  const p = await getProduct(code);
@@ -1081,7 +1101,7 @@ server.registerTool(
1081
1101
  title: "Get the price, shipping and delivery",
1082
1102
  description: "Tell the user what a printed product costs and when it would arrive, before they buy. Returns the price the buy link will charge (before tax), and each shipping option with its cost and delivery estimate for where it's going. Takes the same product and options as snowcone_buy_url; no artwork or shop needed. Nothing is created or charged. Only promise what comes back: an option with no estimated_delivery means we have no date for it yet.",
1083
1103
  inputSchema: {
1084
- product: z.string().min(1).describe("Product code (the catalog document id), e.g. 'BEEB77'."),
1104
+ product: z.string().min(1).describe("Product code (the catalog document id), e.g. 'BC43BE'."),
1085
1105
  options: z.record(z.string()).optional().describe("Variant option picks: attribute \u2192 choice, e.g. { size: 'M', color: 'black' }. The price depends on these."),
1086
1106
  quantity: z.number().int().min(1).max(100).optional().describe("How many (1 to 100). Default 1."),
1087
1107
  ship_to: z.string().length(2).optional().describe("2-letter destination country, e.g. 'US'. Default US. A country we can't ship to returns an error listing the ones we can.")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowcone-app/mcp",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "mcpName": "io.github.snowcone-app/snowcone",
5
5
  "description": "Snowcone MCP server — the agent-native quickstart. Mint a sandbox shop, browse the catalog, and turn any image into a buyable printed-merch mockup URL, all as callable tools.",
6
6
  "keywords": [