@kelviq/mcp-server 1.2.0 → 1.2.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/docs/changelog.md +17 -0
- package/dist/docs/product-catalog/free-and-trials.md +1 -1
- package/dist/tools/_resolve.js +14 -10
- package/dist/tools/_resolve.js.map +1 -1
- package/dist/tools/features.js +9 -2
- package/dist/tools/features.js.map +1 -1
- package/dist/tools/product-files.js +10 -3
- package/dist/tools/product-files.js.map +1 -1
- package/dist/tools/product-settings.js +10 -3
- package/dist/tools/product-settings.js.map +1 -1
- package/dist/tools/products.js +14 -4
- package/dist/tools/products.js.map +1 -1
- package/package.json +1 -1
package/dist/docs/changelog.md
CHANGED
|
@@ -6,6 +6,23 @@ description: "Every Kelviq release across the dashboard, API, SDKs, and develope
|
|
|
6
6
|
---
|
|
7
7
|
import { ChangelogFilter } from "/snippets/changelog-filter.jsx";
|
|
8
8
|
|
|
9
|
+
<Update label="v0.4.1" description="September 18, 2026" tags={["CLI"]}>
|
|
10
|
+
|
|
11
|
+
### Fixes
|
|
12
|
+
|
|
13
|
+
- `kelviq discount create --product <identifier>` now finds the product. It looks the identifier up through the product list, since the product endpoint itself takes only a UUID.
|
|
14
|
+
|
|
15
|
+
</Update>
|
|
16
|
+
|
|
17
|
+
<Update label="v1.2.1" description="September 18, 2026" tags={["MCP Server"]}>
|
|
18
|
+
|
|
19
|
+
### Fixes
|
|
20
|
+
|
|
21
|
+
- Product and feature identifiers now resolve correctly in every tool that accepts them. 1.2.0 looked them up through the retrieve endpoints, which take only a UUID, so any identifier failed with a 404.
|
|
22
|
+
- `product_retrieve`, `product_update`, `product_archive`, the product settings and image tools, `feature_retrieve` and `feature_archive` accept an identifier as well as a UUID.
|
|
23
|
+
|
|
24
|
+
</Update>
|
|
25
|
+
|
|
9
26
|
<Update label="v0.4.0" description="September 16, 2026" tags={["CLI"]}>
|
|
10
27
|
|
|
11
28
|
### New Features
|
|
@@ -27,7 +27,7 @@ Entitlement checks return `false` for a customer Kelviq has never seen, so a fre
|
|
|
27
27
|
1. Create the customer **with an email address** — `customers.create` in the SDK, or `POST /customers/`.
|
|
28
28
|
2. Create the subscription — `POST /subscriptions/create/` with the plan's identifier and `chargePeriod: "ONE_TIME"`.
|
|
29
29
|
|
|
30
|
-
Keep that order. Creating a subscription for a customer Kelviq has not seen fails with `Subscription requires a customer with a valid email address` — and the failed attempt still registers the customer, without an email. From then on `POST /customers/` answers `Customer already exists`, and the portal refuses that customer too. Recover by patching the email onto the existing record with `PATCH /customers/{customerId}/`, after which the subscription call succeeds. Treat `Customer already exists` as a signal to patch rather than an error to surface.
|
|
30
|
+
Keep that order, and enrol at signup, before the customer reaches checkout. Creating a subscription for a customer Kelviq has not seen fails with `Subscription requires a customer with a valid email address` — and the failed attempt still registers the customer, without an email. Creating a checkout session with a `customerId` registers the customer the same way. From then on `POST /customers/` answers `Customer already exists`, and the portal refuses that customer too. Recover by patching the email onto the existing record with `PATCH /customers/{customerId}/`, after which the subscription call succeeds. Treat `Customer already exists` as a signal to patch rather than an error to surface.
|
|
31
31
|
|
|
32
32
|
Enrolling this way also records a $0 order for the plan.
|
|
33
33
|
|
package/dist/tools/_resolve.js
CHANGED
|
@@ -2,24 +2,27 @@ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
|
|
|
2
2
|
export function isUuid(value) {
|
|
3
3
|
return UUID_RE.test(value);
|
|
4
4
|
}
|
|
5
|
-
const
|
|
5
|
+
const LIST_PATH = {
|
|
6
6
|
product: '/catalog/products/',
|
|
7
7
|
feature: '/catalog/features/',
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
10
|
+
* Product and feature endpoints take the UUID in the path only: an
|
|
11
|
+
* identifier there is a routing 404 (live-verified 2026-09-18). Plans are
|
|
12
|
+
* the exception and accept their identifier directly. So a product or
|
|
13
|
+
* feature reference given as an identifier is looked up through the list
|
|
14
|
+
* endpoint's `search` and matched on `identifier` exactly. A value that
|
|
15
|
+
* already looks like a UUID is returned as-is with no request. A failed
|
|
16
|
+
* lookup is returned as an error naming the value, so callers never reach
|
|
17
|
+
* the real call with an unresolved reference.
|
|
16
18
|
*/
|
|
17
19
|
async function resolveId(http, kind, value) {
|
|
18
20
|
if (isUuid(value))
|
|
19
21
|
return { ok: true, data: value };
|
|
20
22
|
const result = await http.request({
|
|
21
23
|
method: 'GET',
|
|
22
|
-
path:
|
|
24
|
+
path: LIST_PATH[kind],
|
|
25
|
+
query: { search: value, page_size: 100 },
|
|
23
26
|
auth: 'server',
|
|
24
27
|
});
|
|
25
28
|
if (!result.ok) {
|
|
@@ -28,11 +31,12 @@ async function resolveId(http, kind, value) {
|
|
|
28
31
|
error: { ...result.error, message: `Could not resolve ${kind} "${value}": ${result.error.message}` },
|
|
29
32
|
};
|
|
30
33
|
}
|
|
31
|
-
const
|
|
34
|
+
const match = (result.data?.results ?? []).find((item) => item.identifier === value);
|
|
35
|
+
const id = match?.id;
|
|
32
36
|
if (typeof id !== 'string' || id.length === 0) {
|
|
33
37
|
return {
|
|
34
38
|
ok: false,
|
|
35
|
-
error: { status: '
|
|
39
|
+
error: { status: 'Not found', message: `Could not resolve ${kind} "${value}": no ${kind} has that identifier.` },
|
|
36
40
|
};
|
|
37
41
|
}
|
|
38
42
|
return { ok: true, data: id };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_resolve.js","sourceRoot":"","sources":["../../src/tools/_resolve.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,GAAG,iEAAiE,CAAC;AAElF,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAID,MAAM,
|
|
1
|
+
{"version":3,"file":"_resolve.js","source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AC,EAAE,CAAC;QAC9C,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,qBAAqB,IAAI,KAAK,KAAK,SAAS,IAAI,uBAAuB,EAAE;SACjH,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAsB,EAAE,KAAa;IACpE,OAAO,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,IAAsB,EAAE,KAAa;IACpE,OAAO,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/tools/features.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FeatureArchive, FeatureCreate, FeatureRetrieve, ListFeatures, } from '../schemas/kelviq.js';
|
|
2
2
|
import { resultToContent } from './_util.js';
|
|
3
|
+
import { resolveFeatureId } from './_resolve.js';
|
|
3
4
|
export function registerFeatureTools(server, http) {
|
|
4
5
|
server.registerTool('feature_list', {
|
|
5
6
|
title: 'List features',
|
|
@@ -35,9 +36,12 @@ export function registerFeatureTools(server, http) {
|
|
|
35
36
|
annotations: { readOnlyHint: true },
|
|
36
37
|
inputSchema: FeatureRetrieve.shape,
|
|
37
38
|
}, async (input) => {
|
|
39
|
+
const featureId = await resolveFeatureId(http, input.featureId);
|
|
40
|
+
if (!featureId.ok)
|
|
41
|
+
return resultToContent(featureId);
|
|
38
42
|
const result = await http.request({
|
|
39
43
|
method: 'GET',
|
|
40
|
-
path: `/catalog/features/${encodeURIComponent(
|
|
44
|
+
path: `/catalog/features/${encodeURIComponent(featureId.data)}/`,
|
|
41
45
|
auth: 'server',
|
|
42
46
|
});
|
|
43
47
|
return resultToContent(result);
|
|
@@ -48,9 +52,12 @@ export function registerFeatureTools(server, http) {
|
|
|
48
52
|
annotations: { destructiveHint: true, idempotentHint: true },
|
|
49
53
|
inputSchema: FeatureArchive.shape,
|
|
50
54
|
}, async (input) => {
|
|
55
|
+
const featureId = await resolveFeatureId(http, input.featureId);
|
|
56
|
+
if (!featureId.ok)
|
|
57
|
+
return resultToContent(featureId);
|
|
51
58
|
const result = await http.request({
|
|
52
59
|
method: 'DELETE',
|
|
53
|
-
path: `/catalog/features/${encodeURIComponent(
|
|
60
|
+
path: `/catalog/features/${encodeURIComponent(featureId.data)}/`,
|
|
54
61
|
auth: 'server',
|
|
55
62
|
});
|
|
56
63
|
return resultToContent(result);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/tools/features.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,aAAa,EACb,eAAe,EACf,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"features.js","sourceRoot":"","sources":["../../src/tools/features.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,aAAa,EACb,eAAe,EACf,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,IAAsB;IAC5E,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,mGAAmG;QACrG,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE;QACnC,WAAW,EAAE,YAAY,CAAC,KAAK;KAChC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YA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AAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,YAAY,CACjB,iBAAiB,EACjB;QACE,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,wGAAwG;QACrH,WAAW,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE;QAC5D,WAAW,EAAE,cAAc,CAAC,KAAK;KAClC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE;YAAE,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;YAChE,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ProductImageDelete, ProductImageUpdate } from '../schemas/kelviq.js';
|
|
2
2
|
import { resultToContent } from './_util.js';
|
|
3
|
+
import { resolveProductId } from './_resolve.js';
|
|
3
4
|
export function registerProductFileTools(server, http) {
|
|
4
5
|
server.registerTool('product_image_update', {
|
|
5
6
|
title: 'Update product image',
|
|
@@ -7,10 +8,13 @@ export function registerProductFileTools(server, http) {
|
|
|
7
8
|
annotations: { destructiveHint: false, idempotentHint: true },
|
|
8
9
|
inputSchema: ProductImageUpdate.shape,
|
|
9
10
|
}, async (input) => {
|
|
10
|
-
const { productId, imageId, ...body } = input;
|
|
11
|
+
const { productId: productRef, imageId, ...body } = input;
|
|
12
|
+
const productId = await resolveProductId(http, productRef);
|
|
13
|
+
if (!productId.ok)
|
|
14
|
+
return resultToContent(productId);
|
|
11
15
|
const result = await http.request({
|
|
12
16
|
method: 'PATCH',
|
|
13
|
-
path: `/catalog/products/${encodeURIComponent(productId)}/image/${encodeURIComponent(imageId)}/`,
|
|
17
|
+
path: `/catalog/products/${encodeURIComponent(productId.data)}/image/${encodeURIComponent(imageId)}/`,
|
|
14
18
|
body,
|
|
15
19
|
auth: 'server',
|
|
16
20
|
});
|
|
@@ -22,9 +26,12 @@ export function registerProductFileTools(server, http) {
|
|
|
22
26
|
annotations: { destructiveHint: true, idempotentHint: true },
|
|
23
27
|
inputSchema: ProductImageDelete.shape,
|
|
24
28
|
}, async (input) => {
|
|
29
|
+
const productId = await resolveProductId(http, input.productId);
|
|
30
|
+
if (!productId.ok)
|
|
31
|
+
return resultToContent(productId);
|
|
25
32
|
const result = await http.request({
|
|
26
33
|
method: 'DELETE',
|
|
27
|
-
path: `/catalog/products/${encodeURIComponent(
|
|
34
|
+
path: `/catalog/products/${encodeURIComponent(productId.data)}/image/${encodeURIComponent(input.imageId)}/`,
|
|
28
35
|
auth: 'server',
|
|
29
36
|
});
|
|
30
37
|
return resultToContent(result);
|
|
@@ -1 +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;
|
|
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;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;A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eAAe,CAAC,SAAS,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG;YAC3G,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ProductSettingsGet, ProductSettingsUpdate } from '../schemas/kelviq.js';
|
|
2
2
|
import { resultToContent } from './_util.js';
|
|
3
|
+
import { resolveProductId } from './_resolve.js';
|
|
3
4
|
export function registerProductSettingsTools(server, http) {
|
|
4
5
|
server.registerTool('product_settings_get', {
|
|
5
6
|
title: 'Get product settings',
|
|
@@ -7,9 +8,12 @@ export function registerProductSettingsTools(server, http) {
|
|
|
7
8
|
annotations: { readOnlyHint: true },
|
|
8
9
|
inputSchema: ProductSettingsGet.shape,
|
|
9
10
|
}, async (input) => {
|
|
11
|
+
const productId = await resolveProductId(http, input.productId);
|
|
12
|
+
if (!productId.ok)
|
|
13
|
+
return resultToContent(productId);
|
|
10
14
|
const result = await http.request({
|
|
11
15
|
method: 'GET',
|
|
12
|
-
path: `/catalog/products/${encodeURIComponent(
|
|
16
|
+
path: `/catalog/products/${encodeURIComponent(productId.data)}/settings/`,
|
|
13
17
|
auth: 'server',
|
|
14
18
|
});
|
|
15
19
|
return resultToContent(result);
|
|
@@ -20,10 +24,13 @@ export function registerProductSettingsTools(server, http) {
|
|
|
20
24
|
annotations: { destructiveHint: false, idempotentHint: true },
|
|
21
25
|
inputSchema: ProductSettingsUpdate.shape,
|
|
22
26
|
}, async (input) => {
|
|
23
|
-
const { productId, ...body } = input;
|
|
27
|
+
const { productId: productRef, ...body } = input;
|
|
28
|
+
const productId = await resolveProductId(http, productRef);
|
|
29
|
+
if (!productId.ok)
|
|
30
|
+
return resultToContent(productId);
|
|
24
31
|
const result = await http.request({
|
|
25
32
|
method: 'PATCH',
|
|
26
|
-
path: `/catalog/products/${encodeURIComponent(productId)}/settings/`,
|
|
33
|
+
path: `/catalog/products/${encodeURIComponent(productId.data)}/settings/`,
|
|
27
34
|
body,
|
|
28
35
|
auth: 'server',
|
|
29
36
|
});
|
|
@@ -1 +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;
|
|
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;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,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,EAAE,YAAY,EAAE,IAAI,EAAE;QACnC,WAAW,EAAE,kBAAkB,CAAC,KAAK;KACtC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE;YAAE,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY;YACzE,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,EAAE,eAAe,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE;QAC7D,WAAW,EAAE,qBAAqB,CAAC,KAAK;KACzC,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;QACjD,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC3D,IAAI,CAAC,SAAS,CAAC,EAAE;YAAE,OAAO,eAAe,CAAC,SAAS,CAAC,CAAC;QACrD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC;YAChC,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,qBAAqB,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY;YACzE,IAAI;YACJ,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QACH,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/tools/products.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ListProducts, ProductArchive, ProductCreate, ProductRetrieve, ProductUpdate, } from '../schemas/kelviq.js';
|
|
2
2
|
import { resultToContent } from './_util.js';
|
|
3
|
+
import { resolveProductId } from './_resolve.js';
|
|
3
4
|
export function registerProductTools(server, http) {
|
|
4
5
|
server.registerTool('product_list', {
|
|
5
6
|
title: 'List products',
|
|
@@ -35,9 +36,12 @@ export function registerProductTools(server, http) {
|
|
|
35
36
|
annotations: { readOnlyHint: true },
|
|
36
37
|
inputSchema: ProductRetrieve.shape,
|
|
37
38
|
}, async (input) => {
|
|
39
|
+
const productId = await resolveProductId(http, input.productId);
|
|
40
|
+
if (!productId.ok)
|
|
41
|
+
return resultToContent(productId);
|
|
38
42
|
const result = await http.request({
|
|
39
43
|
method: 'GET',
|
|
40
|
-
path: `/catalog/products/${encodeURIComponent(
|
|
44
|
+
path: `/catalog/products/${encodeURIComponent(productId.data)}/`,
|
|
41
45
|
auth: 'server',
|
|
42
46
|
});
|
|
43
47
|
return resultToContent(result);
|
|
@@ -48,10 +52,13 @@ export function registerProductTools(server, http) {
|
|
|
48
52
|
annotations: { destructiveHint: false, idempotentHint: true },
|
|
49
53
|
inputSchema: ProductUpdate.shape,
|
|
50
54
|
}, async (input) => {
|
|
51
|
-
const { productId, ...body } = input;
|
|
55
|
+
const { productId: productRef, ...body } = input;
|
|
56
|
+
const productId = await resolveProductId(http, productRef);
|
|
57
|
+
if (!productId.ok)
|
|
58
|
+
return resultToContent(productId);
|
|
52
59
|
const result = await http.request({
|
|
53
60
|
method: 'PATCH',
|
|
54
|
-
path: `/catalog/products/${encodeURIComponent(productId)}/`,
|
|
61
|
+
path: `/catalog/products/${encodeURIComponent(productId.data)}/`,
|
|
55
62
|
body,
|
|
56
63
|
auth: 'server',
|
|
57
64
|
});
|
|
@@ -63,9 +70,12 @@ export function registerProductTools(server, http) {
|
|
|
63
70
|
annotations: { destructiveHint: true, idempotentHint: true },
|
|
64
71
|
inputSchema: ProductArchive.shape,
|
|
65
72
|
}, async (input) => {
|
|
73
|
+
const productId = await resolveProductId(http, input.productId);
|
|
74
|
+
if (!productId.ok)
|
|
75
|
+
return resultToContent(productId);
|
|
66
76
|
const result = await http.request({
|
|
67
77
|
method: 'DELETE',
|
|
68
|
-
path: `/catalog/products/${encodeURIComponent(
|
|
78
|
+
path: `/catalog/products/${encodeURIComponent(productId.data)}/`,
|
|
69
79
|
auth: 'server',
|
|
70
80
|
});
|
|
71
81
|
return resultToContent(result);
|
|
@@ -1 +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;
|
|
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;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,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,EAAE,YAAY,EAAE,IAAI,EAAE;QACnC,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,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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kelviq/mcp-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Model Context Protocol server for Kelviq — typed tools for the Kelviq API plus searchable documentation resources.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Kelviq <hi@kelviq.com>",
|