@airwallex/developer-mcp 0.3.0-beta.10
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 +22 -0
- package/README.md +148 -0
- package/dist/constants/config.js +8 -0
- package/dist/constants/descriptions.js +86 -0
- package/dist/index.js +55 -0
- package/dist/integration-best-practices.md +15 -0
- package/dist/server.js +54 -0
- package/dist/services/AirTrackerClient.js +61 -0
- package/dist/tools/createBillingCheckout.js +71 -0
- package/dist/tools/createBillingPrice.js +106 -0
- package/dist/tools/createBillingProduct.js +49 -0
- package/dist/tools/createPaymentLink.js +70 -0
- package/dist/tools/createTransfer.js +83 -0
- package/dist/tools/getBalances.js +35 -0
- package/dist/tools/getFxQuote.js +63 -0
- package/dist/tools/index.js +25 -0
- package/dist/tools/listBeneficiaries.js +38 -0
- package/dist/tools/listBillingPrices.js +46 -0
- package/dist/tools/listBillingProducts.js +38 -0
- package/dist/tools/listGlobalAccounts.js +36 -0
- package/dist/tools/listPaymentLinks.js +38 -0
- package/dist/tools/listTransfers.js +35 -0
- package/dist/tools/readIntegrationBestPractices.js +32 -0
- package/dist/tools/retrieveDocs.js +63 -0
- package/dist/tools/simulateDeposit.js +54 -0
- package/dist/tools/simulateTransferResult.js +42 -0
- package/dist/types/index.js +2 -0
- package/dist/utils/device.js +13 -0
- package/dist/utils/version.js +43 -0
- package/dist/utils/withTelemetry.js +16 -0
- package/package.json +65 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBillingProductToolConfig = exports.createBillingProductSchema = void 0;
|
|
4
|
+
exports.executeCreateBillingProduct = executeCreateBillingProduct;
|
|
5
|
+
const uuid_1 = require("uuid");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
8
|
+
exports.createBillingProductSchema = zod_1.z.object({
|
|
9
|
+
description: zod_1.z.string().optional(),
|
|
10
|
+
name: zod_1.z.string().min(1, "Product name is required"),
|
|
11
|
+
request_id: zod_1.z
|
|
12
|
+
.string()
|
|
13
|
+
.min(1)
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Optional idempotency key. If not provided, one will be generated automatically"),
|
|
16
|
+
});
|
|
17
|
+
async function executeCreateBillingProduct(airwallex, args) {
|
|
18
|
+
try {
|
|
19
|
+
const requestId = args.request_id || (0, uuid_1.v4)();
|
|
20
|
+
const response = (await airwallex.post("/api/v1/products/create", {
|
|
21
|
+
name: args.name,
|
|
22
|
+
request_id: requestId,
|
|
23
|
+
...(args.description && { description: args.description }),
|
|
24
|
+
}));
|
|
25
|
+
return {
|
|
26
|
+
content: [
|
|
27
|
+
{
|
|
28
|
+
text: JSON.stringify(response, null, 2),
|
|
29
|
+
type: "text",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const statusCode = error?.status || error?.statusCode || 500;
|
|
36
|
+
const errorMessage = error?.message || "Unknown error occurred";
|
|
37
|
+
throw new Error(`Failed to create billing product (${statusCode}): ${errorMessage}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.createBillingProductToolConfig = {
|
|
41
|
+
annotations: {
|
|
42
|
+
openWorldHint: true,
|
|
43
|
+
readOnlyHint: false,
|
|
44
|
+
title: "Create billing product",
|
|
45
|
+
},
|
|
46
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.CREATE_BILLING_PRODUCT,
|
|
47
|
+
inputSchema: exports.createBillingProductSchema,
|
|
48
|
+
name: "create_billing_product",
|
|
49
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPaymentLinkToolConfig = exports.createPaymentLinkSchema = void 0;
|
|
4
|
+
exports.executeCreatePaymentLink = executeCreatePaymentLink;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
7
|
+
exports.createPaymentLinkSchema = zod_1.z.object({
|
|
8
|
+
amount: zod_1.z
|
|
9
|
+
.number()
|
|
10
|
+
.positive()
|
|
11
|
+
.describe("The payment amount. For Fixed pricing only."),
|
|
12
|
+
currency: zod_1.z
|
|
13
|
+
.string()
|
|
14
|
+
.length(3)
|
|
15
|
+
.describe("The payment currency. For Fixed pricing only."),
|
|
16
|
+
description: zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("The additional description text that appears under the title in the payment checkout page."),
|
|
20
|
+
reusable: zod_1.z.boolean().optional().default(false),
|
|
21
|
+
shopper_email: zod_1.z
|
|
22
|
+
.string()
|
|
23
|
+
.email()
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("The email address to send the payment link to. Since this parameter is optional, OMIT it when it is not explicitly supplied by the user. NEVER mock or use a placeholder email address."),
|
|
26
|
+
title: zod_1.z
|
|
27
|
+
.string()
|
|
28
|
+
.min(1)
|
|
29
|
+
.describe("The title of the payment link that is displayed in the payment checkout page."),
|
|
30
|
+
});
|
|
31
|
+
async function executeCreatePaymentLink(airwallex, args) {
|
|
32
|
+
try {
|
|
33
|
+
const createPayload = {
|
|
34
|
+
amount: args.amount,
|
|
35
|
+
currency: args.currency,
|
|
36
|
+
reusable: args.reusable,
|
|
37
|
+
title: args.title,
|
|
38
|
+
};
|
|
39
|
+
if (args.description) {
|
|
40
|
+
createPayload.description = args.description;
|
|
41
|
+
}
|
|
42
|
+
const response = (await airwallex.post("/api/v1/pa/payment_links/create", createPayload));
|
|
43
|
+
if (args.shopper_email) {
|
|
44
|
+
await airwallex.post(`/api/v1/pa/payment_links/${response.id}/notify_shopper`, { shopper_email: args.shopper_email });
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
content: [
|
|
48
|
+
{
|
|
49
|
+
text: JSON.stringify(response, null, 2),
|
|
50
|
+
type: "text",
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
const statusCode = error?.status || error?.statusCode || 500;
|
|
57
|
+
const errorMessage = error?.message || "Unknown error occurred";
|
|
58
|
+
throw new Error(`Failed to create payment link (${statusCode}): ${errorMessage}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.createPaymentLinkToolConfig = {
|
|
62
|
+
annotations: {
|
|
63
|
+
openWorldHint: true,
|
|
64
|
+
readOnlyHint: false,
|
|
65
|
+
title: "Create payment link",
|
|
66
|
+
},
|
|
67
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.CREATE_PAYMENT_LINK,
|
|
68
|
+
inputSchema: exports.createPaymentLinkSchema,
|
|
69
|
+
name: "create_payment_link",
|
|
70
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTransferToolConfig = exports.createTransferSchema = void 0;
|
|
4
|
+
exports.executeCreateTransfer = executeCreateTransfer;
|
|
5
|
+
const uuid_1 = require("uuid");
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
8
|
+
exports.createTransferSchema = zod_1.z
|
|
9
|
+
.object({
|
|
10
|
+
beneficiary_id: zod_1.z
|
|
11
|
+
.string()
|
|
12
|
+
.min(1)
|
|
13
|
+
.describe("The ID of the beneficiary to send the transfer to."),
|
|
14
|
+
reason: zod_1.z.string().min(1),
|
|
15
|
+
reference: zod_1.z.string().min(1),
|
|
16
|
+
source_amount: zod_1.z
|
|
17
|
+
.number()
|
|
18
|
+
.positive()
|
|
19
|
+
.optional()
|
|
20
|
+
.describe("The amount to be transferred from the source wallet."),
|
|
21
|
+
source_currency: zod_1.z
|
|
22
|
+
.string()
|
|
23
|
+
.length(3)
|
|
24
|
+
.describe("The currency of the source amount."),
|
|
25
|
+
transfer_amount: zod_1.z
|
|
26
|
+
.number()
|
|
27
|
+
.positive()
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("The amount that the beneficiary must receive."),
|
|
30
|
+
transfer_currency: zod_1.z
|
|
31
|
+
.string()
|
|
32
|
+
.length(3)
|
|
33
|
+
.describe("The currency of the transfer amount."),
|
|
34
|
+
transfer_method: zod_1.z
|
|
35
|
+
.enum(["LOCAL", "SWIFT"])
|
|
36
|
+
.describe("The method of the transfer."),
|
|
37
|
+
})
|
|
38
|
+
.refine((data) => {
|
|
39
|
+
const hasTransferAmount = data.transfer_amount !== undefined;
|
|
40
|
+
const hasSourceAmount = data.source_amount !== undefined;
|
|
41
|
+
return hasTransferAmount !== hasSourceAmount;
|
|
42
|
+
}, {
|
|
43
|
+
message: "Exactly one of transfer_amount OR source_amount must be provided, but not both.",
|
|
44
|
+
});
|
|
45
|
+
async function executeCreateTransfer(airwallex, args) {
|
|
46
|
+
try {
|
|
47
|
+
const requestBody = {
|
|
48
|
+
beneficiary_id: args.beneficiary_id,
|
|
49
|
+
reason: args.reason,
|
|
50
|
+
reference: args.reference,
|
|
51
|
+
request_id: (0, uuid_1.v4)(),
|
|
52
|
+
source_amount: args.source_amount,
|
|
53
|
+
source_currency: args.source_currency,
|
|
54
|
+
transfer_amount: args.transfer_amount,
|
|
55
|
+
transfer_currency: args.transfer_currency,
|
|
56
|
+
transfer_method: args.transfer_method,
|
|
57
|
+
};
|
|
58
|
+
const response = (await airwallex.post("/api/v1/transfers/create", requestBody));
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
text: JSON.stringify(response, null, 2),
|
|
63
|
+
type: "text",
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
const statusCode = error?.status || error?.statusCode || 500;
|
|
70
|
+
const errorMessage = error?.message || "Unknown error occurred";
|
|
71
|
+
throw new Error(`Failed to create transfer (${statusCode}): ${errorMessage}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.createTransferToolConfig = {
|
|
75
|
+
annotations: {
|
|
76
|
+
openWorldHint: true,
|
|
77
|
+
readOnlyHint: false,
|
|
78
|
+
title: "Create transfer",
|
|
79
|
+
},
|
|
80
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.CREATE_TRANSFER,
|
|
81
|
+
inputSchema: exports.createTransferSchema,
|
|
82
|
+
name: "create_transfer",
|
|
83
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAccountBalancesToolConfig = exports.getAccountBalancesSchema = void 0;
|
|
4
|
+
exports.executeGetAccountBalances = executeGetAccountBalances;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
7
|
+
exports.getAccountBalancesSchema = zod_1.z.object({});
|
|
8
|
+
async function executeGetAccountBalances(airwallex) {
|
|
9
|
+
try {
|
|
10
|
+
const response = (await airwallex.get("/api/v1/balances/current"));
|
|
11
|
+
return {
|
|
12
|
+
content: [
|
|
13
|
+
{
|
|
14
|
+
text: JSON.stringify(response, null, 2),
|
|
15
|
+
type: "text",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
const statusCode = error?.status || error?.statusCode || 500;
|
|
22
|
+
const errorMessage = error?.message || "Unknown error occurred";
|
|
23
|
+
throw new Error(`Failed to get account balances (${statusCode}): ${errorMessage}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.getAccountBalancesToolConfig = {
|
|
27
|
+
annotations: {
|
|
28
|
+
openWorldHint: true,
|
|
29
|
+
readOnlyHint: true,
|
|
30
|
+
title: "Get balances",
|
|
31
|
+
},
|
|
32
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.GET_ACCOUNT_BALANCES,
|
|
33
|
+
inputSchema: exports.getAccountBalancesSchema,
|
|
34
|
+
name: "get_balances",
|
|
35
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFxQuoteToolConfig = exports.getFxQuoteSchema = void 0;
|
|
4
|
+
exports.executeGetFxQuote = executeGetFxQuote;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
7
|
+
exports.getFxQuoteSchema = zod_1.z
|
|
8
|
+
.object({
|
|
9
|
+
buy_amount: zod_1.z
|
|
10
|
+
.number()
|
|
11
|
+
.positive()
|
|
12
|
+
.describe("The amount to buy. Skip this if you are setting sell_amount")
|
|
13
|
+
.optional(),
|
|
14
|
+
buy_currency: zod_1.z.string().length(3).describe("The currency to buy"),
|
|
15
|
+
sell_amount: zod_1.z
|
|
16
|
+
.number()
|
|
17
|
+
.positive()
|
|
18
|
+
.describe("The amount to sell. Skip this if you are setting buy_amount")
|
|
19
|
+
.optional(),
|
|
20
|
+
sell_currency: zod_1.z.string().length(3).describe("The currency to sell"),
|
|
21
|
+
validity: zod_1.z
|
|
22
|
+
.enum(["MIN_1", "MIN_15", "MIN_30", "HR_1", "HR_4", "HR_8", "HR_24"])
|
|
23
|
+
.describe("The validity of the quote"),
|
|
24
|
+
})
|
|
25
|
+
.refine((data) => (data.buy_amount !== undefined && data.sell_amount === undefined) ||
|
|
26
|
+
(data.buy_amount === undefined && data.sell_amount !== undefined), {
|
|
27
|
+
message: "Exactly one of buy_amount or sell_amount must be set",
|
|
28
|
+
path: ["buy_amount", "sell_amount"],
|
|
29
|
+
});
|
|
30
|
+
async function executeGetFxQuote(airwallex, args) {
|
|
31
|
+
try {
|
|
32
|
+
const response = (await airwallex.post("/api/v1/fx/quotes/create", {
|
|
33
|
+
buy_amount: args.buy_amount,
|
|
34
|
+
buy_currency: args.buy_currency,
|
|
35
|
+
sell_amount: args.sell_amount,
|
|
36
|
+
sell_currency: args.sell_currency,
|
|
37
|
+
validity: args.validity,
|
|
38
|
+
}));
|
|
39
|
+
return {
|
|
40
|
+
content: [
|
|
41
|
+
{
|
|
42
|
+
text: JSON.stringify(response, null, 2),
|
|
43
|
+
type: "text",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
const statusCode = error?.status || error?.statusCode || 500;
|
|
50
|
+
const errorMessage = error?.message || "Unknown error occurred";
|
|
51
|
+
throw new Error(`Failed to get FX quote (${statusCode}): ${errorMessage}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.getFxQuoteToolConfig = {
|
|
55
|
+
annotations: {
|
|
56
|
+
openWorldHint: true,
|
|
57
|
+
readOnlyHint: true,
|
|
58
|
+
title: "Get FX quote",
|
|
59
|
+
},
|
|
60
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.GET_FX_QUOTE,
|
|
61
|
+
inputSchema: exports.getFxQuoteSchema,
|
|
62
|
+
name: "get_fx_quote",
|
|
63
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./createBillingCheckout"), exports);
|
|
18
|
+
__exportStar(require("./createBillingProduct"), exports);
|
|
19
|
+
__exportStar(require("./getBalances"), exports);
|
|
20
|
+
__exportStar(require("./listBillingPrices"), exports);
|
|
21
|
+
__exportStar(require("./listBillingProducts"), exports);
|
|
22
|
+
__exportStar(require("./listGlobalAccounts"), exports);
|
|
23
|
+
__exportStar(require("./readIntegrationBestPractices"), exports);
|
|
24
|
+
__exportStar(require("./retrieveDocs"), exports);
|
|
25
|
+
__exportStar(require("./simulateDeposit"), exports);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listBeneficiariesToolConfig = exports.listBeneficiariesSchema = void 0;
|
|
4
|
+
exports.executeListBeneficiaries = executeListBeneficiaries;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
7
|
+
exports.listBeneficiariesSchema = zod_1.z.object({});
|
|
8
|
+
async function executeListBeneficiaries(airwallex) {
|
|
9
|
+
try {
|
|
10
|
+
const queryParams = new URLSearchParams();
|
|
11
|
+
queryParams.append("page_size", "100");
|
|
12
|
+
const url = `/api/v1/beneficiaries${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
13
|
+
const response = (await airwallex.get(url));
|
|
14
|
+
return {
|
|
15
|
+
content: [
|
|
16
|
+
{
|
|
17
|
+
text: JSON.stringify(response, null, 2),
|
|
18
|
+
type: "text",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const statusCode = error?.status || error?.statusCode || 500;
|
|
25
|
+
const errorMessage = error?.message || "Unknown error occurred";
|
|
26
|
+
throw new Error(`Failed to list beneficiaries (${statusCode}): ${errorMessage}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.listBeneficiariesToolConfig = {
|
|
30
|
+
annotations: {
|
|
31
|
+
openWorldHint: true,
|
|
32
|
+
readOnlyHint: true,
|
|
33
|
+
title: "List beneficiaries",
|
|
34
|
+
},
|
|
35
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.LIST_BENEFICIARIES,
|
|
36
|
+
inputSchema: exports.listBeneficiariesSchema,
|
|
37
|
+
name: "list_beneficiaries",
|
|
38
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listBillingPricesToolConfig = exports.listBillingPricesSchema = void 0;
|
|
4
|
+
exports.executeListBillingPrices = executeListBillingPrices;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
7
|
+
exports.listBillingPricesSchema = zod_1.z.object({
|
|
8
|
+
product_id: zod_1.z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe("Optional product ID to filter prices by"),
|
|
12
|
+
});
|
|
13
|
+
async function executeListBillingPrices(airwallex, args) {
|
|
14
|
+
try {
|
|
15
|
+
const queryParams = new URLSearchParams();
|
|
16
|
+
if (args.product_id) {
|
|
17
|
+
queryParams.append("product_id", args.product_id);
|
|
18
|
+
}
|
|
19
|
+
queryParams.append("page_size", "100");
|
|
20
|
+
const url = `/api/v1/prices${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
21
|
+
const response = (await airwallex.get(url));
|
|
22
|
+
return {
|
|
23
|
+
content: [
|
|
24
|
+
{
|
|
25
|
+
text: JSON.stringify(response, null, 2),
|
|
26
|
+
type: "text",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
const statusCode = error?.status || error?.statusCode || 500;
|
|
33
|
+
const errorMessage = error?.message || "Unknown error occurred";
|
|
34
|
+
throw new Error(`Failed to list billing prices (${statusCode}): ${errorMessage}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.listBillingPricesToolConfig = {
|
|
38
|
+
annotations: {
|
|
39
|
+
openWorldHint: true,
|
|
40
|
+
readOnlyHint: true,
|
|
41
|
+
title: "List billing prices",
|
|
42
|
+
},
|
|
43
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.LIST_BILLING_PRICES,
|
|
44
|
+
inputSchema: exports.listBillingPricesSchema,
|
|
45
|
+
name: "list_billing_prices",
|
|
46
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listBillingProductsToolConfig = exports.listBillingProductsSchema = void 0;
|
|
4
|
+
exports.executeListBillingProducts = executeListBillingProducts;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
7
|
+
exports.listBillingProductsSchema = zod_1.z.object({});
|
|
8
|
+
async function executeListBillingProducts(airwallex) {
|
|
9
|
+
try {
|
|
10
|
+
const queryParams = new URLSearchParams();
|
|
11
|
+
queryParams.append("page_size", "100");
|
|
12
|
+
const url = `/api/v1/products${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
13
|
+
const response = (await airwallex.get(url));
|
|
14
|
+
return {
|
|
15
|
+
content: [
|
|
16
|
+
{
|
|
17
|
+
text: JSON.stringify(response, null, 2),
|
|
18
|
+
type: "text",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const statusCode = error?.status || error?.statusCode || 500;
|
|
25
|
+
const errorMessage = error?.message || "Unknown error occurred";
|
|
26
|
+
throw new Error(`Failed to list billing products (${statusCode}): ${errorMessage}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.listBillingProductsToolConfig = {
|
|
30
|
+
annotations: {
|
|
31
|
+
openWorldHint: true,
|
|
32
|
+
readOnlyHint: true,
|
|
33
|
+
title: "List billing products",
|
|
34
|
+
},
|
|
35
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.LIST_BILLING_PRODUCTS,
|
|
36
|
+
inputSchema: exports.listBillingProductsSchema,
|
|
37
|
+
name: "list_billing_products",
|
|
38
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listGlobalAccountsToolConfig = exports.listGlobalAccountsSchema = void 0;
|
|
4
|
+
exports.executeListGlobalAccounts = executeListGlobalAccounts;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
7
|
+
exports.listGlobalAccountsSchema = zod_1.z.object({});
|
|
8
|
+
async function executeListGlobalAccounts(airwallex) {
|
|
9
|
+
try {
|
|
10
|
+
const response = (await airwallex.get("/api/v1/global_accounts"));
|
|
11
|
+
return {
|
|
12
|
+
content: [
|
|
13
|
+
{
|
|
14
|
+
text: JSON.stringify(response, null, 2),
|
|
15
|
+
type: "text",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
// Simplified error handling
|
|
22
|
+
const statusCode = error?.status || error?.statusCode || 500;
|
|
23
|
+
const errorMessage = error?.message || "Unknown error occurred";
|
|
24
|
+
throw new Error(`Failed to list global accounts (${statusCode}): ${errorMessage}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.listGlobalAccountsToolConfig = {
|
|
28
|
+
annotations: {
|
|
29
|
+
openWorldHint: true,
|
|
30
|
+
readOnlyHint: true,
|
|
31
|
+
title: "List global accounts",
|
|
32
|
+
},
|
|
33
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.LIST_GLOBAL_ACCOUNTS,
|
|
34
|
+
inputSchema: exports.listGlobalAccountsSchema,
|
|
35
|
+
name: "list_global_accounts",
|
|
36
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listPaymentLinksToolConfig = exports.listPaymentLinksSchema = void 0;
|
|
4
|
+
exports.executeListPaymentLinks = executeListPaymentLinks;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
7
|
+
exports.listPaymentLinksSchema = zod_1.z.object({});
|
|
8
|
+
async function executeListPaymentLinks(airwallex) {
|
|
9
|
+
try {
|
|
10
|
+
const queryParams = new URLSearchParams();
|
|
11
|
+
queryParams.append("page_size", "100");
|
|
12
|
+
const url = `/api/v1/pa/payment_links${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
13
|
+
const response = (await airwallex.get(url));
|
|
14
|
+
return {
|
|
15
|
+
content: [
|
|
16
|
+
{
|
|
17
|
+
text: JSON.stringify(response, null, 2),
|
|
18
|
+
type: "text",
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const statusCode = error?.status || error?.statusCode || 500;
|
|
25
|
+
const errorMessage = error?.message || "Unknown error occurred";
|
|
26
|
+
throw new Error(`Failed to list payment links (${statusCode}): ${errorMessage}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.listPaymentLinksToolConfig = {
|
|
30
|
+
annotations: {
|
|
31
|
+
openWorldHint: true,
|
|
32
|
+
readOnlyHint: true,
|
|
33
|
+
title: "List payment links",
|
|
34
|
+
},
|
|
35
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.LIST_PAYMENT_LINKS,
|
|
36
|
+
inputSchema: exports.listPaymentLinksSchema,
|
|
37
|
+
name: "list_payment_links",
|
|
38
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listTransfersToolConfig = exports.listTransfersSchema = void 0;
|
|
4
|
+
exports.executeListTransfers = executeListTransfers;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
7
|
+
exports.listTransfersSchema = zod_1.z.object({});
|
|
8
|
+
async function executeListTransfers(airwallex) {
|
|
9
|
+
try {
|
|
10
|
+
const response = (await airwallex.get("/api/v1/transfers"));
|
|
11
|
+
return {
|
|
12
|
+
content: [
|
|
13
|
+
{
|
|
14
|
+
text: JSON.stringify(response, null, 2),
|
|
15
|
+
type: "text",
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
const statusCode = error?.status || error?.statusCode || 500;
|
|
22
|
+
const errorMessage = error?.message || "Unknown error occurred";
|
|
23
|
+
throw new Error(`Failed to list transfers (${statusCode}): ${errorMessage}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.listTransfersToolConfig = {
|
|
27
|
+
annotations: {
|
|
28
|
+
openWorldHint: true,
|
|
29
|
+
readOnlyHint: true,
|
|
30
|
+
title: "List transfers",
|
|
31
|
+
},
|
|
32
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.LIST_TRANSFERS,
|
|
33
|
+
inputSchema: exports.listTransfersSchema,
|
|
34
|
+
name: "list_transfers",
|
|
35
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readBestPracticesToolConfig = exports.readBestPracticesSchema = void 0;
|
|
4
|
+
exports.executeReadBestPractices = executeReadBestPractices;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
7
|
+
exports.readBestPracticesSchema = zod_1.z.object({});
|
|
8
|
+
async function executeReadBestPractices(integrationBestPracticesContent) {
|
|
9
|
+
try {
|
|
10
|
+
return {
|
|
11
|
+
content: [
|
|
12
|
+
{
|
|
13
|
+
text: integrationBestPracticesContent,
|
|
14
|
+
type: "text",
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw new Error(`Failed to read the integration best practices file: ${error instanceof Error ? error.message : String(error)}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.readBestPracticesToolConfig = {
|
|
24
|
+
annotations: {
|
|
25
|
+
openWorldHint: false,
|
|
26
|
+
readOnlyHint: true,
|
|
27
|
+
title: "Read Airwallex integration best practices",
|
|
28
|
+
},
|
|
29
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.READ_BEST_PRACTICES,
|
|
30
|
+
inputSchema: exports.readBestPracticesSchema,
|
|
31
|
+
name: "read_integration_best_practices",
|
|
32
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.retrieveDocsToolConfig = exports.retrieveDocsSchema = void 0;
|
|
4
|
+
exports.executeRetrieveDocs = executeRetrieveDocs;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const config_1 = require("../constants/config");
|
|
7
|
+
const descriptions_1 = require("../constants/descriptions");
|
|
8
|
+
exports.retrieveDocsSchema = zod_1.z.object({
|
|
9
|
+
question: zod_1.z
|
|
10
|
+
.string()
|
|
11
|
+
.min(1)
|
|
12
|
+
.describe("The question to search the documentation with."),
|
|
13
|
+
source: zod_1.z
|
|
14
|
+
.enum([
|
|
15
|
+
"product-docs",
|
|
16
|
+
"api-docs",
|
|
17
|
+
"js-sdk-docs",
|
|
18
|
+
"ios-sdk-docs",
|
|
19
|
+
"android-sdk-docs",
|
|
20
|
+
])
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Documentation source to search. OMIT this parameter to search all sources. PREFER to start with a broad search and then narrow down the search with a specific source if needed. Set the source to `product-docs` for information related to integration or migration guides, general product enquiries & detailed API response error code descriptions and reasons. Set the source to `api-docs` for information related to specific API endpoints and for general API-related information related to versioning, authentication, rate limits, etc. Set the source to `js-sdk-docs` for specific information related to Airwallex.js or the Components SDK. For the legacy JS libraries, use `product-docs`, `ios-sdk-docs` for specific information related to the Payments iOS SDK, `android-sdk-docs` for specific information related to the Payments Android SDK."),
|
|
23
|
+
});
|
|
24
|
+
async function executeRetrieveDocs(args, version) {
|
|
25
|
+
const baseUrl = config_1.BASE_URLS.docsSearch;
|
|
26
|
+
const response = await fetch(`${baseUrl}/retrieve`, {
|
|
27
|
+
body: JSON.stringify({
|
|
28
|
+
query: args.question,
|
|
29
|
+
sources: args.source ? [args.source] : undefined,
|
|
30
|
+
}),
|
|
31
|
+
headers: {
|
|
32
|
+
"Content-Type": "application/json",
|
|
33
|
+
"User-Agent": `awx-local-mcp-server/${version}`,
|
|
34
|
+
},
|
|
35
|
+
method: "POST",
|
|
36
|
+
});
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
39
|
+
}
|
|
40
|
+
const data = (await response.json());
|
|
41
|
+
const results = data.results.map((entry) => ({
|
|
42
|
+
content: entry.content,
|
|
43
|
+
source_url: entry.source_url,
|
|
44
|
+
}));
|
|
45
|
+
return {
|
|
46
|
+
content: [
|
|
47
|
+
{
|
|
48
|
+
text: JSON.stringify(results.map((result) => result.content), null, 2),
|
|
49
|
+
type: "text",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.retrieveDocsToolConfig = {
|
|
55
|
+
annotations: {
|
|
56
|
+
openWorldHint: true,
|
|
57
|
+
readOnlyHint: true,
|
|
58
|
+
title: "Search Airwallex Product, API & SDK documentation",
|
|
59
|
+
},
|
|
60
|
+
description: descriptions_1.TOOL_DESCRIPTIONS.RETRIEVE_DOCS,
|
|
61
|
+
inputSchema: exports.retrieveDocsSchema,
|
|
62
|
+
name: "search_public_docs",
|
|
63
|
+
};
|