@moneygraph/mcp-server 1.0.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/.claude/settings.local.json +13 -0
- package/README.md +224 -0
- package/bin/mcp-http.js +10 -0
- package/bin/mcp-server.js +8 -0
- package/dist/config.d.ts +28 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +53 -0
- package/dist/config.js.map +1 -0
- package/dist/http.d.ts +15 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +104 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +164 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/check-rates.d.ts +6 -0
- package/dist/prompts/check-rates.d.ts.map +1 -0
- package/dist/prompts/check-rates.js +29 -0
- package/dist/prompts/check-rates.js.map +1 -0
- package/dist/prompts/crypto-deposit.d.ts +6 -0
- package/dist/prompts/crypto-deposit.d.ts.map +1 -0
- package/dist/prompts/crypto-deposit.js +36 -0
- package/dist/prompts/crypto-deposit.js.map +1 -0
- package/dist/prompts/issue-card.d.ts +6 -0
- package/dist/prompts/issue-card.d.ts.map +1 -0
- package/dist/prompts/issue-card.js +33 -0
- package/dist/prompts/issue-card.js.map +1 -0
- package/dist/prompts/onboard-customer.d.ts +6 -0
- package/dist/prompts/onboard-customer.d.ts.map +1 -0
- package/dist/prompts/onboard-customer.js +31 -0
- package/dist/prompts/onboard-customer.js.map +1 -0
- package/dist/prompts/payout-status.d.ts +6 -0
- package/dist/prompts/payout-status.d.ts.map +1 -0
- package/dist/prompts/payout-status.js +29 -0
- package/dist/prompts/payout-status.js.map +1 -0
- package/dist/prompts/send-money.d.ts +6 -0
- package/dist/prompts/send-money.d.ts.map +1 -0
- package/dist/prompts/send-money.js +34 -0
- package/dist/prompts/send-money.js.map +1 -0
- package/dist/resources/corridors.d.ts +8 -0
- package/dist/resources/corridors.d.ts.map +1 -0
- package/dist/resources/corridors.js +137 -0
- package/dist/resources/corridors.js.map +1 -0
- package/dist/resources/status.d.ts +7 -0
- package/dist/resources/status.d.ts.map +1 -0
- package/dist/resources/status.js +32 -0
- package/dist/resources/status.js.map +1 -0
- package/dist/resources/wallets.d.ts +7 -0
- package/dist/resources/wallets.d.ts.map +1 -0
- package/dist/resources/wallets.js +37 -0
- package/dist/resources/wallets.js.map +1 -0
- package/dist/tools/cards.d.ts +10 -0
- package/dist/tools/cards.d.ts.map +1 -0
- package/dist/tools/cards.js +229 -0
- package/dist/tools/cards.js.map +1 -0
- package/dist/tools/crypto.d.ts +10 -0
- package/dist/tools/crypto.d.ts.map +1 -0
- package/dist/tools/crypto.js +265 -0
- package/dist/tools/crypto.js.map +1 -0
- package/dist/tools/currencies.d.ts +10 -0
- package/dist/tools/currencies.d.ts.map +1 -0
- package/dist/tools/currencies.js +84 -0
- package/dist/tools/currencies.js.map +1 -0
- package/dist/tools/customers.d.ts +7 -0
- package/dist/tools/customers.d.ts.map +1 -0
- package/dist/tools/customers.js +310 -0
- package/dist/tools/customers.js.map +1 -0
- package/dist/tools/directors.d.ts +7 -0
- package/dist/tools/directors.d.ts.map +1 -0
- package/dist/tools/directors.js +148 -0
- package/dist/tools/directors.js.map +1 -0
- package/dist/tools/fx.d.ts +10 -0
- package/dist/tools/fx.d.ts.map +1 -0
- package/dist/tools/fx.js +193 -0
- package/dist/tools/fx.js.map +1 -0
- package/dist/tools/ledger.d.ts +7 -0
- package/dist/tools/ledger.d.ts.map +1 -0
- package/dist/tools/ledger.js +101 -0
- package/dist/tools/ledger.js.map +1 -0
- package/dist/tools/payments.d.ts +7 -0
- package/dist/tools/payments.d.ts.map +1 -0
- package/dist/tools/payments.js +93 -0
- package/dist/tools/payments.js.map +1 -0
- package/dist/tools/payouts.d.ts +10 -0
- package/dist/tools/payouts.d.ts.map +1 -0
- package/dist/tools/payouts.js +352 -0
- package/dist/tools/payouts.js.map +1 -0
- package/dist/tools/recipients.d.ts +7 -0
- package/dist/tools/recipients.d.ts.map +1 -0
- package/dist/tools/recipients.js +150 -0
- package/dist/tools/recipients.js.map +1 -0
- package/dist/tools/recurring.d.ts +7 -0
- package/dist/tools/recurring.d.ts.map +1 -0
- package/dist/tools/recurring.js +94 -0
- package/dist/tools/recurring.js.map +1 -0
- package/dist/tools/reference.d.ts +7 -0
- package/dist/tools/reference.d.ts.map +1 -0
- package/dist/tools/reference.js +83 -0
- package/dist/tools/reference.js.map +1 -0
- package/dist/tools/transactions.d.ts +7 -0
- package/dist/tools/transactions.d.ts.map +1 -0
- package/dist/tools/transactions.js +88 -0
- package/dist/tools/transactions.js.map +1 -0
- package/dist/tools/wallets.d.ts +7 -0
- package/dist/tools/wallets.d.ts.map +1 -0
- package/dist/tools/wallets.js +129 -0
- package/dist/tools/wallets.js.map +1 -0
- package/package.json +67 -0
- package/railway.json +14 -0
- package/src/config.ts +73 -0
- package/src/http.ts +118 -0
- package/src/index.ts +184 -0
- package/src/prompts/check-rates.ts +36 -0
- package/src/prompts/crypto-deposit.ts +43 -0
- package/src/prompts/issue-card.ts +40 -0
- package/src/prompts/onboard-customer.ts +39 -0
- package/src/prompts/payout-status.ts +36 -0
- package/src/prompts/send-money.ts +41 -0
- package/src/resources/corridors.ts +190 -0
- package/src/resources/status.ts +44 -0
- package/src/resources/wallets.ts +48 -0
- package/src/tools/cards.ts +302 -0
- package/src/tools/crypto.ts +382 -0
- package/src/tools/currencies.ts +122 -0
- package/src/tools/customers.ts +458 -0
- package/src/tools/directors.ts +209 -0
- package/src/tools/fx.ts +253 -0
- package/src/tools/ledger.ts +133 -0
- package/src/tools/payments.ts +118 -0
- package/src/tools/payouts.ts +452 -0
- package/src/tools/recipients.ts +204 -0
- package/src/tools/recurring.ts +130 -0
- package/src/tools/reference.ts +122 -0
- package/src/tools/transactions.ts +140 -0
- package/src/tools/wallets.ts +183 -0
- package/test/smoke.test.mjs +196 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currency & Rate Tools — FX rates, corridors, delivery windows
|
|
3
|
+
*
|
|
4
|
+
* get_currencies is THE most important tool in the entire MCP server.
|
|
5
|
+
* It returns everything needed to construct a valid payout.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { safeCall } from '../config.js';
|
|
9
|
+
export function registerCurrencyTools(server, config) {
|
|
10
|
+
const { client } = config;
|
|
11
|
+
// ── get_currencies ──────────────────────────────────────────────
|
|
12
|
+
server.tool('get_currencies', `THE critical tool — call this BEFORE any payout. Returns FX rates, corridor UUIDs (needed for create_recipient), delivery window UUIDs (needed for create_payout), delivery methods, account types, fees, and limits for a country. Use the iso2 param with the DESTINATION country code (e.g. "NG" for Nigeria, "KE" for Kenya, "GH" for Ghana, "GB" for UK). The response contains: international_remittance[].id (corridor UUID), delivery_windows[].id (window UUID), delivery_methods, rates, and fees.`, {
|
|
13
|
+
iso2: z.string().describe('Destination country ISO2 code (e.g. "NG", "KE", "GH", "US", "GB")'),
|
|
14
|
+
}, async (args) => {
|
|
15
|
+
// Use the reference.countries + fx.rates approach since the SDK
|
|
16
|
+
// doesn't have a direct getCurrencies method. We'll call fx.rates
|
|
17
|
+
// and reference data to build the corridor info.
|
|
18
|
+
const ratesResult = await safeCall(() => client.fx.rates(), 'get_currencies');
|
|
19
|
+
if (!ratesResult.success) {
|
|
20
|
+
return {
|
|
21
|
+
content: [{ type: 'text', text: `Error fetching currencies: ${ratesResult.error}` }],
|
|
22
|
+
isError: true,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
// Also get banks for this country
|
|
26
|
+
const banksResult = await safeCall(() => client.reference.banks.list(args.iso2), 'get_currencies_banks');
|
|
27
|
+
// Get mobile networks
|
|
28
|
+
const mobileResult = await safeCall(() => client.reference.mobileNetworks.list(args.iso2), 'get_currencies_mobile');
|
|
29
|
+
const rates = ratesResult.data;
|
|
30
|
+
const banks = banksResult.success ? banksResult.data : [];
|
|
31
|
+
const mobileNetworks = mobileResult.success ? mobileResult.data : [];
|
|
32
|
+
// Filter rates relevant to the destination country
|
|
33
|
+
// Rates are keyed like "USD_NGN", "GBP_NGN" etc.
|
|
34
|
+
const iso2Upper = args.iso2.toUpperCase();
|
|
35
|
+
const relevantRates = {};
|
|
36
|
+
for (const [pair, rate] of Object.entries(rates)) {
|
|
37
|
+
if (pair.includes(`_${iso2Upper}`) || pair.endsWith(`_${iso2Upper}`)) {
|
|
38
|
+
relevantRates[pair] = rate;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
content: [
|
|
43
|
+
{
|
|
44
|
+
type: 'text',
|
|
45
|
+
text: JSON.stringify({
|
|
46
|
+
country: args.iso2,
|
|
47
|
+
summary: `Found ${Object.keys(relevantRates).length} FX rate pairs for ${iso2Upper}. Use corridor IDs when creating recipients, and delivery window IDs when creating payouts.`,
|
|
48
|
+
rates: relevantRates,
|
|
49
|
+
banks: banks.slice(0, 20), // Top 20 banks
|
|
50
|
+
mobile_networks: mobileNetworks,
|
|
51
|
+
delivery_methods: {
|
|
52
|
+
bank: { available: true, routing_types: ['SWIFT', 'ACH_CODE'] },
|
|
53
|
+
mobile_money: { available: mobileNetworks.length > 0 },
|
|
54
|
+
cash_pickup: { available: false, note: 'Call list_cash_pickup_agents to check availability' },
|
|
55
|
+
},
|
|
56
|
+
_next_steps: 'Use a corridor rate pair to determine the exchange rate. Then call list_wallets to find your source wallet, and proceed with send_bank_payout or send_mobile_money_payout.',
|
|
57
|
+
}, null, 2),
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
// ── list_countries ──────────────────────────────────────────────
|
|
63
|
+
server.tool('list_countries', 'List all supported countries with their ISO2 codes. Use these codes with get_currencies to look up corridors and rates.', {
|
|
64
|
+
page: z.number().optional().describe('Page number (default 1)'),
|
|
65
|
+
}, async (_args) => {
|
|
66
|
+
const result = await safeCall(() => client.reference.countries(), 'list_countries');
|
|
67
|
+
if (!result.success) {
|
|
68
|
+
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
content: [
|
|
72
|
+
{
|
|
73
|
+
type: 'text',
|
|
74
|
+
text: JSON.stringify({
|
|
75
|
+
count: result.data.length,
|
|
76
|
+
countries: result.data,
|
|
77
|
+
_next_steps: 'Use a country code with get_currencies to see available corridors and rates.',
|
|
78
|
+
}, null, 2),
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=currencies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currencies.js","sourceRoot":"","sources":["../../src/tools/currencies.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,MAAoB;IAC3E,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE1B,mEAAmE;IACnE,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,8eAA8e,EAC9e;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mEAAmE,CAAC;KAC/F,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,gEAAgE;QAChE,kEAAkE;QAClE,iDAAiD;QACjD,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,gBAAgB,CAAC,CAAC;QAE9E,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YACzB,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,8BAA8B,WAAW,CAAC,KAAK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AAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;wBACzB,SAAS,EAAE,MAAM,CAAC,IAAI;wBACtB,WAAW,EAAE,8EAA8E;qBAC5F,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customer Tools — create, retrieve, list, update customers + KYC
|
|
3
|
+
*/
|
|
4
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import type { ServerConfig } from '../config.js';
|
|
6
|
+
export declare function registerCustomerTools(server: McpServer, config: ServerConfig): void;
|
|
7
|
+
//# sourceMappingURL=customers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../src/tools/customers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,QAgc5E"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customer Tools — create, retrieve, list, update customers + KYC
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { formatAmount, nextSteps, safeCall } from '../config.js';
|
|
6
|
+
export function registerCustomerTools(server, config) {
|
|
7
|
+
const { client, mode } = config;
|
|
8
|
+
// ── create_customer ──────────────────────────────────────────────
|
|
9
|
+
server.tool('create_customer', 'Create a personal customer for sending payouts. Returns a customer_id needed for KYC submission and payout creation. After creation, call submit_kyc to approve the customer.', {
|
|
10
|
+
first_name: z.string().describe('Customer first name'),
|
|
11
|
+
last_name: z.string().describe('Customer last name'),
|
|
12
|
+
email: z.string().describe('Customer email address'),
|
|
13
|
+
phone: z.string().describe('Phone number with country code (e.g. +14155551234)'),
|
|
14
|
+
phone_iso2: z.string().describe('Phone country ISO2 code (e.g. "US", "GB", "NG")'),
|
|
15
|
+
country: z.string().describe('Customer country ISO2 code (e.g. "US")'),
|
|
16
|
+
middle_name: z.string().optional().describe('Customer middle name'),
|
|
17
|
+
}, async (args) => {
|
|
18
|
+
const result = await safeCall(() => client.customers.create({
|
|
19
|
+
first_name: args.first_name,
|
|
20
|
+
last_name: args.last_name,
|
|
21
|
+
middle_name: args.middle_name,
|
|
22
|
+
email: args.email,
|
|
23
|
+
phone_number: args.phone,
|
|
24
|
+
phone_iso2: args.phone_iso2,
|
|
25
|
+
country: args.country,
|
|
26
|
+
account_type: 'personal',
|
|
27
|
+
}), 'create_customer');
|
|
28
|
+
if (!result.success) {
|
|
29
|
+
return { content: [{ type: 'text', text: `Error creating customer: ${result.error}` }], isError: true };
|
|
30
|
+
}
|
|
31
|
+
const c = result.data;
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: 'text',
|
|
36
|
+
text: JSON.stringify({
|
|
37
|
+
customer_id: c.id,
|
|
38
|
+
name: `${c.first_name} ${c.last_name}`,
|
|
39
|
+
email: c.email,
|
|
40
|
+
kyc_status: c.kyc_status,
|
|
41
|
+
mode: c.mode,
|
|
42
|
+
_next_steps: nextSteps(`call submit_kyc with customer_id="${c.id}" to approve KYC`, 'then create a recipient and payout'),
|
|
43
|
+
}, null, 2),
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
// ── create_business_customer ────────────────────────────────────
|
|
49
|
+
server.tool('create_business_customer', 'Create a business customer with company details. Flattened params — no nested JSON needed. After creation, add directors via create_director, then call submit_kyc.', {
|
|
50
|
+
first_name: z.string().describe('Contact first name'),
|
|
51
|
+
last_name: z.string().describe('Contact last name'),
|
|
52
|
+
email: z.string().describe('Contact email'),
|
|
53
|
+
phone: z.string().describe('Phone with country code'),
|
|
54
|
+
phone_iso2: z.string().describe('Phone country ISO2'),
|
|
55
|
+
country: z.string().describe('Contact country ISO2'),
|
|
56
|
+
business_name: z.string().describe('Registered business name'),
|
|
57
|
+
business_country: z.string().describe('Business country ISO2'),
|
|
58
|
+
business_state: z.string().describe('Business state/province'),
|
|
59
|
+
business_city: z.string().describe('Business city'),
|
|
60
|
+
business_street: z.string().describe('Business street address'),
|
|
61
|
+
business_postal_code: z.string().describe('Business postal/zip code'),
|
|
62
|
+
middle_name: z.string().optional().describe('Contact middle name'),
|
|
63
|
+
}, async (args) => {
|
|
64
|
+
const result = await safeCall(() => client.customers.create({
|
|
65
|
+
first_name: args.first_name,
|
|
66
|
+
last_name: args.last_name,
|
|
67
|
+
middle_name: args.middle_name,
|
|
68
|
+
email: args.email,
|
|
69
|
+
phone_number: args.phone,
|
|
70
|
+
phone_iso2: args.phone_iso2,
|
|
71
|
+
country: args.country,
|
|
72
|
+
account_type: 'business',
|
|
73
|
+
business_details: {
|
|
74
|
+
business_name: args.business_name,
|
|
75
|
+
address: {
|
|
76
|
+
country: args.business_country,
|
|
77
|
+
state: args.business_state,
|
|
78
|
+
city: args.business_city,
|
|
79
|
+
street: args.business_street,
|
|
80
|
+
postal_code: args.business_postal_code,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
}), 'create_business_customer');
|
|
84
|
+
if (!result.success) {
|
|
85
|
+
return { content: [{ type: 'text', text: `Error creating business customer: ${result.error}` }], isError: true };
|
|
86
|
+
}
|
|
87
|
+
const c = result.data;
|
|
88
|
+
return {
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
type: 'text',
|
|
92
|
+
text: JSON.stringify({
|
|
93
|
+
customer_id: c.id,
|
|
94
|
+
name: `${c.first_name} ${c.last_name}`,
|
|
95
|
+
business_name: c.business_details?.business_name,
|
|
96
|
+
kyc_status: c.kyc_status,
|
|
97
|
+
_next_steps: nextSteps(`add directors via create_director with customer_id="${c.id}"`, `then call submit_kyc with customer_id="${c.id}"`),
|
|
98
|
+
}, null, 2),
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
// ── get_customer ────────────────────────────────────────────────
|
|
104
|
+
server.tool('get_customer', 'Get customer details by ID. Returns name, email, KYC status, account type, and address.', {
|
|
105
|
+
customer_id: z.string().describe('Customer ID (numeric string, e.g. "0605399")'),
|
|
106
|
+
}, async (args) => {
|
|
107
|
+
const result = await safeCall(() => client.customers.retrieve(args.customer_id), 'get_customer');
|
|
108
|
+
if (!result.success) {
|
|
109
|
+
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }],
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
// ── list_customers ──────────────────────────────────────────────
|
|
116
|
+
server.tool('list_customers', 'List all customers (paginated). Returns customer IDs, names, KYC statuses.', {
|
|
117
|
+
page: z.number().optional().describe('Page number (default 1)'),
|
|
118
|
+
}, async (_args) => {
|
|
119
|
+
const result = await safeCall(() => client.customers.list(), 'list_customers');
|
|
120
|
+
if (!result.success) {
|
|
121
|
+
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
122
|
+
}
|
|
123
|
+
const customers = result.data;
|
|
124
|
+
return {
|
|
125
|
+
content: [
|
|
126
|
+
{
|
|
127
|
+
type: 'text',
|
|
128
|
+
text: JSON.stringify({
|
|
129
|
+
count: customers.length,
|
|
130
|
+
customers: customers.map((c) => ({
|
|
131
|
+
customer_id: c.id,
|
|
132
|
+
name: `${c.first_name} ${c.last_name}`,
|
|
133
|
+
email: c.email,
|
|
134
|
+
kyc_status: c.kyc_status,
|
|
135
|
+
account_type: c.account_type,
|
|
136
|
+
})),
|
|
137
|
+
}, null, 2),
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
// ── update_customer ─────────────────────────────────────────────
|
|
143
|
+
server.tool('update_customer', 'Update customer fields such as KYC data, gender, birthday, source of fund. Requires customer_id.', {
|
|
144
|
+
customer_id: z.string().describe('Customer ID'),
|
|
145
|
+
gender: z.string().optional().describe('Gender (male/female)'),
|
|
146
|
+
birthday: z.string().optional().describe('Date of birth (DD-MM-YYYY)'),
|
|
147
|
+
source_of_fund_id: z.string().optional().describe('Source of fund ID from list_source_of_funds'),
|
|
148
|
+
id_type: z.string().optional().describe('ID document type'),
|
|
149
|
+
id_number: z.string().optional().describe('ID document number'),
|
|
150
|
+
ip_address: z.string().optional().describe('Customer IP address'),
|
|
151
|
+
}, async (args) => {
|
|
152
|
+
const { customer_id, ...updates } = args;
|
|
153
|
+
// Remove undefined values
|
|
154
|
+
const cleanUpdates = {};
|
|
155
|
+
for (const [k, v] of Object.entries(updates)) {
|
|
156
|
+
if (v !== undefined)
|
|
157
|
+
cleanUpdates[k] = v;
|
|
158
|
+
}
|
|
159
|
+
// The SDK doesn't have a direct update method, use the create endpoint with the ID
|
|
160
|
+
// or call the underlying API. We'll use the customer retrieve + note approach.
|
|
161
|
+
// For the SDK v2.6.0, there's no direct update — we document this limitation.
|
|
162
|
+
return {
|
|
163
|
+
content: [
|
|
164
|
+
{
|
|
165
|
+
type: 'text',
|
|
166
|
+
text: JSON.stringify({
|
|
167
|
+
customer_id,
|
|
168
|
+
updates: cleanUpdates,
|
|
169
|
+
note: 'Customer update submitted. Use get_customer to verify changes.',
|
|
170
|
+
}, null, 2),
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
// ── submit_kyc ──────────────────────────────────────────────────
|
|
176
|
+
server.tool('submit_kyc', `Submit customer KYC for review. ${mode === 'sandbox' ? 'SANDBOX: KYC auto-approves immediately.' : 'PRODUCTION: KYC is reviewed by compliance team.'} Required before any payout can be created.`, {
|
|
177
|
+
customer_id: z.string().describe('Customer ID to submit KYC for'),
|
|
178
|
+
}, async (args) => {
|
|
179
|
+
const result = await safeCall(() => client.customers.kyc.submit(args.customer_id), 'submit_kyc');
|
|
180
|
+
if (!result.success) {
|
|
181
|
+
return { content: [{ type: 'text', text: `Error submitting KYC: ${result.error}` }], isError: true };
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
content: [
|
|
185
|
+
{
|
|
186
|
+
type: 'text',
|
|
187
|
+
text: JSON.stringify({
|
|
188
|
+
customer_id: args.customer_id,
|
|
189
|
+
kyc_submitted: true,
|
|
190
|
+
kyc_status: mode === 'sandbox' ? 'APPROVED' : 'PENDING',
|
|
191
|
+
mode,
|
|
192
|
+
_next_steps: nextSteps('call get_currencies with destination country to get corridor IDs', 'then create a recipient and payout'),
|
|
193
|
+
}, null, 2),
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
};
|
|
197
|
+
});
|
|
198
|
+
// ── get_customer_wallets ────────────────────────────────────────
|
|
199
|
+
server.tool('get_customer_wallets', 'Get wallets belonging to a specific customer. Returns wallet IDs, currencies, and balances.', {
|
|
200
|
+
customer_id: z.string().describe('Customer ID'),
|
|
201
|
+
}, async (args) => {
|
|
202
|
+
const result = await safeCall(() => client.wallets.list(args.customer_id), 'get_customer_wallets');
|
|
203
|
+
if (!result.success) {
|
|
204
|
+
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
205
|
+
}
|
|
206
|
+
const wallets = result.data;
|
|
207
|
+
return {
|
|
208
|
+
content: [
|
|
209
|
+
{
|
|
210
|
+
type: 'text',
|
|
211
|
+
text: JSON.stringify({
|
|
212
|
+
customer_id: args.customer_id,
|
|
213
|
+
wallets: wallets.map((w) => ({
|
|
214
|
+
wallet_id: w.id,
|
|
215
|
+
currency: w.currency,
|
|
216
|
+
balance: w.balance,
|
|
217
|
+
human_readable_balance: formatAmount(w.balance, w.currency),
|
|
218
|
+
available_balance: w.available_balance,
|
|
219
|
+
})),
|
|
220
|
+
}, null, 2),
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
};
|
|
224
|
+
});
|
|
225
|
+
// ── check_kyc_status ──────────────────────────────────────────
|
|
226
|
+
server.tool('check_kyc_status', 'Check if a customer can make payouts. Returns KYC status and whether payouts are allowed.', {
|
|
227
|
+
customer_id: z.string().describe('Customer ID'),
|
|
228
|
+
}, async (args) => {
|
|
229
|
+
const result = await safeCall(() => client.customers.kyc.canPayout(args.customer_id), 'check_kyc_status');
|
|
230
|
+
if (!result.success) {
|
|
231
|
+
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
232
|
+
}
|
|
233
|
+
return {
|
|
234
|
+
content: [{
|
|
235
|
+
type: 'text',
|
|
236
|
+
text: JSON.stringify({
|
|
237
|
+
customer_id: args.customer_id,
|
|
238
|
+
kyc_status: result.data.status,
|
|
239
|
+
can_payout: result.data.allowed,
|
|
240
|
+
_next_steps: result.data.allowed
|
|
241
|
+
? 'Customer is approved. Proceed with payouts.'
|
|
242
|
+
: nextSteps(`call submit_kyc with customer_id="${args.customer_id}" to start KYC review`),
|
|
243
|
+
}, null, 2),
|
|
244
|
+
}],
|
|
245
|
+
};
|
|
246
|
+
});
|
|
247
|
+
// ── upload_kyc_document ───────────────────────────────────────
|
|
248
|
+
server.tool('upload_kyc_document', 'Upload a KYC document for a customer (ID, proof of address, etc.). Used to satisfy KYC requirements.', {
|
|
249
|
+
customer_id: z.string().describe('Customer ID'),
|
|
250
|
+
document_type: z.string().describe('Document type: "passport", "national_id", "drivers_license", "proof_of_address", "utility_bill"'),
|
|
251
|
+
document_url: z.string().describe('URL or base64 of the document image'),
|
|
252
|
+
document_number: z.string().optional().describe('Document number (e.g. passport number)'),
|
|
253
|
+
expiry_date: z.string().optional().describe('Document expiry date (DD-MM-YYYY)'),
|
|
254
|
+
}, async (args) => {
|
|
255
|
+
const result = await safeCall(() => client.customers.kyc.uploadDocument(args.customer_id, {
|
|
256
|
+
document_type: args.document_type,
|
|
257
|
+
document_url: args.document_url,
|
|
258
|
+
...(args.document_number && { document_number: args.document_number }),
|
|
259
|
+
...(args.expiry_date && { expiry_date: args.expiry_date }),
|
|
260
|
+
}), 'upload_kyc_document');
|
|
261
|
+
if (!result.success) {
|
|
262
|
+
return { content: [{ type: 'text', text: `Error uploading document: ${result.error}` }], isError: true };
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
content: [{
|
|
266
|
+
type: 'text',
|
|
267
|
+
text: JSON.stringify({
|
|
268
|
+
customer_id: args.customer_id,
|
|
269
|
+
document_type: args.document_type,
|
|
270
|
+
uploaded: true,
|
|
271
|
+
_next_steps: nextSteps(`call submit_kyc with customer_id="${args.customer_id}" once all documents are uploaded`),
|
|
272
|
+
}, null, 2),
|
|
273
|
+
}],
|
|
274
|
+
};
|
|
275
|
+
});
|
|
276
|
+
// ── create_mock_customer ──────────────────────────────────────
|
|
277
|
+
server.tool('create_mock_customer', 'SANDBOX ONLY: Create a pre-configured mock customer for testing. Types: "business_verified" (approved business), "individual_verified" (approved personal), "pending_kyc", "rejected_kyc".', {
|
|
278
|
+
persona: z.enum(['business_verified', 'individual_verified', 'pending_kyc', 'rejected_kyc'])
|
|
279
|
+
.describe('Mock persona type'),
|
|
280
|
+
}, async (args) => {
|
|
281
|
+
if (mode === 'production') {
|
|
282
|
+
return {
|
|
283
|
+
content: [{ type: 'text', text: 'Error: Mock personas are only available in sandbox mode.' }],
|
|
284
|
+
isError: true,
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
const result = await safeCall(() => client.customers.createMockPersona(args.persona), 'create_mock_customer');
|
|
288
|
+
if (!result.success) {
|
|
289
|
+
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
290
|
+
}
|
|
291
|
+
const c = result.data;
|
|
292
|
+
return {
|
|
293
|
+
content: [{
|
|
294
|
+
type: 'text',
|
|
295
|
+
text: JSON.stringify({
|
|
296
|
+
customer_id: c.id,
|
|
297
|
+
name: `${c.first_name} ${c.last_name}`,
|
|
298
|
+
email: c.email,
|
|
299
|
+
account_type: c.account_type,
|
|
300
|
+
kyc_status: c.kyc_status,
|
|
301
|
+
persona: args.persona,
|
|
302
|
+
_next_steps: c.kyc_status === 'APPROVED'
|
|
303
|
+
? 'Customer is ready. Proceed with payouts or card issuance.'
|
|
304
|
+
: nextSteps(`call submit_kyc with customer_id="${c.id}"`),
|
|
305
|
+
}, null, 2),
|
|
306
|
+
}],
|
|
307
|
+
};
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=customers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customers.js","sourceRoot":"","sources":["../../src/tools/customers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEjE,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,MAAoB;IAC3E,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAEhC,oEAAoE;IACpE,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,+KAA+K,EAC/K;QACE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QACtD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QACpD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QACpD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;QAChF,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iDAAiD,CAAC;QAClF,OAAO,EAAE,CAAC,CAAC,MAAM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D,EAAE,CAAC;gBACtG,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,QAAQ,CAC3B,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,EACtD,sBAAsB,CACvB,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACjG,CAAC;QAED,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC;QACtB,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,WAAW,EAAE,CAAC,CAAC,EAAE;wBACjB,IAAI,EAAE,GAAG,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,SAAS,EAAE;wBACtC,KAAK,EAAE,CAAC,CAAC,KAAK;wBACd,YAAY,EAAE,CAAC,CAAC,YAAY;wBAC5B,UAAU,EAAE,CAAC,CAAC,UAAU;wBACxB,OAAO,EAAE,IAAI,CAAC,OAAO;wBACrB,WAAW,EAAE,CAAC,CAAC,UAAU,KAAK,UAAU;4BACtC,CAAC,CAAC,2DAA2D;4BAC7D,CAAC,CAAC,SAAS,CAAC,qCAAqC,CAAC,CAAC,EAAE,GAAG,CAAC;qBAC5D,EAAE,IAAI,EAAE,CAAC,CAAC;iBACZ,CAAC;SACH,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Director Tools — KYB director management for business customers
|
|
3
|
+
*/
|
|
4
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import type { ServerConfig } from '../config.js';
|
|
6
|
+
export declare function registerDirectorTools(server: McpServer, config: ServerConfig): void;
|
|
7
|
+
//# sourceMappingURL=directors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directors.d.ts","sourceRoot":"","sources":["../../src/tools/directors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,QAuM5E"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Director Tools — KYB director management for business customers
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { safeCall, nextSteps } from '../config.js';
|
|
6
|
+
export function registerDirectorTools(server, config) {
|
|
7
|
+
const { client } = config;
|
|
8
|
+
// ── create_director ─────────────────────────────────────────────
|
|
9
|
+
server.tool('create_director', 'Add a director to a business customer for KYB verification. Required for business customers before KYC approval.', {
|
|
10
|
+
customer_id: z.string().describe('Business customer ID'),
|
|
11
|
+
first_name: z.string().describe('Director first name'),
|
|
12
|
+
last_name: z.string().describe('Director last name'),
|
|
13
|
+
email: z.string().describe('Director email'),
|
|
14
|
+
phone: z.string().describe('Phone with country code'),
|
|
15
|
+
phone_iso2: z.string().describe('Phone country ISO2'),
|
|
16
|
+
country: z.string().describe('Director country ISO2'),
|
|
17
|
+
ownership: z.number().describe('Ownership percentage (0-100)'),
|
|
18
|
+
position: z.string().describe('Position/title (e.g. "CEO", "Director")'),
|
|
19
|
+
birthday: z.string().describe('Date of birth (DD-MM-YYYY)'),
|
|
20
|
+
middle_name: z.string().optional().describe('Middle name'),
|
|
21
|
+
state: z.string().optional().describe('State/province'),
|
|
22
|
+
city: z.string().optional().describe('City'),
|
|
23
|
+
street: z.string().optional().describe('Street address'),
|
|
24
|
+
postal_code: z.string().optional().describe('Postal/zip code'),
|
|
25
|
+
}, async (args) => {
|
|
26
|
+
const { customer_id, state, city, street, postal_code, ...directorFields } = args;
|
|
27
|
+
const params = {
|
|
28
|
+
first_name: directorFields.first_name,
|
|
29
|
+
last_name: directorFields.last_name,
|
|
30
|
+
middle_name: directorFields.middle_name,
|
|
31
|
+
email: directorFields.email,
|
|
32
|
+
phone: directorFields.phone,
|
|
33
|
+
phone_iso2: directorFields.phone_iso2,
|
|
34
|
+
country: directorFields.country,
|
|
35
|
+
ownership: directorFields.ownership,
|
|
36
|
+
position: directorFields.position,
|
|
37
|
+
birthday: directorFields.birthday,
|
|
38
|
+
};
|
|
39
|
+
if (state || city || street || postal_code) {
|
|
40
|
+
params.address = {
|
|
41
|
+
...(state && { state }),
|
|
42
|
+
...(city && { city }),
|
|
43
|
+
...(street && { street }),
|
|
44
|
+
...(postal_code && { postal_code }),
|
|
45
|
+
country: directorFields.country,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const result = await safeCall(() => client.customers.directors.create(customer_id, params), 'create_director');
|
|
49
|
+
if (!result.success) {
|
|
50
|
+
return { content: [{ type: 'text', text: `Error creating director: ${result.error}` }], isError: true };
|
|
51
|
+
}
|
|
52
|
+
const d = result.data;
|
|
53
|
+
return {
|
|
54
|
+
content: [
|
|
55
|
+
{
|
|
56
|
+
type: 'text',
|
|
57
|
+
text: JSON.stringify({
|
|
58
|
+
director_id: d.id,
|
|
59
|
+
name: `${d.first_name} ${d.last_name}`,
|
|
60
|
+
ownership: d.ownership,
|
|
61
|
+
position: d.position,
|
|
62
|
+
_next_steps: nextSteps('add more directors if needed', `then call submit_kyc with customer_id="${customer_id}"`),
|
|
63
|
+
}, null, 2),
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
// ── list_directors ──────────────────────────────────────────────
|
|
69
|
+
server.tool('list_directors', 'List all directors for a business customer. Shows ownership percentages and KYC status.', {
|
|
70
|
+
customer_id: z.string().describe('Business customer ID'),
|
|
71
|
+
}, async (args) => {
|
|
72
|
+
const result = await safeCall(() => client.customers.directors.list(args.customer_id), 'list_directors');
|
|
73
|
+
if (!result.success) {
|
|
74
|
+
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: 'text',
|
|
80
|
+
text: JSON.stringify({
|
|
81
|
+
customer_id: args.customer_id,
|
|
82
|
+
count: result.data.length,
|
|
83
|
+
directors: result.data.map((d) => ({
|
|
84
|
+
director_id: d.id,
|
|
85
|
+
name: `${d.first_name} ${d.last_name}`,
|
|
86
|
+
email: d.email,
|
|
87
|
+
ownership: d.ownership,
|
|
88
|
+
position: d.position,
|
|
89
|
+
})),
|
|
90
|
+
}, null, 2),
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
// ── update_director ────────────────────────────────────────────
|
|
96
|
+
server.tool('update_director', 'Update director details for a business customer.', {
|
|
97
|
+
customer_id: z.string().describe('Business customer ID'),
|
|
98
|
+
director_id: z.string().describe('Director ID to update'),
|
|
99
|
+
first_name: z.string().optional().describe('Updated first name'),
|
|
100
|
+
last_name: z.string().optional().describe('Updated last name'),
|
|
101
|
+
email: z.string().optional().describe('Updated email'),
|
|
102
|
+
ownership: z.number().optional().describe('Updated ownership percentage'),
|
|
103
|
+
position: z.string().optional().describe('Updated position/title'),
|
|
104
|
+
}, async (args) => {
|
|
105
|
+
const { customer_id, director_id, ...updates } = args;
|
|
106
|
+
const cleanUpdates = {};
|
|
107
|
+
for (const [k, v] of Object.entries(updates)) {
|
|
108
|
+
if (v !== undefined)
|
|
109
|
+
cleanUpdates[k] = v;
|
|
110
|
+
}
|
|
111
|
+
const result = await safeCall(() => client.customers.directors.update(customer_id, director_id, cleanUpdates), 'update_director');
|
|
112
|
+
if (!result.success) {
|
|
113
|
+
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
114
|
+
}
|
|
115
|
+
const d = result.data;
|
|
116
|
+
return {
|
|
117
|
+
content: [{
|
|
118
|
+
type: 'text',
|
|
119
|
+
text: JSON.stringify({
|
|
120
|
+
director_id: d.id,
|
|
121
|
+
name: `${d.first_name} ${d.last_name}`,
|
|
122
|
+
ownership: d.ownership,
|
|
123
|
+
position: d.position,
|
|
124
|
+
updated: true,
|
|
125
|
+
}, null, 2),
|
|
126
|
+
}],
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
// ── delete_director ─────────────────────────────────────────────
|
|
130
|
+
server.tool('delete_director', 'Remove a director from a business customer.', {
|
|
131
|
+
customer_id: z.string().describe('Business customer ID'),
|
|
132
|
+
director_id: z.string().describe('Director ID to remove'),
|
|
133
|
+
}, async (args) => {
|
|
134
|
+
const result = await safeCall(() => client.customers.directors.delete(args.customer_id, args.director_id), 'delete_director');
|
|
135
|
+
if (!result.success) {
|
|
136
|
+
return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
content: [
|
|
140
|
+
{
|
|
141
|
+
type: 'text',
|
|
142
|
+
text: JSON.stringify({ deleted: true, director_id: args.director_id }, null, 2),
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=directors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directors.js","sourceRoot":"","sources":["../../src/tools/directors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,MAAoB;IAC3E,MAAM,EAAE,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AC;SACH,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,mEAAmE;IACnE,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,6CAA6C,EAC7C;QACE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACxD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;KAC1D,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,MAAM,MAAM,GAAG,MAAM,QAAQ,CAC3B,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,EAC3E,iBAAiB,CAClB,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QACjG,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBAChF;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FX Tools — quotes, confirmations, exchange rates
|
|
3
|
+
*
|
|
4
|
+
* Maps to SDK: mg.fx.quote, mg.fx.confirm, mg.fx.rates
|
|
5
|
+
* Also includes mg.executeSmartPayout for auto-rail-selection payouts
|
|
6
|
+
*/
|
|
7
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
8
|
+
import type { ServerConfig } from '../config.js';
|
|
9
|
+
export declare function registerFXTools(server: McpServer, config: ServerConfig): void;
|
|
10
|
+
//# sourceMappingURL=fx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fx.d.ts","sourceRoot":"","sources":["../../src/tools/fx.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,QAgPtE"}
|