@shoppexio/mcp-commerce-server 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/server.mjs +262 -0
package/package.json
CHANGED
package/src/server.mjs
CHANGED
|
@@ -257,6 +257,84 @@ export class ShoppexCommerceDevApiClient {
|
|
|
257
257
|
body: input,
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
|
+
|
|
261
|
+
productsDelete(productId) {
|
|
262
|
+
return this.request('DELETE', `/dev/v1/products/${encodeURIComponent(productId)}`);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
productsDuplicate(productId) {
|
|
266
|
+
return this.request('POST', `/dev/v1/products/${encodeURIComponent(productId)}/duplicate`);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
productsUploadSerials(productId, input) {
|
|
270
|
+
return this.request('POST', `/dev/v1/products/${encodeURIComponent(productId)}/serials`, {
|
|
271
|
+
body: input,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
customersList(input = {}) {
|
|
276
|
+
return this.request('GET', '/dev/v1/customers', {
|
|
277
|
+
query: { limit: input.limit, filters: input.filters },
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
categoriesList() {
|
|
282
|
+
return this.request('GET', '/dev/v1/categories');
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
categoriesCreate(input) {
|
|
286
|
+
return this.request('POST', '/dev/v1/categories', { body: input });
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
categoriesUpdate(categoryId, input) {
|
|
290
|
+
return this.request('PATCH', `/dev/v1/categories/${encodeURIComponent(categoryId)}`, { body: input });
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
webhooksList() {
|
|
294
|
+
return this.request('GET', '/dev/v1/webhooks');
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
webhooksCreate(input) {
|
|
298
|
+
return this.request('POST', '/dev/v1/webhooks', { body: input });
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
invoicesList(input = {}) {
|
|
302
|
+
return this.request('GET', '/dev/v1/invoices', {
|
|
303
|
+
query: { limit: input.limit, status: input.status, customer_email: input.customer_email },
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
invoicesGet(uniqid) {
|
|
308
|
+
return this.request('GET', `/dev/v1/invoices/${encodeURIComponent(uniqid)}`);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
disputesList(input = {}) {
|
|
312
|
+
return this.request('GET', '/dev/v1/disputes', {
|
|
313
|
+
query: { limit: input.limit, status: input.status },
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
licensesList() {
|
|
318
|
+
return this.request('GET', '/dev/v1/licenses');
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
affiliatesList(input = {}) {
|
|
322
|
+
return this.request('GET', '/dev/v1/affiliates', {
|
|
323
|
+
query: { limit: input.limit },
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
subscriptionsList(input = {}) {
|
|
328
|
+
return this.request('GET', '/dev/v1/subscriptions', {
|
|
329
|
+
query: { limit: input.limit, status: input.status },
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
subscriptionsCancel(subscriptionId, input = {}) {
|
|
334
|
+
return this.request('POST', `/dev/v1/subscriptions/${encodeURIComponent(subscriptionId)}/cancel`, {
|
|
335
|
+
body: input,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
260
338
|
}
|
|
261
339
|
|
|
262
340
|
const BaseToolSchema = {
|
|
@@ -538,6 +616,190 @@ export function createCommerceToolCatalog() {
|
|
|
538
616
|
return createClient(args).productsUpdate(args.product_id, body);
|
|
539
617
|
},
|
|
540
618
|
},
|
|
619
|
+
{
|
|
620
|
+
name: 'products_delete',
|
|
621
|
+
description: 'Soft-delete a product by uniqid. The product is hidden from the storefront but kept for historical orders.',
|
|
622
|
+
inputSchema: { ...BaseToolSchema, product_id: z.string().trim().min(1) },
|
|
623
|
+
execute: async (args) => createClient(args).productsDelete(args.product_id),
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
name: 'products_duplicate',
|
|
627
|
+
description: 'Duplicate a product by uniqid. Returns the newly created product.',
|
|
628
|
+
inputSchema: { ...BaseToolSchema, product_id: z.string().trim().min(1) },
|
|
629
|
+
execute: async (args) => createClient(args).productsDuplicate(args.product_id),
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
name: 'products_upload_serials',
|
|
633
|
+
description: 'Upload additional serial keys (license keys) to a product whose type is SERIALS. Useful for restocking digital key-based products.',
|
|
634
|
+
inputSchema: {
|
|
635
|
+
...BaseToolSchema,
|
|
636
|
+
product_id: z.string().trim().min(1),
|
|
637
|
+
serials: z.array(z.string().trim().min(1)).min(1),
|
|
638
|
+
remove_duplicates: z.boolean().optional(),
|
|
639
|
+
},
|
|
640
|
+
execute: async (args) => createClient(args).productsUploadSerials(args.product_id, {
|
|
641
|
+
serials: args.serials,
|
|
642
|
+
serials_remove_duplicates: args.remove_duplicates ?? false,
|
|
643
|
+
}),
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
name: 'customers_list',
|
|
647
|
+
description: 'List customers for the authenticated shop. Supports Shoppex-style filter expressions (e.g. "email:john@example.com").',
|
|
648
|
+
inputSchema: {
|
|
649
|
+
...BaseToolSchema,
|
|
650
|
+
limit: z.number().int().min(1).max(50).optional(),
|
|
651
|
+
filters: z.string().trim().min(1).optional(),
|
|
652
|
+
},
|
|
653
|
+
execute: async (args) => createClient(args).customersList({
|
|
654
|
+
limit: args.limit,
|
|
655
|
+
filters: args.filters,
|
|
656
|
+
}),
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
name: 'categories_list',
|
|
660
|
+
description: 'List product categories for the authenticated shop.',
|
|
661
|
+
inputSchema: { ...BaseToolSchema },
|
|
662
|
+
execute: async (args) => createClient(args).categoriesList(),
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
name: 'categories_create',
|
|
666
|
+
description: 'Create a product category.',
|
|
667
|
+
inputSchema: {
|
|
668
|
+
...BaseToolSchema,
|
|
669
|
+
name: z.string().trim().min(1).max(128),
|
|
670
|
+
description: z.string().optional(),
|
|
671
|
+
parent_id: z.string().trim().min(1).optional().nullable(),
|
|
672
|
+
image_id: z.string().trim().min(1).optional().nullable(),
|
|
673
|
+
},
|
|
674
|
+
execute: async (args) => {
|
|
675
|
+
const body = { name: args.name };
|
|
676
|
+
if (args.description !== undefined) body.description = args.description;
|
|
677
|
+
if (args.parent_id !== undefined) body.parent_id = args.parent_id;
|
|
678
|
+
if (args.image_id !== undefined) body.image_id = args.image_id;
|
|
679
|
+
return createClient(args).categoriesCreate(body);
|
|
680
|
+
},
|
|
681
|
+
},
|
|
682
|
+
{
|
|
683
|
+
name: 'categories_update',
|
|
684
|
+
description: 'Update a category by id. Only provided fields change.',
|
|
685
|
+
inputSchema: {
|
|
686
|
+
...BaseToolSchema,
|
|
687
|
+
category_id: z.string().trim().min(1),
|
|
688
|
+
name: z.string().trim().min(1).max(128).optional(),
|
|
689
|
+
description: z.string().optional(),
|
|
690
|
+
parent_id: z.string().trim().min(1).optional().nullable(),
|
|
691
|
+
image_id: z.string().trim().min(1).optional().nullable(),
|
|
692
|
+
},
|
|
693
|
+
execute: async (args) => {
|
|
694
|
+
const body = {};
|
|
695
|
+
if (args.name !== undefined) body.name = args.name;
|
|
696
|
+
if (args.description !== undefined) body.description = args.description;
|
|
697
|
+
if (args.parent_id !== undefined) body.parent_id = args.parent_id;
|
|
698
|
+
if (args.image_id !== undefined) body.image_id = args.image_id;
|
|
699
|
+
return createClient(args).categoriesUpdate(args.category_id, body);
|
|
700
|
+
},
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
name: 'webhooks_list',
|
|
704
|
+
description: 'List webhook subscriptions registered for the authenticated shop.',
|
|
705
|
+
inputSchema: { ...BaseToolSchema },
|
|
706
|
+
execute: async (args) => createClient(args).webhooksList(),
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
name: 'webhooks_create',
|
|
710
|
+
description: 'Register a webhook subscription for shop events. Returns the webhook with its signing secret.',
|
|
711
|
+
inputSchema: {
|
|
712
|
+
...BaseToolSchema,
|
|
713
|
+
url: z.string().trim().url(),
|
|
714
|
+
events: z.array(z.string().trim().min(1)).min(1),
|
|
715
|
+
description: z.string().max(255).optional(),
|
|
716
|
+
},
|
|
717
|
+
execute: async (args) => {
|
|
718
|
+
const body = { url: args.url, events: args.events };
|
|
719
|
+
if (args.description !== undefined) body.description = args.description;
|
|
720
|
+
return createClient(args).webhooksCreate(body);
|
|
721
|
+
},
|
|
722
|
+
},
|
|
723
|
+
{
|
|
724
|
+
name: 'invoices_list',
|
|
725
|
+
description: 'List invoices. Can filter by status (pending, paid, cancelled, refunded) and customer email.',
|
|
726
|
+
inputSchema: {
|
|
727
|
+
...BaseToolSchema,
|
|
728
|
+
limit: z.number().int().min(1).max(50).optional(),
|
|
729
|
+
status: z.string().trim().min(1).optional(),
|
|
730
|
+
customer_email: z.string().trim().email().optional(),
|
|
731
|
+
},
|
|
732
|
+
execute: async (args) => createClient(args).invoicesList({
|
|
733
|
+
limit: args.limit,
|
|
734
|
+
status: args.status,
|
|
735
|
+
customer_email: args.customer_email,
|
|
736
|
+
}),
|
|
737
|
+
},
|
|
738
|
+
{
|
|
739
|
+
name: 'invoices_get',
|
|
740
|
+
description: 'Fetch one invoice with line items, payment, and customer by uniqid.',
|
|
741
|
+
inputSchema: { ...BaseToolSchema, invoice_id: z.string().trim().min(1) },
|
|
742
|
+
execute: async (args) => createClient(args).invoicesGet(args.invoice_id),
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
name: 'disputes_list',
|
|
746
|
+
description: 'List chargeback disputes. Filter by status (open, won, lost, warning).',
|
|
747
|
+
inputSchema: {
|
|
748
|
+
...BaseToolSchema,
|
|
749
|
+
limit: z.number().int().min(1).max(50).optional(),
|
|
750
|
+
status: z.string().trim().min(1).optional(),
|
|
751
|
+
},
|
|
752
|
+
execute: async (args) => createClient(args).disputesList({
|
|
753
|
+
limit: args.limit,
|
|
754
|
+
status: args.status,
|
|
755
|
+
}),
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
name: 'licenses_list',
|
|
759
|
+
description: 'List software licenses issued by the shop. Useful for validating or revoking customer license keys.',
|
|
760
|
+
inputSchema: { ...BaseToolSchema },
|
|
761
|
+
execute: async (args) => createClient(args).licensesList(),
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
name: 'affiliates_list',
|
|
765
|
+
description: 'List affiliates (customers with active affiliate links) for the authenticated shop.',
|
|
766
|
+
inputSchema: {
|
|
767
|
+
...BaseToolSchema,
|
|
768
|
+
limit: z.number().int().min(1).max(50).optional(),
|
|
769
|
+
},
|
|
770
|
+
execute: async (args) => createClient(args).affiliatesList({
|
|
771
|
+
limit: args.limit,
|
|
772
|
+
}),
|
|
773
|
+
},
|
|
774
|
+
{
|
|
775
|
+
name: 'subscriptions_list',
|
|
776
|
+
description: 'List recurring subscriptions. Filter by status (active, past_due, cancelled, paused, trialing).',
|
|
777
|
+
inputSchema: {
|
|
778
|
+
...BaseToolSchema,
|
|
779
|
+
limit: z.number().int().min(1).max(50).optional(),
|
|
780
|
+
status: z.string().trim().min(1).optional(),
|
|
781
|
+
},
|
|
782
|
+
execute: async (args) => createClient(args).subscriptionsList({
|
|
783
|
+
limit: args.limit,
|
|
784
|
+
status: args.status,
|
|
785
|
+
}),
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
name: 'subscriptions_cancel',
|
|
789
|
+
description: 'Cancel a subscription by id. Optionally cancel immediately or at end of current period.',
|
|
790
|
+
inputSchema: {
|
|
791
|
+
...BaseToolSchema,
|
|
792
|
+
subscription_id: z.string().trim().min(1),
|
|
793
|
+
cancel_at_period_end: z.boolean().optional(),
|
|
794
|
+
reason: z.string().max(255).optional(),
|
|
795
|
+
},
|
|
796
|
+
execute: async (args) => {
|
|
797
|
+
const body = {};
|
|
798
|
+
if (args.cancel_at_period_end !== undefined) body.cancel_at_period_end = args.cancel_at_period_end;
|
|
799
|
+
if (args.reason !== undefined) body.reason = args.reason;
|
|
800
|
+
return createClient(args).subscriptionsCancel(args.subscription_id, body);
|
|
801
|
+
},
|
|
802
|
+
},
|
|
541
803
|
];
|
|
542
804
|
}
|
|
543
805
|
|