ce-storefront 0.8.2 → 0.9.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/README.md +53 -0
- package/bin/mcp-server.js +1765 -177
- package/bin/mcp-server.js.map +43 -13
- package/docs/sdks/auth/README.md +10 -10
- package/docs/sdks/carts/README.md +10 -0
- package/docs/sdks/customers/README.md +20 -20
- package/docs/sdks/kyc/README.md +566 -0
- package/esm/funcs/authGetAnonymousToken.js +1 -1
- package/esm/funcs/authGetAnonymousToken.js.map +1 -1
- package/esm/funcs/kycCreateDocument.d.ts +17 -0
- package/esm/funcs/kycCreateDocument.d.ts.map +1 -0
- package/esm/funcs/kycCreateDocument.js +110 -0
- package/esm/funcs/kycCreateDocument.js.map +1 -0
- package/esm/funcs/kycDeleteDocument.d.ts +17 -0
- package/esm/funcs/kycDeleteDocument.d.ts.map +1 -0
- package/esm/funcs/kycDeleteDocument.js +89 -0
- package/esm/funcs/kycDeleteDocument.js.map +1 -0
- package/esm/funcs/kycGetDocument.d.ts +17 -0
- package/esm/funcs/kycGetDocument.d.ts.map +1 -0
- package/esm/funcs/kycGetDocument.js +89 -0
- package/esm/funcs/kycGetDocument.js.map +1 -0
- package/esm/funcs/kycListDocuments.d.ts +17 -0
- package/esm/funcs/kycListDocuments.d.ts.map +1 -0
- package/esm/funcs/kycListDocuments.js +85 -0
- package/esm/funcs/kycListDocuments.js.map +1 -0
- package/esm/funcs/kycListKycDocument.d.ts +17 -0
- package/esm/funcs/kycListKycDocument.d.ts.map +1 -0
- package/esm/funcs/kycListKycDocument.js +70 -0
- package/esm/funcs/kycListKycDocument.js.map +1 -0
- package/esm/funcs/kycUpdateDocument.d.ts +17 -0
- package/esm/funcs/kycUpdateDocument.d.ts.map +1 -0
- package/esm/funcs/kycUpdateDocument.js +115 -0
- package/esm/funcs/kycUpdateDocument.js.map +1 -0
- package/esm/funcs/kycVerifyDocument.d.ts +17 -0
- package/esm/funcs/kycVerifyDocument.d.ts.map +1 -0
- package/esm/funcs/kycVerifyDocument.js +86 -0
- package/esm/funcs/kycVerifyDocument.js.map +1 -0
- package/esm/lib/config.d.ts +4 -4
- package/esm/lib/config.js +4 -4
- package/esm/lib/config.js.map +1 -1
- package/esm/mcp-server/mcp-server.js +1 -1
- package/esm/mcp-server/prompts.d.ts.map +1 -1
- package/esm/mcp-server/prompts.js +5 -1
- package/esm/mcp-server/prompts.js.map +1 -1
- package/esm/mcp-server/resources.d.ts.map +1 -1
- package/esm/mcp-server/resources.js +10 -2
- package/esm/mcp-server/resources.js.map +1 -1
- package/esm/mcp-server/server.d.ts.map +1 -1
- package/esm/mcp-server/server.js +16 -3
- package/esm/mcp-server/server.js.map +1 -1
- package/esm/mcp-server/tools/kycCreateDocument.d.ts +8 -0
- package/esm/mcp-server/tools/kycCreateDocument.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycCreateDocument.js +28 -0
- package/esm/mcp-server/tools/kycCreateDocument.js.map +1 -0
- package/esm/mcp-server/tools/kycDeleteDocument.d.ts +8 -0
- package/esm/mcp-server/tools/kycDeleteDocument.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycDeleteDocument.js +28 -0
- package/esm/mcp-server/tools/kycDeleteDocument.js.map +1 -0
- package/esm/mcp-server/tools/kycGetDocument.d.ts +8 -0
- package/esm/mcp-server/tools/kycGetDocument.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycGetDocument.js +28 -0
- package/esm/mcp-server/tools/kycGetDocument.js.map +1 -0
- package/esm/mcp-server/tools/kycListDocuments.d.ts +8 -0
- package/esm/mcp-server/tools/kycListDocuments.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycListDocuments.js +28 -0
- package/esm/mcp-server/tools/kycListDocuments.js.map +1 -0
- package/esm/mcp-server/tools/kycListKycDocument.d.ts +3 -0
- package/esm/mcp-server/tools/kycListKycDocument.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycListKycDocument.js +23 -0
- package/esm/mcp-server/tools/kycListKycDocument.js.map +1 -0
- package/esm/mcp-server/tools/kycUpdateDocument.d.ts +8 -0
- package/esm/mcp-server/tools/kycUpdateDocument.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycUpdateDocument.js +28 -0
- package/esm/mcp-server/tools/kycUpdateDocument.js.map +1 -0
- package/esm/mcp-server/tools/kycVerifyDocument.d.ts +8 -0
- package/esm/mcp-server/tools/kycVerifyDocument.d.ts.map +1 -0
- package/esm/mcp-server/tools/kycVerifyDocument.js +28 -0
- package/esm/mcp-server/tools/kycVerifyDocument.js.map +1 -0
- package/esm/mcp-server/tools.d.ts.map +1 -1
- package/esm/mcp-server/tools.js +4 -3
- package/esm/mcp-server/tools.js.map +1 -1
- package/esm/models/components/document.d.ts +164 -0
- package/esm/models/components/document.d.ts.map +1 -0
- package/esm/models/components/document.js +172 -0
- package/esm/models/components/document.js.map +1 -0
- package/esm/models/components/documentinput.d.ts +65 -0
- package/esm/models/components/documentinput.d.ts.map +1 -0
- package/esm/models/components/documentinput.js +87 -0
- package/esm/models/components/documentinput.js.map +1 -0
- package/esm/models/components/gstindetail.d.ts +29 -0
- package/esm/models/components/gstindetail.d.ts.map +1 -0
- package/esm/models/components/gstindetail.js +31 -0
- package/esm/models/components/gstindetail.js.map +1 -0
- package/esm/models/components/index.d.ts +6 -0
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +6 -0
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/components/kycdocument.d.ts +103 -0
- package/esm/models/components/kycdocument.d.ts.map +1 -0
- package/esm/models/components/kycdocument.js +101 -0
- package/esm/models/components/kycdocument.js.map +1 -0
- package/esm/models/components/pandetail.d.ts +29 -0
- package/esm/models/components/pandetail.d.ts.map +1 -0
- package/esm/models/components/pandetail.js +31 -0
- package/esm/models/components/pandetail.js.map +1 -0
- package/esm/models/components/updatedocument.d.ts +67 -0
- package/esm/models/components/updatedocument.d.ts.map +1 -0
- package/esm/models/components/updatedocument.js +91 -0
- package/esm/models/components/updatedocument.js.map +1 -0
- package/esm/models/operations/createdocument.d.ts +92 -0
- package/esm/models/operations/createdocument.d.ts.map +1 -0
- package/esm/models/operations/createdocument.js +97 -0
- package/esm/models/operations/createdocument.js.map +1 -0
- package/esm/models/operations/deletedocument.d.ts +67 -0
- package/esm/models/operations/deletedocument.d.ts.map +1 -0
- package/esm/models/operations/deletedocument.js +69 -0
- package/esm/models/operations/deletedocument.js.map +1 -0
- package/esm/models/operations/getdocument.d.ts +95 -0
- package/esm/models/operations/getdocument.d.ts.map +1 -0
- package/esm/models/operations/getdocument.js +97 -0
- package/esm/models/operations/getdocument.js.map +1 -0
- package/esm/models/operations/index.d.ts +7 -0
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +7 -0
- package/esm/models/operations/index.js.map +1 -1
- package/esm/models/operations/listdocuments.d.ts +90 -0
- package/esm/models/operations/listdocuments.d.ts.map +1 -0
- package/esm/models/operations/listdocuments.js +86 -0
- package/esm/models/operations/listdocuments.js.map +1 -0
- package/esm/models/operations/listkycdocument.d.ts +64 -0
- package/esm/models/operations/listkycdocument.d.ts.map +1 -0
- package/esm/models/operations/listkycdocument.js +74 -0
- package/esm/models/operations/listkycdocument.js.map +1 -0
- package/esm/models/operations/updatedocument.d.ts +97 -0
- package/esm/models/operations/updatedocument.d.ts.map +1 -0
- package/esm/models/operations/updatedocument.js +101 -0
- package/esm/models/operations/updatedocument.js.map +1 -0
- package/esm/models/operations/verifydocument.d.ts +140 -0
- package/esm/models/operations/verifydocument.d.ts.map +1 -0
- package/esm/models/operations/verifydocument.js +168 -0
- package/esm/models/operations/verifydocument.js.map +1 -0
- package/esm/sdk/kyc.d.ts +54 -0
- package/esm/sdk/kyc.d.ts.map +1 -0
- package/esm/sdk/kyc.js +78 -0
- package/esm/sdk/kyc.js.map +1 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.d.ts.map +1 -1
- package/esm/sdk/sdk.js +4 -0
- package/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/authGetAnonymousToken.ts +1 -1
- package/src/funcs/kycCreateDocument.ts +207 -0
- package/src/funcs/kycDeleteDocument.ts +183 -0
- package/src/funcs/kycGetDocument.ts +183 -0
- package/src/funcs/kycListDocuments.ts +177 -0
- package/src/funcs/kycListKycDocument.ts +153 -0
- package/src/funcs/kycUpdateDocument.ts +214 -0
- package/src/funcs/kycVerifyDocument.ts +170 -0
- package/src/lib/config.ts +4 -4
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/prompts.ts +8 -1
- package/src/mcp-server/resources.ts +16 -2
- package/src/mcp-server/server.ts +17 -3
- package/src/mcp-server/tools/kycCreateDocument.ts +37 -0
- package/src/mcp-server/tools/kycDeleteDocument.ts +37 -0
- package/src/mcp-server/tools/kycGetDocument.ts +37 -0
- package/src/mcp-server/tools/kycListDocuments.ts +37 -0
- package/src/mcp-server/tools/kycListKycDocument.ts +30 -0
- package/src/mcp-server/tools/kycUpdateDocument.ts +37 -0
- package/src/mcp-server/tools/kycVerifyDocument.ts +37 -0
- package/src/mcp-server/tools.ts +6 -3
- package/src/models/components/document.ts +260 -0
- package/src/models/components/documentinput.ts +154 -0
- package/src/models/components/gstindetail.ts +62 -0
- package/src/models/components/index.ts +6 -0
- package/src/models/components/kycdocument.ts +161 -0
- package/src/models/components/pandetail.ts +62 -0
- package/src/models/components/updatedocument.ts +168 -0
- package/src/models/operations/createdocument.ts +210 -0
- package/src/models/operations/deletedocument.ts +150 -0
- package/src/models/operations/getdocument.ts +213 -0
- package/src/models/operations/index.ts +7 -0
- package/src/models/operations/listdocuments.ts +197 -0
- package/src/models/operations/listkycdocument.ts +153 -0
- package/src/models/operations/updatedocument.ts +219 -0
- package/src/models/operations/verifydocument.ts +346 -0
- package/src/sdk/kyc.ts +133 -0
- package/src/sdk/sdk.ts +6 -0
package/src/lib/config.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const ServerProd = "prod";
|
|
|
20
20
|
*/
|
|
21
21
|
export const ServerList = {
|
|
22
22
|
[ServerStaging]:
|
|
23
|
-
"https://staging.api.commercengine.io/api/v1/
|
|
23
|
+
"https://staging.api.commercengine.io/api/v1/store_id/storefront",
|
|
24
24
|
[ServerProd]:
|
|
25
25
|
"https://prod.api.commercengine.io/api/v1/{store_id}/storefront",
|
|
26
26
|
} as const;
|
|
@@ -76,7 +76,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
76
76
|
export const SDK_METADATA = {
|
|
77
77
|
language: "typescript",
|
|
78
78
|
openapiDocVersion: "1.0",
|
|
79
|
-
sdkVersion: "0.
|
|
80
|
-
genVersion: "2.
|
|
81
|
-
userAgent: "speakeasy-sdk/typescript 0.
|
|
79
|
+
sdkVersion: "0.9.1",
|
|
80
|
+
genVersion: "2.568.5",
|
|
81
|
+
userAgent: "speakeasy-sdk/typescript 0.9.1 2.568.5 1.0 ce-storefront",
|
|
82
82
|
} as const;
|
|
@@ -74,7 +74,14 @@ export function createRegisterPrompt(
|
|
|
74
74
|
prompt: PromptDefinition<A>,
|
|
75
75
|
): void => {
|
|
76
76
|
const scopes = prompt.scopes ?? [];
|
|
77
|
-
if (
|
|
77
|
+
if (allowedScopes.size > 0 && scopes.length === 0) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (
|
|
82
|
+
allowedScopes.size > 0
|
|
83
|
+
&& !scopes.every((s: MCPScope) => allowedScopes.has(s))
|
|
84
|
+
) {
|
|
78
85
|
return;
|
|
79
86
|
}
|
|
80
87
|
|
|
@@ -109,7 +109,14 @@ export function createRegisterResource(
|
|
|
109
109
|
): (resource: ResourceDefinition) => void {
|
|
110
110
|
return (resource: ResourceDefinition): void => {
|
|
111
111
|
const scopes = resource.scopes ?? [];
|
|
112
|
-
if (
|
|
112
|
+
if (allowedScopes.size > 0 && scopes.length === 0) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (
|
|
117
|
+
allowedScopes.size > 0
|
|
118
|
+
&& !scopes.every((s: MCPScope) => allowedScopes.has(s))
|
|
119
|
+
) {
|
|
113
120
|
return;
|
|
114
121
|
}
|
|
115
122
|
|
|
@@ -137,7 +144,14 @@ export function createRegisterResourceTemplate(
|
|
|
137
144
|
): (resource: ResourceTemplateDefinition) => void {
|
|
138
145
|
return (resource: ResourceTemplateDefinition): void => {
|
|
139
146
|
const scopes = resource.scopes ?? [];
|
|
140
|
-
if (
|
|
147
|
+
if (allowedScopes.size > 0 && scopes.length === 0) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (
|
|
152
|
+
allowedScopes.size > 0
|
|
153
|
+
&& !scopes.every((s: MCPScope) => allowedScopes.has(s))
|
|
154
|
+
) {
|
|
141
155
|
return;
|
|
142
156
|
}
|
|
143
157
|
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
createRegisterResource,
|
|
12
12
|
createRegisterResourceTemplate,
|
|
13
13
|
} from "./resources.js";
|
|
14
|
-
import { MCPScope
|
|
14
|
+
import { MCPScope } from "./scopes.js";
|
|
15
15
|
import { createRegisterTool } from "./tools.js";
|
|
16
16
|
import { tool$authCheckVerificationStatus } from "./tools/authCheckVerificationStatus.js";
|
|
17
17
|
import { tool$authCreateNotificationPreferences } from "./tools/authCreateNotificationPreferences.js";
|
|
@@ -54,6 +54,13 @@ import { tool$customersGetAddressDetail } from "./tools/customersGetAddressDetai
|
|
|
54
54
|
import { tool$customersListAddresses } from "./tools/customersListAddresses.js";
|
|
55
55
|
import { tool$customersListUserReviews } from "./tools/customersListUserReviews.js";
|
|
56
56
|
import { tool$customersUpdateAddressDetail } from "./tools/customersUpdateAddressDetail.js";
|
|
57
|
+
import { tool$kycCreateDocument } from "./tools/kycCreateDocument.js";
|
|
58
|
+
import { tool$kycDeleteDocument } from "./tools/kycDeleteDocument.js";
|
|
59
|
+
import { tool$kycGetDocument } from "./tools/kycGetDocument.js";
|
|
60
|
+
import { tool$kycListDocuments } from "./tools/kycListDocuments.js";
|
|
61
|
+
import { tool$kycListKycDocument } from "./tools/kycListKycDocument.js";
|
|
62
|
+
import { tool$kycUpdateDocument } from "./tools/kycUpdateDocument.js";
|
|
63
|
+
import { tool$kycVerifyDocument } from "./tools/kycVerifyDocument.js";
|
|
57
64
|
import { tool$ordersCancelOrder } from "./tools/ordersCancelOrder.js";
|
|
58
65
|
import { tool$ordersCreateOrder } from "./tools/ordersCreateOrder.js";
|
|
59
66
|
import { tool$ordersGetOrderDetail } from "./tools/ordersGetOrderDetail.js";
|
|
@@ -74,7 +81,7 @@ export function createMCPServer(deps: {
|
|
|
74
81
|
}) {
|
|
75
82
|
const server = new McpServer({
|
|
76
83
|
name: "CeStorefront",
|
|
77
|
-
version: "0.
|
|
84
|
+
version: "0.9.1",
|
|
78
85
|
});
|
|
79
86
|
|
|
80
87
|
const client = new CeStorefrontCore({
|
|
@@ -84,7 +91,7 @@ export function createMCPServer(deps: {
|
|
|
84
91
|
storeId: deps.storeId,
|
|
85
92
|
});
|
|
86
93
|
|
|
87
|
-
const scopes = new Set(deps.scopes
|
|
94
|
+
const scopes = new Set(deps.scopes);
|
|
88
95
|
|
|
89
96
|
const allowedTools = deps.allowedTools && new Set(deps.allowedTools);
|
|
90
97
|
const tool = createRegisterTool(
|
|
@@ -131,6 +138,13 @@ export function createMCPServer(deps: {
|
|
|
131
138
|
tool(tool$customersUpdateAddressDetail);
|
|
132
139
|
tool(tool$customersDeleteAddress);
|
|
133
140
|
tool(tool$customersListUserReviews);
|
|
141
|
+
tool(tool$kycListKycDocument);
|
|
142
|
+
tool(tool$kycListDocuments);
|
|
143
|
+
tool(tool$kycCreateDocument);
|
|
144
|
+
tool(tool$kycGetDocument);
|
|
145
|
+
tool(tool$kycUpdateDocument);
|
|
146
|
+
tool(tool$kycDeleteDocument);
|
|
147
|
+
tool(tool$kycVerifyDocument);
|
|
134
148
|
tool(tool$ordersCreateOrder);
|
|
135
149
|
tool(tool$ordersListOrders);
|
|
136
150
|
tool(tool$ordersGetOrderDetail);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycCreateDocument } from "../../funcs/kycCreateDocument.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.CreateDocumentRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycCreateDocument: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-create-document",
|
|
15
|
+
description: `Create document
|
|
16
|
+
|
|
17
|
+
Create document`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycCreateDocument(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycDeleteDocument } from "../../funcs/kycDeleteDocument.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.DeleteDocumentRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycDeleteDocument: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-delete-document",
|
|
15
|
+
description: `Delete document
|
|
16
|
+
|
|
17
|
+
Delete document`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycDeleteDocument(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycGetDocument } from "../../funcs/kycGetDocument.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.GetDocumentRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycGetDocument: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-get-document",
|
|
15
|
+
description: `Retrieve document detail
|
|
16
|
+
|
|
17
|
+
Retrieve document detail`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycGetDocument(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycListDocuments } from "../../funcs/kycListDocuments.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.ListDocumentsRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycListDocuments: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-list-documents",
|
|
15
|
+
description: `List all documents
|
|
16
|
+
|
|
17
|
+
List all documents added by a particular customer.`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycListDocuments(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycListKycDocument } from "../../funcs/kycListKycDocument.js";
|
|
6
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
7
|
+
|
|
8
|
+
export const tool$kycListKycDocument: ToolDefinition = {
|
|
9
|
+
name: "kyc-list-kyc-document",
|
|
10
|
+
description: `List all kyc documents
|
|
11
|
+
|
|
12
|
+
List all kyc documents added for a particular store.`,
|
|
13
|
+
tool: async (client, ctx) => {
|
|
14
|
+
const [result, apiCall] = await kycListKycDocument(
|
|
15
|
+
client,
|
|
16
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
17
|
+
).$inspect();
|
|
18
|
+
|
|
19
|
+
if (!result.ok) {
|
|
20
|
+
return {
|
|
21
|
+
content: [{ type: "text", text: result.error.message }],
|
|
22
|
+
isError: true,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const value = result.value;
|
|
27
|
+
|
|
28
|
+
return formatResult(value, apiCall);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycUpdateDocument } from "../../funcs/kycUpdateDocument.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.UpdateDocumentRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycUpdateDocument: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-update-document",
|
|
15
|
+
description: `Update document detail
|
|
16
|
+
|
|
17
|
+
Update document detail`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycUpdateDocument(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { kycVerifyDocument } from "../../funcs/kycVerifyDocument.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.VerifyDocumentRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$kycVerifyDocument: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "kyc-verify-document",
|
|
15
|
+
description: `Verify document
|
|
16
|
+
|
|
17
|
+
Verify document number before saving.`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await kycVerifyDocument(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
package/src/mcp-server/tools.ts
CHANGED
|
@@ -102,12 +102,15 @@ export function createRegisterTool(
|
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
const
|
|
106
|
-
if (allowedScopes.size > 0 &&
|
|
105
|
+
const scopes = tool.scopes ?? [];
|
|
106
|
+
if (allowedScopes.size > 0 && scopes.length === 0) {
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
if (
|
|
110
|
+
if (
|
|
111
|
+
allowedScopes.size > 0
|
|
112
|
+
&& !scopes.every((s: MCPScope) => allowedScopes.has(s))
|
|
113
|
+
) {
|
|
111
114
|
return;
|
|
112
115
|
}
|
|
113
116
|
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export const DocumentStatus = {
|
|
13
|
+
Submitted: "submitted",
|
|
14
|
+
Approved: "approved",
|
|
15
|
+
Rejected: "rejected",
|
|
16
|
+
Expired: "expired",
|
|
17
|
+
} as const;
|
|
18
|
+
export type DocumentStatus = ClosedEnum<typeof DocumentStatus>;
|
|
19
|
+
|
|
20
|
+
export const DocumentVerificationType = {
|
|
21
|
+
Automatic: "automatic",
|
|
22
|
+
Manual: "manual",
|
|
23
|
+
} as const;
|
|
24
|
+
export type DocumentVerificationType = ClosedEnum<
|
|
25
|
+
typeof DocumentVerificationType
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
export const CreatedBy = {
|
|
29
|
+
Customer: "customer",
|
|
30
|
+
Admin: "admin",
|
|
31
|
+
} as const;
|
|
32
|
+
export type CreatedBy = ClosedEnum<typeof CreatedBy>;
|
|
33
|
+
|
|
34
|
+
export const ModifiedBy = {
|
|
35
|
+
Customer: "customer",
|
|
36
|
+
Admin: "admin",
|
|
37
|
+
} as const;
|
|
38
|
+
export type ModifiedBy = ClosedEnum<typeof ModifiedBy>;
|
|
39
|
+
|
|
40
|
+
export type Document = {
|
|
41
|
+
id?: string | undefined;
|
|
42
|
+
documentNumber: string;
|
|
43
|
+
note?: string | undefined;
|
|
44
|
+
status?: DocumentStatus | undefined;
|
|
45
|
+
title?: string | undefined;
|
|
46
|
+
fileUrl?: string | undefined;
|
|
47
|
+
verificationType?: DocumentVerificationType | undefined;
|
|
48
|
+
isVerified?: boolean | undefined;
|
|
49
|
+
verifiedAt?: Date | undefined;
|
|
50
|
+
createdBy?: CreatedBy | undefined;
|
|
51
|
+
createdAt?: Date | undefined;
|
|
52
|
+
modifiedBy?: ModifiedBy | undefined;
|
|
53
|
+
modifiedAt?: Date | undefined;
|
|
54
|
+
modifiedReason?: string | undefined;
|
|
55
|
+
expiresAt?: Date | undefined;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** @internal */
|
|
59
|
+
export const DocumentStatus$inboundSchema: z.ZodNativeEnum<
|
|
60
|
+
typeof DocumentStatus
|
|
61
|
+
> = z.nativeEnum(DocumentStatus);
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
export const DocumentStatus$outboundSchema: z.ZodNativeEnum<
|
|
65
|
+
typeof DocumentStatus
|
|
66
|
+
> = DocumentStatus$inboundSchema;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
71
|
+
*/
|
|
72
|
+
export namespace DocumentStatus$ {
|
|
73
|
+
/** @deprecated use `DocumentStatus$inboundSchema` instead. */
|
|
74
|
+
export const inboundSchema = DocumentStatus$inboundSchema;
|
|
75
|
+
/** @deprecated use `DocumentStatus$outboundSchema` instead. */
|
|
76
|
+
export const outboundSchema = DocumentStatus$outboundSchema;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** @internal */
|
|
80
|
+
export const DocumentVerificationType$inboundSchema: z.ZodNativeEnum<
|
|
81
|
+
typeof DocumentVerificationType
|
|
82
|
+
> = z.nativeEnum(DocumentVerificationType);
|
|
83
|
+
|
|
84
|
+
/** @internal */
|
|
85
|
+
export const DocumentVerificationType$outboundSchema: z.ZodNativeEnum<
|
|
86
|
+
typeof DocumentVerificationType
|
|
87
|
+
> = DocumentVerificationType$inboundSchema;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
92
|
+
*/
|
|
93
|
+
export namespace DocumentVerificationType$ {
|
|
94
|
+
/** @deprecated use `DocumentVerificationType$inboundSchema` instead. */
|
|
95
|
+
export const inboundSchema = DocumentVerificationType$inboundSchema;
|
|
96
|
+
/** @deprecated use `DocumentVerificationType$outboundSchema` instead. */
|
|
97
|
+
export const outboundSchema = DocumentVerificationType$outboundSchema;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** @internal */
|
|
101
|
+
export const CreatedBy$inboundSchema: z.ZodNativeEnum<typeof CreatedBy> = z
|
|
102
|
+
.nativeEnum(CreatedBy);
|
|
103
|
+
|
|
104
|
+
/** @internal */
|
|
105
|
+
export const CreatedBy$outboundSchema: z.ZodNativeEnum<typeof CreatedBy> =
|
|
106
|
+
CreatedBy$inboundSchema;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @internal
|
|
110
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
111
|
+
*/
|
|
112
|
+
export namespace CreatedBy$ {
|
|
113
|
+
/** @deprecated use `CreatedBy$inboundSchema` instead. */
|
|
114
|
+
export const inboundSchema = CreatedBy$inboundSchema;
|
|
115
|
+
/** @deprecated use `CreatedBy$outboundSchema` instead. */
|
|
116
|
+
export const outboundSchema = CreatedBy$outboundSchema;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** @internal */
|
|
120
|
+
export const ModifiedBy$inboundSchema: z.ZodNativeEnum<typeof ModifiedBy> = z
|
|
121
|
+
.nativeEnum(ModifiedBy);
|
|
122
|
+
|
|
123
|
+
/** @internal */
|
|
124
|
+
export const ModifiedBy$outboundSchema: z.ZodNativeEnum<typeof ModifiedBy> =
|
|
125
|
+
ModifiedBy$inboundSchema;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @internal
|
|
129
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
130
|
+
*/
|
|
131
|
+
export namespace ModifiedBy$ {
|
|
132
|
+
/** @deprecated use `ModifiedBy$inboundSchema` instead. */
|
|
133
|
+
export const inboundSchema = ModifiedBy$inboundSchema;
|
|
134
|
+
/** @deprecated use `ModifiedBy$outboundSchema` instead. */
|
|
135
|
+
export const outboundSchema = ModifiedBy$outboundSchema;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** @internal */
|
|
139
|
+
export const Document$inboundSchema: z.ZodType<
|
|
140
|
+
Document,
|
|
141
|
+
z.ZodTypeDef,
|
|
142
|
+
unknown
|
|
143
|
+
> = z.object({
|
|
144
|
+
id: z.string().optional(),
|
|
145
|
+
document_number: z.string(),
|
|
146
|
+
note: z.string().optional(),
|
|
147
|
+
status: DocumentStatus$inboundSchema.optional(),
|
|
148
|
+
title: z.string().optional(),
|
|
149
|
+
file_url: z.string().optional(),
|
|
150
|
+
verification_type: DocumentVerificationType$inboundSchema.optional(),
|
|
151
|
+
is_verified: z.boolean().optional(),
|
|
152
|
+
verified_at: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
153
|
+
.optional(),
|
|
154
|
+
created_by: CreatedBy$inboundSchema.optional(),
|
|
155
|
+
created_at: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
156
|
+
.optional(),
|
|
157
|
+
modified_by: ModifiedBy$inboundSchema.optional(),
|
|
158
|
+
modified_at: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
159
|
+
.optional(),
|
|
160
|
+
modified_reason: z.string().optional(),
|
|
161
|
+
expires_at: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
162
|
+
.optional(),
|
|
163
|
+
}).transform((v) => {
|
|
164
|
+
return remap$(v, {
|
|
165
|
+
"document_number": "documentNumber",
|
|
166
|
+
"file_url": "fileUrl",
|
|
167
|
+
"verification_type": "verificationType",
|
|
168
|
+
"is_verified": "isVerified",
|
|
169
|
+
"verified_at": "verifiedAt",
|
|
170
|
+
"created_by": "createdBy",
|
|
171
|
+
"created_at": "createdAt",
|
|
172
|
+
"modified_by": "modifiedBy",
|
|
173
|
+
"modified_at": "modifiedAt",
|
|
174
|
+
"modified_reason": "modifiedReason",
|
|
175
|
+
"expires_at": "expiresAt",
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
/** @internal */
|
|
180
|
+
export type Document$Outbound = {
|
|
181
|
+
id?: string | undefined;
|
|
182
|
+
document_number: string;
|
|
183
|
+
note?: string | undefined;
|
|
184
|
+
status?: string | undefined;
|
|
185
|
+
title?: string | undefined;
|
|
186
|
+
file_url?: string | undefined;
|
|
187
|
+
verification_type?: string | undefined;
|
|
188
|
+
is_verified?: boolean | undefined;
|
|
189
|
+
verified_at?: string | undefined;
|
|
190
|
+
created_by?: string | undefined;
|
|
191
|
+
created_at?: string | undefined;
|
|
192
|
+
modified_by?: string | undefined;
|
|
193
|
+
modified_at?: string | undefined;
|
|
194
|
+
modified_reason?: string | undefined;
|
|
195
|
+
expires_at?: string | undefined;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
/** @internal */
|
|
199
|
+
export const Document$outboundSchema: z.ZodType<
|
|
200
|
+
Document$Outbound,
|
|
201
|
+
z.ZodTypeDef,
|
|
202
|
+
Document
|
|
203
|
+
> = z.object({
|
|
204
|
+
id: z.string().optional(),
|
|
205
|
+
documentNumber: z.string(),
|
|
206
|
+
note: z.string().optional(),
|
|
207
|
+
status: DocumentStatus$outboundSchema.optional(),
|
|
208
|
+
title: z.string().optional(),
|
|
209
|
+
fileUrl: z.string().optional(),
|
|
210
|
+
verificationType: DocumentVerificationType$outboundSchema.optional(),
|
|
211
|
+
isVerified: z.boolean().optional(),
|
|
212
|
+
verifiedAt: z.date().transform(v => v.toISOString()).optional(),
|
|
213
|
+
createdBy: CreatedBy$outboundSchema.optional(),
|
|
214
|
+
createdAt: z.date().transform(v => v.toISOString()).optional(),
|
|
215
|
+
modifiedBy: ModifiedBy$outboundSchema.optional(),
|
|
216
|
+
modifiedAt: z.date().transform(v => v.toISOString()).optional(),
|
|
217
|
+
modifiedReason: z.string().optional(),
|
|
218
|
+
expiresAt: z.date().transform(v => v.toISOString()).optional(),
|
|
219
|
+
}).transform((v) => {
|
|
220
|
+
return remap$(v, {
|
|
221
|
+
documentNumber: "document_number",
|
|
222
|
+
fileUrl: "file_url",
|
|
223
|
+
verificationType: "verification_type",
|
|
224
|
+
isVerified: "is_verified",
|
|
225
|
+
verifiedAt: "verified_at",
|
|
226
|
+
createdBy: "created_by",
|
|
227
|
+
createdAt: "created_at",
|
|
228
|
+
modifiedBy: "modified_by",
|
|
229
|
+
modifiedAt: "modified_at",
|
|
230
|
+
modifiedReason: "modified_reason",
|
|
231
|
+
expiresAt: "expires_at",
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @internal
|
|
237
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
238
|
+
*/
|
|
239
|
+
export namespace Document$ {
|
|
240
|
+
/** @deprecated use `Document$inboundSchema` instead. */
|
|
241
|
+
export const inboundSchema = Document$inboundSchema;
|
|
242
|
+
/** @deprecated use `Document$outboundSchema` instead. */
|
|
243
|
+
export const outboundSchema = Document$outboundSchema;
|
|
244
|
+
/** @deprecated use `Document$Outbound` instead. */
|
|
245
|
+
export type Outbound = Document$Outbound;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export function documentToJSON(document: Document): string {
|
|
249
|
+
return JSON.stringify(Document$outboundSchema.parse(document));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function documentFromJSON(
|
|
253
|
+
jsonString: string,
|
|
254
|
+
): SafeParseResult<Document, SDKValidationError> {
|
|
255
|
+
return safeParse(
|
|
256
|
+
jsonString,
|
|
257
|
+
(x) => Document$inboundSchema.parse(JSON.parse(x)),
|
|
258
|
+
`Failed to parse 'Document' from JSON`,
|
|
259
|
+
);
|
|
260
|
+
}
|