@burdenoff/mcp-libs 2026.1008.4 → 2026.1009.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/dist/modules/files/index.cjs +101 -432
- package/dist/modules/files/index.cjs.map +1 -1
- package/dist/modules/files/index.js +102 -428
- package/dist/modules/files/index.js.map +1 -1
- package/dist/modules/groups/index.cjs +89 -360
- package/dist/modules/groups/index.cjs.map +1 -1
- package/dist/modules/groups/index.js +90 -356
- package/dist/modules/groups/index.js.map +1 -1
- package/dist/modules/rbac/index.cjs +85 -409
- package/dist/modules/rbac/index.cjs.map +1 -1
- package/dist/modules/rbac/index.js +86 -405
- package/dist/modules/rbac/index.js.map +1 -1
- package/dist/modules/sandbox/index.cjs +80 -1136
- package/dist/modules/sandbox/index.cjs.map +1 -1
- package/dist/modules/sandbox/index.js +80 -916
- package/dist/modules/sandbox/index.js.map +1 -1
- package/dist/modules/scheduler/index.cjs +70 -1044
- package/dist/modules/scheduler/index.cjs.map +1 -1
- package/dist/modules/scheduler/index.js +69 -1038
- package/dist/modules/scheduler/index.js.map +1 -1
- package/dist/modules/security/index.cjs +42 -507
- package/dist/modules/security/index.cjs.map +1 -1
- package/dist/modules/security/index.js +41 -501
- package/dist/modules/security/index.js.map +1 -1
- package/dist/modules/store/index.cjs +49 -479
- package/dist/modules/store/index.cjs.map +1 -1
- package/dist/modules/store/index.js +48 -473
- package/dist/modules/store/index.js.map +1 -1
- package/dist/modules/support/index.cjs +18 -19
- package/dist/modules/support/index.cjs.map +1 -1
- package/dist/modules/support/index.js +18 -19
- package/dist/modules/support/index.js.map +1 -1
- package/dist/modules/tags/index.cjs +43 -348
- package/dist/modules/tags/index.cjs.map +1 -1
- package/dist/modules/tags/index.js +42 -342
- package/dist/modules/tags/index.js.map +1 -1
- package/dist/modules/vibecontrols/index.js +1774 -1
- package/dist/modules/vibecontrols/index.js.map +1 -1
- package/dist/modules/workspaces/index.cjs +20 -29
- package/dist/modules/workspaces/index.cjs.map +1 -1
- package/dist/modules/workspaces/index.js +20 -29
- package/dist/modules/workspaces/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-XITZQYB2.js +0 -1776
- package/dist/chunk-XITZQYB2.js.map +0 -1
|
@@ -1,483 +1,58 @@
|
|
|
1
|
-
import { mcpToolName,
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
// src/modules/store/operations.ts
|
|
5
|
-
var BROWSE_STORE = `
|
|
6
|
-
query BrowseStore($input: BrowseStoreInput!) {
|
|
7
|
-
browseStore(input: $input) {
|
|
8
|
-
products { id name description price currency type status }
|
|
9
|
-
facets { categories types }
|
|
10
|
-
totalCount hasMore
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
var SEARCH_STORE = `
|
|
15
|
-
query SearchStore($query: String!, $filters: StoreFiltersInput) {
|
|
16
|
-
searchStore(query: $query, filters: $filters) {
|
|
17
|
-
id name price currency type activeInstallCount
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
var GET_STORE_PRODUCT = `
|
|
22
|
-
query GetStoreProduct($id: ID!) {
|
|
23
|
-
getProduct(id: $id) {
|
|
24
|
-
id name description price currency type status
|
|
25
|
-
publisher { name }
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
|
-
var MY_CART = `
|
|
30
|
-
query MyCart {
|
|
31
|
-
myCart {
|
|
32
|
-
id currency subtotal total itemCount isEmpty
|
|
33
|
-
items { id productId quantity }
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
`;
|
|
37
|
-
var ADD_TO_CART = `
|
|
38
|
-
mutation AddToCart($input: AddToCartInput!) {
|
|
39
|
-
addToCart(input: $input) {
|
|
40
|
-
id itemCount subtotal items { productId quantity }
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
`;
|
|
44
|
-
var REMOVE_FROM_CART = `
|
|
45
|
-
mutation RemoveFromCart($cartId: ID!, $itemId: ID!) {
|
|
46
|
-
removeFromCart(cartId: $cartId, itemId: $itemId) {
|
|
47
|
-
id itemCount subtotal
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
`;
|
|
51
|
-
var CHECKOUT_CART = `
|
|
52
|
-
mutation CheckoutCart($cartId: ID!) {
|
|
53
|
-
checkoutCart(cartId: $cartId) {
|
|
54
|
-
success order { id total status }
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
`;
|
|
58
|
-
var GET_ORDERS = `
|
|
59
|
-
query GetOrders($limit: Int, $offset: Int) {
|
|
60
|
-
getOrders(limit: $limit, offset: $offset) {
|
|
61
|
-
id status total currency createdAt
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
`;
|
|
65
|
-
var GET_ORDER = `
|
|
66
|
-
query GetOrder($id: ID!) {
|
|
67
|
-
getOrder(id: $id) {
|
|
68
|
-
id status total currency paidAt billingAccountId
|
|
69
|
-
lineItems { productId quantity unitPrice }
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
var GET_INSTALLED_PRODUCTS = `
|
|
74
|
-
query GetInstalledProducts($workspaceId: ID!) {
|
|
75
|
-
getInstalledProducts(workspaceId: $workspaceId) {
|
|
76
|
-
id application { id name } status installedAt lastUsedAt
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
`;
|
|
80
|
-
var UNINSTALL_PRODUCT = `
|
|
81
|
-
mutation UninstallProduct($installationId: ID!) {
|
|
82
|
-
uninstallProduct(installationId: $installationId) { success }
|
|
83
|
-
}
|
|
84
|
-
`;
|
|
85
|
-
var GET_LICENSES = `
|
|
86
|
-
query GetLicenses($entitlementId: ID!) {
|
|
87
|
-
getLicenses(entitlementId: $entitlementId) {
|
|
88
|
-
id status validFrom expiresAt
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
`;
|
|
92
|
-
var CLEAR_CART = `
|
|
93
|
-
mutation ClearCart {
|
|
94
|
-
clearCart {
|
|
95
|
-
cart {
|
|
96
|
-
id currency subtotal total itemCount isEmpty
|
|
97
|
-
items { id productId quantity }
|
|
98
|
-
}
|
|
99
|
-
errors { code field message }
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
`;
|
|
103
|
-
var GET_MY_PUBLISHER = `
|
|
104
|
-
query MyPublisher {
|
|
105
|
-
myPublisher {
|
|
106
|
-
id name legalName email contactEmail websiteUrl
|
|
107
|
-
bio logoUrl isVerified verificationStatus
|
|
108
|
-
productCount totalSales totalEarnings tier
|
|
109
|
-
createdAt updatedAt
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
`;
|
|
113
|
-
var GET_MY_PUBLISHER_PRODUCTS = `
|
|
114
|
-
query MyPublisherProducts {
|
|
115
|
-
myPublisher {
|
|
116
|
-
id productCount
|
|
117
|
-
products {
|
|
118
|
-
id name slug description price currency type status downloads
|
|
119
|
-
publisher { id name isVerified }
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
`;
|
|
1
|
+
import { mcpToolName, errorResult } from '../../chunk-G76DKEPI.js';
|
|
124
2
|
|
|
125
3
|
// src/modules/store/tools.ts
|
|
126
|
-
function
|
|
127
|
-
if (override !== void 0 && override !== "") return override;
|
|
128
|
-
const auth = ctx.auth.read();
|
|
129
|
-
if (!auth?.workspaceId) return null;
|
|
130
|
-
return auth.workspaceId;
|
|
131
|
-
}
|
|
132
|
-
function registerStoreTools(server, ctx, track) {
|
|
4
|
+
function stubbedTool(server, toolName, title, description, featureNote, inputSchema, altSuggestions) {
|
|
133
5
|
server.registerTool(
|
|
134
|
-
|
|
6
|
+
toolName,
|
|
135
7
|
{
|
|
136
|
-
title
|
|
137
|
-
description:
|
|
138
|
-
inputSchema
|
|
139
|
-
query: z.string().describe("Search query"),
|
|
140
|
-
type: z.string().optional().describe("Product type filter"),
|
|
141
|
-
category: z.string().optional().describe("Category filter")
|
|
142
|
-
}
|
|
8
|
+
title,
|
|
9
|
+
description: `${description} [STUB]`,
|
|
10
|
+
inputSchema
|
|
143
11
|
},
|
|
144
|
-
async (
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (type !== void 0) filters.productType = type.toUpperCase();
|
|
148
|
-
if (category !== void 0) filters.category = category;
|
|
149
|
-
const data = await ctx.gql.global.request(SEARCH_STORE, {
|
|
150
|
-
query,
|
|
151
|
-
filters: Object.keys(filters).length ? filters : void 0
|
|
152
|
-
});
|
|
153
|
-
return jsonResult(data.searchStore);
|
|
154
|
-
} catch (error) {
|
|
155
|
-
ctx.logger.error("store_search failed", { error: String(error) });
|
|
156
|
-
return errorResult(
|
|
157
|
-
`Failed to search store: ${error instanceof Error ? error.message : String(error)}`
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
);
|
|
162
|
-
server.registerTool(
|
|
163
|
-
track(mcpToolName(ctx.productName, "store_browse")),
|
|
164
|
-
{
|
|
165
|
-
title: "Browse Store",
|
|
166
|
-
description: "Browse the marketplace with structured input (categories, facets, paging).",
|
|
167
|
-
inputSchema: {
|
|
168
|
-
category: z.string().optional().describe("Category filter"),
|
|
169
|
-
type: z.string().optional().describe("Product type filter"),
|
|
170
|
-
limit: z.number().optional().describe("Page size"),
|
|
171
|
-
offset: z.number().optional().describe("Skip results")
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
async ({ category, type, limit, offset }) => {
|
|
175
|
-
try {
|
|
176
|
-
const input = {};
|
|
177
|
-
if (category !== void 0) input.category = category;
|
|
178
|
-
if (type !== void 0) input.productType = type.toUpperCase();
|
|
179
|
-
if (limit !== void 0) input.limit = limit;
|
|
180
|
-
if (offset !== void 0) input.offset = offset;
|
|
181
|
-
const data = await ctx.gql.global.request(BROWSE_STORE, { input });
|
|
182
|
-
return jsonResult(data.browseStore);
|
|
183
|
-
} catch (error) {
|
|
184
|
-
ctx.logger.error("store_browse failed", { error: String(error) });
|
|
185
|
-
return errorResult(
|
|
186
|
-
`Failed to browse store: ${error instanceof Error ? error.message : String(error)}`
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
server.registerTool(
|
|
192
|
-
track(mcpToolName(ctx.productName, "store_get_product")),
|
|
193
|
-
{
|
|
194
|
-
title: "Get Store Product",
|
|
195
|
-
description: "Get a marketplace product by ID.",
|
|
196
|
-
inputSchema: { id: z.string().describe("Product ID") }
|
|
197
|
-
},
|
|
198
|
-
async ({ id }) => {
|
|
199
|
-
try {
|
|
200
|
-
const data = await ctx.gql.global.request(
|
|
201
|
-
GET_STORE_PRODUCT,
|
|
202
|
-
{ id }
|
|
203
|
-
);
|
|
204
|
-
if (!data.getProduct) return errorResult(`Product ${id} not found`);
|
|
205
|
-
return jsonResult(data.getProduct);
|
|
206
|
-
} catch (error) {
|
|
207
|
-
ctx.logger.error("store_get_product failed", { error: String(error) });
|
|
208
|
-
return errorResult(
|
|
209
|
-
`Failed to get product: ${error instanceof Error ? error.message : String(error)}`
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
);
|
|
214
|
-
server.registerTool(
|
|
215
|
-
track(mcpToolName(ctx.productName, "store_cart_list")),
|
|
216
|
-
{
|
|
217
|
-
title: "Show Cart",
|
|
218
|
-
description: "Show the current user's cart.",
|
|
219
|
-
inputSchema: {}
|
|
220
|
-
},
|
|
221
|
-
async () => {
|
|
222
|
-
try {
|
|
223
|
-
const data = await ctx.gql.global.request(MY_CART);
|
|
224
|
-
return jsonResult(data.myCart);
|
|
225
|
-
} catch (error) {
|
|
226
|
-
ctx.logger.error("store_cart_list failed", { error: String(error) });
|
|
227
|
-
return errorResult(
|
|
228
|
-
`Failed to fetch cart: ${error instanceof Error ? error.message : String(error)}`
|
|
229
|
-
);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
);
|
|
233
|
-
server.registerTool(
|
|
234
|
-
track(mcpToolName(ctx.productName, "store_cart_add")),
|
|
235
|
-
{
|
|
236
|
-
title: "Add to Cart",
|
|
237
|
-
description: "Add a product (and optional variant) to the cart.",
|
|
238
|
-
inputSchema: {
|
|
239
|
-
product: z.string().describe("Product ID"),
|
|
240
|
-
quantity: z.number().optional().describe("Quantity (default 1)"),
|
|
241
|
-
variant: z.string().optional().describe("Variant ID")
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
async ({ product, quantity, variant }) => {
|
|
245
|
-
try {
|
|
246
|
-
const input = { productId: product };
|
|
247
|
-
if (quantity !== void 0) input.quantity = quantity;
|
|
248
|
-
if (variant !== void 0) input.variantId = variant;
|
|
249
|
-
const data = await ctx.gql.global.request(ADD_TO_CART, { input });
|
|
250
|
-
return jsonResult(data.addToCart);
|
|
251
|
-
} catch (error) {
|
|
252
|
-
ctx.logger.error("store_cart_add failed", { error: String(error) });
|
|
253
|
-
return errorResult(
|
|
254
|
-
`Failed to add to cart: ${error instanceof Error ? error.message : String(error)}`
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
);
|
|
259
|
-
server.registerTool(
|
|
260
|
-
track(mcpToolName(ctx.productName, "store_cart_remove")),
|
|
261
|
-
{
|
|
262
|
-
title: "Remove from Cart",
|
|
263
|
-
description: "Remove an item from the cart.",
|
|
264
|
-
inputSchema: {
|
|
265
|
-
cart: z.string().describe("Cart ID"),
|
|
266
|
-
item: z.string().describe("Cart item ID")
|
|
267
|
-
}
|
|
268
|
-
},
|
|
269
|
-
async ({ cart, item }) => {
|
|
270
|
-
try {
|
|
271
|
-
await ctx.gql.global.request(REMOVE_FROM_CART, { cartId: cart, itemId: item });
|
|
272
|
-
return jsonResult({ status: "success", message: "Item removed from cart", cart, item });
|
|
273
|
-
} catch (error) {
|
|
274
|
-
ctx.logger.error("store_cart_remove failed", { error: String(error) });
|
|
275
|
-
return errorResult(
|
|
276
|
-
`Failed to remove cart item: ${error instanceof Error ? error.message : String(error)}`
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
);
|
|
281
|
-
server.registerTool(
|
|
282
|
-
track(mcpToolName(ctx.productName, "store_cart_checkout")),
|
|
283
|
-
{
|
|
284
|
-
title: "Checkout Cart",
|
|
285
|
-
description: "Check out the cart server-side (uses default payment method on the billing account).",
|
|
286
|
-
inputSchema: { cartId: z.string().describe("Cart ID") }
|
|
287
|
-
},
|
|
288
|
-
async ({ cartId }) => {
|
|
289
|
-
try {
|
|
290
|
-
const data = await ctx.gql.global.request(CHECKOUT_CART, { cartId });
|
|
291
|
-
return jsonResult(data.checkoutCart);
|
|
292
|
-
} catch (error) {
|
|
293
|
-
ctx.logger.error("store_cart_checkout failed", { error: String(error) });
|
|
294
|
-
return errorResult(
|
|
295
|
-
`Failed to checkout cart: ${error instanceof Error ? error.message : String(error)}`
|
|
296
|
-
);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
);
|
|
300
|
-
server.registerTool(
|
|
301
|
-
track(mcpToolName(ctx.productName, "store_cart_clear")),
|
|
302
|
-
{
|
|
303
|
-
title: "Clear Cart",
|
|
304
|
-
description: "Remove every item from the current user's active cart. Returns the resulting empty cart payload.",
|
|
305
|
-
inputSchema: {}
|
|
306
|
-
},
|
|
307
|
-
async () => {
|
|
308
|
-
try {
|
|
309
|
-
const data = await ctx.gql.global.request(CLEAR_CART);
|
|
310
|
-
const payload = data.clearCart;
|
|
311
|
-
if (payload?.errors && payload.errors.length > 0) {
|
|
312
|
-
const first = payload.errors[0];
|
|
313
|
-
return errorResult(`Failed to clear cart: ${first.code} ${first.message}`);
|
|
314
|
-
}
|
|
315
|
-
return jsonResult(payload?.cart ?? null);
|
|
316
|
-
} catch (error) {
|
|
317
|
-
ctx.logger.error("store_cart_clear failed", { error: String(error) });
|
|
318
|
-
return errorResult(
|
|
319
|
-
`Failed to clear cart: ${error instanceof Error ? error.message : String(error)}`
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
);
|
|
324
|
-
server.registerTool(
|
|
325
|
-
track(mcpToolName(ctx.productName, "store_orders_list")),
|
|
326
|
-
{
|
|
327
|
-
title: "List Orders",
|
|
328
|
-
description: "List orders for the current user.",
|
|
329
|
-
inputSchema: {
|
|
330
|
-
limit: z.number().optional().describe("Page size (default 50)"),
|
|
331
|
-
offset: z.number().optional().describe("Skip results (default 0)")
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
async ({ limit, offset }) => {
|
|
335
|
-
try {
|
|
336
|
-
const data = await ctx.gql.global.request(GET_ORDERS, {
|
|
337
|
-
limit,
|
|
338
|
-
offset: offset ?? 0
|
|
339
|
-
});
|
|
340
|
-
return jsonResult(data.getOrders);
|
|
341
|
-
} catch (error) {
|
|
342
|
-
ctx.logger.error("store_orders_list failed", { error: String(error) });
|
|
343
|
-
return errorResult(
|
|
344
|
-
`Failed to list orders: ${error instanceof Error ? error.message : String(error)}`
|
|
345
|
-
);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
);
|
|
349
|
-
server.registerTool(
|
|
350
|
-
track(mcpToolName(ctx.productName, "store_orders_get")),
|
|
351
|
-
{
|
|
352
|
-
title: "Get Order",
|
|
353
|
-
description: "Get an order by ID.",
|
|
354
|
-
inputSchema: { id: z.string().describe("Order ID") }
|
|
355
|
-
},
|
|
356
|
-
async ({ id }) => {
|
|
357
|
-
try {
|
|
358
|
-
const data = await ctx.gql.global.request(GET_ORDER, { id });
|
|
359
|
-
if (!data.getOrder) return errorResult(`Order ${id} not found`);
|
|
360
|
-
return jsonResult(data.getOrder);
|
|
361
|
-
} catch (error) {
|
|
362
|
-
ctx.logger.error("store_orders_get failed", { error: String(error) });
|
|
363
|
-
return errorResult(
|
|
364
|
-
`Failed to get order: ${error instanceof Error ? error.message : String(error)}`
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
);
|
|
369
|
-
server.registerTool(
|
|
370
|
-
track(mcpToolName(ctx.productName, "store_installed_list")),
|
|
371
|
-
{
|
|
372
|
-
title: "List Installed Products",
|
|
373
|
-
description: "List installed products in the current (or specified) workspace.",
|
|
374
|
-
inputSchema: {
|
|
375
|
-
workspace: z.string().optional().describe("Workspace ID (defaults to current)")
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
async ({ workspace }) => {
|
|
379
|
-
try {
|
|
380
|
-
const wid = resolveWorkspaceId(ctx, workspace);
|
|
381
|
-
if (!wid) {
|
|
382
|
-
return errorResult(
|
|
383
|
-
"No active workspace. Bind a workspace via the auth login flow first."
|
|
384
|
-
);
|
|
385
|
-
}
|
|
386
|
-
const data = await ctx.gql.global.request(GET_INSTALLED_PRODUCTS, { workspaceId: wid });
|
|
387
|
-
return jsonResult(data.getInstalledProducts);
|
|
388
|
-
} catch (error) {
|
|
389
|
-
ctx.logger.error("store_installed_list failed", { error: String(error) });
|
|
390
|
-
return errorResult(
|
|
391
|
-
`Failed to list installed products: ${error instanceof Error ? error.message : String(error)}`
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
);
|
|
396
|
-
server.registerTool(
|
|
397
|
-
track(mcpToolName(ctx.productName, "store_installed_uninstall")),
|
|
398
|
-
{
|
|
399
|
-
title: "Uninstall Product",
|
|
400
|
-
description: "Uninstall a product by installation ID.",
|
|
401
|
-
inputSchema: { installationId: z.string().describe("Installation ID") }
|
|
402
|
-
},
|
|
403
|
-
async ({ installationId }) => {
|
|
404
|
-
try {
|
|
405
|
-
await ctx.gql.global.request(UNINSTALL_PRODUCT, { installationId });
|
|
406
|
-
return jsonResult({ status: "success", message: "Product uninstalled", installationId });
|
|
407
|
-
} catch (error) {
|
|
408
|
-
ctx.logger.error("store_installed_uninstall failed", { error: String(error) });
|
|
409
|
-
return errorResult(
|
|
410
|
-
`Failed to uninstall product: ${error instanceof Error ? error.message : String(error)}`
|
|
411
|
-
);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
);
|
|
415
|
-
server.registerTool(
|
|
416
|
-
track(mcpToolName(ctx.productName, "store_licenses_list")),
|
|
417
|
-
{
|
|
418
|
-
title: "List Licenses",
|
|
419
|
-
description: "List licenses for an entitlement.",
|
|
420
|
-
inputSchema: { entitlement: z.string().describe("Entitlement ID") }
|
|
421
|
-
},
|
|
422
|
-
async ({ entitlement }) => {
|
|
423
|
-
try {
|
|
424
|
-
const data = await ctx.gql.global.request(GET_LICENSES, { entitlementId: entitlement });
|
|
425
|
-
return jsonResult(data.getLicenses);
|
|
426
|
-
} catch (error) {
|
|
427
|
-
ctx.logger.error("store_licenses_list failed", { error: String(error) });
|
|
428
|
-
return errorResult(
|
|
429
|
-
`Failed to list licenses: ${error instanceof Error ? error.message : String(error)}`
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
);
|
|
434
|
-
server.registerTool(
|
|
435
|
-
track(mcpToolName(ctx.productName, "store_publisher_get")),
|
|
436
|
-
{
|
|
437
|
-
title: "Get Publisher",
|
|
438
|
-
description: "Fetch the current user's publisher profile (verification status, tier, totals). Returns null if no publisher profile exists yet.",
|
|
439
|
-
inputSchema: {}
|
|
440
|
-
},
|
|
441
|
-
async () => {
|
|
442
|
-
try {
|
|
443
|
-
const data = await ctx.gql.global.request(
|
|
444
|
-
GET_MY_PUBLISHER
|
|
445
|
-
);
|
|
446
|
-
return jsonResult(data.myPublisher);
|
|
447
|
-
} catch (error) {
|
|
448
|
-
ctx.logger.error("store_publisher_get failed", { error: String(error) });
|
|
449
|
-
return errorResult(
|
|
450
|
-
`Failed to get publisher: ${error instanceof Error ? error.message : String(error)}`
|
|
451
|
-
);
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
);
|
|
455
|
-
server.registerTool(
|
|
456
|
-
track(mcpToolName(ctx.productName, "store_publisher_products")),
|
|
457
|
-
{
|
|
458
|
-
title: "List Publisher Products",
|
|
459
|
-
description: "List products published by the current user's publisher profile. Returns { publisherId, productCount, products } or null if no profile exists.",
|
|
460
|
-
inputSchema: {}
|
|
461
|
-
},
|
|
462
|
-
async () => {
|
|
463
|
-
try {
|
|
464
|
-
const data = await ctx.gql.global.request(GET_MY_PUBLISHER_PRODUCTS);
|
|
465
|
-
const p = data.myPublisher;
|
|
466
|
-
if (!p) return jsonResult(null);
|
|
467
|
-
return jsonResult({
|
|
468
|
-
publisherId: p.id,
|
|
469
|
-
productCount: p.productCount,
|
|
470
|
-
products: p.products
|
|
471
|
-
});
|
|
472
|
-
} catch (error) {
|
|
473
|
-
ctx.logger.error("store_publisher_products failed", { error: String(error) });
|
|
474
|
-
return errorResult(
|
|
475
|
-
`Failed to list publisher products: ${error instanceof Error ? error.message : String(error)}`
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
12
|
+
async () => errorResult(
|
|
13
|
+
`[stubbed] ${featureNote} Use ${altSuggestions.join(", ")} instead. The tool remains registered so callers receive a meaningful response instead of a schema-validation error.`
|
|
14
|
+
)
|
|
479
15
|
);
|
|
480
16
|
}
|
|
17
|
+
function registerStoreTools(server, ctx, track) {
|
|
18
|
+
const featureNote = "Live alpha removed `Query.storeProducts` and the `searchStore` / `browseStore` / `myCart` family. The closest survivors (`searchProducts` / `featuredProducts`) are a different domain shape.";
|
|
19
|
+
const alts = [
|
|
20
|
+
"the next alpha release that restores the public `storeProducts` query",
|
|
21
|
+
"the SDK store API (which the MCP will mirror once it lands)"
|
|
22
|
+
];
|
|
23
|
+
const tools = [
|
|
24
|
+
["store_browse", "Browse Store", "Browse the marketplace."],
|
|
25
|
+
["store_search", "Search Store", "Search the marketplace."],
|
|
26
|
+
["store_get_product", "Get Product", "Get a product by ID."],
|
|
27
|
+
["store_cart_list", "Get My Cart", "Get the current user's cart."],
|
|
28
|
+
["store_cart_add", "Add to Cart", "Add a product to the cart."],
|
|
29
|
+
["store_cart_remove", "Remove from Cart", "Remove a product from the cart."],
|
|
30
|
+
["store_cart_checkout", "Checkout Cart", "Complete the cart checkout."],
|
|
31
|
+
["store_cart_clear", "Clear Cart", "Clear the cart."],
|
|
32
|
+
["store_orders_list", "List Orders", "List orders."],
|
|
33
|
+
["store_orders_get", "Get Order", "Get an order by ID."],
|
|
34
|
+
["store_installed_list", "List Installed Products", "List installed products."],
|
|
35
|
+
["store_installed_uninstall", "Uninstall Product", "Uninstall a product."],
|
|
36
|
+
["store_licenses_list", "List Licenses", "List product licenses."],
|
|
37
|
+
["store_publisher_get", "Get My Publisher", "Get the caller's publisher profile."],
|
|
38
|
+
[
|
|
39
|
+
"store_publisher_products",
|
|
40
|
+
"List My Publisher Products",
|
|
41
|
+
"List products published by the caller."
|
|
42
|
+
]
|
|
43
|
+
];
|
|
44
|
+
for (const [tool, title, desc] of tools) {
|
|
45
|
+
stubbedTool(
|
|
46
|
+
server,
|
|
47
|
+
track(mcpToolName(ctx.productName, tool)),
|
|
48
|
+
title,
|
|
49
|
+
desc,
|
|
50
|
+
featureNote,
|
|
51
|
+
{},
|
|
52
|
+
alts
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
481
56
|
|
|
482
57
|
// src/modules/store/index.ts
|
|
483
58
|
var storeModule = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/modules/store/operations.ts","../../../src/modules/store/tools.ts","../../../src/modules/store/index.ts"],"names":[],"mappings":";;;;AAAO,IAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAUrB,IAAM,YAAA,GAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQrB,IAAM,iBAAA,GAAoB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAS1B,IAAM,OAAA,GAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAShB,IAAM,WAAA,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQpB,IAAM,gBAAA,GAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAQzB,IAAM,aAAA,GAAgB;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AAA,IAAI,CAAC,CAAA,EAAG,OAAO,UAAA,CAAW,IAAI,CAAA;AAC9B,QAAA,OAAO,UAAA,CAAW;AAAA,UAChB,aAAa,CAAA,CAAE,EAAA;AAAA,UACf,cAAc,CAAA,CAAE,YAAA;AAAA,UAChB,UAAU,CAAA,CAAE;AAAA,SACb,CAAA;AAAA,MACH,SAAS,KAAA,EAAO;AACd,QAAA,GAAA,CAAI,MAAA,CAAO,MAAM,iCAAA,EAAmC,EAAE,OAAO,MAAA,CAAO,KAAK,GAAG,CAAA;AAC5E,QAAA,OAAO,WAAA;AAAA,UACL,sCAAsC,KAAA,YAAiB,KAAA,GAAQ,MAAM,OAAA,GAAU,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,SAC9F;AAAA,MACF;AAAA,IACF;AAAA,GACF;AACF;;;AC3cA,IAAM,WAAA,GAAyB;AAAA,EAC7B,EAAA,EAAI,OAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,OAAA;AAAA,EACb,SAAA,EAAW,CAAC,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,kBAAA,CAAmB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAErC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["export const BROWSE_STORE = `\n query BrowseStore($input: BrowseStoreInput!) {\n browseStore(input: $input) {\n products { id name description price currency type status }\n facets { categories types }\n totalCount hasMore\n }\n }\n`;\n\nexport const SEARCH_STORE = `\n query SearchStore($query: String!, $filters: StoreFiltersInput) {\n searchStore(query: $query, filters: $filters) {\n id name price currency type activeInstallCount\n }\n }\n`;\n\nexport const GET_STORE_PRODUCT = `\n query GetStoreProduct($id: ID!) {\n getProduct(id: $id) {\n id name description price currency type status\n publisher { name }\n }\n }\n`;\n\nexport const MY_CART = `\n query MyCart {\n myCart {\n id currency subtotal total itemCount isEmpty\n items { id productId quantity }\n }\n }\n`;\n\nexport const ADD_TO_CART = `\n mutation AddToCart($input: AddToCartInput!) {\n addToCart(input: $input) {\n id itemCount subtotal items { productId quantity }\n }\n }\n`;\n\nexport const REMOVE_FROM_CART = `\n mutation RemoveFromCart($cartId: ID!, $itemId: ID!) {\n removeFromCart(cartId: $cartId, itemId: $itemId) {\n id itemCount subtotal\n }\n }\n`;\n\nexport const CHECKOUT_CART = `\n mutation CheckoutCart($cartId: ID!) {\n checkoutCart(cartId: $cartId) {\n success order { id total status }\n }\n }\n`;\n\nexport const GET_ORDERS = `\n query GetOrders($limit: Int, $offset: Int) {\n getOrders(limit: $limit, offset: $offset) {\n id status total currency createdAt\n }\n }\n`;\n\nexport const GET_ORDER = `\n query GetOrder($id: ID!) {\n getOrder(id: $id) {\n id status total currency paidAt billingAccountId\n lineItems { productId quantity unitPrice }\n }\n }\n`;\n\nexport const GET_INSTALLED_PRODUCTS = `\n query GetInstalledProducts($workspaceId: ID!) {\n getInstalledProducts(workspaceId: $workspaceId) {\n id application { id name } status installedAt lastUsedAt\n }\n }\n`;\n\nexport const UNINSTALL_PRODUCT = `\n mutation UninstallProduct($installationId: ID!) {\n uninstallProduct(installationId: $installationId) { success }\n }\n`;\n\nexport const GET_LICENSES = `\n query GetLicenses($entitlementId: ID!) {\n getLicenses(entitlementId: $entitlementId) {\n id status validFrom expiresAt\n }\n }\n`;\n\nexport const CLEAR_CART = `\n mutation ClearCart {\n clearCart {\n cart {\n id currency subtotal total itemCount isEmpty\n items { id productId quantity }\n }\n errors { code field message }\n }\n }\n`;\n\nexport const GET_MY_PUBLISHER = `\n query MyPublisher {\n myPublisher {\n id name legalName email contactEmail websiteUrl\n bio logoUrl isVerified verificationStatus\n productCount totalSales totalEarnings tier\n createdAt updatedAt\n }\n }\n`;\n\nexport const GET_MY_PUBLISHER_PRODUCTS = `\n query MyPublisherProducts {\n myPublisher {\n id productCount\n products {\n id name slug description price currency type status downloads\n publisher { id name isVerified }\n }\n }\n }\n`;\n","/**\n * Store module tools — marketplace search, cart, orders, installed apps,\n * licenses. Backend: ~/products/global/store/global-store-svc/.\n * Ported from cli-sdk/src/modules/store/.\n *\n * Note: store_cart_checkout completes the cart server-side (no browser\n * redirect). Provider-bound payment capture (Stripe checkout pages) is not\n * exposed in cli-sdk and is omitted here.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport {\n BROWSE_STORE,\n SEARCH_STORE,\n GET_STORE_PRODUCT,\n MY_CART,\n ADD_TO_CART,\n REMOVE_FROM_CART,\n CHECKOUT_CART,\n CLEAR_CART,\n GET_ORDERS,\n GET_ORDER,\n GET_INSTALLED_PRODUCTS,\n UNINSTALL_PRODUCT,\n GET_LICENSES,\n GET_MY_PUBLISHER,\n GET_MY_PUBLISHER_PRODUCTS,\n} from './operations.js';\n\ninterface StoreProduct {\n id: string;\n name: string;\n price?: number;\n currency?: string;\n type?: string;\n status?: string;\n}\n\ninterface CartRow {\n id: string;\n itemCount?: number;\n subtotal?: number;\n total?: number;\n currency?: string;\n isEmpty?: boolean;\n items?: Array<{ id: string; productId: string; quantity: number }>;\n}\n\ninterface OrderRow {\n id: string;\n status?: string;\n total?: number;\n currency?: string;\n createdAt?: string;\n}\n\nfunction resolveWorkspaceId(ctx: McpContext, override: string | undefined): string | null {\n if (override !== undefined && override !== '') return override;\n const auth = ctx.auth.read();\n if (!auth?.workspaceId) return null;\n return auth.workspaceId;\n}\n\nexport function registerStoreTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n // ── Search / browse / get ──────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_search')),\n {\n title: 'Search Store',\n description: 'Search the marketplace for products by query and optional filters.',\n inputSchema: {\n query: z.string().describe('Search query'),\n type: z.string().optional().describe('Product type filter'),\n category: z.string().optional().describe('Category filter'),\n },\n },\n async ({ query, type, category }) => {\n try {\n const filters: Record<string, unknown> = {};\n if (type !== undefined) filters.productType = type.toUpperCase();\n if (category !== undefined) filters.category = category;\n const data = await ctx.gql.global.request<{ searchStore: StoreProduct[] }>(SEARCH_STORE, {\n query,\n filters: Object.keys(filters).length ? filters : undefined,\n });\n return jsonResult(data.searchStore);\n } catch (error) {\n ctx.logger.error('store_search failed', { error: String(error) });\n return errorResult(\n `Failed to search store: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_browse')),\n {\n title: 'Browse Store',\n description: 'Browse the marketplace with structured input (categories, facets, paging).',\n inputSchema: {\n category: z.string().optional().describe('Category filter'),\n type: z.string().optional().describe('Product type filter'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Skip results'),\n },\n },\n async ({ category, type, limit, offset }) => {\n try {\n const input: Record<string, unknown> = {};\n if (category !== undefined) input.category = category;\n if (type !== undefined) input.productType = type.toUpperCase();\n if (limit !== undefined) input.limit = limit;\n if (offset !== undefined) input.offset = offset;\n const data = await ctx.gql.global.request<{\n browseStore: {\n products: StoreProduct[];\n facets: { categories: string[]; types: string[] };\n totalCount: number;\n hasMore: boolean;\n };\n }>(BROWSE_STORE, { input });\n return jsonResult(data.browseStore);\n } catch (error) {\n ctx.logger.error('store_browse failed', { error: String(error) });\n return errorResult(\n `Failed to browse store: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_get_product')),\n {\n title: 'Get Store Product',\n description: 'Get a marketplace product by ID.',\n inputSchema: { id: z.string().describe('Product ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getProduct: StoreProduct | null }>(\n GET_STORE_PRODUCT,\n { id },\n );\n if (!data.getProduct) return errorResult(`Product ${id} not found`);\n return jsonResult(data.getProduct);\n } catch (error) {\n ctx.logger.error('store_get_product failed', { error: String(error) });\n return errorResult(\n `Failed to get product: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Cart ───────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_list')),\n {\n title: 'Show Cart',\n description: \"Show the current user's cart.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{ myCart: CartRow }>(MY_CART);\n return jsonResult(data.myCart);\n } catch (error) {\n ctx.logger.error('store_cart_list failed', { error: String(error) });\n return errorResult(\n `Failed to fetch cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_add')),\n {\n title: 'Add to Cart',\n description: 'Add a product (and optional variant) to the cart.',\n inputSchema: {\n product: z.string().describe('Product ID'),\n quantity: z.number().optional().describe('Quantity (default 1)'),\n variant: z.string().optional().describe('Variant ID'),\n },\n },\n async ({ product, quantity, variant }) => {\n try {\n const input: Record<string, unknown> = { productId: product };\n if (quantity !== undefined) input.quantity = quantity;\n if (variant !== undefined) input.variantId = variant;\n const data = await ctx.gql.global.request<{ addToCart: CartRow }>(ADD_TO_CART, { input });\n return jsonResult(data.addToCart);\n } catch (error) {\n ctx.logger.error('store_cart_add failed', { error: String(error) });\n return errorResult(\n `Failed to add to cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_remove')),\n {\n title: 'Remove from Cart',\n description: 'Remove an item from the cart.',\n inputSchema: {\n cart: z.string().describe('Cart ID'),\n item: z.string().describe('Cart item ID'),\n },\n },\n async ({ cart, item }) => {\n try {\n await ctx.gql.global.request(REMOVE_FROM_CART, { cartId: cart, itemId: item });\n return jsonResult({ status: 'success', message: 'Item removed from cart', cart, item });\n } catch (error) {\n ctx.logger.error('store_cart_remove failed', { error: String(error) });\n return errorResult(\n `Failed to remove cart item: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_checkout')),\n {\n title: 'Checkout Cart',\n description:\n 'Check out the cart server-side (uses default payment method on the billing account).',\n inputSchema: { cartId: z.string().describe('Cart ID') },\n },\n async ({ cartId }) => {\n try {\n const data = await ctx.gql.global.request<{\n checkoutCart: { success: boolean; order?: OrderRow };\n }>(CHECKOUT_CART, { cartId });\n return jsonResult(data.checkoutCart);\n } catch (error) {\n ctx.logger.error('store_cart_checkout failed', { error: String(error) });\n return errorResult(\n `Failed to checkout cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_clear')),\n {\n title: 'Clear Cart',\n description:\n \"Remove every item from the current user's active cart. Returns the resulting empty cart payload.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{\n clearCart: {\n cart: CartRow | null;\n errors: Array<{ code: string; field?: string; message: string }> | null;\n };\n }>(CLEAR_CART);\n const payload = data.clearCart;\n if (payload?.errors && payload.errors.length > 0) {\n const first = payload.errors[0];\n return errorResult(`Failed to clear cart: ${first.code} ${first.message}`);\n }\n return jsonResult(payload?.cart ?? null);\n } catch (error) {\n ctx.logger.error('store_cart_clear failed', { error: String(error) });\n return errorResult(\n `Failed to clear cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Orders ─────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_orders_list')),\n {\n title: 'List Orders',\n description: 'List orders for the current user.',\n inputSchema: {\n limit: z.number().optional().describe('Page size (default 50)'),\n offset: z.number().optional().describe('Skip results (default 0)'),\n },\n },\n async ({ limit, offset }) => {\n try {\n const data = await ctx.gql.global.request<{ getOrders: OrderRow[] }>(GET_ORDERS, {\n limit,\n offset: offset ?? 0,\n });\n return jsonResult(data.getOrders);\n } catch (error) {\n ctx.logger.error('store_orders_list failed', { error: String(error) });\n return errorResult(\n `Failed to list orders: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_orders_get')),\n {\n title: 'Get Order',\n description: 'Get an order by ID.',\n inputSchema: { id: z.string().describe('Order ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getOrder: OrderRow | null }>(GET_ORDER, { id });\n if (!data.getOrder) return errorResult(`Order ${id} not found`);\n return jsonResult(data.getOrder);\n } catch (error) {\n ctx.logger.error('store_orders_get failed', { error: String(error) });\n return errorResult(\n `Failed to get order: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Installed ──────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_installed_list')),\n {\n title: 'List Installed Products',\n description: 'List installed products in the current (or specified) workspace.',\n inputSchema: {\n workspace: z.string().optional().describe('Workspace ID (defaults to current)'),\n },\n },\n async ({ workspace }) => {\n try {\n const wid = resolveWorkspaceId(ctx, workspace);\n if (!wid) {\n return errorResult(\n 'No active workspace. Bind a workspace via the auth login flow first.',\n );\n }\n const data = await ctx.gql.global.request<{\n getInstalledProducts: Array<{\n id: string;\n application: { id: string; name: string };\n status: string;\n installedAt: string;\n }>;\n }>(GET_INSTALLED_PRODUCTS, { workspaceId: wid });\n return jsonResult(data.getInstalledProducts);\n } catch (error) {\n ctx.logger.error('store_installed_list failed', { error: String(error) });\n return errorResult(\n `Failed to list installed products: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_installed_uninstall')),\n {\n title: 'Uninstall Product',\n description: 'Uninstall a product by installation ID.',\n inputSchema: { installationId: z.string().describe('Installation ID') },\n },\n async ({ installationId }) => {\n try {\n await ctx.gql.global.request(UNINSTALL_PRODUCT, { installationId });\n return jsonResult({ status: 'success', message: 'Product uninstalled', installationId });\n } catch (error) {\n ctx.logger.error('store_installed_uninstall failed', { error: String(error) });\n return errorResult(\n `Failed to uninstall product: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Licenses ───────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_licenses_list')),\n {\n title: 'List Licenses',\n description: 'List licenses for an entitlement.',\n inputSchema: { entitlement: z.string().describe('Entitlement ID') },\n },\n async ({ entitlement }) => {\n try {\n const data = await ctx.gql.global.request<{\n getLicenses: Array<{ id: string; status: string; validFrom: string; expiresAt: string }>;\n }>(GET_LICENSES, { entitlementId: entitlement });\n return jsonResult(data.getLicenses);\n } catch (error) {\n ctx.logger.error('store_licenses_list failed', { error: String(error) });\n return errorResult(\n `Failed to list licenses: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Publisher ──────────────────────────────────────────────────────────\n // Schema reality: global-store-svc only exposes `myPublisher` (the current\n // user's own publisher profile). There is no public `getPublisher(id)` —\n // these tools target the bound user.\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_publisher_get')),\n {\n title: 'Get Publisher',\n description:\n \"Fetch the current user's publisher profile (verification status, tier, totals). Returns null if no publisher profile exists yet.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{ myPublisher: unknown | null }>(\n GET_MY_PUBLISHER,\n );\n return jsonResult(data.myPublisher);\n } catch (error) {\n ctx.logger.error('store_publisher_get failed', { error: String(error) });\n return errorResult(\n `Failed to get publisher: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_publisher_products')),\n {\n title: 'List Publisher Products',\n description:\n \"List products published by the current user's publisher profile. Returns { publisherId, productCount, products } or null if no profile exists.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{\n myPublisher: { id: string; productCount: number; products: StoreProduct[] } | null;\n }>(GET_MY_PUBLISHER_PRODUCTS);\n const p = data.myPublisher;\n if (!p) return jsonResult(null);\n return jsonResult({\n publisherId: p.id,\n productCount: p.productCount,\n products: p.products,\n });\n } catch (error) {\n ctx.logger.error('store_publisher_products failed', { error: String(error) });\n return errorResult(\n `Failed to list publisher products: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Store module — marketplace search/browse, cart, orders, installed apps,\n * licenses. Backend: ~/products/global/store/global-store-svc/.\n * Ported from cli-sdk/src/modules/store/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerStoreTools } from './tools.js';\n\nconst storeModule: McpModule = {\n id: 'store',\n version: '0.0.1',\n displayName: 'Store',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerStoreTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default storeModule;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/modules/store/tools.ts","../../../src/modules/store/index.ts"],"names":[],"mappings":";;;AAKA,SAAS,YACP,MAAA,EACA,QAAA,EACA,OACA,WAAA,EACA,WAAA,EACA,aACA,cAAA,EACM;AACN,EAAA,MAAA,CAAO,YAAA;AAAA,IACL,QAAA;AAAA,IACA;AAAA,MACE,KAAA;AAAA,MACA,WAAA,EAAa,GAAG,WAAW,CAAA,OAAA,CAAA;AAAA,MAC3B;AAAA,KACF;AAAA,IACA,YACE,WAAA;AAAA,MACE,aAAa,WAAW,CAAA,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,EAAM,KAAA,EAAO,IAAI,KAAK,KAAA,EAAO;AACvC,IAAA,WAAA;AAAA,MACE,MAAA;AAAA,MACA,KAAA,CAAM,WAAA,CAAY,GAAA,CAAI,WAAA,EAAa,IAAI,CAAC,CAAA;AAAA,MACxC,KAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAA;AAAA,MACA,EAAC;AAAA,MACD;AAAA,KACF;AAAA,EACF;AACF;;;ACrEA,IAAM,WAAA,GAAyB;AAAA,EAC7B,EAAA,EAAI,OAAA;AAAA,EACJ,OAAA,EAAS,OAAA;AAAA,EACT,WAAA,EAAa,OAAA;AAAA,EACb,SAAA,EAAW,CAAC,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,kBAAA,CAAmB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAErC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["import { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { errorResult, mcpToolName, type McpContext } from '../../core/index.js';\n\ntype StubInputSchema = Record<string, z.ZodTypeAny>;\nfunction stubbedTool(\n server: McpServer,\n toolName: string,\n title: string,\n description: string,\n featureNote: string,\n inputSchema: StubInputSchema,\n altSuggestions: string[],\n): void {\n server.registerTool(\n toolName,\n {\n title,\n description: `${description} [STUB]`,\n inputSchema,\n },\n async () =>\n errorResult(\n `[stubbed] ${featureNote} Use ${altSuggestions.join(', ')} instead. The tool remains registered so callers receive a meaningful response instead of a schema-validation error.`,\n ),\n );\n}\n\nexport function registerStoreTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n // BOFF-8199: `Query.storeProducts` (and the related `searchStore`,\n // `browseStore`, `myCart`, etc.) are gone from the live alpha gateway.\n // The closest survivors are `searchProducts`, `featuredProducts`,\n // `i18nProducts`, `lowStockProducts`, `platformProducts` — a\n // different domain. Stub all 14 store tools so callers get a clean\n // \"[stubbed]\" error and the per-call wiring is in place for the day\n // the store service re-exposes the public surface.\n const featureNote =\n 'Live alpha removed `Query.storeProducts` and the `searchStore` / `browseStore` / `myCart` family. The closest survivors (`searchProducts` / `featuredProducts`) are a different domain shape.';\n const alts = [\n 'the next alpha release that restores the public `storeProducts` query',\n 'the SDK store API (which the MCP will mirror once it lands)',\n ];\n\n const tools: Array<[string, string, string]> = [\n ['store_browse', 'Browse Store', 'Browse the marketplace.'],\n ['store_search', 'Search Store', 'Search the marketplace.'],\n ['store_get_product', 'Get Product', 'Get a product by ID.'],\n ['store_cart_list', 'Get My Cart', \"Get the current user's cart.\"],\n ['store_cart_add', 'Add to Cart', 'Add a product to the cart.'],\n ['store_cart_remove', 'Remove from Cart', 'Remove a product from the cart.'],\n ['store_cart_checkout', 'Checkout Cart', 'Complete the cart checkout.'],\n ['store_cart_clear', 'Clear Cart', 'Clear the cart.'],\n ['store_orders_list', 'List Orders', 'List orders.'],\n ['store_orders_get', 'Get Order', 'Get an order by ID.'],\n ['store_installed_list', 'List Installed Products', 'List installed products.'],\n ['store_installed_uninstall', 'Uninstall Product', 'Uninstall a product.'],\n ['store_licenses_list', 'List Licenses', 'List product licenses.'],\n ['store_publisher_get', 'Get My Publisher', \"Get the caller's publisher profile.\"],\n [\n 'store_publisher_products',\n 'List My Publisher Products',\n 'List products published by the caller.',\n ],\n ];\n for (const [tool, title, desc] of tools) {\n stubbedTool(\n server,\n track(mcpToolName(ctx.productName, tool)),\n title,\n desc,\n featureNote,\n {},\n alts,\n );\n }\n}\n","/**\n * Store module — marketplace search/browse, cart, orders, installed apps,\n * licenses. Backend: ~/products/global/store/global-store-svc/.\n * Ported from cli-sdk/src/modules/store/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerStoreTools } from './tools.js';\n\nconst storeModule: McpModule = {\n id: 'store',\n version: '0.0.1',\n displayName: 'Store',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerStoreTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default storeModule;\n"]}
|