@snowcone-app/mcp 0.13.0 → 0.14.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,23 @@
1
1
  # @snowcone-app/mcp
2
2
 
3
+ ## 0.14.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#5285](https://github.com/snowcone-app/snowcone-monorepo/pull/5285) [`126e84a`](https://github.com/snowcone-app/snowcone-monorepo/commit/126e84a5ab7e7e5d5cd60e37311bd8c3daca07d8) Thanks [@kevinsproles](https://github.com/kevinsproles)! - The drafts grid shows each draft design at once and its mockup over it when that has loaded (a draft picture loads about a second before its first mockup). `SNOWCONE_HOSTS.drafts` names the host draft designs are stored on.
8
+
9
+ ## 0.14.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#5283](https://github.com/snowcone-app/snowcone-monorepo/pull/5283) [`dc607b7`](https://github.com/snowcone-app/snowcone-monorepo/commit/dc607b7631ea17c8e7a51c447714c3c4303e9a0c) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Using a draft design (rendering it on a product, asking for its buy link) now reports it to the backend, which checks the picture the first time it is used. The report runs beside the tool and never slows it.
14
+
15
+ ## 0.14.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#5278](https://github.com/snowcone-app/snowcone-monorepo/pull/5278) [`2230a30`](https://github.com/snowcone-app/snowcone-monorepo/commit/2230a30284331a6d63c67e17624df855d959f981) Thanks [@kevinsproles](https://github.com/kevinsproles)! - A person's own photo can now reach a mockup. `snowcone_upload_image` stores a photo attached in the chat (for apps that pass files to tools); `snowcone_upload_link` returns a page where the person picks a photo from their phone or computer, and `snowcone_upload_status` returns its `image_url` once they have. Each needs your shop's `api_key` from `snowcone_mint_shop`.
20
+
3
21
  ## 0.13.0
4
22
 
5
23
  ### Minor Changes
package/README.md CHANGED
@@ -49,6 +49,9 @@ URL builder is bundled in).
49
49
  | `snowcone_release_shop` | Delete an unclaimed sandbox shop you minted. |
50
50
  | `snowcone_search_catalog` | Full-text search the public product catalog. |
51
51
  | `snowcone_get_product` | Placements / mockups / options for one product. |
52
+ | `snowcone_upload_image` | Store a photo the person attached in the chat (apps that pass files to tools) and get its `image_url`. |
53
+ | `snowcone_upload_link` | A link to a page where the person picks their own photo, for apps that can't pass files. |
54
+ | `snowcone_upload_status` | Whether they've uploaded yet, and the photo's `image_url`. |
52
55
  | `snowcone_render_mockup` | Build an `<img>`-ready mockup URL from a product + artwork + shop. |
53
56
  | `snowcone_get_quote` | The price, shipping options and delivery estimates, before anyone buys. |
54
57
  | `snowcone_buy_url` | Build the matching checkout URL. |
package/dist/index.js CHANGED
@@ -26,7 +26,11 @@ var SNOWCONE_HOSTS = {
26
26
  /** Developer docs. */
27
27
  docs: "https://developers.snowcone.app",
28
28
  /** The storefront site; `/api/launch` says whether orders are open yet. */
29
- site: "https://snowcone.app"
29
+ site: "https://snowcone.app",
30
+ /** The hosted MCP endpoint; it also serves the photo upload page (`/upload/<token>`). */
31
+ mcp: "https://mcp.snowcone.app",
32
+ /** Where draft designs made for a search are stored (a draft's `image_url`). */
33
+ drafts: "https://agentdraft.storage.snowcone.app"
30
34
  };
31
35
  var SNOWCONE_REALTIME_WS_URL = `${SNOWCONE_HOSTS.cdn.replace(/^http/, "ws")}/realtime`;
