@kelviq/mcp-server 0.2.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/LICENSE +21 -0
- package/README.md +322 -0
- package/dist/config.d.ts +16 -0
- package/dist/config.js +45 -0
- package/dist/config.js.map +1 -0
- package/dist/docs/README.md +128 -0
- package/dist/docs/api-reference/authentication.md +41 -0
- package/dist/docs/backend-integration/node-sdk.md +1040 -0
- package/dist/docs/backend-integration/python-sdk.md +1198 -0
- package/dist/docs/changelog/app.md +80 -0
- package/dist/docs/changelog/checkout-api.md +59 -0
- package/dist/docs/changelog/js-promotions-ui.md +14 -0
- package/dist/docs/changelog/js-sdk.md +281 -0
- package/dist/docs/changelog/node-sdk.md +378 -0
- package/dist/docs/changelog/python-sdk.md +456 -0
- package/dist/docs/changelog/react-sdk.md +580 -0
- package/dist/docs/checkout/checkout-configuration.md +434 -0
- package/dist/docs/coustomers-management/overview.md +111 -0
- package/dist/docs/customer-portal/overview.md +81 -0
- package/dist/docs/frontend-integration/js-sdk.md +676 -0
- package/dist/docs/frontend-integration/promotions-ui-js.md +265 -0
- package/dist/docs/frontend-integration/react-promotions-ui.md +361 -0
- package/dist/docs/frontend-integration/react-sdk.md +1187 -0
- package/dist/docs/frontend-integration/react-ui.md +771 -0
- package/dist/docs/getstarted/fees.md +160 -0
- package/dist/docs/getstarted/introduction-to-kelviq.md +80 -0
- package/dist/docs/getstarted/merchant-of-record.md +64 -0
- package/dist/docs/getstarted/review-process.md +190 -0
- package/dist/docs/guides/subscription-integration-for-nextjs.md +512 -0
- package/dist/docs/guides/subscription-integration.md +291 -0
- package/dist/docs/guides/webhooks.md +963 -0
- package/dist/docs/legal/approved-prohibited-policy.md +252 -0
- package/dist/docs/legal/buyer-terms.md +177 -0
- package/dist/docs/legal/compliant-user-flow.md +216 -0
- package/dist/docs/legal/master-service-agreement.md +404 -0
- package/dist/docs/legal/payment-flow-diagram.md +188 -0
- package/dist/docs/legal/seller-terms.md +169 -0
- package/dist/docs/manifest.json +415 -0
- package/dist/docs/monetization/offerings.md +156 -0
- package/dist/docs/monetization/pricing-tables.md +226 -0
- package/dist/docs/monetization/targeting-rules.md +278 -0
- package/dist/docs/openapi.json +5479 -0
- package/dist/docs/payouts/overview.md +43 -0
- package/dist/docs/payouts/payout-account.md +12 -0
- package/dist/docs/payouts/transactions.md +23 -0
- package/dist/docs/product-catalog/digital-downloads.md +117 -0
- package/dist/docs/product-catalog/discounts.md +69 -0
- package/dist/docs/product-catalog/entitlements.md +428 -0
- package/dist/docs/product-catalog/free-and-trials.md +36 -0
- package/dist/docs/product-catalog/license-keys.md +324 -0
- package/dist/docs/product-catalog/links.md +92 -0
- package/dist/docs/product-catalog/location-based-pricing.md +41 -0
- package/dist/docs/product-catalog/one-time-payments.md +24 -0
- package/dist/docs/product-catalog/plans.md +199 -0
- package/dist/docs/product-catalog/products.md +60 -0
- package/dist/docs/product-catalog/subscriptions.md +29 -0
- package/dist/docs/product-catalog/tax-settings.md +37 -0
- package/dist/docs/product-catalog/usage-based-billing.md +119 -0
- package/dist/docs/promotions/create-a-promotion.md +75 -0
- package/dist/docs/promotions/customize-banner.md +41 -0
- package/dist/docs/promotions/integrate.md +38 -0
- package/dist/docs/promotions/overview.md +51 -0
- package/dist/docs/quickstart/core-concepts.md +146 -0
- package/dist/docs/quickstart/dashboard-setup.md +129 -0
- package/dist/docs/quickstart/integrate-with-your-app.md +149 -0
- package/dist/docs/sales/checkout-sessions.md +58 -0
- package/dist/docs/sales/orders.md +76 -0
- package/dist/http/client.d.ts +28 -0
- package/dist/http/client.js +76 -0
- package/dist/http/client.js.map +1 -0
- package/dist/http/errors.d.ts +20 -0
- package/dist/http/errors.js +58 -0
- package/dist/http/errors.js.map +1 -0
- package/dist/resources/docs-index.d.ts +25 -0
- package/dist/resources/docs-index.js +109 -0
- package/dist/resources/docs-index.js.map +1 -0
- package/dist/resources/index.d.ts +2 -0
- package/dist/resources/index.js +73 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/schemas/kelviq.d.ts +1304 -0
- package/dist/schemas/kelviq.js +468 -0
- package/dist/schemas/kelviq.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +41 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/_util.d.ts +15 -0
- package/dist/tools/_util.js +15 -0
- package/dist/tools/_util.js.map +1 -0
- package/dist/tools/checkout.d.ts +3 -0
- package/dist/tools/checkout.js +18 -0
- package/dist/tools/checkout.js.map +1 -0
- package/dist/tools/customers.d.ts +3 -0
- package/dist/tools/customers.js +32 -0
- package/dist/tools/customers.js.map +1 -0
- package/dist/tools/docs.d.ts +2 -0
- package/dist/tools/docs.js +43 -0
- package/dist/tools/docs.js.map +1 -0
- package/dist/tools/entitlements.d.ts +3 -0
- package/dist/tools/entitlements.js +22 -0
- package/dist/tools/entitlements.js.map +1 -0
- package/dist/tools/features.d.ts +3 -0
- package/dist/tools/features.js +55 -0
- package/dist/tools/features.js.map +1 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.js +44 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/licenses.d.ts +3 -0
- package/dist/tools/licenses.js +44 -0
- package/dist/tools/licenses.js.map +1 -0
- package/dist/tools/media.d.ts +3 -0
- package/dist/tools/media.js +18 -0
- package/dist/tools/media.js.map +1 -0
- package/dist/tools/offerings.d.ts +3 -0
- package/dist/tools/offerings.js +21 -0
- package/dist/tools/offerings.js.map +1 -0
- package/dist/tools/partner.d.ts +3 -0
- package/dist/tools/partner.js +55 -0
- package/dist/tools/partner.js.map +1 -0
- package/dist/tools/plan-entitlements.d.ts +3 -0
- package/dist/tools/plan-entitlements.js +56 -0
- package/dist/tools/plan-entitlements.js.map +1 -0
- package/dist/tools/plan-files.d.ts +3 -0
- package/dist/tools/plan-files.js +43 -0
- package/dist/tools/plan-files.js.map +1 -0
- package/dist/tools/plans.d.ts +3 -0
- package/dist/tools/plans.js +120 -0
- package/dist/tools/plans.js.map +1 -0
- package/dist/tools/portal.d.ts +3 -0
- package/dist/tools/portal.js +18 -0
- package/dist/tools/portal.js.map +1 -0
- package/dist/tools/product-files.d.ts +3 -0
- package/dist/tools/product-files.js +31 -0
- package/dist/tools/product-files.js.map +1 -0
- package/dist/tools/product-settings.d.ts +3 -0
- package/dist/tools/product-settings.js +31 -0
- package/dist/tools/product-settings.js.map +1 -0
- package/dist/tools/products.d.ts +3 -0
- package/dist/tools/products.js +69 -0
- package/dist/tools/products.js.map +1 -0
- package/dist/tools/promotions.d.ts +3 -0
- package/dist/tools/promotions.js +19 -0
- package/dist/tools/promotions.js.map +1 -0
- package/dist/tools/subscriptions.d.ts +3 -0
- package/dist/tools/subscriptions.js +63 -0
- package/dist/tools/subscriptions.js.map +1 -0
- package/dist/tools/usage.d.ts +3 -0
- package/dist/tools/usage.js +18 -0
- package/dist/tools/usage.js.map +1 -0
- package/package.json +88 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { ListPlans, PlanArchive, PlanCreate, PlanDiscardDraft, PlanPricesBulkSet, PlanPricesList, PlanPublish, PlanRetrieve, PlanUpdate, } from '../schemas/kelviq.js';
|
|
2
|
+
import { resultToContent } from './_util.js';
|
|
3
|
+
export function registerPlanTools(server, http) {
|
|
4
|
+
server.registerTool('plan_list', {
|
|
5
|
+
title: 'List plans',
|
|
6
|
+
description: 'List all catalog plans in the account.',
|
|
7
|
+
inputSchema: ListPlans.shape,
|
|
8
|
+
}, async () => {
|
|
9
|
+
const result = await http.request({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/catalog/plans/',
|
|
12
|
+
auth: 'server',
|
|
13
|
+
});
|
|
14
|
+
return resultToContent(result);
|
|
15
|
+
});
|
|
16
|
+
server.registerTool('plan_create', {
|
|
17
|
+
title: 'Create plan',
|
|
18
|
+
description: 'Create a new plan under a product. Required: `name`, `product` (product UUID). The new plan is created in DRAFT state — call `plan_publish` to make it live.',
|
|
19
|
+
inputSchema: PlanCreate.shape,
|
|
20
|
+
}, async (input) => {
|
|
21
|
+
const result = await http.request({
|
|
22
|
+
method: 'POST',
|
|
23
|
+
path: '/catalog/plans/',
|
|
24
|
+
body: input,
|
|
25
|
+
auth: 'server',
|
|
26
|
+
});
|
|
27
|
+
return resultToContent(result);
|
|
28
|
+
});
|
|
29
|
+
server.registerTool('plan_retrieve', {
|
|
30
|
+
title: 'Retrieve plan',
|
|
31
|
+
description: 'Fetch a single plan by identifier.',
|
|
32
|
+
inputSchema: PlanRetrieve.shape,
|
|
33
|
+
}, async (input) => {
|
|
34
|
+
const result = await http.request({
|
|
35
|
+
method: 'GET',
|
|
36
|
+
path: `/catalog/plans/${encodeURIComponent(input.planIdentifier)}/`,
|
|
37
|
+
auth: 'server',
|
|
38
|
+
});
|
|
39
|
+
return resultToContent(result);
|
|
40
|
+
});
|
|
41
|
+
server.registerTool('plan_update', {
|
|
42
|
+
title: 'Update plan',
|
|
43
|
+
description: 'Patch an existing plan. Updates to a published (`is_latest`) plan automatically create a new draft version — call `plan_publish` to release it.',
|
|
44
|
+
inputSchema: PlanUpdate.shape,
|
|
45
|
+
}, async (input) => {
|
|
46
|
+
const { planIdentifier, ...body } = input;
|
|
47
|
+
const result = await http.request({
|
|
48
|
+
method: 'PATCH',
|
|
49
|
+
path: `/catalog/plans/${encodeURIComponent(planIdentifier)}/`,
|
|
50
|
+
body,
|
|
51
|
+
auth: 'server',
|
|
52
|
+
});
|
|
53
|
+
return resultToContent(result);
|
|
54
|
+
});
|
|
55
|
+
server.registerTool('plan_archive', {
|
|
56
|
+
title: 'Archive plan',
|
|
57
|
+
description: 'Archive a plan. Existing subscriptions remain active; new subscriptions cannot be created.',
|
|
58
|
+
inputSchema: PlanArchive.shape,
|
|
59
|
+
}, async (input) => {
|
|
60
|
+
const result = await http.request({
|
|
61
|
+
method: 'DELETE',
|
|
62
|
+
path: `/catalog/plans/${encodeURIComponent(input.planIdentifier)}/`,
|
|
63
|
+
auth: 'server',
|
|
64
|
+
});
|
|
65
|
+
return resultToContent(result);
|
|
66
|
+
});
|
|
67
|
+
server.registerTool('plan_publish', {
|
|
68
|
+
title: 'Publish plan',
|
|
69
|
+
description: 'Publish the latest draft of a plan, making it the live version. Use `updateFeatures` / `updatePricing` to also migrate existing customers to the new features / pricing.',
|
|
70
|
+
inputSchema: PlanPublish.shape,
|
|
71
|
+
}, async (input) => {
|
|
72
|
+
const { planIdentifier, ...body } = input;
|
|
73
|
+
const result = await http.request({
|
|
74
|
+
method: 'POST',
|
|
75
|
+
path: `/catalog/plans/${encodeURIComponent(planIdentifier)}/publish/`,
|
|
76
|
+
body,
|
|
77
|
+
auth: 'server',
|
|
78
|
+
});
|
|
79
|
+
return resultToContent(result);
|
|
80
|
+
});
|
|
81
|
+
server.registerTool('plan_discard_draft', {
|
|
82
|
+
title: 'Discard draft plan',
|
|
83
|
+
description: 'Discard the current draft of a plan. The previously-published version (if any) remains the live plan.',
|
|
84
|
+
inputSchema: PlanDiscardDraft.shape,
|
|
85
|
+
}, async (input) => {
|
|
86
|
+
const result = await http.request({
|
|
87
|
+
method: 'DELETE',
|
|
88
|
+
path: `/catalog/plans/${encodeURIComponent(input.planIdentifier)}/discard/`,
|
|
89
|
+
auth: 'server',
|
|
90
|
+
});
|
|
91
|
+
return resultToContent(result);
|
|
92
|
+
});
|
|
93
|
+
server.registerTool('plan_prices_list', {
|
|
94
|
+
title: 'List plan prices',
|
|
95
|
+
description: 'List all prices configured on a plan (across currencies, charge periods, and feature-level pricing).',
|
|
96
|
+
inputSchema: PlanPricesList.shape,
|
|
97
|
+
}, async (input) => {
|
|
98
|
+
const result = await http.request({
|
|
99
|
+
method: 'GET',
|
|
100
|
+
path: `/catalog/plans/${encodeURIComponent(input.planIdentifier)}/prices/`,
|
|
101
|
+
auth: 'server',
|
|
102
|
+
});
|
|
103
|
+
return resultToContent(result);
|
|
104
|
+
});
|
|
105
|
+
server.registerTool('plan_prices_bulk_set', {
|
|
106
|
+
title: 'Bulk set plan prices',
|
|
107
|
+
description: 'Atomically replace all prices on a plan. Each entry: { priceType (FREE/PAID/CUSTOM), currency, freeTrial, trialPeriod, taxBehavior, chargeCatalogPrice: [{feature?, priceModel, paymentType, …}] }. See the bundled docs (`api-reference/plans/update-plan-prices`) for full per-charge shape.',
|
|
108
|
+
inputSchema: PlanPricesBulkSet.shape,
|
|
109
|
+
}, async (input) => {
|
|
110
|
+
const { planIdentifier, ...body } = input;
|
|
111
|
+
const result = await http.request({
|
|
112
|
+
method: 'POST',
|
|
113
|
+
path: `/catalog/plans/${encodeURIComponent(planIdentifier)}/prices/bulk/`,
|
|
114
|
+
body,
|
|
115
|
+
auth: 'server',
|
|
116
|
+
});
|
|
117
|
+
return resultToContent(result);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=plans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plans.js","sourceRoot":"","sources":["../../src/tools/plans.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,SAAS,EACT,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,UAAU,GACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,UAAU,iBAAiB,CAAC,MAAiB,EAAE,IAAsB;IACzE,MAAM,CAAC,YAAY,CACjB,WAAW,EACX;QACE,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,wCAAwC;QACrD,WAAW,EAAE,SAAS,CAAC,KAAK;KAC7B,EACD,KAAK,IAAI,EAAE;QACT,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,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BAAkB,kBAAkB,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW;YAC3E,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,kBAAkB,EAClB;QACE,KAAK,EAAE,kBAAkB;QACzB,WAAW,EAAE,sGAAsG;QACnH,WAAW,EAAE,cAAc,CAAC,KAAK;KAClC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU;YAC1E,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,gSAAgS;QAClS,WAAW,EAAE,iBAAiB,CAAC,KAAK;KACrC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,cAAc,CAAC,eAAe;YACzE,IAAI;YACJ,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CreatePortalSession } from '../schemas/kelviq.js';
|
|
2
|
+
import { resultToContent } from './_util.js';
|
|
3
|
+
export function registerPortalTools(server, http) {
|
|
4
|
+
server.registerTool('portal_session_create', {
|
|
5
|
+
title: 'Create customer portal session',
|
|
6
|
+
description: 'Create a pre-authenticated customer portal session and return a URL the customer can use to manage their subscription without logging in.',
|
|
7
|
+
inputSchema: CreatePortalSession.shape,
|
|
8
|
+
}, async (input) => {
|
|
9
|
+
const result = await http.request({
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/portal/session/',
|
|
12
|
+
body: input,
|
|
13
|
+
auth: 'server',
|
|
14
|
+
});
|
|
15
|
+
return resultToContent(result);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=portal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"portal.js","sourceRoot":"","sources":["../../src/tools/portal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,IAAsB;IAC3E,MAAM,CAAC,YAAY,CACjB,uBAAuB,EACvB;QACE,KAAK,EAAE,gCAAgC;QACvC,WAAW,EACT,2IAA2I;QAC7I,WAAW,EAAE,mBAAmB,CAAC,KAAK;KACvC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ProductImageDelete, ProductImageUpdate } from '../schemas/kelviq.js';
|
|
2
|
+
import { resultToContent } from './_util.js';
|
|
3
|
+
export function registerProductFileTools(server, http) {
|
|
4
|
+
server.registerTool('product_image_update', {
|
|
5
|
+
title: 'Update product image',
|
|
6
|
+
description: 'Edit display fields of a product image (name, ordering, thumbnail flag, enabled). The underlying file cannot be replaced — upload a new image instead.',
|
|
7
|
+
inputSchema: ProductImageUpdate.shape,
|
|
8
|
+
}, async (input) => {
|
|
9
|
+
const { productId, imageId, ...body } = input;
|
|
10
|
+
const result = await http.request({
|
|
11
|
+
method: 'PATCH',
|
|
12
|
+
path: `/catalog/products/${encodeURIComponent(productId)}/image/${encodeURIComponent(imageId)}/`,
|
|
13
|
+
body,
|
|
14
|
+
auth: 'server',
|
|
15
|
+
});
|
|
16
|
+
return resultToContent(result);
|
|
17
|
+
});
|
|
18
|
+
server.registerTool('product_image_delete', {
|
|
19
|
+
title: 'Delete product image',
|
|
20
|
+
description: 'Permanently remove an image from a product.',
|
|
21
|
+
inputSchema: ProductImageDelete.shape,
|
|
22
|
+
}, async (input) => {
|
|
23
|
+
const result = await http.request({
|
|
24
|
+
method: 'DELETE',
|
|
25
|
+
path: `/catalog/products/${encodeURIComponent(input.productId)}/image/${encodeURIComponent(input.imageId)}/`,
|
|
26
|
+
auth: 'server',
|
|
27
|
+
});
|
|
28
|
+
return resultToContent(result);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=product-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-files.js","sourceRoot":"","sources":["../../src/tools/product-files.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,UAAU,wBAAwB,CAAC,MAAiB,EAAE,IAAsB;IAChF,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,wJAAwJ;QAC1J,WAAW,EAAE,kBAAkB,CAAC,KAAK;KACtC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QAC9C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,SAAS,CAAC,UAAU,kBAAkB,CAAC,OAAO,CAAC,GAAG;YAChG,IAAI;YACJ,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,6CAA6C;QAC1D,WAAW,EAAE,kBAAkB,CAAC,KAAK;KACtC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG;YAC5G,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ProductSettingsGet, ProductSettingsUpdate } from '../schemas/kelviq.js';
|
|
2
|
+
import { resultToContent } from './_util.js';
|
|
3
|
+
export function registerProductSettingsTools(server, http) {
|
|
4
|
+
server.registerTool('product_settings_get', {
|
|
5
|
+
title: 'Get product settings',
|
|
6
|
+
description: 'Retrieve product settings (VPN/Tor/proxy policy, default currency, product URL).',
|
|
7
|
+
inputSchema: ProductSettingsGet.shape,
|
|
8
|
+
}, async (input) => {
|
|
9
|
+
const result = await http.request({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: `/catalog/products/${encodeURIComponent(input.productId)}/settings/`,
|
|
12
|
+
auth: 'server',
|
|
13
|
+
});
|
|
14
|
+
return resultToContent(result);
|
|
15
|
+
});
|
|
16
|
+
server.registerTool('product_settings_update', {
|
|
17
|
+
title: 'Update product settings',
|
|
18
|
+
description: 'Patch product settings. Any subset of fields may be supplied; missing fields are left unchanged.',
|
|
19
|
+
inputSchema: ProductSettingsUpdate.shape,
|
|
20
|
+
}, async (input) => {
|
|
21
|
+
const { productId, ...body } = input;
|
|
22
|
+
const result = await http.request({
|
|
23
|
+
method: 'PATCH',
|
|
24
|
+
path: `/catalog/products/${encodeURIComponent(productId)}/settings/`,
|
|
25
|
+
body,
|
|
26
|
+
auth: 'server',
|
|
27
|
+
});
|
|
28
|
+
return resultToContent(result);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=product-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-settings.js","sourceRoot":"","sources":["../../src/tools/product-settings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,UAAU,4BAA4B,CAAC,MAAiB,EAAE,IAAsB;IACpF,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,kFAAkF;QACpF,WAAW,EAAE,kBAAkB,CAAC,KAAK;KACtC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY;YAC1E,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,yBAAyB,EACzB;QACE,KAAK,EAAE,yBAAyB;QAChC,WAAW,EACT,kGAAkG;QACpG,WAAW,EAAE,qBAAqB,CAAC,KAAK;KACzC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QACrC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,SAAS,CAAC,YAAY;YACpE,IAAI;YACJ,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ListProducts, ProductArchive, ProductCreate, ProductRetrieve, ProductUpdate, } from '../schemas/kelviq.js';
|
|
2
|
+
import { resultToContent } from './_util.js';
|
|
3
|
+
export function registerProductTools(server, http) {
|
|
4
|
+
server.registerTool('product_list', {
|
|
5
|
+
title: 'List products',
|
|
6
|
+
description: 'List catalog products. Optional `search` filters by name/identifier substring; `page` paginates.',
|
|
7
|
+
inputSchema: ListProducts.shape,
|
|
8
|
+
}, async (input) => {
|
|
9
|
+
const result = await http.request({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/catalog/products/',
|
|
12
|
+
auth: 'server',
|
|
13
|
+
query: { search: input.search, page: input.page },
|
|
14
|
+
});
|
|
15
|
+
return resultToContent(result);
|
|
16
|
+
});
|
|
17
|
+
server.registerTool('product_create', {
|
|
18
|
+
title: 'Create product',
|
|
19
|
+
description: 'Create a new catalog product. Required: `name` and `taxCode`. `identifier` is auto-generated from `name` if omitted. `imageKeys` are tmp S3 keys from `media_presigned_upload`.',
|
|
20
|
+
inputSchema: ProductCreate.shape,
|
|
21
|
+
}, async (input) => {
|
|
22
|
+
const result = await http.request({
|
|
23
|
+
method: 'POST',
|
|
24
|
+
path: '/catalog/products/',
|
|
25
|
+
body: input,
|
|
26
|
+
auth: 'server',
|
|
27
|
+
});
|
|
28
|
+
return resultToContent(result);
|
|
29
|
+
});
|
|
30
|
+
server.registerTool('product_retrieve', {
|
|
31
|
+
title: 'Retrieve product',
|
|
32
|
+
description: 'Fetch a single catalog product by UUID or identifier.',
|
|
33
|
+
inputSchema: ProductRetrieve.shape,
|
|
34
|
+
}, async (input) => {
|
|
35
|
+
const result = await http.request({
|
|
36
|
+
method: 'GET',
|
|
37
|
+
path: `/catalog/products/${encodeURIComponent(input.productId)}/`,
|
|
38
|
+
auth: 'server',
|
|
39
|
+
});
|
|
40
|
+
return resultToContent(result);
|
|
41
|
+
});
|
|
42
|
+
server.registerTool('product_update', {
|
|
43
|
+
title: 'Update product',
|
|
44
|
+
description: 'Patch an existing product. Only the fields you pass are updated.',
|
|
45
|
+
inputSchema: ProductUpdate.shape,
|
|
46
|
+
}, async (input) => {
|
|
47
|
+
const { productId, ...body } = input;
|
|
48
|
+
const result = await http.request({
|
|
49
|
+
method: 'PATCH',
|
|
50
|
+
path: `/catalog/products/${encodeURIComponent(productId)}/`,
|
|
51
|
+
body,
|
|
52
|
+
auth: 'server',
|
|
53
|
+
});
|
|
54
|
+
return resultToContent(result);
|
|
55
|
+
});
|
|
56
|
+
server.registerTool('product_archive', {
|
|
57
|
+
title: 'Archive product',
|
|
58
|
+
description: 'Archive a catalog product. Archived products stop being purchasable but historical subscriptions/orders are preserved.',
|
|
59
|
+
inputSchema: ProductArchive.shape,
|
|
60
|
+
}, async (input) => {
|
|
61
|
+
const result = await http.request({
|
|
62
|
+
method: 'DELETE',
|
|
63
|
+
path: `/catalog/products/${encodeURIComponent(input.productId)}/`,
|
|
64
|
+
auth: 'server',
|
|
65
|
+
});
|
|
66
|
+
return resultToContent(result);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=products.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"products.js","sourceRoot":"","sources":["../../src/tools/products.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,IAAsB;IAC5E,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,kGAAkG;QACpG,WAAW,EAAE,YAAY,CAAC,KAAK;KAChC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;SAClD,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,gBAAgB,EAChB;QACE,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,iLAAiL;QACnL,WAAW,EAAE,aAAa,CAAC,KAAK;KACjC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,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AAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GetPromotion } from '../schemas/kelviq.js';
|
|
2
|
+
import { resultToContent } from './_util.js';
|
|
3
|
+
export function registerPromotionTools(server, http) {
|
|
4
|
+
server.registerTool('promotion_get', {
|
|
5
|
+
title: 'Get promotion',
|
|
6
|
+
description: 'Resolve the active promotion for the caller\'s detected location. Returns discount percentage, coupon code, banner widget config, and security checks (proxy/VPN/Tor). NOTE: this tool authenticates with your Client API Key (KELVIQ_CLIENT_API_KEY), not the Server API Key.',
|
|
7
|
+
inputSchema: GetPromotion.shape,
|
|
8
|
+
}, async (input) => {
|
|
9
|
+
const result = await http.request({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/promotions',
|
|
12
|
+
host: 'edge',
|
|
13
|
+
auth: 'client',
|
|
14
|
+
query: { promotion_id: input.promotionId },
|
|
15
|
+
});
|
|
16
|
+
return resultToContent(result);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=promotions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promotions.js","sourceRoot":"","sources":["../../src/tools/promotions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,UAAU,sBAAsB,CAAC,MAAiB,EAAE,IAAsB;IAC9E,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,gRAAgR;QAClR,WAAW,EAAE,YAAY,CAAC,KAAK;KAChC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,EAAE,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE;SAC3C,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { CancelSubscription, CreateSubscription, ListSubscriptions, UpdateSubscription, } from '../schemas/kelviq.js';
|
|
2
|
+
import { resultToContent } from './_util.js';
|
|
3
|
+
export function registerSubscriptionTools(server, http) {
|
|
4
|
+
server.registerTool('subscription_create', {
|
|
5
|
+
title: 'Create subscription',
|
|
6
|
+
description: 'Create a subscription directly for a customer, bypassing hosted checkout. Use when the customer has already been collected externally. For free plans pass chargePeriod=ONE_TIME. To upgrade from a free plan, use checkout_create_session instead.',
|
|
7
|
+
inputSchema: CreateSubscription.shape,
|
|
8
|
+
}, async (input) => {
|
|
9
|
+
const result = await http.request({
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/subscriptions/create/',
|
|
12
|
+
body: input,
|
|
13
|
+
auth: 'server',
|
|
14
|
+
});
|
|
15
|
+
return resultToContent(result);
|
|
16
|
+
});
|
|
17
|
+
server.registerTool('subscription_list', {
|
|
18
|
+
title: 'List subscriptions',
|
|
19
|
+
description: 'List subscriptions, optionally filtered by customerId. Paginated via `page` and `pageSize`. Returns { count, next, previous, results }.',
|
|
20
|
+
inputSchema: ListSubscriptions.shape,
|
|
21
|
+
}, async (input) => {
|
|
22
|
+
const result = await http.request({
|
|
23
|
+
method: 'GET',
|
|
24
|
+
path: '/subscriptions/',
|
|
25
|
+
auth: 'server',
|
|
26
|
+
query: {
|
|
27
|
+
customer_id: input.customerId,
|
|
28
|
+
page: input.page,
|
|
29
|
+
page_size: input.pageSize,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
return resultToContent(result);
|
|
33
|
+
});
|
|
34
|
+
server.registerTool('subscription_update', {
|
|
35
|
+
title: 'Update subscription',
|
|
36
|
+
description: 'Change plan, charge period, and/or features for an existing subscription. Note: free plans are one-time charges — to upgrade from free, use checkout_create_session instead.',
|
|
37
|
+
inputSchema: UpdateSubscription.shape,
|
|
38
|
+
}, async (input) => {
|
|
39
|
+
const { subscriptionId, ...body } = input;
|
|
40
|
+
const result = await http.request({
|
|
41
|
+
method: 'POST',
|
|
42
|
+
path: `/subscriptions/${encodeURIComponent(subscriptionId)}/update/`,
|
|
43
|
+
body,
|
|
44
|
+
auth: 'server',
|
|
45
|
+
});
|
|
46
|
+
return resultToContent(result);
|
|
47
|
+
});
|
|
48
|
+
server.registerTool('subscription_cancel', {
|
|
49
|
+
title: 'Cancel subscription',
|
|
50
|
+
description: 'Cancel a subscription. cancellationType: IMMEDIATE | CURRENT_PERIOD_ENDS | SPECIFIC_DATE. Pass cancellationDate (YYYY-MM-DD) only when type is SPECIFIC_DATE.',
|
|
51
|
+
inputSchema: CancelSubscription.shape,
|
|
52
|
+
}, async (input) => {
|
|
53
|
+
const { subscriptionId, ...body } = input;
|
|
54
|
+
const result = await http.request({
|
|
55
|
+
method: 'POST',
|
|
56
|
+
path: `/subscriptions/${encodeURIComponent(subscriptionId)}/cancel/`,
|
|
57
|
+
body,
|
|
58
|
+
auth: 'server',
|
|
59
|
+
});
|
|
60
|
+
return resultToContent(result);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=subscriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/tools/subscriptions.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,UAAU,yBAAyB,CAAC,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C,OAAO,CAAC;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,cAAc,CAAC,UAAU;YACpE,IAAI;YACJ,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,+JAA+J;QACjK,WAAW,EAAE,kBAAkB,CAAC,KAAK;KACtC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QAC1C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,kBAAkB,kBAAkB,CAAC,cAAc,CAAC,UAAU;YACpE,IAAI;YACJ,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReportUsage } from '../schemas/kelviq.js';
|
|
2
|
+
import { resultToContent } from './_util.js';
|
|
3
|
+
export function registerUsageTools(server, http) {
|
|
4
|
+
server.registerTool('usage_report', {
|
|
5
|
+
title: 'Report feature usage',
|
|
6
|
+
description: 'Report a usage value for a metered feature. behaviour=SET replaces the current value; behaviour=DELTA increments by `value`. Returns a server-generated idempotencyKey + timestamp.',
|
|
7
|
+
inputSchema: ReportUsage.shape,
|
|
8
|
+
}, async (input) => {
|
|
9
|
+
const result = await http.request({
|
|
10
|
+
method: 'POST',
|
|
11
|
+
path: '/report/usage/',
|
|
12
|
+
body: input,
|
|
13
|
+
auth: 'server',
|
|
14
|
+
});
|
|
15
|
+
return resultToContent(result);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=usage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/tools/usage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,IAAsB;IAC1E,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EACT,qLAAqL;QACvL,WAAW,EAAE,WAAW,CAAC,KAAK;KAC/B,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kelviq/mcp-server",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Model Context Protocol server for Kelviq — typed tools for the Kelviq API plus searchable documentation resources.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Kelviq <hi@kelviq.com>",
|
|
7
|
+
"homepage": "https://kelviq.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/kelviq/kelviq-mcp-server.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/kelviq/kelviq-mcp-server/issues",
|
|
14
|
+
"email": "hi@kelviq.com"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"model-context-protocol",
|
|
19
|
+
"kelviq",
|
|
20
|
+
"subscriptions",
|
|
21
|
+
"saas",
|
|
22
|
+
"monetization",
|
|
23
|
+
"claude",
|
|
24
|
+
"anthropic"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "dist/server.js",
|
|
28
|
+
"types": "dist/server.d.ts",
|
|
29
|
+
"bin": {
|
|
30
|
+
"kelviq-mcp": "dist/server.js"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist",
|
|
34
|
+
"README.md",
|
|
35
|
+
"LICENSE"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"snapshot": "tsx scripts/snapshot-docs.ts",
|
|
42
|
+
"copy-docs": "tsx scripts/copy-docs.ts",
|
|
43
|
+
"build": "npm run snapshot && tsc && npm run copy-docs && node -e \"require('fs').chmodSync('dist/server.js', 0o755)\"",
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
|
+
"lint": "eslint src scripts",
|
|
46
|
+
"lint:fix": "eslint --fix src scripts",
|
|
47
|
+
"commit": "git-cz",
|
|
48
|
+
"start": "node dist/server.js",
|
|
49
|
+
"dev": "tsx src/server.ts",
|
|
50
|
+
"inspect": "npx -y @modelcontextprotocol/inspector node dist/server.js",
|
|
51
|
+
"release": "./scripts/publish.sh",
|
|
52
|
+
"release:beta": "./scripts/publish.sh --beta",
|
|
53
|
+
"release:dry-run": "./scripts/publish.sh --dry-run",
|
|
54
|
+
"prepublishOnly": "npm run build",
|
|
55
|
+
"prepare": "husky"
|
|
56
|
+
},
|
|
57
|
+
"lint-staged": {
|
|
58
|
+
"*.{ts,js}": [
|
|
59
|
+
"eslint --fix"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"config": {
|
|
63
|
+
"commitizen": {
|
|
64
|
+
"path": "@commitlint/cz-commitlint"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
69
|
+
"flexsearch": "^0.7.43",
|
|
70
|
+
"gray-matter": "^4.0.3",
|
|
71
|
+
"zod": "^3.23.8"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@commitlint/cli": "^20.5.3",
|
|
75
|
+
"@commitlint/config-conventional": "^20.5.3",
|
|
76
|
+
"@commitlint/cz-commitlint": "^20.5.3",
|
|
77
|
+
"@eslint/js": "^10.0.1",
|
|
78
|
+
"@types/node": "^20.14.0",
|
|
79
|
+
"commitizen": "^4.3.2",
|
|
80
|
+
"eslint": "^10.5.0",
|
|
81
|
+
"husky": "^9.1.7",
|
|
82
|
+
"inquirer": "^9.3.8",
|
|
83
|
+
"lint-staged": "^16.4.0",
|
|
84
|
+
"tsx": "^4.19.0",
|
|
85
|
+
"typescript": "^5.6.0",
|
|
86
|
+
"typescript-eslint": "^8.61.1"
|
|
87
|
+
}
|
|
88
|
+
}
|