@snowcone-app/mcp 0.3.2 → 0.4.0
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 +16 -0
- package/dist/index.js +79 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @snowcone-app/mcp
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#625](https://github.com/snowcone-app/snowcone-monorepo/pull/625) [`1f9e32d`](https://github.com/snowcone-app/snowcone-monorepo/commit/1f9e32d65a53cd9be2fea4f858cba485837f19e7) Thanks [@kevinsproles](https://github.com/kevinsproles)! - New `snowcone_search_designs` tool: search the public pre-made designs catalog
|
|
8
|
+
(first-party-curated, remixable designs) with facet filters, returning each
|
|
9
|
+
design's license, product, and a ready-to-render `mockup_url` for your shop
|
|
10
|
+
(or a `YOUR_SHOP_ID` template without one). New `SNOWCONE_MEILI_DESIGNS_INDEX`
|
|
11
|
+
env override (default `snowcone-designs`).
|
|
12
|
+
|
|
13
|
+
## 0.3.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#596](https://github.com/snowcone-app/snowcone-monorepo/pull/596) [`b04c995`](https://github.com/snowcone-app/snowcone-monorepo/commit/b04c995d0a115760341f8b51f1ecbfb01deb8d6b) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Point API-key management links at snowcone.app/studio/api-keys (the old /api-keys route is gone).
|
|
18
|
+
|
|
3
19
|
## 0.3.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var BUY_BASE = stripSlash(process.env.SNOWCONE_BUY_BASE ?? "https://buy.snowcone
|
|
|
14
14
|
var MEILI_HOST = stripSlash(process.env.SNOWCONE_MEILI_HOST ?? "https://search.snowcone.app");
|
|
15
15
|
var MEILI_KEY = process.env.SNOWCONE_MEILI_KEY ?? "eee819b849798ad9091228c486ec05d0931e5292";
|
|
16
16
|
var MEILI_INDEX = process.env.SNOWCONE_MEILI_INDEX ?? "snowcone";
|
|
17
|
+
var MEILI_DESIGNS_INDEX = process.env.SNOWCONE_MEILI_DESIGNS_INDEX ?? "snowcone-designs";
|
|
17
18
|
var CHARACTER_LIMIT = 25e3;
|
|
18
19
|
var HTTP_TIMEOUT_MS = 2e4;
|
|
19
20
|
var USER_AGENT = "snowcone-mcp/0.1.0";
|
|
@@ -214,6 +215,20 @@ function summarizeProduct(p) {
|
|
|
214
215
|
};
|
|
215
216
|
}
|
|
216
217
|
|
|
218
|
+
// src/designs.ts
|
|
219
|
+
var headers2 = { Authorization: `Bearer ${MEILI_KEY}` };
|
|
220
|
+
async function searchDesigns(query, limit, offset, filter) {
|
|
221
|
+
const body = await httpJson(
|
|
222
|
+
`${MEILI_HOST}/indexes/${MEILI_DESIGNS_INDEX}/search`,
|
|
223
|
+
{
|
|
224
|
+
method: "POST",
|
|
225
|
+
headers: headers2,
|
|
226
|
+
body: { q: query, limit, offset, ...filter ? { filter } : {} }
|
|
227
|
+
}
|
|
228
|
+
);
|
|
229
|
+
return { hits: body.hits ?? [], estimatedTotalHits: body.estimatedTotalHits ?? body.hits?.length ?? 0 };
|
|
230
|
+
}
|
|
231
|
+
|
|
217
232
|
// src/version.ts
|
|
218
233
|
import { createRequire } from "module";
|
|
219
234
|
var VERSION = (() => {
|
|
@@ -247,7 +262,7 @@ image URL. There is nothing to install to render or sell.
|
|
|
247
262
|
*Want to harden against Shop-ID theft? Pass \`require_signature: true\` to mint
|
|
248
263
|
a LOCKED shop \u2014 then every render/buy URL must be signed with your
|
|
249
264
|
\`shop_secret\` (pass it as \`shop_secret\`) or the edge 403s. Leave it off to
|
|
250
|
-
start; your human can flip "Require signed URLs" later on /api-keys.*
|
|
265
|
+
start; your human can flip "Require signed URLs" later on /studio/api-keys.*
|
|
251
266
|
|
|
252
267
|
2. **Find a product** \u2014 \`snowcone_search_catalog\` to browse, or
|
|
253
268
|
\`snowcone_get_product\` for placements/mockups/options. \`BEEB77\` is a known
|
|
@@ -295,11 +310,11 @@ URL still renders on it, so on an open shop a signature is not yet a hard lock.
|
|
|
295
310
|
|
|
296
311
|
Two ways to lock YOUR shop:
|
|
297
312
|
- **L3 signing** \u2014 mint with \`require_signature: true\` (or have your human flip
|
|
298
|
-
"Require signed URLs" on /api-keys). Then pass \`shop_secret\` to
|
|
313
|
+
"Require signed URLs" on /studio/api-keys). Then pass \`shop_secret\` to
|
|
299
314
|
\`snowcone_render_mockup\`/\`snowcone_buy_url\` to get an **L3-signed** URL
|
|
300
315
|
(\`&signature=\u2026\`); unsigned or tampered URLs are rejected (403).
|
|
301
316
|
- **Asset-origin allowlist** (the stronger lock) \u2014 restrict which hosts art may
|
|
302
|
-
load from, so a leaked Shop ID can't render *novel* art. Set on /api-keys.
|
|
317
|
+
load from, so a leaked Shop ID can't render *novel* art. Set on /studio/api-keys.
|
|
303
318
|
|
|
304
319
|
Until you lock the shop, treat any artwork you render on it as effectively public.
|
|
305
320
|
|
|
@@ -571,7 +586,7 @@ server.registerTool(
|
|
|
571
586
|
...args.require_signature ? { require_signed_urls: true } : {}
|
|
572
587
|
});
|
|
573
588
|
const sigLine = r.require_signed_urls ? `This shop REQUIRES signed URLs: pass shop_secret=${r.shop_secret} as shop_secret on every render/buy call, or the edge 403s.
|
|
574
|
-
` : `This shop is OPEN (unsigned URLs render). To lock it later, your human can toggle "Require signed URLs" on /api-keys.
|
|
589
|
+
` : `This shop is OPEN (unsigned URLs render). To lock it later, your human can toggle "Require signed URLs" on /studio/api-keys.
|
|
575
590
|
`;
|
|
576
591
|
const text = `Minted shop_id=${r.shop_id} (REUSE this \u2014 don't mint again).
|
|
577
592
|
shop_secret=${r.shop_secret} (secret)
|
|
@@ -666,6 +681,66 @@ server.registerTool(
|
|
|
666
681
|
}
|
|
667
682
|
}
|
|
668
683
|
);
|
|
684
|
+
async function summarizeDesign(d, shop, shopSecret) {
|
|
685
|
+
const base = {
|
|
686
|
+
pairing_id: d.pairingId ?? d.id,
|
|
687
|
+
slug: d.slug ?? null,
|
|
688
|
+
title: d.title,
|
|
689
|
+
tags: d.tags ?? [],
|
|
690
|
+
occasion: d.occasion ?? null,
|
|
691
|
+
style: d.style ?? null,
|
|
692
|
+
product_id: d.productId,
|
|
693
|
+
min_price_cents: d.minPriceCents ?? null,
|
|
694
|
+
license: d.license ?? { remixable: true },
|
|
695
|
+
preview_thumbnail: d.previewThumbnail ?? null
|
|
696
|
+
};
|
|
697
|
+
if (!d.productId || !d.assets && !d.asset) return base;
|
|
698
|
+
const input = {
|
|
699
|
+
product: d.productId,
|
|
700
|
+
shop: shop ?? "YOUR_SHOP_ID",
|
|
701
|
+
...d.assets ? { design: d.assets } : d.asset ? { asset: d.asset } : {},
|
|
702
|
+
...d.variant ? { variant: d.variant } : {},
|
|
703
|
+
...shop && shopSecret ? { shopSecret } : {}
|
|
704
|
+
};
|
|
705
|
+
const url = await renderUrl(input);
|
|
706
|
+
return shop ? { ...base, mockup_url: url } : { ...base, mockup_url_template: url };
|
|
707
|
+
}
|
|
708
|
+
server.registerTool(
|
|
709
|
+
"snowcone_search_designs",
|
|
710
|
+
{
|
|
711
|
+
title: "Search the pre-made designs catalog",
|
|
712
|
+
description: "Full-text search the public catalog of pre-made, remixable designs (first-party-curated, e.g. for holiday cards, tees, posters) so an integration never starts from a blank canvas. Filterable facets: tags, occasion, style, productId, minPriceCents. Each result includes the design's product, license, and a ready-to-render mockup_url when you pass your 'shop' (catalog design assets render for EVERY shop \u2014 they bypass the asset-origin allowlist). Without 'shop' you get a mockup_url_template containing YOUR_SHOP_ID to substitute.",
|
|
713
|
+
inputSchema: {
|
|
714
|
+
query: z.string().default("").describe("Search text, e.g. 'christmas card'. Empty string lists curated designs."),
|
|
715
|
+
limit: z.number().int().min(1).max(50).default(10).describe("Max results (1-50)."),
|
|
716
|
+
offset: z.number().int().min(0).default(0).describe("Pagination offset."),
|
|
717
|
+
filter: z.string().optional().describe(`Meilisearch filter expression, e.g. "occasion = 'christmas' AND style = 'watercolor'".`),
|
|
718
|
+
shop: z.string().optional().describe("Your public Shop ID \u2014 when set, each result includes a ready-to-render mockup_url."),
|
|
719
|
+
shop_secret: z.string().optional().describe("Per-shop secret (scsec_\u2026). With 'shop', URLs are L3-signed (server-side only \u2014 never expose it).")
|
|
720
|
+
},
|
|
721
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true }
|
|
722
|
+
},
|
|
723
|
+
async (args) => {
|
|
724
|
+
try {
|
|
725
|
+
const { hits, estimatedTotalHits } = await searchDesigns(args.query, args.limit, args.offset, args.filter);
|
|
726
|
+
const items = await Promise.all(hits.map((h) => summarizeDesign(h, args.shop, args.shop_secret)));
|
|
727
|
+
const out = {
|
|
728
|
+
total: estimatedTotalHits,
|
|
729
|
+
count: items.length,
|
|
730
|
+
offset: args.offset,
|
|
731
|
+
items,
|
|
732
|
+
has_more: estimatedTotalHits > args.offset + items.length
|
|
733
|
+
};
|
|
734
|
+
let text = JSON.stringify(out, null, 2);
|
|
735
|
+
if (text.length > CHARACTER_LIMIT) {
|
|
736
|
+
text = JSON.stringify({ ...out, items: items.slice(0, 5), truncated: true }, null, 2);
|
|
737
|
+
}
|
|
738
|
+
return { content: [{ type: "text", text }], structuredContent: out };
|
|
739
|
+
} catch (err) {
|
|
740
|
+
return fail(formatError(err));
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
);
|
|
669
744
|
server.registerTool(
|
|
670
745
|
"snowcone_get_product",
|
|
671
746
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snowcone-app/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"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.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"tsup": "^8.1.0",
|
|
43
43
|
"typescript": "^5.5.4",
|
|
44
44
|
"vitest": "^2.1.9",
|
|
45
|
-
"@snowcone-app/mockup-url": "0.1.
|
|
45
|
+
"@snowcone-app/mockup-url": "0.1.1"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|