@burdenoff/mcp-libs 2026.1101.7 → 2026.1106.1
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/chunk-XITZQYB2.js +1776 -0
- package/dist/chunk-XITZQYB2.js.map +1 -0
- package/dist/modules/mybodyshield/index.cjs +43 -0
- package/dist/modules/mybodyshield/index.cjs.map +1 -1
- package/dist/modules/mybodyshield/index.js +43 -0
- package/dist/modules/mybodyshield/index.js.map +1 -1
- package/dist/modules/mybodyshield/operations.d.ts +3 -0
- package/dist/modules/sandbox/index.cjs +976 -80
- package/dist/modules/sandbox/index.cjs.map +1 -1
- package/dist/modules/sandbox/index.js +776 -80
- package/dist/modules/sandbox/index.js.map +1 -1
- package/dist/modules/sandbox/operations.d.ts +1 -0
- package/dist/modules/sandbox/tools.d.ts +1 -0
- package/dist/modules/store/index.cjs +411 -50
- package/dist/modules/store/index.cjs.map +1 -1
- package/dist/modules/store/index.js +405 -49
- package/dist/modules/store/index.js.map +1 -1
- package/dist/modules/store/operations.d.ts +13 -13
- package/dist/modules/store/tools.d.ts +1 -1
- package/dist/modules/theculturepost/tools/shared.d.ts +1 -1
- package/dist/modules/vibecontrols/index.js +1 -1775
- package/dist/modules/vibecontrols/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var zod = require('zod');
|
|
3
4
|
require('graphql-request');
|
|
4
5
|
require('cross-fetch');
|
|
5
6
|
require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
6
7
|
require('@modelcontextprotocol/sdk/types.js');
|
|
7
8
|
require('crypto');
|
|
8
|
-
require('zod');
|
|
9
9
|
|
|
10
|
-
// src/
|
|
10
|
+
// src/modules/store/tools.ts
|
|
11
11
|
|
|
12
12
|
// src/core/errors.ts
|
|
13
13
|
var McpInternalError = class extends Error {
|
|
@@ -38,6 +38,12 @@ function mcpToolName(productName, ...parts) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
// src/core/result.ts
|
|
41
|
+
function jsonResult(data, structured) {
|
|
42
|
+
const result = {
|
|
43
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
|
|
44
|
+
};
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
41
47
|
function errorResult(message, hint) {
|
|
42
48
|
const text = hint ? `${message}
|
|
43
49
|
|
|
@@ -45,58 +51,413 @@ Hint: ${hint}` : message;
|
|
|
45
51
|
return { content: [{ type: "text", text }], isError: true };
|
|
46
52
|
}
|
|
47
53
|
|
|
54
|
+
// src/modules/store/operations.ts
|
|
55
|
+
var PRODUCT_FIELDS = `
|
|
56
|
+
id name slug description price currency type status pricingModel
|
|
57
|
+
rating reviewCount downloads purchaseCount featured
|
|
58
|
+
`;
|
|
59
|
+
var CART_FIELDS = `
|
|
60
|
+
id currency subtotal total itemCount isEmpty requiresShipping status
|
|
61
|
+
items { id productId productName quantity unitPrice subtotal isAvailable }
|
|
62
|
+
`;
|
|
63
|
+
var CART_ERRORS = "errors { code field message }";
|
|
64
|
+
var BROWSE_STORE = `
|
|
65
|
+
query BrowseStore($input: BrowseStoreInput!) {
|
|
66
|
+
browseStore(input: $input) {
|
|
67
|
+
products { ${PRODUCT_FIELDS} }
|
|
68
|
+
facets {
|
|
69
|
+
categories { value count }
|
|
70
|
+
types { value count }
|
|
71
|
+
}
|
|
72
|
+
totalCount hasMore nextCursor
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
76
|
+
var SEARCH_PRODUCTS = `
|
|
77
|
+
query SearchProducts($query: String!, $limit: Int, $offset: Int) {
|
|
78
|
+
searchProducts(query: $query, limit: $limit, offset: $offset) { ${PRODUCT_FIELDS} }
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
81
|
+
var GET_STORE_PRODUCT = `
|
|
82
|
+
query GetStoreProduct($id: ID!) {
|
|
83
|
+
product(id: $id) {
|
|
84
|
+
${PRODUCT_FIELDS}
|
|
85
|
+
longDescription category tags license
|
|
86
|
+
publisher { id name isVerified }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
var MY_CART = `
|
|
91
|
+
query MyCart {
|
|
92
|
+
myCart { ${CART_FIELDS} }
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
var ADD_TO_CART = `
|
|
96
|
+
mutation AddToCart($input: AddToCartInput!) {
|
|
97
|
+
addToCart(input: $input) {
|
|
98
|
+
cart { ${CART_FIELDS} }
|
|
99
|
+
cartItem { id productId productName quantity unitPrice subtotal }
|
|
100
|
+
${CART_ERRORS}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
`;
|
|
104
|
+
var REMOVE_FROM_CART = `
|
|
105
|
+
mutation RemoveFromCart($cartItemId: String!) {
|
|
106
|
+
removeFromCart(cartItemId: $cartItemId) {
|
|
107
|
+
cart { ${CART_FIELDS} }
|
|
108
|
+
${CART_ERRORS}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
`;
|
|
112
|
+
var CLEAR_CART = `
|
|
113
|
+
mutation ClearCart {
|
|
114
|
+
clearCart {
|
|
115
|
+
cart { ${CART_FIELDS} }
|
|
116
|
+
${CART_ERRORS}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
`;
|
|
120
|
+
var CHECKOUT_CART = `
|
|
121
|
+
mutation Checkout($input: CheckoutInput!) {
|
|
122
|
+
checkout(input: $input) {
|
|
123
|
+
success
|
|
124
|
+
order { id status total currency createdAt }
|
|
125
|
+
${CART_ERRORS}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
`;
|
|
129
|
+
var GET_ORDERS = `
|
|
130
|
+
query MyOrders($limit: Int, $offset: Int, $status: OrderStatus) {
|
|
131
|
+
myOrders(limit: $limit, offset: $offset, status: $status) {
|
|
132
|
+
id status total currency createdAt
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
var GET_ORDER = `
|
|
137
|
+
query GetStoreOrder($id: ID!) {
|
|
138
|
+
getStoreOrder(id: $id) {
|
|
139
|
+
id status total currency createdAt processedAt billingAccountId
|
|
140
|
+
lineItems
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
`;
|
|
144
|
+
var GET_INSTALLED_PRODUCTS = `
|
|
145
|
+
query MyStoreAppInstallations($filter: InstallationFilterInput, $limit: Int, $offset: Int) {
|
|
146
|
+
myStoreAppInstallations(filter: $filter, limit: $limit, offset: $offset) {
|
|
147
|
+
items {
|
|
148
|
+
id productId productName productType status version
|
|
149
|
+
workspaceId installedAt
|
|
150
|
+
}
|
|
151
|
+
total hasMore
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
155
|
+
var UNINSTALL_PRODUCT = `
|
|
156
|
+
mutation UninstallApp($id: ID!, $reason: String, $feedback: String) {
|
|
157
|
+
uninstallApp(id: $id, reason: $reason, feedback: $feedback)
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
160
|
+
var GET_LICENSES = `
|
|
161
|
+
query MyEntitlements($limit: Int, $offset: Int) {
|
|
162
|
+
myEntitlements(limit: $limit, offset: $offset) {
|
|
163
|
+
id productId status licenseKey workspaceId expiresAt createdAt
|
|
164
|
+
product { id name }
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
`;
|
|
168
|
+
var GET_MY_PUBLISHER = `
|
|
169
|
+
query MyPublisher {
|
|
170
|
+
myPublisher {
|
|
171
|
+
id name legalName email contactEmail websiteUrl
|
|
172
|
+
bio logoUrl isVerified verificationStatus
|
|
173
|
+
productCount totalSales totalEarnings tier
|
|
174
|
+
createdAt updatedAt
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
178
|
+
var GET_MY_PUBLISHER_PRODUCTS = `
|
|
179
|
+
query MyPublisherProducts {
|
|
180
|
+
myPublisher {
|
|
181
|
+
id productCount
|
|
182
|
+
products {
|
|
183
|
+
id name slug description price currency type status downloads
|
|
184
|
+
publisher { id name isVerified }
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
`;
|
|
189
|
+
|
|
48
190
|
// src/modules/store/tools.ts
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
191
|
+
var PRODUCT_TYPES = [
|
|
192
|
+
"ACCESSORY",
|
|
193
|
+
"AGENT",
|
|
194
|
+
"APP",
|
|
195
|
+
"APPAREL",
|
|
196
|
+
"BOOK",
|
|
197
|
+
"BOTAPP",
|
|
198
|
+
"COLLECTIBLE",
|
|
199
|
+
"COMPONENT",
|
|
200
|
+
"CONSOLE",
|
|
201
|
+
"CONSUMABLE",
|
|
202
|
+
"DASHBOARD",
|
|
203
|
+
"DATASINK",
|
|
204
|
+
"EQUIPMENT",
|
|
205
|
+
"EXTENSION",
|
|
206
|
+
"HARDWARE",
|
|
207
|
+
"INTEGRATION",
|
|
208
|
+
"MERCHANDISE",
|
|
209
|
+
"NODE",
|
|
210
|
+
"PARSER",
|
|
211
|
+
"PLUGIN",
|
|
212
|
+
"TEMPLATE",
|
|
213
|
+
"THEME",
|
|
214
|
+
"VIBEMODULE",
|
|
215
|
+
"WIDGET",
|
|
216
|
+
"WORKFLOW"
|
|
217
|
+
];
|
|
218
|
+
var ORDER_STATUSES = ["PENDING", "PROCESSED", "FAILED", "REFUNDED"];
|
|
219
|
+
var INSTALLATION_STATUSES = [
|
|
220
|
+
"PENDING",
|
|
221
|
+
"INSTALLING",
|
|
222
|
+
"ACTIVE",
|
|
223
|
+
"INACTIVE",
|
|
224
|
+
"FAILED",
|
|
225
|
+
"UNINSTALLED"
|
|
226
|
+
];
|
|
227
|
+
var TOOL_ANNOTATIONS = {
|
|
228
|
+
store_cart_checkout: { readOnlyHint: false, destructiveHint: true },
|
|
229
|
+
store_cart_clear: { readOnlyHint: false, destructiveHint: true },
|
|
230
|
+
store_browse: { readOnlyHint: true, destructiveHint: false },
|
|
231
|
+
store_publisher_products: { readOnlyHint: true, destructiveHint: false }
|
|
232
|
+
};
|
|
233
|
+
function cartErrors(data) {
|
|
234
|
+
const payload = Object.values(data ?? {})[0];
|
|
235
|
+
const errors = payload?.errors;
|
|
236
|
+
return errors && errors.length > 0 ? errors.map((e) => e.message).join("; ") : null;
|
|
61
237
|
}
|
|
62
238
|
function registerStoreTools(server, ctx, track) {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
];
|
|
89
|
-
for (const [tool, title, desc] of tools) {
|
|
90
|
-
stubbedTool(
|
|
91
|
-
server,
|
|
92
|
-
track(mcpToolName(ctx.productName, tool)),
|
|
93
|
-
title,
|
|
94
|
-
desc,
|
|
95
|
-
featureNote,
|
|
96
|
-
{},
|
|
97
|
-
alts
|
|
239
|
+
const tool = (name, title, description, inputSchema, document, variables, pick = (data) => Object.values(data)[0]) => {
|
|
240
|
+
server.registerTool(
|
|
241
|
+
track(mcpToolName(ctx.productName, name)),
|
|
242
|
+
{
|
|
243
|
+
title,
|
|
244
|
+
description,
|
|
245
|
+
inputSchema,
|
|
246
|
+
...TOOL_ANNOTATIONS[name] ? { annotations: TOOL_ANNOTATIONS[name] } : {}
|
|
247
|
+
},
|
|
248
|
+
async (args) => {
|
|
249
|
+
try {
|
|
250
|
+
const data = await ctx.gql.global.request(
|
|
251
|
+
document,
|
|
252
|
+
variables(args)
|
|
253
|
+
);
|
|
254
|
+
const failure = cartErrors(data);
|
|
255
|
+
if (failure) return errorResult(`${title} failed: ${failure}`);
|
|
256
|
+
return jsonResult(pick(data));
|
|
257
|
+
} catch (error) {
|
|
258
|
+
ctx.logger.error(`${name} failed`, { error: String(error) });
|
|
259
|
+
return errorResult(
|
|
260
|
+
`${title} failed: ${error instanceof Error ? error.message : String(error)}`
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
98
264
|
);
|
|
99
|
-
}
|
|
265
|
+
};
|
|
266
|
+
tool(
|
|
267
|
+
"store_search",
|
|
268
|
+
"Search Store",
|
|
269
|
+
"Search the marketplace for products by free-text query.",
|
|
270
|
+
{
|
|
271
|
+
query: zod.z.string().describe("Search query"),
|
|
272
|
+
limit: zod.z.number().int().optional().describe("Page size"),
|
|
273
|
+
offset: zod.z.number().int().optional().describe("Skip results")
|
|
274
|
+
},
|
|
275
|
+
SEARCH_PRODUCTS,
|
|
276
|
+
({ query, limit, offset }) => ({ query, limit, offset })
|
|
277
|
+
);
|
|
278
|
+
tool(
|
|
279
|
+
"store_browse",
|
|
280
|
+
"Browse Store",
|
|
281
|
+
"Browse the marketplace with filters, sorting and paging; returns facets and totals.",
|
|
282
|
+
{
|
|
283
|
+
category: zod.z.string().optional().describe("Category filter"),
|
|
284
|
+
type: zod.z.enum(PRODUCT_TYPES).optional().describe("Product type filter"),
|
|
285
|
+
search: zod.z.string().optional().describe("Free-text filter"),
|
|
286
|
+
sortBy: zod.z.enum([
|
|
287
|
+
"RELEVANCE",
|
|
288
|
+
"NEWEST",
|
|
289
|
+
"OLDEST",
|
|
290
|
+
"NAME_ASC",
|
|
291
|
+
"NAME_DESC",
|
|
292
|
+
"PRICE_LOW",
|
|
293
|
+
"PRICE_HIGH",
|
|
294
|
+
"RATING",
|
|
295
|
+
"DOWNLOADS",
|
|
296
|
+
"FEATURED"
|
|
297
|
+
]).optional().describe("Sort order"),
|
|
298
|
+
limit: zod.z.number().int().optional().describe("Page size"),
|
|
299
|
+
offset: zod.z.number().int().optional().describe("Skip results")
|
|
300
|
+
},
|
|
301
|
+
BROWSE_STORE,
|
|
302
|
+
({ category, type, search, sortBy, limit, offset }) => {
|
|
303
|
+
const filter = {};
|
|
304
|
+
if (category !== void 0) filter.category = category;
|
|
305
|
+
if (type !== void 0) filter.type = type;
|
|
306
|
+
if (search !== void 0) filter.search = search;
|
|
307
|
+
const pagination = {};
|
|
308
|
+
if (limit !== void 0) pagination.limit = limit;
|
|
309
|
+
if (offset !== void 0) pagination.offset = offset;
|
|
310
|
+
const input = {};
|
|
311
|
+
if (Object.keys(filter).length > 0) input.filter = filter;
|
|
312
|
+
if (Object.keys(pagination).length > 0) input.pagination = pagination;
|
|
313
|
+
if (sortBy !== void 0) input.sortBy = sortBy;
|
|
314
|
+
return { input };
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
tool(
|
|
318
|
+
"store_get_product",
|
|
319
|
+
"Get Product",
|
|
320
|
+
"Get a marketplace product by ID.",
|
|
321
|
+
{ id: zod.z.string().describe("Product ID") },
|
|
322
|
+
GET_STORE_PRODUCT,
|
|
323
|
+
({ id }) => ({ id })
|
|
324
|
+
);
|
|
325
|
+
tool("store_cart_list", "Get My Cart", "Get the current user's cart.", {}, MY_CART, () => ({}));
|
|
326
|
+
tool(
|
|
327
|
+
"store_cart_add",
|
|
328
|
+
"Add to Cart",
|
|
329
|
+
"Add a product (and optional variant) to the cart.",
|
|
330
|
+
{
|
|
331
|
+
product: zod.z.string().describe("Product ID"),
|
|
332
|
+
quantity: zod.z.number().int().optional().describe("Quantity (default 1)"),
|
|
333
|
+
variant: zod.z.string().optional().describe("Variant ID")
|
|
334
|
+
},
|
|
335
|
+
ADD_TO_CART,
|
|
336
|
+
({ product, quantity, variant }) => {
|
|
337
|
+
const input = { productId: product };
|
|
338
|
+
if (quantity !== void 0) input.quantity = quantity;
|
|
339
|
+
if (variant !== void 0) input.variantId = variant;
|
|
340
|
+
return { input };
|
|
341
|
+
}
|
|
342
|
+
);
|
|
343
|
+
tool(
|
|
344
|
+
"store_cart_remove",
|
|
345
|
+
"Remove from Cart",
|
|
346
|
+
"Remove one line item from the cart.",
|
|
347
|
+
{ item: zod.z.string().describe("Cart item ID (from store_cart_list)") },
|
|
348
|
+
REMOVE_FROM_CART,
|
|
349
|
+
({ item }) => ({ cartItemId: item })
|
|
350
|
+
);
|
|
351
|
+
tool(
|
|
352
|
+
"store_cart_checkout",
|
|
353
|
+
"Checkout Cart",
|
|
354
|
+
"Check out the current cart server-side and return the resulting order.",
|
|
355
|
+
{
|
|
356
|
+
billingAccountId: zod.z.string().optional().describe("Billing account to charge"),
|
|
357
|
+
paymentMethodId: zod.z.string().optional().describe("Saved payment method"),
|
|
358
|
+
shippingAddressId: zod.z.string().optional().describe("Shipping address (physical items)"),
|
|
359
|
+
shippingMethodId: zod.z.string().optional().describe("Shipping method (physical items)"),
|
|
360
|
+
notes: zod.z.string().optional().describe("Order notes")
|
|
361
|
+
},
|
|
362
|
+
CHECKOUT_CART,
|
|
363
|
+
(args) => {
|
|
364
|
+
const input = {};
|
|
365
|
+
for (const [key, value] of Object.entries(args)) if (value !== void 0) input[key] = value;
|
|
366
|
+
return { input };
|
|
367
|
+
}
|
|
368
|
+
);
|
|
369
|
+
tool(
|
|
370
|
+
"store_cart_clear",
|
|
371
|
+
"Clear Cart",
|
|
372
|
+
"Remove every item from the cart.",
|
|
373
|
+
{},
|
|
374
|
+
CLEAR_CART,
|
|
375
|
+
() => ({})
|
|
376
|
+
);
|
|
377
|
+
tool(
|
|
378
|
+
"store_orders_list",
|
|
379
|
+
"List Orders",
|
|
380
|
+
"List orders for the current user.",
|
|
381
|
+
{
|
|
382
|
+
status: zod.z.enum(ORDER_STATUSES).optional().describe("Filter by order status"),
|
|
383
|
+
limit: zod.z.number().int().optional().describe("Page size"),
|
|
384
|
+
offset: zod.z.number().int().optional().describe("Skip results")
|
|
385
|
+
},
|
|
386
|
+
GET_ORDERS,
|
|
387
|
+
({ status, limit, offset }) => ({ status, limit, offset })
|
|
388
|
+
);
|
|
389
|
+
tool(
|
|
390
|
+
"store_orders_get",
|
|
391
|
+
"Get Order",
|
|
392
|
+
"Get an order by ID.",
|
|
393
|
+
{ id: zod.z.string().describe("Order ID") },
|
|
394
|
+
GET_ORDER,
|
|
395
|
+
({ id }) => ({ id })
|
|
396
|
+
);
|
|
397
|
+
tool(
|
|
398
|
+
"store_installed_list",
|
|
399
|
+
"List Installed Products",
|
|
400
|
+
"List the caller\u2019s store app installations, optionally for one workspace or product.",
|
|
401
|
+
{
|
|
402
|
+
workspace: zod.z.string().optional().describe("Workspace ID filter"),
|
|
403
|
+
product: zod.z.string().optional().describe("Product ID filter"),
|
|
404
|
+
status: zod.z.enum(INSTALLATION_STATUSES).optional().describe("Installation status filter"),
|
|
405
|
+
limit: zod.z.number().int().optional().describe("Page size"),
|
|
406
|
+
offset: zod.z.number().int().optional().describe("Skip results")
|
|
407
|
+
},
|
|
408
|
+
GET_INSTALLED_PRODUCTS,
|
|
409
|
+
({ workspace, product, status, limit, offset }) => {
|
|
410
|
+
const filter = {};
|
|
411
|
+
if (workspace !== void 0) filter.workspaceId = workspace;
|
|
412
|
+
if (product !== void 0) filter.productId = product;
|
|
413
|
+
if (status !== void 0) filter.status = status;
|
|
414
|
+
return {
|
|
415
|
+
filter: Object.keys(filter).length > 0 ? filter : void 0,
|
|
416
|
+
limit,
|
|
417
|
+
offset
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
tool(
|
|
422
|
+
"store_installed_uninstall",
|
|
423
|
+
"Uninstall Product",
|
|
424
|
+
"Uninstall a store app by installation ID (from store_installed_list).",
|
|
425
|
+
{
|
|
426
|
+
installationId: zod.z.string().describe("Installation ID"),
|
|
427
|
+
reason: zod.z.string().optional().describe("Why it is being uninstalled"),
|
|
428
|
+
feedback: zod.z.string().optional().describe("Free-text feedback for the publisher")
|
|
429
|
+
},
|
|
430
|
+
UNINSTALL_PRODUCT,
|
|
431
|
+
({ installationId, reason, feedback }) => ({ id: installationId, reason, feedback }),
|
|
432
|
+
(data) => ({ uninstalled: data.uninstallApp === true })
|
|
433
|
+
);
|
|
434
|
+
tool(
|
|
435
|
+
"store_licenses_list",
|
|
436
|
+
"List Licenses",
|
|
437
|
+
"List the caller's product entitlements (licenses), including license keys and expiry.",
|
|
438
|
+
{
|
|
439
|
+
limit: zod.z.number().int().optional().describe("Page size"),
|
|
440
|
+
offset: zod.z.number().int().optional().describe("Skip results")
|
|
441
|
+
},
|
|
442
|
+
GET_LICENSES,
|
|
443
|
+
({ limit, offset }) => ({ limit, offset })
|
|
444
|
+
);
|
|
445
|
+
tool(
|
|
446
|
+
"store_publisher_get",
|
|
447
|
+
"Get My Publisher",
|
|
448
|
+
"Get the caller's publisher profile (null when the caller is not a publisher).",
|
|
449
|
+
{},
|
|
450
|
+
GET_MY_PUBLISHER,
|
|
451
|
+
() => ({})
|
|
452
|
+
);
|
|
453
|
+
tool(
|
|
454
|
+
"store_publisher_products",
|
|
455
|
+
"List My Publisher Products",
|
|
456
|
+
"List products published by the caller.",
|
|
457
|
+
{},
|
|
458
|
+
GET_MY_PUBLISHER_PRODUCTS,
|
|
459
|
+
() => ({})
|
|
460
|
+
);
|
|
100
461
|
}
|
|
101
462
|
|
|
102
463
|
// src/modules/store/index.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/tool-name.ts","../../../src/core/result.ts","../../../src/modules/store/tools.ts","../../../src/modules/store/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AA8BO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EACjB,KAAA;AAAA,EAEzB,WAAA,CAAY,SAAiB,KAAA,EAAiB;AAC5C,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACf;AACF,CAAA;;;AC1BA,IAAM,oB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AAA,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.cjs","sourcesContent":["/**\n * Error classes for MCP SDK.\n *\n * Modules MUST throw these instead of throwing raw Errors. The registerTool\n * wrapper in result.ts catches and maps them to MCP-protocol-compliant\n * `{ isError: true, content: [...] }` responses.\n *\n * Throwing past the wrapper to the protocol surfaces as JSON-RPC -32603 to\n * the client and is a protocol bug.\n */\n\nexport class McpUserError extends Error {\n public readonly hint: string | undefined;\n\n constructor(message: string, opts?: { hint?: string }) {\n super(message);\n this.name = 'McpUserError';\n this.hint = opts?.hint;\n }\n}\n\nexport class McpAuthError extends McpUserError {\n constructor(message: string, opts?: { hint?: string }) {\n super(message, {\n hint: opts?.hint ?? 'Run the auth_login tool to authenticate.',\n });\n this.name = 'McpAuthError';\n }\n}\n\nexport class McpInternalError extends Error {\n public override readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'McpInternalError';\n this.cause = cause;\n }\n}\n","/**\n * Tool / resource / prompt naming helpers.\n *\n * Mandatory product prefix avoids collisions when Claude Desktop runs\n * multiple MCP servers concurrently (typical setup is ~6).\n *\n * Tool names are capped at 63 characters — Claude Desktop pre-1.x\n * truncated at 64 in some versions.\n */\n\nimport { McpInternalError } from './errors.js';\n\nconst MAX_TOOL_NAME_LENGTH = 63;\n\nfunction assertSafeName(name: string, kind: 'tool' | 'resource' | 'prompt'): string {\n if (kind === 'tool' && name.length > MAX_TOOL_NAME_LENGTH) {\n throw new McpInternalError(\n `Tool name '${name}' exceeds ${MAX_TOOL_NAME_LENGTH} characters (some MCP clients truncate at 64).`,\n );\n }\n return name;\n}\n\n/**\n * Build a tool name. Format: `<productName>_<...parts>` (snake_case).\n * Example: mcpToolName('vibecontrols', 'vibes', 'list') -> 'vibecontrols_vibes_list'\n */\nexport function mcpToolName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpToolName: productName is required');\n }\n const name = [productName, ...parts].filter(Boolean).join('_');\n return assertSafeName(name, 'tool');\n}\n\n/**\n * Build a resource URI. Format: `<productName>://<...parts>`.\n * Example: mcpResourceUri('vibecontrols', 'schema') -> 'vibecontrols://schema'\n */\nexport function mcpResourceUri(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpResourceUri: productName is required');\n }\n return `${productName}://${parts.filter(Boolean).join('/')}`;\n}\n\n/**\n * Build a prompt name. Format: `<productName>-<...parts>` (kebab-case).\n * Example: mcpPromptName('vibecontrols', 'setup') -> 'vibecontrols-setup'\n */\nexport function mcpPromptName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpPromptName: productName is required');\n }\n return [productName, ...parts].filter(Boolean).join('-');\n}\n\nexport const TOOL_NAME_LIMIT = MAX_TOOL_NAME_LENGTH;\n\n/**\n * Name-based hint heuristics for MCP `annotations` (readOnlyHint /\n * destructiveHint). Used by tool-governance.ts to auto-fill annotations for\n * the fleet of product modules that call `server.registerTool` directly\n * (bypassing the `registerTool()` core helper) and so never set them\n * explicitly today (BOFF-3903). Deliberately conservative — matched against\n * whole `_`-delimited segments so e.g. `timeentries_delete` and\n * `pomodoro_delete_goal` match, but a hypothetical `undeletable_check`\n * would not.\n *\n * The destructive verb set covers more than `delete`: stopping, killing or\n * terminating a running process, revoking or rotating a credential/share,\n * resetting settings and removing/purging/uninstalling are all actions an\n * MCP client must not auto-run without the user's intent (VC/FG parity G57 —\n * e.g. `vibecontrols_sessions_kill`, `vibecontrols_tunnels_rotate_credentials`\n * were previously reported as non-destructive).\n *\n * A module can always override the inference by passing an explicit\n * `annotations` object to `registerTool()` / `server.registerTool()` — do\n * that for the rare verb match that is harmless (e.g. a typing indicator's\n * `typing_stop`).\n */\nexport const DESTRUCTIVE_NAME_VERBS = [\n 'delete',\n 'destroy',\n 'erase',\n 'kill',\n 'purge',\n 'remove',\n 'reset',\n 'revoke',\n 'rotate',\n 'stop',\n 'terminate',\n 'uninstall',\n 'wipe',\n] as const;\nconst DESTRUCTIVE_NAME_SEGMENT = new RegExp(\n `(?:^|_)(?:${DESTRUCTIVE_NAME_VERBS.join('|')})(?:_|$)`,\n 'i',\n);\nconst READ_ONLY_NAME_SEGMENT = /(?:^|_)(?:list|get|search|check|read|count|stats|by_date)(?:_|$)/i;\n\n/** True when a tool name looks destructive (irreversibly deletes data) by naming convention. */\nexport function inferDestructiveHint(toolName: string): boolean {\n return DESTRUCTIVE_NAME_SEGMENT.test(toolName);\n}\n\n/**\n * True when a tool name looks read-only by naming convention. Never true for\n * a name that also looks destructive (a tool can't be both).\n */\nexport function inferReadOnlyHint(toolName: string): boolean {\n return !inferDestructiveHint(toolName) && READ_ONLY_NAME_SEGMENT.test(toolName);\n}\n","/**\n * MCP tool result helpers + central handler.\n *\n * Modules NEVER call server.registerTool directly — they use registerTool()\n * from this module so the central try/catch wraps the handler and:\n * - maps thrown McpUserError / McpAuthError / McpInternalError to\n * MCP-protocol-compliant `{ isError: true, content: [...] }` shapes\n * - threads `_meta.progressToken` into ctx.progress for long ops\n * - emits a structured log line on every error\n * - never leaks `cause` from McpInternalError to the client\n *\n * This is the analog of cli-sdk's createProgram() central error handler.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { ZodRawShape } from 'zod';\nimport type { McpContext } from './context.js';\nimport { McpAuthError, McpInternalError, McpUserError } from './errors.js';\nimport type { ToolAnnotations } from './tool-governance.js';\n\nexport interface ToolTextContent {\n type: 'text';\n text: string;\n [k: string]: unknown;\n}\n\nexport interface ToolResult {\n content: ToolTextContent[];\n isError?: boolean;\n structuredContent?: Record<string, unknown>;\n [k: string]: unknown;\n}\n\nexport interface ToolMeta {\n progressToken?: string | number;\n}\n\n/**\n * Build a successful tool result with JSON content (pretty-printed).\n */\nexport function jsonResult(data: unknown, structured?: Record<string, unknown>): ToolResult {\n const result: ToolResult = {\n content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],\n };\n if (structured !== undefined) {\n result.structuredContent = structured;\n }\n return result;\n}\n\n/**\n * Build a successful tool result with plain text content.\n */\nexport function textResult(text: string): ToolResult {\n return { content: [{ type: 'text', text }] };\n}\n\n/**\n * Build an error tool result. Honors MCP's `{ isError: true, content }` shape.\n * Optional hint is appended on a new line so the LLM can react.\n */\nexport function errorResult(message: string, hint?: string): ToolResult {\n const text = hint ? `${message}\\n\\nHint: ${hint}` : message;\n return { content: [{ type: 'text', text }], isError: true };\n}\n\nexport interface ToolMetadata {\n title: string;\n description: string;\n inputSchema?: ZodRawShape;\n /**\n * Explicit MCP annotations (readOnlyHint / destructiveHint / ...). Optional\n * — when omitted, `wrapServerWithToolGovernance` (applied centrally in\n * `createMcpServer`) infers them from the tool name. Set this to override\n * the inference for a tool whose name doesn't match the naming convention.\n */\n annotations?: ToolAnnotations;\n}\n\nexport type ToolHandler<TArgs = Record<string, unknown>> = (\n args: TArgs,\n ctx: McpContext,\n meta: ToolMeta,\n) => Promise<unknown>;\n\n/**\n * Register a tool with the central error wrapper.\n *\n * The handler returns a plain value or void. The wrapper:\n * - wraps non-undefined returns in jsonResult()\n * - if the value already looks like a ToolResult (has `content`), passes through\n * - catches McpAuthError / McpUserError / McpInternalError / generic Error\n * - logs every error via ctx.logger.error\n */\nexport function registerTool<TArgs extends Record<string, unknown>>(\n server: McpServer,\n ctx: McpContext,\n name: string,\n metadata: ToolMetadata,\n handler: ToolHandler<TArgs>,\n): void {\n const sdkConfig = {\n title: metadata.title,\n description: metadata.description,\n ...(metadata.inputSchema ? { inputSchema: metadata.inputSchema } : {}),\n ...(metadata.annotations ? { annotations: metadata.annotations } : {}),\n };\n\n // The MCP SDK's registerTool signature is `(name, config, handler)`. The\n // handler arity depends on whether inputSchema is present (1-arg without,\n // 2-arg with). We accept a unified handler shape and dispatch at runtime.\n // The SDK's typing is strict and conditional on the inputSchema generic;\n // bypass with a cast since runtime acceptance is unconditional.\n const wrapped = async (...callbackArgs: unknown[]): Promise<ToolResult> => {\n const hasArgs = callbackArgs.length === 2;\n const args = (hasArgs ? callbackArgs[0] : {}) as TArgs;\n const extra = (hasArgs ? callbackArgs[1] : callbackArgs[0]) as\n { _meta?: { progressToken?: string | number } } | undefined;\n\n const progressToken = extra?._meta?.progressToken;\n const meta: ToolMeta = progressToken !== undefined ? { progressToken } : {};\n\n try {\n const result = await handler(args, ctx, meta);\n if (isToolResult(result)) return result;\n if (result === undefined) return textResult('OK');\n return jsonResult(result);\n } catch (error) {\n return mapErrorToResult(error, ctx, name);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (server as any).registerTool(name, sdkConfig, wrapped);\n}\n\nfunction isToolResult(value: unknown): value is ToolResult {\n return (\n !!value &&\n typeof value === 'object' &&\n 'content' in value &&\n Array.isArray((value as ToolResult).content)\n );\n}\n\nfunction mapErrorToResult(error: unknown, ctx: McpContext, toolName: string): ToolResult {\n if (error instanceof McpAuthError) {\n ctx.logger.warn(`${toolName}: auth required`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpUserError) {\n ctx.logger.info(`${toolName}: user error`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpInternalError) {\n ctx.logger.error(`${toolName}: internal error`, {\n message: error.message,\n cause: stringifyCause(error.cause),\n });\n return errorResult(`Internal error in ${toolName}.`);\n }\n const message = error instanceof Error ? error.message : String(error);\n ctx.logger.error(`${toolName}: unhandled error`, { message });\n return errorResult(`${toolName}: ${message}`);\n}\n\nfunction stringifyCause(cause: unknown): string | undefined {\n if (cause === undefined || cause === null) return undefined;\n if (cause instanceof Error) return cause.message;\n try {\n return JSON.stringify(cause);\n } catch {\n return String(cause);\n }\n}\n","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"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/tool-name.ts","../../../src/core/result.ts","../../../src/modules/store/operations.ts","../../../src/modules/store/tools.ts","../../../src/modules/store/index.ts"],"names":["z"],"mappings":";;;;;;;;;;;;AA8BO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EACjB,KAAA;AAAA,EAEzB,WAAA,CAAY,SAAiB,KAAA,EAAiB;AAC5C,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AAAA,EACf;AACF,CAAA;;;AC1BA,IAAM,oBAAA,GAAuB,EAAA;AAE7B,SAAS,cAAA,CAAe,MAAc,IAAA,EAA8C;AAClF,EAAA,IAAuB,IAAA,CAAK,MAAA,GAAS,oBAAA,EAAsB;AACzD,IAAA,MAAM,IAAI,gBAAA;AAAA,MACR,CAAA,WAAA,EAAc,IAAI,CAAA,UAAA,EAAa,oBAAoB,CAAA,8CAAA;AAAA,KACrD;AAAA,EACF;AACA,EAAA,OAAO,IAAA;AACT;AAMO,SAAS,WAAA,CAAY,gBAAwB,KAAA,EAAyB;AAC3E,EAAA,IAAI,CAAC,WAAA,EAAa;AAChB,IAAA,MAAM,IAAI,iBAAiB,sCAAsC,CAAA;AAAA,EACnE;AACA,EAAA,MAAM,IAAA,GAAO,CAAC,WAAA,EAAa,GAAG,KAAK,EAAE,MAAA,CAAO,OAAO,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAC7D,EAAA,OAAO,cAAA,CAAe,IAAY,CAAA;AACpC;;;ACOO,SAAS,UAAA,CAAW,MAAe,UAAA,EAAkD;AAC1F,EAAA,MAAM,MAAA,GAAqB;AAAA,IACzB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,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.cjs","sourcesContent":["/**\n * Error classes for MCP SDK.\n *\n * Modules MUST throw these instead of throwing raw Errors. The registerTool\n * wrapper in result.ts catches and maps them to MCP-protocol-compliant\n * `{ isError: true, content: [...] }` responses.\n *\n * Throwing past the wrapper to the protocol surfaces as JSON-RPC -32603 to\n * the client and is a protocol bug.\n */\n\nexport class McpUserError extends Error {\n public readonly hint: string | undefined;\n\n constructor(message: string, opts?: { hint?: string }) {\n super(message);\n this.name = 'McpUserError';\n this.hint = opts?.hint;\n }\n}\n\nexport class McpAuthError extends McpUserError {\n constructor(message: string, opts?: { hint?: string }) {\n super(message, {\n hint: opts?.hint ?? 'Run the auth_login tool to authenticate.',\n });\n this.name = 'McpAuthError';\n }\n}\n\nexport class McpInternalError extends Error {\n public override readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'McpInternalError';\n this.cause = cause;\n }\n}\n","/**\n * Tool / resource / prompt naming helpers.\n *\n * Mandatory product prefix avoids collisions when Claude Desktop runs\n * multiple MCP servers concurrently (typical setup is ~6).\n *\n * Tool names are capped at 63 characters — Claude Desktop pre-1.x\n * truncated at 64 in some versions.\n */\n\nimport { McpInternalError } from './errors.js';\n\nconst MAX_TOOL_NAME_LENGTH = 63;\n\nfunction assertSafeName(name: string, kind: 'tool' | 'resource' | 'prompt'): string {\n if (kind === 'tool' && name.length > MAX_TOOL_NAME_LENGTH) {\n throw new McpInternalError(\n `Tool name '${name}' exceeds ${MAX_TOOL_NAME_LENGTH} characters (some MCP clients truncate at 64).`,\n );\n }\n return name;\n}\n\n/**\n * Build a tool name. Format: `<productName>_<...parts>` (snake_case).\n * Example: mcpToolName('vibecontrols', 'vibes', 'list') -> 'vibecontrols_vibes_list'\n */\nexport function mcpToolName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpToolName: productName is required');\n }\n const name = [productName, ...parts].filter(Boolean).join('_');\n return assertSafeName(name, 'tool');\n}\n\n/**\n * Build a resource URI. Format: `<productName>://<...parts>`.\n * Example: mcpResourceUri('vibecontrols', 'schema') -> 'vibecontrols://schema'\n */\nexport function mcpResourceUri(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpResourceUri: productName is required');\n }\n return `${productName}://${parts.filter(Boolean).join('/')}`;\n}\n\n/**\n * Build a prompt name. Format: `<productName>-<...parts>` (kebab-case).\n * Example: mcpPromptName('vibecontrols', 'setup') -> 'vibecontrols-setup'\n */\nexport function mcpPromptName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpPromptName: productName is required');\n }\n return [productName, ...parts].filter(Boolean).join('-');\n}\n\nexport const TOOL_NAME_LIMIT = MAX_TOOL_NAME_LENGTH;\n\n/**\n * Name-based hint heuristics for MCP `annotations` (readOnlyHint /\n * destructiveHint). Used by tool-governance.ts to auto-fill annotations for\n * the fleet of product modules that call `server.registerTool` directly\n * (bypassing the `registerTool()` core helper) and so never set them\n * explicitly today (BOFF-3903). Deliberately conservative — matched against\n * whole `_`-delimited segments so e.g. `timeentries_delete` and\n * `pomodoro_delete_goal` match, but a hypothetical `undeletable_check`\n * would not.\n *\n * The destructive verb set covers more than `delete`: stopping, killing or\n * terminating a running process, revoking or rotating a credential/share,\n * resetting settings and removing/purging/uninstalling are all actions an\n * MCP client must not auto-run without the user's intent (VC/FG parity G57 —\n * e.g. `vibecontrols_sessions_kill`, `vibecontrols_tunnels_rotate_credentials`\n * were previously reported as non-destructive).\n *\n * A module can always override the inference by passing an explicit\n * `annotations` object to `registerTool()` / `server.registerTool()` — do\n * that for the rare verb match that is harmless (e.g. a typing indicator's\n * `typing_stop`).\n */\nexport const DESTRUCTIVE_NAME_VERBS = [\n 'delete',\n 'destroy',\n 'erase',\n 'kill',\n 'purge',\n 'remove',\n 'reset',\n 'revoke',\n 'rotate',\n 'stop',\n 'terminate',\n 'uninstall',\n 'wipe',\n] as const;\nconst DESTRUCTIVE_NAME_SEGMENT = new RegExp(\n `(?:^|_)(?:${DESTRUCTIVE_NAME_VERBS.join('|')})(?:_|$)`,\n 'i',\n);\nconst READ_ONLY_NAME_SEGMENT = /(?:^|_)(?:list|get|search|check|read|count|stats|by_date)(?:_|$)/i;\n\n/** True when a tool name looks destructive (irreversibly deletes data) by naming convention. */\nexport function inferDestructiveHint(toolName: string): boolean {\n return DESTRUCTIVE_NAME_SEGMENT.test(toolName);\n}\n\n/**\n * True when a tool name looks read-only by naming convention. Never true for\n * a name that also looks destructive (a tool can't be both).\n */\nexport function inferReadOnlyHint(toolName: string): boolean {\n return !inferDestructiveHint(toolName) && READ_ONLY_NAME_SEGMENT.test(toolName);\n}\n","/**\n * MCP tool result helpers + central handler.\n *\n * Modules NEVER call server.registerTool directly — they use registerTool()\n * from this module so the central try/catch wraps the handler and:\n * - maps thrown McpUserError / McpAuthError / McpInternalError to\n * MCP-protocol-compliant `{ isError: true, content: [...] }` shapes\n * - threads `_meta.progressToken` into ctx.progress for long ops\n * - emits a structured log line on every error\n * - never leaks `cause` from McpInternalError to the client\n *\n * This is the analog of cli-sdk's createProgram() central error handler.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { ZodRawShape } from 'zod';\nimport type { McpContext } from './context.js';\nimport { McpAuthError, McpInternalError, McpUserError } from './errors.js';\nimport type { ToolAnnotations } from './tool-governance.js';\n\nexport interface ToolTextContent {\n type: 'text';\n text: string;\n [k: string]: unknown;\n}\n\nexport interface ToolResult {\n content: ToolTextContent[];\n isError?: boolean;\n structuredContent?: Record<string, unknown>;\n [k: string]: unknown;\n}\n\nexport interface ToolMeta {\n progressToken?: string | number;\n}\n\n/**\n * Build a successful tool result with JSON content (pretty-printed).\n */\nexport function jsonResult(data: unknown, structured?: Record<string, unknown>): ToolResult {\n const result: ToolResult = {\n content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],\n };\n if (structured !== undefined) {\n result.structuredContent = structured;\n }\n return result;\n}\n\n/**\n * Build a successful tool result with plain text content.\n */\nexport function textResult(text: string): ToolResult {\n return { content: [{ type: 'text', text }] };\n}\n\n/**\n * Build an error tool result. Honors MCP's `{ isError: true, content }` shape.\n * Optional hint is appended on a new line so the LLM can react.\n */\nexport function errorResult(message: string, hint?: string): ToolResult {\n const text = hint ? `${message}\\n\\nHint: ${hint}` : message;\n return { content: [{ type: 'text', text }], isError: true };\n}\n\nexport interface ToolMetadata {\n title: string;\n description: string;\n inputSchema?: ZodRawShape;\n /**\n * Explicit MCP annotations (readOnlyHint / destructiveHint / ...). Optional\n * — when omitted, `wrapServerWithToolGovernance` (applied centrally in\n * `createMcpServer`) infers them from the tool name. Set this to override\n * the inference for a tool whose name doesn't match the naming convention.\n */\n annotations?: ToolAnnotations;\n}\n\nexport type ToolHandler<TArgs = Record<string, unknown>> = (\n args: TArgs,\n ctx: McpContext,\n meta: ToolMeta,\n) => Promise<unknown>;\n\n/**\n * Register a tool with the central error wrapper.\n *\n * The handler returns a plain value or void. The wrapper:\n * - wraps non-undefined returns in jsonResult()\n * - if the value already looks like a ToolResult (has `content`), passes through\n * - catches McpAuthError / McpUserError / McpInternalError / generic Error\n * - logs every error via ctx.logger.error\n */\nexport function registerTool<TArgs extends Record<string, unknown>>(\n server: McpServer,\n ctx: McpContext,\n name: string,\n metadata: ToolMetadata,\n handler: ToolHandler<TArgs>,\n): void {\n const sdkConfig = {\n title: metadata.title,\n description: metadata.description,\n ...(metadata.inputSchema ? { inputSchema: metadata.inputSchema } : {}),\n ...(metadata.annotations ? { annotations: metadata.annotations } : {}),\n };\n\n // The MCP SDK's registerTool signature is `(name, config, handler)`. The\n // handler arity depends on whether inputSchema is present (1-arg without,\n // 2-arg with). We accept a unified handler shape and dispatch at runtime.\n // The SDK's typing is strict and conditional on the inputSchema generic;\n // bypass with a cast since runtime acceptance is unconditional.\n const wrapped = async (...callbackArgs: unknown[]): Promise<ToolResult> => {\n const hasArgs = callbackArgs.length === 2;\n const args = (hasArgs ? callbackArgs[0] : {}) as TArgs;\n const extra = (hasArgs ? callbackArgs[1] : callbackArgs[0]) as\n { _meta?: { progressToken?: string | number } } | undefined;\n\n const progressToken = extra?._meta?.progressToken;\n const meta: ToolMeta = progressToken !== undefined ? { progressToken } : {};\n\n try {\n const result = await handler(args, ctx, meta);\n if (isToolResult(result)) return result;\n if (result === undefined) return textResult('OK');\n return jsonResult(result);\n } catch (error) {\n return mapErrorToResult(error, ctx, name);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (server as any).registerTool(name, sdkConfig, wrapped);\n}\n\nfunction isToolResult(value: unknown): value is ToolResult {\n return (\n !!value &&\n typeof value === 'object' &&\n 'content' in value &&\n Array.isArray((value as ToolResult).content)\n );\n}\n\nfunction mapErrorToResult(error: unknown, ctx: McpContext, toolName: string): ToolResult {\n if (error instanceof McpAuthError) {\n ctx.logger.warn(`${toolName}: auth required`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpUserError) {\n ctx.logger.info(`${toolName}: user error`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpInternalError) {\n ctx.logger.error(`${toolName}: internal error`, {\n message: error.message,\n cause: stringifyCause(error.cause),\n });\n return errorResult(`Internal error in ${toolName}.`);\n }\n const message = error instanceof Error ? error.message : String(error);\n ctx.logger.error(`${toolName}: unhandled error`, { message });\n return errorResult(`${toolName}: ${message}`);\n}\n\nfunction stringifyCause(cause: unknown): string | undefined {\n if (cause === undefined || cause === null) return undefined;\n if (cause instanceof Error) return cause.message;\n try {\n return JSON.stringify(cause);\n } catch {\n return String(cause);\n }\n}\n","/**\n * Store operations — all served by the GLOBAL supergraph (global-store-svc).\n *\n * BOFF-8199 stubbed this module on the belief that `Query.storeProducts`,\n * `searchStore`, `getOrders`, ... had been removed. They were never the right\n * fields: the store surface is `browseStore`, `searchProducts`, `product`,\n * `myCart`, `checkout`, `myOrders`, `getStoreOrder`, `myStoreAppInstallations`,\n * `uninstallApp`, `myEntitlements` and `myPublisher`. Every document here is\n * validated against the pruned global supergraph fixture by\n * tests/unit/platform-supergraph-contract.test.ts.\n */\n\nconst PRODUCT_FIELDS = `\n id name slug description price currency type status pricingModel\n rating reviewCount downloads purchaseCount featured\n`;\n\nconst CART_FIELDS = `\n id currency subtotal total itemCount isEmpty requiresShipping status\n items { id productId productName quantity unitPrice subtotal isAvailable }\n`;\n\nconst CART_ERRORS = 'errors { code field message }';\n\nexport const BROWSE_STORE = `\n query BrowseStore($input: BrowseStoreInput!) {\n browseStore(input: $input) {\n products { ${PRODUCT_FIELDS} }\n facets {\n categories { value count }\n types { value count }\n }\n totalCount hasMore nextCursor\n }\n }\n`;\n\nexport const SEARCH_PRODUCTS = `\n query SearchProducts($query: String!, $limit: Int, $offset: Int) {\n searchProducts(query: $query, limit: $limit, offset: $offset) { ${PRODUCT_FIELDS} }\n }\n`;\n\nexport const GET_STORE_PRODUCT = `\n query GetStoreProduct($id: ID!) {\n product(id: $id) {\n ${PRODUCT_FIELDS}\n longDescription category tags license\n publisher { id name isVerified }\n }\n }\n`;\n\nexport const MY_CART = `\n query MyCart {\n myCart { ${CART_FIELDS} }\n }\n`;\n\nexport const ADD_TO_CART = `\n mutation AddToCart($input: AddToCartInput!) {\n addToCart(input: $input) {\n cart { ${CART_FIELDS} }\n cartItem { id productId productName quantity unitPrice subtotal }\n ${CART_ERRORS}\n }\n }\n`;\n\nexport const REMOVE_FROM_CART = `\n mutation RemoveFromCart($cartItemId: String!) {\n removeFromCart(cartItemId: $cartItemId) {\n cart { ${CART_FIELDS} }\n ${CART_ERRORS}\n }\n }\n`;\n\nexport const CLEAR_CART = `\n mutation ClearCart {\n clearCart {\n cart { ${CART_FIELDS} }\n ${CART_ERRORS}\n }\n }\n`;\n\nexport const CHECKOUT_CART = `\n mutation Checkout($input: CheckoutInput!) {\n checkout(input: $input) {\n success\n order { id status total currency createdAt }\n ${CART_ERRORS}\n }\n }\n`;\n\nexport const GET_ORDERS = `\n query MyOrders($limit: Int, $offset: Int, $status: OrderStatus) {\n myOrders(limit: $limit, offset: $offset, status: $status) {\n id status total currency createdAt\n }\n }\n`;\n\nexport const GET_ORDER = `\n query GetStoreOrder($id: ID!) {\n getStoreOrder(id: $id) {\n id status total currency createdAt processedAt billingAccountId\n lineItems\n }\n }\n`;\n\nexport const GET_INSTALLED_PRODUCTS = `\n query MyStoreAppInstallations($filter: InstallationFilterInput, $limit: Int, $offset: Int) {\n myStoreAppInstallations(filter: $filter, limit: $limit, offset: $offset) {\n items {\n id productId productName productType status version\n workspaceId installedAt\n }\n total hasMore\n }\n }\n`;\n\nexport const UNINSTALL_PRODUCT = `\n mutation UninstallApp($id: ID!, $reason: String, $feedback: String) {\n uninstallApp(id: $id, reason: $reason, feedback: $feedback)\n }\n`;\n\nexport const GET_LICENSES = `\n query MyEntitlements($limit: Int, $offset: Int) {\n myEntitlements(limit: $limit, offset: $offset) {\n id productId status licenseKey workspaceId expiresAt createdAt\n product { id name }\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 browse/search, cart, orders, installed apps,\n * licenses (entitlements) and the caller's publisher profile.\n *\n * Backend: ~/products/global/store/global-store-svc/ (GLOBAL supergraph).\n *\n * `store_cart_checkout` completes the cart server-side (no browser redirect);\n * provider-bound payment capture pages are not exposed here.\n */\n\nimport { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport {\n jsonResult,\n errorResult,\n mcpToolName,\n type McpContext,\n type ToolAnnotations,\n} from '../../core/index.js';\nimport {\n BROWSE_STORE,\n SEARCH_PRODUCTS,\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\nconst PRODUCT_TYPES = [\n 'ACCESSORY',\n 'AGENT',\n 'APP',\n 'APPAREL',\n 'BOOK',\n 'BOTAPP',\n 'COLLECTIBLE',\n 'COMPONENT',\n 'CONSOLE',\n 'CONSUMABLE',\n 'DASHBOARD',\n 'DATASINK',\n 'EQUIPMENT',\n 'EXTENSION',\n 'HARDWARE',\n 'INTEGRATION',\n 'MERCHANDISE',\n 'NODE',\n 'PARSER',\n 'PLUGIN',\n 'TEMPLATE',\n 'THEME',\n 'VIBEMODULE',\n 'WIDGET',\n 'WORKFLOW',\n] as const;\n\nconst ORDER_STATUSES = ['PENDING', 'PROCESSED', 'FAILED', 'REFUNDED'] as const;\nconst INSTALLATION_STATUSES = [\n 'PENDING',\n 'INSTALLING',\n 'ACTIVE',\n 'INACTIVE',\n 'FAILED',\n 'UNINSTALLED',\n] as const;\n\ntype Variables = Record<string, unknown>;\n\n/**\n * Explicit MCP annotations. The governance layer infers hints from the tool name\n * only, and that gets these wrong: `checkout` charges the billing account but\n * looks like a plain write, `clear` empties the cart, and `browse`/`products`\n * are reads that look like writes. A destructive hint makes a server that\n * enables `enforceDestructiveConfirmation` require `confirm: true`.\n */\nconst TOOL_ANNOTATIONS: Record<string, ToolAnnotations> = {\n store_cart_checkout: { readOnlyHint: false, destructiveHint: true },\n store_cart_clear: { readOnlyHint: false, destructiveHint: true },\n store_browse: { readOnlyHint: true, destructiveHint: false },\n store_publisher_products: { readOnlyHint: true, destructiveHint: false },\n};\n\n/** A cart mutation answers `success`/`errors` rather than throwing; surface them as an error. */\nfunction cartErrors(data: unknown): string | null {\n const payload = Object.values((data ?? {}) as Record<string, unknown>)[0] as\n { errors?: Array<{ message: string }> | null } | undefined;\n const errors = payload?.errors;\n return errors && errors.length > 0 ? errors.map((e) => e.message).join('; ') : null;\n}\n\nexport function registerStoreTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n const tool = (\n name: string,\n title: string,\n description: string,\n inputSchema: Record<string, z.ZodTypeAny>,\n document: string,\n variables: (args: Record<string, unknown>) => Variables,\n pick: (data: Record<string, unknown>) => unknown = (data) => Object.values(data)[0],\n ): void => {\n server.registerTool(\n track(mcpToolName(ctx.productName, name)),\n {\n title,\n description,\n inputSchema,\n ...(TOOL_ANNOTATIONS[name] ? { annotations: TOOL_ANNOTATIONS[name] } : {}),\n },\n async (args: Record<string, unknown>) => {\n try {\n const data = await ctx.gql.global.request<Record<string, unknown>>(\n document,\n variables(args),\n );\n const failure = cartErrors(data);\n if (failure) return errorResult(`${title} failed: ${failure}`);\n return jsonResult(pick(data));\n } catch (error) {\n ctx.logger.error(`${name} failed`, { error: String(error) });\n return errorResult(\n `${title} failed: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n };\n\n // ── Search / browse / get ──────────────────────────────────────────────\n tool(\n 'store_search',\n 'Search Store',\n 'Search the marketplace for products by free-text query.',\n {\n query: z.string().describe('Search query'),\n limit: z.number().int().optional().describe('Page size'),\n offset: z.number().int().optional().describe('Skip results'),\n },\n SEARCH_PRODUCTS,\n ({ query, limit, offset }) => ({ query, limit, offset }),\n );\n\n tool(\n 'store_browse',\n 'Browse Store',\n 'Browse the marketplace with filters, sorting and paging; returns facets and totals.',\n {\n category: z.string().optional().describe('Category filter'),\n type: z.enum(PRODUCT_TYPES).optional().describe('Product type filter'),\n search: z.string().optional().describe('Free-text filter'),\n sortBy: z\n .enum([\n 'RELEVANCE',\n 'NEWEST',\n 'OLDEST',\n 'NAME_ASC',\n 'NAME_DESC',\n 'PRICE_LOW',\n 'PRICE_HIGH',\n 'RATING',\n 'DOWNLOADS',\n 'FEATURED',\n ])\n .optional()\n .describe('Sort order'),\n limit: z.number().int().optional().describe('Page size'),\n offset: z.number().int().optional().describe('Skip results'),\n },\n BROWSE_STORE,\n ({ category, type, search, sortBy, limit, offset }) => {\n const filter: Variables = {};\n if (category !== undefined) filter.category = category;\n if (type !== undefined) filter.type = type;\n if (search !== undefined) filter.search = search;\n const pagination: Variables = {};\n if (limit !== undefined) pagination.limit = limit;\n if (offset !== undefined) pagination.offset = offset;\n const input: Variables = {};\n if (Object.keys(filter).length > 0) input.filter = filter;\n if (Object.keys(pagination).length > 0) input.pagination = pagination;\n if (sortBy !== undefined) input.sortBy = sortBy;\n return { input };\n },\n );\n\n tool(\n 'store_get_product',\n 'Get Product',\n 'Get a marketplace product by ID.',\n { id: z.string().describe('Product ID') },\n GET_STORE_PRODUCT,\n ({ id }) => ({ id }),\n );\n\n // ── Cart ───────────────────────────────────────────────────────────────\n tool('store_cart_list', 'Get My Cart', \"Get the current user's cart.\", {}, MY_CART, () => ({}));\n\n tool(\n 'store_cart_add',\n 'Add to Cart',\n 'Add a product (and optional variant) to the cart.',\n {\n product: z.string().describe('Product ID'),\n quantity: z.number().int().optional().describe('Quantity (default 1)'),\n variant: z.string().optional().describe('Variant ID'),\n },\n ADD_TO_CART,\n ({ product, quantity, variant }) => {\n const input: Variables = { productId: product };\n if (quantity !== undefined) input.quantity = quantity;\n if (variant !== undefined) input.variantId = variant;\n return { input };\n },\n );\n\n tool(\n 'store_cart_remove',\n 'Remove from Cart',\n 'Remove one line item from the cart.',\n { item: z.string().describe('Cart item ID (from store_cart_list)') },\n REMOVE_FROM_CART,\n ({ item }) => ({ cartItemId: item }),\n );\n\n tool(\n 'store_cart_checkout',\n 'Checkout Cart',\n 'Check out the current cart server-side and return the resulting order.',\n {\n billingAccountId: z.string().optional().describe('Billing account to charge'),\n paymentMethodId: z.string().optional().describe('Saved payment method'),\n shippingAddressId: z.string().optional().describe('Shipping address (physical items)'),\n shippingMethodId: z.string().optional().describe('Shipping method (physical items)'),\n notes: z.string().optional().describe('Order notes'),\n },\n CHECKOUT_CART,\n (args) => {\n const input: Variables = {};\n for (const [key, value] of Object.entries(args)) if (value !== undefined) input[key] = value;\n return { input };\n },\n );\n\n tool(\n 'store_cart_clear',\n 'Clear Cart',\n 'Remove every item from the cart.',\n {},\n CLEAR_CART,\n () => ({}),\n );\n\n // ── Orders ─────────────────────────────────────────────────────────────\n tool(\n 'store_orders_list',\n 'List Orders',\n 'List orders for the current user.',\n {\n status: z.enum(ORDER_STATUSES).optional().describe('Filter by order status'),\n limit: z.number().int().optional().describe('Page size'),\n offset: z.number().int().optional().describe('Skip results'),\n },\n GET_ORDERS,\n ({ status, limit, offset }) => ({ status, limit, offset }),\n );\n\n tool(\n 'store_orders_get',\n 'Get Order',\n 'Get an order by ID.',\n { id: z.string().describe('Order ID') },\n GET_ORDER,\n ({ id }) => ({ id }),\n );\n\n // ── Installed products / licenses ──────────────────────────────────────\n tool(\n 'store_installed_list',\n 'List Installed Products',\n 'List the caller’s store app installations, optionally for one workspace or product.',\n {\n workspace: z.string().optional().describe('Workspace ID filter'),\n product: z.string().optional().describe('Product ID filter'),\n status: z.enum(INSTALLATION_STATUSES).optional().describe('Installation status filter'),\n limit: z.number().int().optional().describe('Page size'),\n offset: z.number().int().optional().describe('Skip results'),\n },\n GET_INSTALLED_PRODUCTS,\n ({ workspace, product, status, limit, offset }) => {\n const filter: Variables = {};\n if (workspace !== undefined) filter.workspaceId = workspace;\n if (product !== undefined) filter.productId = product;\n if (status !== undefined) filter.status = status;\n return {\n filter: Object.keys(filter).length > 0 ? filter : undefined,\n limit,\n offset,\n };\n },\n );\n\n tool(\n 'store_installed_uninstall',\n 'Uninstall Product',\n 'Uninstall a store app by installation ID (from store_installed_list).',\n {\n installationId: z.string().describe('Installation ID'),\n reason: z.string().optional().describe('Why it is being uninstalled'),\n feedback: z.string().optional().describe('Free-text feedback for the publisher'),\n },\n UNINSTALL_PRODUCT,\n ({ installationId, reason, feedback }) => ({ id: installationId, reason, feedback }),\n (data) => ({ uninstalled: data.uninstallApp === true }),\n );\n\n tool(\n 'store_licenses_list',\n 'List Licenses',\n \"List the caller's product entitlements (licenses), including license keys and expiry.\",\n {\n limit: z.number().int().optional().describe('Page size'),\n offset: z.number().int().optional().describe('Skip results'),\n },\n GET_LICENSES,\n ({ limit, offset }) => ({ limit, offset }),\n );\n\n // ── Publisher ──────────────────────────────────────────────────────────\n tool(\n 'store_publisher_get',\n 'Get My Publisher',\n \"Get the caller's publisher profile (null when the caller is not a publisher).\",\n {},\n GET_MY_PUBLISHER,\n () => ({}),\n );\n\n tool(\n 'store_publisher_products',\n 'List My Publisher Products',\n 'List products published by the caller.',\n {},\n GET_MY_PUBLISHER_PRODUCTS,\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"]}
|