@snowcone-app/mcp 0.3.3 → 0.5.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 +75 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @snowcone-app/mcp
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#646](https://github.com/snowcone-app/snowcone-monorepo/pull/646) [`e2c6f42`](https://github.com/snowcone-app/snowcone-monorepo/commit/e2c6f424c74eaf60402ce55bac7b081fe5e0ed18) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Designs catalog now indexes every published marketplace design, not just first-party-curated picks. The design doc's `firstParty: true` field is replaced by a `curated: boolean` filterable facet (`curated = true` selects Snowcone-curated designs); `curated` is also added to the index's filterable attributes.
|
|
8
|
+
|
|
9
|
+
## 0.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#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
|
|
14
|
+
(first-party-curated, remixable designs) with facet filters, returning each
|
|
15
|
+
design's license, product, and a ready-to-render `mockup_url` for your shop
|
|
16
|
+
(or a `YOUR_SHOP_ID` template without one). New `SNOWCONE_MEILI_DESIGNS_INDEX`
|
|
17
|
+
env override (default `snowcone-designs`).
|
|
18
|
+
|
|
3
19
|
## 0.3.3
|
|
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 = (() => {
|
|
@@ -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 remixable published designs (e.g. holiday cards, tees, posters; filter curated = true for first-party-curated picks) so an integration never starts from a blank canvas. Filterable facets: tags, occasion, style, productId, minPriceCents, curated. Each result includes the design's product, license, and a ready-to-render mockup_url when you pass your 'shop'. 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.5.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",
|