32
36
  var PARAMS = {
@@ -235,6 +239,8 @@ var API_BASE = stripSlash(process.env.SNOWCONE_API_BASE ?? SNOWCONE_HOSTS.api);
235
239
  var IMG_BASE = stripSlash(process.env.SNOWCONE_IMG_BASE ?? SNOWCONE_HOSTS.img);
236
240
  var BUY_BASE = stripSlash(process.env.SNOWCONE_BUY_BASE ?? SNOWCONE_HOSTS.buy);
237
241
  var LAUNCH_URL = process.env.SNOWCONE_LAUNCH_URL ?? `${stripSlash(SNOWCONE_HOSTS.site)}/api/launch`;
242
+ var UPLOAD_PAGE_BASE = stripSlash(process.env.SNOWCONE_UPLOAD_PAGE_BASE ?? SNOWCONE_HOSTS.mcp);
243
+ var DRAFTS_BASE = stripSlash(process.env.SNOWCONE_DRAFTS_BASE ?? SNOWCONE_HOSTS.drafts);
238
244
  var MEILI_HOST = stripSlash(process.env.SNOWCONE_MEILI_HOST ?? SNOWCONE_HOSTS.search);
239
245
  var MEILI_KEY = process.env.SNOWCONE_MEILI_KEY ?? "73f573ead9be75531c56ee89d104caa49d79154db387f119a013d33eccfe654b";
240
246
  var MEILI_INDEX = process.env.SNOWCONE_MEILI_INDEX ?? "snowcone";
@@ -249,7 +255,7 @@ function stripSlash(s) {
249
255
  // package.json
250
256
  var package_default = {
251
257
  name: "@snowcone-app/mcp",
252
- version: "0.13.0",
258
+ version: "0.14.2",
253
259
  mcpName: "io.github.snowcone-app/snowcone",
254
260
  description: "Snowcone MCP server \u2014 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.",
255
261
  keywords: [
@@ -352,6 +358,8 @@ var CARD_HTML = `<!doctype html>
352
358
  :root[data-theme="dark"] { --bg:#16181c; --fg:#f2f3f5; --muted:#a2a8b3; --line:#2c3038; --well:#1f2228; --accent:#f2f3f5; --accent-fg:#14161a; }
353
359
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg:#16181c; --fg:#f2f3f5; --muted:#a2a8b3; --line:#2c3038; --well:#1f2228; --accent:#f2f3f5; --accent-fg:#14161a; } }
354
360
  * { box-sizing: border-box; }
361
+ /* An author display rule beats the hidden attribute; this keeps hidden meaning hidden. */
362
+ [hidden] { display: none !important; }
355
363
  html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
356
364
  .card { max-width: 560px; margin: 0 auto; padding: 12px; }
357
365
  .well { position: relative; background: var(--well); border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; display: grid; place-items: center; }
@@ -847,7 +855,7 @@ async function searchDesigns(query, limit, offset, filter, semanticRatio) {
847
855
  }
848
856
 
849
857
  // src/drafts.ts
850
- var KNOWN = ["ok", "blocked", "limited", "budget-exhausted", "no-product", "unavailable"];
858
+ var KNOWN = ["ok", "blocked", "no-idea", "limited", "budget-exhausted", "no-product", "unavailable"];
851
859
  async function searchDrafts(query, forwardedFor) {
852
860
  const none = (status, detail) => ({ status, detail, drafts: [], cached: false, subject: "", product_terms: "", ms: 0, draft_budget: null });
853
861
  try {
@@ -874,6 +882,36 @@ async function searchDrafts(query, forwardedFor) {
874
882
  return none("unreachable", `Draft designs could not be reached (${why.slice(0, 120)}). The catalog results are unaffected.`);
875
883
  }
876
884
  }
885
+ var DRAFT_PICTURE = /^https:\/\/[^\s?#]+\/agent-drafts\/drf_[A-Za-z0-9_-]{12}\.webp$/;
886
+ function draftPicturesIn(...artwork) {
887
+ const found = /* @__PURE__ */ new Set();
888
+ const walk = (value, depth) => {
889
+ if (found.size >= 4 || depth > 4) return;
890
+ if (typeof value === "string") {
891
+ if (value.length <= 400 && DRAFT_PICTURE.test(value)) found.add(value);
892
+ } else if (Array.isArray(value)) {
893
+ for (const v of value) walk(v, depth + 1);
894
+ } else if (value && typeof value === "object") {
895
+ for (const v of Object.values(value)) walk(v, depth + 1);
896
+ }
897
+ };
898
+ for (const a of artwork) walk(a, 0);
899
+ return [...found];
900
+ }
901
+ async function markDraftUsed(imageUrl) {
902
+ try {
903
+ const res = await fetch(`${API_BASE}/agent-drafts/used`, {
904
+ method: "POST",
905
+ headers: { "Content-Type": "application/json", Accept: "application/json" },
906
+ body: JSON.stringify({ image_url: imageUrl }),
907
+ signal: AbortSignal.timeout(15e3)
908
+ });
909
+ await res.arrayBuffer();
910
+ if (!res.ok) console.error(`drafts: could not report a used draft (HTTP ${res.status})`);
911
+ } catch (err) {
912
+ console.error("drafts: could not report a used draft", err instanceof Error ? err.message : err);
913
+ }
914
+ }
877
915
  var money = (cents) => `$${(cents / 100).toFixed(2)}`;
878
916
  function draftsText(query, a) {
879
917
  if (a.status === "ok" && a.drafts.length > 0) {
@@ -900,7 +938,7 @@ var GRID_TOOL_META = {
900
938
  "openai/toolInvocation/invoked": "Ideas ready"
901
939
  };
902
940
  function gridResourceMeta(opts = {}) {
903
- const domains = [new URL(IMG_BASE).origin];
941
+ const domains = [new URL(IMG_BASE).origin, new URL(DRAFTS_BASE).origin];
904
942
  if (opts.beaconUrl) domains.push(new URL(opts.beaconUrl).origin);
905
943
  return {
906
944
  ui: { csp: { resourceDomains: domains, connectDomains: [] }, prefersBorder: true },
@@ -915,7 +953,8 @@ var NOTES = {
915
953
  blocked: "We can't sketch this one: it asks for a brand, a real person or something we don't print. Try describing an original design.",
916
954
  limited: "That's a lot of new ideas in a short time. Try again in a little while.",
917
955
  "budget-exhausted": "Today's free sketches are used up. They come back tomorrow.",
918
- "no-product": "We don't make that product yet. Try a t-shirt, hoodie, tote bag or phone case.",
956
+ "no-idea": "Tell us what the design should show, for example \u201Ccorgi astronaut phone case\u201D.",
957
+ "no-product": "There's no product to show a design on right now. Try again in a moment.",
919
958
  unavailable: "Sketches aren't available right now. Try again in a moment.",
920
959
  unreachable: "Sketches aren't available right now. Try again in a moment."
921
960
  };
@@ -934,7 +973,7 @@ function buildGrid(query, drafted, catalogCount) {
934
973
  return { query, status, note: tiles.length > 0 ? "" : NOTES[status], tiles, catalog_count: catalogCount };
935
974
  }
936
975
  function gridHtml(opts = {}) {
937
- return GRID_HTML.replace("__VERSION__", VERSION).replace("__BEACON__", opts.beaconUrl ? JSON.stringify(opts.beaconUrl).slice(1, -1) : "");
976
+ return GRID_HTML.replace("__VERSION__", VERSION).replace("__BEACON__", opts.beaconUrl ? JSON.stringify(opts.beaconUrl).slice(1, -1) : "").replace("__DRAFTS_ORIGIN__", new URL(DRAFTS_BASE).origin);
938
977
  }
939
978
  var GRID_HTML = `<!doctype html>
940
979
  <html lang="en">
@@ -947,13 +986,18 @@ var GRID_HTML = `<!doctype html>
947
986
  :root[data-theme="dark"] { --bg:#16181c; --fg:#f2f3f5; --muted:#a2a8b3; --line:#2c3038; --well:#1f2228; --accent:#f2f3f5; --accent-fg:#14161a; }
948
987
  @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg:#16181c; --fg:#f2f3f5; --muted:#a2a8b3; --line:#2c3038; --well:#1f2228; --accent:#f2f3f5; --accent-fg:#14161a; } }
949
988
  * { box-sizing: border-box; }
989
+ /* An author display rule beats the hidden attribute; this keeps hidden meaning hidden. */
990
+ [hidden] { display: none !important; }
950
991
  html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.4 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
951
992
  .grid-card { max-width: 640px; margin: 0 auto; padding: 12px; }
952
993
  .title { font-weight: 600; font-size: 15px; margin: 0 2px 10px; }
953
994
  .tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
954
995
  .tile { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
955
- .pic { position: relative; background: var(--well); aspect-ratio: 16 / 9; }
956
- .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
996
+ /* The draft design shows in the tile at once (a small picture, about 0.2 s); the mockup, which takes a second or two the first time, fades in over it. */
997
+ .pic { position: relative; background: var(--well) center / contain no-repeat; aspect-ratio: 16 / 9; }
998
+ .pic img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .18s ease-out; }
999
+ .pic img.in { opacity: 1; }
1000
+ @media (prefers-reduced-motion: reduce) { .pic img { transition: none; } }
957
1001
  .badge { position: absolute; top: 8px; left: 8px; background: var(--bg); color: var(--fg); border: 1px solid var(--line); border-radius: 999px; font-size: 11px; font-weight: 600; padding: 2px 8px; }
958
1002
  .meta { padding: 8px 10px 0; flex: 1; }
959
1003
  .pname { font-size: 13px; font-weight: 600; line-height: 1.3; }
@@ -977,6 +1021,7 @@ var GRID_HTML = `<!doctype html>
977
1021
  const $ = (id) => document.getElementById(id);
978
1022
  const root = $("grid");
979
1023
  const BEACON = "__BEACON__";
1024
+ const DRAFTS_ORIGIN = "__DRAFTS_ORIGIN__";
980
1025
  let beaconSent = false;
981
1026
  let bridge = false;
982
1027
  let nextId = 1;
@@ -1053,10 +1098,21 @@ var GRID_HTML = `<!doctype html>
1053
1098
  tile.dataset.product = t.product_id;
1054
1099
  const pic = document.createElement("div");
1055
1100
  pic.className = "pic";
1101
+ // What the tile shows right now: the design alone, then the mockup. Only a picture from the drafts store is used.
1102
+ tile.dataset.shown = "none";
1103
+ if (typeof t.image_url === "string" && t.image_url.startsWith(DRAFTS_ORIGIN + "/") && !/["\\\\()\\s]/.test(t.image_url)) {
1104
+ pic.style.backgroundImage = 'url("' + t.image_url + '")';
1105
+ tile.dataset.shown = "design";
1106
+ }
1056
1107
  const img = document.createElement("img");
1057
1108
  img.alt = "Draft " + n + " on " + t.product_name;
1058
1109
  img.loading = "lazy";
1059
- img.onload = () => { if (BEACON && !beaconSent) { beaconSent = true; new Image().src = BEACON; } resize(); };
1110
+ img.onload = () => {
1111
+ img.className = "in";
1112
+ tile.dataset.shown = "mockup";
1113
+ if (BEACON && !beaconSent) { beaconSent = true; new Image().src = BEACON; }
1114
+ resize();
1115
+ };
1060
1116
  img.src = t.mockup_url;
1061
1117
  const badge = document.createElement("div");
1062
1118
  badge.className = "badge";
@@ -1363,6 +1419,69 @@ function releaseShop(shopId, shopSecret) {
1363
1419
  });
1364
1420
  }
1365
1421
 
1422
+ // src/uploads.ts
1423
+ var MAX_UPLOAD_BYTES = 10 * 1024 * 1024;
1424
+ function uploadPageUrl(token) {
1425
+ return `${UPLOAD_PAGE_BASE}/upload/${encodeURIComponent(token)}`;
1426
+ }
1427
+ async function createUploadLink(apiKey) {
1428
+ const r = await httpJson(`${API_BASE}/snowcone/upload-links`, {
1429
+ method: "POST",
1430
+ headers: { "x-api-key": apiKey },
1431
+ body: {}
1432
+ });
1433
+ return { upload_url: uploadPageUrl(r.upload_token), upload_token: r.upload_token, expires_in: r.expires_in };
1434
+ }
1435
+ async function uploadStatus(token) {
1436
+ const r = await httpJson(`${API_BASE}/snowcone/upload-links/${encodeURIComponent(token)}`);
1437
+ if (r.status !== "pending" && r.status !== "uploaded" && r.status !== "expired") {
1438
+ throw new Error(`E_UPLOAD_STATUS_UNKNOWN: the upload link answered with an unknown status (${String(r.status).slice(0, 40)}).`);
1439
+ }
1440
+ return { status: r.status, ...r.image_url ? { image_url: r.image_url } : {}, expires_at: r.expires_at };
1441
+ }
1442
+ var IMAGE_TYPE = /^image\/(png|jpeg|webp|avif)\b/i;
1443
+ async function persistAttachment(apiKey, downloadUrl) {
1444
+ let url;
1445
+ try {
1446
+ url = new URL(downloadUrl);
1447
+ } catch {
1448
+ throw new Error("E_UPLOAD_URL: the attachment has no usable download URL. If your app can't pass files to tools, use snowcone_upload_link instead.");
1449
+ }
1450
+ if (url.protocol !== "https:") throw new Error("E_UPLOAD_URL: the attachment's download URL must be https.");
1451
+ const res = await fetch(url, { signal: AbortSignal.timeout(2e4) });
1452
+ if (!res.ok) throw new Error(`E_UPLOAD_FETCH: the attachment could not be downloaded (HTTP ${res.status}). Its link may have expired: ask the person to attach it again.`);
1453
+ const contentType = (res.headers.get("content-type") ?? "").split(";")[0].trim().toLowerCase();
1454
+ if (!IMAGE_TYPE.test(contentType)) {
1455
+ throw new Error(`E_UPLOAD_NOT_IMAGE: the attachment is ${contentType || "of an unknown type"}; we print PNG, JPEG, WebP or AVIF. Ask for one of those (a HEIC photo can be shared as JPEG).`);
1456
+ }
1457
+ const declared = Number(res.headers.get("content-length") ?? 0);
1458
+ if (declared > MAX_UPLOAD_BYTES) throw new Error(tooLarge(declared));
1459
+ const reader = res.body?.getReader();
1460
+ if (!reader) throw new Error("E_UPLOAD_FETCH: the attachment came back empty.");
1461
+ const chunks = [];
1462
+ let total = 0;
1463
+ for (; ; ) {
1464
+ const { done, value } = await reader.read();
1465
+ if (done) break;
1466
+ total += value.byteLength;
1467
+ if (total > MAX_UPLOAD_BYTES) {
1468
+ await reader.cancel();
1469
+ throw new Error(tooLarge(total));
1470
+ }
1471
+ chunks.push(value);
1472
+ }
1473
+ if (total === 0) throw new Error("E_UPLOAD_FETCH: the attachment came back empty.");
1474
+ const r = await httpJson(`${API_BASE}/snowcone/persist-image`, {
1475
+ method: "POST",
1476
+ headers: { "x-api-key": apiKey },
1477
+ body: { imageBase64: Buffer.concat(chunks).toString("base64"), contentType }
1478
+ });
1479
+ return { image_url: r.permanentUrl, bytes: total, content_type: contentType };
1480
+ }
1481
+ function tooLarge(bytes) {
1482
+ return `E_UPLOAD_TOO_LARGE: the attachment is ${(bytes / 1024 / 1024).toFixed(1)} MB; the most we take is ${MAX_UPLOAD_BYTES / 1024 / 1024} MB. Ask for a smaller export.`;
1483
+ }
1484
+
1366
1485
  // src/urls.ts
1367
1486
  async function buildUrl(input, base) {
1368
1487
  const opts = {
@@ -1388,6 +1507,13 @@ var renderUrl = (input) => buildUrl(input, IMG_BASE);
1388
1507
  var buyUrl = (input) => buildUrl(input, BUY_BASE);
1389
1508
 
1390
1509
  // src/server.ts
1510
+ function noteDraftUse(ctx, args) {
1511
+ for (const picture of draftPicturesIn(args.asset, args.design)) {
1512
+ const work = markDraftUsed(picture);
1513
+ if (ctx.background) ctx.background(work);
1514
+ else void work;
1515
+ }
1516
+ }
1391
1517
  function createServer(ctx = {}) {
1392
1518
  const server2 = new McpServer({ name: "snowcone-mcp-server", version: VERSION });
1393
1519
  registerCard(server2, ctx);
@@ -1780,6 +1906,79 @@ ${text}`;
1780
1906
  }
1781
1907
  }
1782
1908
  );
1909
+ server2.registerTool(
1910
+ "snowcone_upload_image",
1911
+ {
1912
+ title: "Use a photo the person attached",
1913
+ description: "Put a photo the person attached in this chat onto a product: this stores the attached file in your shop and returns a permanent image_url to use as 'asset' in snowcone_render_mockup. Works when your app passes attached files to tools (ChatGPT does). If you can't pass the file, use snowcone_upload_link instead: the person picks the photo on a page we host. Needs your shop's api_key from snowcone_mint_shop. PNG, JPEG, WebP or AVIF, at most 10 MB.",
1914
+ _meta: { "openai/fileParams": ["image"] },
1915
+ inputSchema: {
1916
+ api_key: z.string().min(1).describe("Your shop's api_key from snowcone_mint_shop (secret)."),
1917
+ image: z.object({
1918
+ download_url: z.string().describe("The attached file's temporary https download URL, as your app provides it."),
1919
+ file_id: z.string().optional().describe("The attached file's id, when your app provides one.")
1920
+ }).describe("The attached image file.")
1921
+ },
1922
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true }
1923
+ },
1924
+ async (args) => {
1925
+ try {
1926
+ const r = await persistAttachment(args.api_key, args.image.download_url);
1927
+ return ok(
1928
+ { image_url: r.image_url, bytes: r.bytes, content_type: r.content_type },
1929
+ `Stored the photo: ${r.image_url}
1930
+ Use it as "asset" in snowcone_render_mockup (with your shop) to show it on a product.`
1931
+ );
1932
+ } catch (err) {
1933
+ return fail(formatError(err));
1934
+ }
1935
+ }
1936
+ );
1937
+ server2.registerTool(
1938
+ "snowcone_upload_link",
1939
+ {
1940
+ title: "Get a link for the person to add their photo",
1941
+ description: "Let the person add their own photo when you can't pass an attached file to a tool: returns upload_url, a page we host where they pick a photo from their phone or computer. Give them the link, then call snowcone_upload_status with upload_token to get the photo's image_url. Needs your shop's api_key from snowcone_mint_shop. The link works for 30 minutes and takes up to 3 uploads.",
1942
+ inputSchema: {
1943
+ api_key: z.string().min(1).describe("Your shop's api_key from snowcone_mint_shop (secret).")
1944
+ },
1945
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true }
1946
+ },
1947
+ async (args) => {
1948
+ try {
1949
+ const link = await createUploadLink(args.api_key);
1950
+ const minutes = Math.round(link.expires_in / 60);
1951
+ return ok(
1952
+ { upload_url: link.upload_url, upload_token: link.upload_token, expires_in: link.expires_in },
1953
+ `Give the person this link to add their photo (works for ${minutes} minutes): ${link.upload_url}
1954
+ When they say it's uploaded, call snowcone_upload_status with upload_token=${link.upload_token} to get its image_url.`
1955
+ );
1956
+ } catch (err) {
1957
+ return fail(formatError(err));
1958
+ }
1959
+ }
1960
+ );
1961
+ server2.registerTool(
1962
+ "snowcone_upload_status",
1963
+ {
1964
+ title: "Check whether the person has added their photo",
1965
+ description: "Check an upload link from snowcone_upload_link. Returns status: 'pending' (not uploaded yet), 'uploaded' (image_url is the photo: use it as 'asset' in snowcone_render_mockup) or 'expired' (make a new link).",
1966
+ inputSchema: {
1967
+ upload_token: z.string().min(1).describe("The upload_token from snowcone_upload_link.")
1968
+ },
1969
+ annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }
1970
+ },
1971
+ async (args) => {
1972
+ try {
1973
+ const s = await uploadStatus(args.upload_token);
1974
+ const text = s.status === "uploaded" ? `The photo is uploaded: ${s.image_url}
1975
+ Use it as "asset" in snowcone_render_mockup (with your shop) to show it on a product.` : s.status === "pending" ? "Not uploaded yet. Ask the person to open the link and send their photo, then check again." : "This upload link expired with no photo. Make a new one with snowcone_upload_link.";
1976
+ return ok({ ...s }, text);
1977
+ } catch (err) {
1978
+ return fail(formatError(err));
1979
+ }
1980
+ }
1981
+ );
1783
1982
  server2.registerTool(
1784
1983
  "snowcone_render_mockup",
1785
1984
  {
@@ -1795,6 +1994,7 @@ ${text}`;
1795
1994
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }
1796
1995
  },
1797
1996
  async (args) => {
1997
+ noteDraftUse(ctx, args);
1798
1998
  try {
1799
1999
  const url = await renderUrl(toUrlInput(args));
1800
2000
  const img_html = `<img src="${url}" style="object-fit:cover" alt="mockup" />`;
@@ -1866,6 +2066,7 @@ ${ordersLine(orders)}`
1866
2066
  annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }
1867
2067
  },
1868
2068
  async (args) => {
2069
+ noteDraftUse(ctx, args);
1869
2070
  try {
1870
2071
  const url = await buyUrl(toUrlInput(args));
1871
2072
  const ordersP = readOrdersState();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowcone-app/mcp",
3
- "version": "0.13.0",
3
+ "version": "0.14.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": [
@@ -44,7 +44,7 @@
44
44
  "typescript": "^5.5.4",
45
45
  "vitest": "^2.1.9",
46
46
  "wrangler": "^3.91.0",
47
- "@snowcone-app/mockup-url": "0.6.0"
47
+ "@snowcone-app/mockup-url": "0.6.1"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"