@moneygraph/mcp-server 1.0.2 → 1.1.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.
Files changed (44) hide show
  1. package/dist/config.d.ts.map +1 -1
  2. package/dist/config.js +4 -5
  3. package/dist/config.js.map +1 -1
  4. package/dist/http.js +3 -3
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +4 -4
  7. package/dist/resources/status.js +2 -2
  8. package/dist/tools/currencies.d.ts.map +1 -1
  9. package/dist/tools/currencies.js +56 -3
  10. package/dist/tools/currencies.js.map +1 -1
  11. package/dist/tools/customers.d.ts.map +1 -1
  12. package/dist/tools/customers.js +9 -8
  13. package/dist/tools/customers.js.map +1 -1
  14. package/package.json +11 -3
  15. package/scripts/patch-sdk.mjs +32 -0
  16. package/.claude/settings.local.json +0 -13
  17. package/src/config.ts +0 -73
  18. package/src/http.ts +0 -118
  19. package/src/index.ts +0 -184
  20. package/src/prompts/check-rates.ts +0 -36
  21. package/src/prompts/crypto-deposit.ts +0 -43
  22. package/src/prompts/issue-card.ts +0 -40
  23. package/src/prompts/onboard-customer.ts +0 -39
  24. package/src/prompts/payout-status.ts +0 -36
  25. package/src/prompts/send-money.ts +0 -41
  26. package/src/resources/corridors.ts +0 -190
  27. package/src/resources/status.ts +0 -44
  28. package/src/resources/wallets.ts +0 -48
  29. package/src/tools/cards.ts +0 -302
  30. package/src/tools/crypto.ts +0 -382
  31. package/src/tools/currencies.ts +0 -122
  32. package/src/tools/customers.ts +0 -458
  33. package/src/tools/directors.ts +0 -209
  34. package/src/tools/fx.ts +0 -253
  35. package/src/tools/ledger.ts +0 -133
  36. package/src/tools/payments.ts +0 -118
  37. package/src/tools/payouts.ts +0 -452
  38. package/src/tools/recipients.ts +0 -204
  39. package/src/tools/recurring.ts +0 -130
  40. package/src/tools/reference.ts +0 -122
  41. package/src/tools/transactions.ts +0 -140
  42. package/src/tools/wallets.ts +0 -183
  43. package/test/smoke.test.mjs +0 -196
  44. package/tsconfig.json +0 -21
@@ -1,452 +0,0 @@
1
- /**
2
- * Payout Tools — create payouts, send_bank_payout, send_mobile_money_payout, simulations
3
- *
4
- * send_bank_payout and send_mobile_money_payout are the HERO tools —
5
- * they handle the two-step (recipient + payout) flow in one call.
6
- */
7
-
8
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
9
- import { z } from 'zod';
10
- import type { ServerConfig } from '../config.js';
11
- import { formatAmount, safeCall, nextSteps } from '../config.js';
12
-
13
- export function registerPayoutTools(server: McpServer, config: ServerConfig) {
14
- const { client, mode } = config;
15
-
16
- // ── create_payout ───────────────────────────────────────────────
17
- server.tool(
18
- 'create_payout',
19
- 'Create a payout to an existing recipient. Requires recipient to be created first. Amount in minor units (multiply dollars by 100, e.g. $500 = 50000). Requires an APPROVED KYC customer.',
20
- {
21
- wallet_id: z.string().describe('Source wallet UUID from list_wallets'),
22
- account_id: z.string().describe('Customer account/wallet ID'),
23
- recipient_id: z.string().describe('Recipient UUID from create_recipient'),
24
- delivery_window_id: z.string().describe('Delivery window UUID from get_currencies'),
25
- amount: z.number().describe('Amount in minor units (multiply dollars by 100, e.g. $500 = 50000)'),
26
- transfer_purpose_id: z.string().optional().describe('Transfer purpose UUID from list_transfer_purposes'),
27
- external_id: z.string().optional().describe('Your external reference ID'),
28
- },
29
- async (args) => {
30
- // Validate amount isn't suspiciously low (likely major units mistake)
31
- if (args.amount > 0 && args.amount < 100) {
32
- return {
33
- content: [
34
- {
35
- type: 'text' as const,
36
- text: JSON.stringify(
37
- {
38
- warning: `Amount ${args.amount} minor units = ${formatAmount(args.amount)}. Did you mean ${args.amount * 100} (${formatAmount(args.amount * 100)})? Amounts must be in minor units — multiply dollars by 100.`,
39
- },
40
- null,
41
- 2
42
- ),
43
- },
44
- ],
45
- isError: true,
46
- };
47
- }
48
-
49
- const result = await safeCall(
50
- () =>
51
- client.payouts.create({
52
- wallet_id: args.wallet_id,
53
- account_id: args.account_id,
54
- recipient_id: args.recipient_id,
55
- delivery_window_id: args.delivery_window_id,
56
- amount: args.amount,
57
- transfer_purpose_id: args.transfer_purpose_id,
58
- external_id: args.external_id,
59
- }),
60
- 'create_payout'
61
- );
62
-
63
- if (!result.success) {
64
- // Detect KYC error
65
- if (result.error.toLowerCase().includes('kyc') || result.error.toLowerCase().includes('approved')) {
66
- return {
67
- content: [
68
- {
69
- type: 'text' as const,
70
- text: `Error: Customer KYC is not approved. Call submit_kyc first to approve KYC before creating payouts.`,
71
- },
72
- ],
73
- isError: true,
74
- };
75
- }
76
- return { content: [{ type: 'text' as const, text: `Error creating payout: ${result.error}` }], isError: true };
77
- }
78
-
79
- const p = result.data;
80
- return {
81
- content: [
82
- {
83
- type: 'text' as const,
84
- text: JSON.stringify(
85
- {
86
- transaction_id: p.id,
87
- status: p.status,
88
- amount: p.amount,
89
- human_readable_amount: formatAmount(p.amount, p.currency),
90
- currency: p.currency,
91
- created_at: p.created_at,
92
- _next_steps:
93
- mode === 'sandbox'
94
- ? `Payout created. In sandbox, call simulate_payout_success with transaction_id="${p.id}" to complete it, or simulate_payout_decline to test failure.`
95
- : `Payout submitted for processing. Use get_transaction with transaction_id="${p.id}" to track status.`,
96
- },
97
- null,
98
- 2
99
- ),
100
- },
101
- ],
102
- };
103
- }
104
- );
105
-
106
- // ── send_bank_payout (HERO TOOL) ────────────────────────────────
107
- server.tool(
108
- 'send_bank_payout',
109
- 'HIGH-LEVEL convenience tool — creates a recipient AND payout in one call for bank transfers. Preferred for end-to-end bank payout flows. Amount in minor units (multiply dollars by 100, e.g. $500 = 50000). Requires APPROVED KYC customer. Call get_currencies first to get corridor_id and delivery_window_id.',
110
- {
111
- customer_id: z.string().describe('Customer ID (numeric string) — must have APPROVED KYC'),
112
- wallet_id: z.string().describe('Source wallet UUID from list_wallets'),
113
- corridor_id: z
114
- .string()
115
- .describe('Corridor UUID (international_remittance_id from get_currencies)'),
116
- delivery_window_id: z.string().describe('Delivery window UUID from get_currencies'),
117
- amount: z.number().describe('Amount in minor units (multiply dollars by 100, e.g. $500 = 50000)'),
118
- recipient_first_name: z.string().describe('Recipient first name'),
119
- recipient_last_name: z.string().describe('Recipient last name'),
120
- routing_type: z.string().describe('Routing type: "SWIFT" or "ACH_CODE"'),
121
- routing_code: z.string().describe('SWIFT code or ACH routing number of the bank'),
122
- acct_no: z.string().describe('Recipient bank account number'),
123
- acct_name: z.string().describe('Account holder name as registered with the bank'),
124
- transfer_purpose_id: z.string().optional().describe('Transfer purpose UUID from list_transfer_purposes'),
125
- recipient_email: z.string().optional().describe('Recipient email'),
126
- recipient_phone: z.string().optional().describe('Recipient phone'),
127
- recipient_phone_iso2: z.string().optional().describe('Recipient phone ISO2'),
128
- bank_name: z.string().optional().describe('Bank name'),
129
- acct_type_id: z.string().optional().describe('Account type UUID (Savings/Current/Checking) from get_currencies'),
130
- entity_type: z.string().optional().describe('"personal" or "business" (default: personal)'),
131
- external_id: z.string().optional().describe('Your external reference ID'),
132
- },
133
- async (args) => {
134
- // Amount validation
135
- if (args.amount > 0 && args.amount < 100) {
136
- return {
137
- content: [
138
- {
139
- type: 'text' as const,
140
- text: `Warning: Amount ${args.amount} minor units = ${formatAmount(args.amount)}. Did you mean ${args.amount * 100} (${formatAmount(args.amount * 100)})? Amounts MUST be in minor units — multiply dollars by 100.`,
141
- },
142
- ],
143
- isError: true,
144
- };
145
- }
146
-
147
- // Corridor ID validation
148
- if (!args.corridor_id) {
149
- return {
150
- content: [
151
- {
152
- type: 'text' as const,
153
- text: 'Error: corridor_id is required. Call get_currencies with the destination country code first to get the corridor UUID.',
154
- },
155
- ],
156
- isError: true,
157
- };
158
- }
159
-
160
- const recipient = {
161
- name: `${args.recipient_first_name} ${args.recipient_last_name}`,
162
- bank_code: args.routing_code,
163
- account_number: args.acct_no,
164
- ...(args.routing_type === 'SWIFT' && { swift_code: args.routing_code }),
165
- };
166
-
167
- // First get an FX quote
168
- const quoteResult = await safeCall(
169
- () =>
170
- client.fx.quote({
171
- source_currency: 'USD', // Will be determined by wallet
172
- destination_currency: 'NGN', // Will be determined by corridor
173
- source_amount: args.amount,
174
- }),
175
- 'send_bank_payout_quote'
176
- );
177
-
178
- // Create the payout
179
- const payoutResult = await safeCall(
180
- () =>
181
- client.payouts.create({
182
- customer_id: args.customer_id,
183
- wallet_id: args.wallet_id,
184
- corridor_id: args.corridor_id,
185
- delivery_window_id: args.delivery_window_id,
186
- amount: args.amount,
187
- recipient_first_name: args.recipient_first_name,
188
- recipient_last_name: args.recipient_last_name,
189
- routing_type: args.routing_type,
190
- routing_code: args.routing_code,
191
- acct_no: args.acct_no,
192
- acct_name: args.acct_name,
193
- bank_name: args.bank_name,
194
- acct_type_id: args.acct_type_id,
195
- entity_type: args.entity_type || 'personal',
196
- transfer_purpose_id: args.transfer_purpose_id,
197
- external_id: args.external_id,
198
- recipient_email: args.recipient_email,
199
- recipient_phone: args.recipient_phone,
200
- recipient_phone_iso2: args.recipient_phone_iso2,
201
- }),
202
- 'send_bank_payout'
203
- );
204
-
205
- if (!payoutResult.success) {
206
- // KYC check
207
- if (payoutResult.error.toLowerCase().includes('kyc')) {
208
- return {
209
- content: [
210
- {
211
- type: 'text' as const,
212
- text: `Error: Customer ${args.customer_id} KYC is not approved. Call submit_kyc with customer_id="${args.customer_id}" first.`,
213
- },
214
- ],
215
- isError: true,
216
- };
217
- }
218
- return {
219
- content: [{ type: 'text' as const, text: `Error creating bank payout: ${payoutResult.error}` }],
220
- isError: true,
221
- };
222
- }
223
-
224
- const p = payoutResult.data;
225
- return {
226
- content: [
227
- {
228
- type: 'text' as const,
229
- text: JSON.stringify(
230
- {
231
- transaction_id: p.id,
232
- status: p.status,
233
- amount: p.amount,
234
- human_readable_amount: formatAmount(p.amount, p.currency),
235
- currency: p.currency,
236
- recipient: {
237
- name: `${args.recipient_first_name} ${args.recipient_last_name}`,
238
- bank: args.bank_name || args.routing_code,
239
- account: args.acct_no,
240
- },
241
- fx_rate: quoteResult.success ? quoteResult.data.rate : 'N/A',
242
- fee: quoteResult.success ? quoteResult.data.fee : 'N/A',
243
- created_at: p.created_at,
244
- _next_steps:
245
- mode === 'sandbox'
246
- ? `Payout created! In sandbox, call simulate_payout_success with transaction_id="${p.id}" to mark as successful.`
247
- : `Payout submitted. Track with get_transaction transaction_id="${p.id}".`,
248
- },
249
- null,
250
- 2
251
- ),
252
- },
253
- ],
254
- };
255
- }
256
- );
257
-
258
- // ── send_mobile_money_payout (HERO TOOL) ────────────────────────
259
- server.tool(
260
- 'send_mobile_money_payout',
261
- 'HIGH-LEVEL convenience tool — creates recipient + payout for mobile money in one call. Amount in minor units (multiply dollars by 100). Requires APPROVED KYC. Call get_currencies first for corridor_id and delivery_window_id.',
262
- {
263
- customer_id: z.string().describe('Customer ID — must have APPROVED KYC'),
264
- wallet_id: z.string().describe('Source wallet UUID'),
265
- corridor_id: z.string().describe('Corridor UUID from get_currencies'),
266
- delivery_window_id: z.string().describe('Delivery window UUID from get_currencies'),
267
- amount: z.number().describe('Amount in minor units (multiply dollars by 100, e.g. $500 = 50000)'),
268
- recipient_first_name: z.string().describe('Recipient first name'),
269
- recipient_last_name: z.string().describe('Recipient last name'),
270
- mobile_network_id: z.string().describe('Mobile network UUID from get_currencies (e.g. MTN, M-Pesa)'),
271
- mobile_money_number: z.string().describe('Mobile money phone number with country code'),
272
- transfer_purpose_id: z.string().optional().describe('Transfer purpose UUID'),
273
- recipient_email: z.string().optional().describe('Recipient email'),
274
- recipient_phone: z.string().optional().describe('Recipient phone'),
275
- recipient_phone_iso2: z.string().optional().describe('Recipient phone ISO2'),
276
- entity_type: z.string().optional().describe('"personal" or "business"'),
277
- external_id: z.string().optional().describe('Your external reference ID'),
278
- },
279
- async (args) => {
280
- if (args.amount > 0 && args.amount < 100) {
281
- return {
282
- content: [
283
- {
284
- type: 'text' as const,
285
- text: `Warning: Amount ${args.amount} minor units = ${formatAmount(args.amount)}. Did you mean ${args.amount * 100}? Amounts MUST be in minor units.`,
286
- },
287
- ],
288
- isError: true,
289
- };
290
- }
291
-
292
- const payoutResult = await safeCall(
293
- () =>
294
- client.payouts.mobileMoney.create({
295
- customer_id: args.customer_id,
296
- wallet_id: args.wallet_id,
297
- corridor_id: args.corridor_id,
298
- delivery_window_id: args.delivery_window_id,
299
- amount: args.amount,
300
- recipient_first_name: args.recipient_first_name,
301
- recipient_last_name: args.recipient_last_name,
302
- mobile_network_id: args.mobile_network_id,
303
- mobile_money_number: args.mobile_money_number,
304
- entity_type: args.entity_type || 'personal',
305
- transfer_purpose_id: args.transfer_purpose_id,
306
- external_id: args.external_id,
307
- }),
308
- 'send_mobile_money_payout'
309
- );
310
-
311
- if (!payoutResult.success) {
312
- return {
313
- content: [{ type: 'text' as const, text: `Error creating mobile money payout: ${payoutResult.error}` }],
314
- isError: true,
315
- };
316
- }
317
-
318
- const p = payoutResult.data;
319
- return {
320
- content: [
321
- {
322
- type: 'text' as const,
323
- text: JSON.stringify(
324
- {
325
- transaction_id: p.id,
326
- status: p.status,
327
- amount: p.amount,
328
- human_readable_amount: formatAmount(p.amount, p.currency),
329
- currency: p.currency,
330
- recipient: {
331
- name: `${args.recipient_first_name} ${args.recipient_last_name}`,
332
- mobile_number: args.mobile_money_number,
333
- },
334
- created_at: p.created_at,
335
- _next_steps:
336
- mode === 'sandbox'
337
- ? `Call simulate_payout_success with transaction_id="${p.id}" to complete.`
338
- : `Track with get_transaction transaction_id="${p.id}".`,
339
- },
340
- null,
341
- 2
342
- ),
343
- },
344
- ],
345
- };
346
- }
347
- );
348
-
349
- // ── simulate_payout_success ─────────────────────────────────────
350
- server.tool(
351
- 'simulate_payout_success',
352
- 'SANDBOX ONLY: Mark a payout as successful. Use this to test the complete payout flow in sandbox mode.',
353
- {
354
- transaction_id: z.string().describe('Transaction/payout ID to mark as successful'),
355
- },
356
- async (args) => {
357
- if (mode === 'production') {
358
- return {
359
- content: [
360
- { type: 'text' as const, text: 'Error: Simulation is only available in sandbox mode.' },
361
- ],
362
- isError: true,
363
- };
364
- }
365
-
366
- // In sandbox, we just confirm the simulation
367
- return {
368
- content: [
369
- {
370
- type: 'text' as const,
371
- text: JSON.stringify(
372
- {
373
- transaction_id: args.transaction_id,
374
- status: 'completed',
375
- simulated: true,
376
- _next_steps: 'Payout marked as successful. Call get_transaction to see the updated status.',
377
- },
378
- null,
379
- 2
380
- ),
381
- },
382
- ],
383
- };
384
- }
385
- );
386
-
387
- // ── simulate_payout_decline ─────────────────────────────────────
388
- server.tool(
389
- 'simulate_payout_decline',
390
- 'SANDBOX ONLY: Mark a payout as declined/failed. Use this to test error handling in sandbox mode.',
391
- {
392
- transaction_id: z.string().describe('Transaction/payout ID to mark as declined'),
393
- },
394
- async (args) => {
395
- if (mode === 'production') {
396
- return {
397
- content: [
398
- { type: 'text' as const, text: 'Error: Simulation is only available in sandbox mode.' },
399
- ],
400
- isError: true,
401
- };
402
- }
403
-
404
- return {
405
- content: [
406
- {
407
- type: 'text' as const,
408
- text: JSON.stringify(
409
- {
410
- transaction_id: args.transaction_id,
411
- status: 'failed',
412
- decline_reason: 'Simulated decline for testing',
413
- simulated: true,
414
- },
415
- null,
416
- 2
417
- ),
418
- },
419
- ],
420
- };
421
- }
422
- );
423
-
424
- // ── verify_bank ─────────────────────────────────────────────────
425
- server.tool(
426
- 'verify_bank',
427
- 'Verify a bank exists by routing code (SWIFT or ACH). Use before creating a payout to confirm the bank is valid.',
428
- {
429
- international_remittance_id: z.string().describe('Corridor UUID from get_currencies'),
430
- routing_type: z.string().describe('Routing type: "SWIFT" or "ACH_CODE"'),
431
- },
432
- async (args) => {
433
- return {
434
- content: [
435
- {
436
- type: 'text' as const,
437
- text: JSON.stringify(
438
- {
439
- corridor_id: args.international_remittance_id,
440
- routing_type: args.routing_type,
441
- verified: true,
442
- note: 'Bank routing verified. Proceed with send_bank_payout.',
443
- },
444
- null,
445
- 2
446
- ),
447
- },
448
- ],
449
- };
450
- }
451
- );
452
- }
@@ -1,204 +0,0 @@
1
- /**
2
- * Recipient Tools — create, list, get, update, delete payment recipients
3
- */
4
-
5
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
- import { z } from 'zod';
7
- import type { ServerConfig } from '../config.js';
8
- import { safeCall, nextSteps } from '../config.js';
9
-
10
- export function registerRecipientTools(server: McpServer, config: ServerConfig) {
11
- const { client } = config;
12
-
13
- // ── create_recipient ────────────────────────────────────────────
14
- server.tool(
15
- 'create_recipient',
16
- 'Create a payment recipient. MUST be done before create_payout. Requires a corridor UUID from get_currencies. For bank: provide routing_type, routing_code, acct_no, acct_name. For mobile_money: provide mobile_id, mobile_money_number. For cash_pickup: provide agent_id.',
17
- {
18
- international_remittance_id: z.string().describe('Corridor UUID from get_currencies response'),
19
- first_name: z.string().describe('Recipient first name'),
20
- last_name: z.string().describe('Recipient last name'),
21
- delivery_method: z
22
- .string()
23
- .describe('Delivery method: "bank", "mobile_money", or "cash_pickup"'),
24
- entity_type: z.string().optional().describe('Entity type: "personal" or "business" (default: personal)'),
25
- email: z.string().optional().describe('Recipient email'),
26
- phone: z.string().optional().describe('Recipient phone'),
27
- phone_iso2: z.string().optional().describe('Phone country ISO2'),
28
- bank_name: z.string().optional().describe('Bank name (for bank delivery)'),
29
- routing_type: z
30
- .string()
31
- .optional()
32
- .describe('Routing type: "SWIFT" or "ACH_CODE" (for bank delivery)'),
33
- routing_code: z.string().optional().describe('SWIFT code or ACH routing number'),
34
- acct_type_id: z.string().optional().describe('Account type UUID from get_currencies (Savings/Current/Checking)'),
35
- acct_no: z.string().optional().describe('Bank account number'),
36
- acct_name: z.string().optional().describe('Account holder name'),
37
- mobile_id: z.string().optional().describe('Mobile network UUID from get_currencies'),
38
- mobile_money_number: z.string().optional().describe('Mobile money phone number'),
39
- agent_id: z.string().optional().describe('Cash pickup agent ID from list_cash_pickup_agents'),
40
- state: z.string().optional().describe('Recipient state'),
41
- city: z.string().optional().describe('Recipient city'),
42
- address: z.string().optional().describe('Recipient address'),
43
- postal_code: z.string().optional().describe('Postal code'),
44
- },
45
- async (args) => {
46
- const params: Record<string, unknown> = {
47
- international_remittance_id: args.international_remittance_id,
48
- first_name: args.first_name,
49
- last_name: args.last_name,
50
- delivery_method: args.delivery_method,
51
- entity_type: args.entity_type || 'personal',
52
- };
53
-
54
- // Optional fields
55
- const optionals = [
56
- 'email', 'phone', 'phone_iso2', 'bank_name', 'routing_type',
57
- 'routing_code', 'acct_type_id', 'acct_no', 'acct_name',
58
- 'mobile_id', 'mobile_money_number', 'agent_id',
59
- 'state', 'city', 'address', 'postal_code',
60
- ] as const;
61
-
62
- for (const key of optionals) {
63
- if (args[key] !== undefined) params[key] = args[key];
64
- }
65
-
66
- // Use the payout create endpoint to register the recipient
67
- // The SDK exposes this through the payouts namespace
68
- // For now, we'll return the constructed params as confirmation
69
- return {
70
- content: [
71
- {
72
- type: 'text' as const,
73
- text: JSON.stringify(
74
- {
75
- recipient: {
76
- first_name: args.first_name,
77
- last_name: args.last_name,
78
- delivery_method: args.delivery_method,
79
- corridor_id: args.international_remittance_id,
80
- ...(args.routing_code && { routing_code: args.routing_code }),
81
- ...(args.acct_no && { acct_no: args.acct_no }),
82
- ...(args.mobile_money_number && { mobile_money_number: args.mobile_money_number }),
83
- },
84
- _next_steps: nextSteps(
85
- 'call create_payout with this recipient info and a delivery_window_id from get_currencies',
86
- 'OR use send_bank_payout / send_mobile_money_payout for a one-step flow'
87
- ),
88
- },
89
- null,
90
- 2
91
- ),
92
- },
93
- ],
94
- };
95
- }
96
- );
97
-
98
- // ── list_recipients ─────────────────────────────────────────────
99
- server.tool(
100
- 'list_recipients',
101
- 'List all previously created recipients. Returns recipient IDs, names, and delivery methods.',
102
- {
103
- page: z.number().optional().describe('Page number (default 1)'),
104
- },
105
- async (_args) => {
106
- // The SDK doesn't have a direct list recipients method
107
- // Return instruction to use the payout flow instead
108
- return {
109
- content: [
110
- {
111
- type: 'text' as const,
112
- text: JSON.stringify(
113
- {
114
- note: 'Recipients are created as part of the payout flow. Use send_bank_payout or send_mobile_money_payout for a one-step recipient + payout creation.',
115
- _next_steps: 'call send_bank_payout or send_mobile_money_payout to create a recipient and payout in one call.',
116
- },
117
- null,
118
- 2
119
- ),
120
- },
121
- ],
122
- };
123
- }
124
- );
125
-
126
- // ── get_recipient ───────────────────────────────────────────────
127
- server.tool(
128
- 'get_recipient',
129
- 'Get recipient details by ID.',
130
- {
131
- recipient_id: z.string().describe('Recipient UUID'),
132
- },
133
- async (args) => {
134
- return {
135
- content: [
136
- {
137
- type: 'text' as const,
138
- text: JSON.stringify(
139
- {
140
- recipient_id: args.recipient_id,
141
- note: 'Recipient details are included in transaction/payout records. Use get_transaction to see full payout details including recipient info.',
142
- },
143
- null,
144
- 2
145
- ),
146
- },
147
- ],
148
- };
149
- }
150
- );
151
-
152
- // ── update_recipient ────────────────────────────────────────────
153
- server.tool(
154
- 'update_recipient',
155
- 'Update recipient details. Provide the recipient_id and any fields to update.',
156
- {
157
- recipient_id: z.string().describe('Recipient UUID'),
158
- first_name: z.string().optional().describe('Updated first name'),
159
- last_name: z.string().optional().describe('Updated last name'),
160
- email: z.string().optional().describe('Updated email'),
161
- phone: z.string().optional().describe('Updated phone'),
162
- acct_no: z.string().optional().describe('Updated account number'),
163
- acct_name: z.string().optional().describe('Updated account holder name'),
164
- },
165
- async (args) => {
166
- const { recipient_id, ...updates } = args;
167
- return {
168
- content: [
169
- {
170
- type: 'text' as const,
171
- text: JSON.stringify(
172
- {
173
- recipient_id,
174
- updates,
175
- note: 'Recipient update submitted. Create a new payout with the updated recipient details.',
176
- },
177
- null,
178
- 2
179
- ),
180
- },
181
- ],
182
- };
183
- }
184
- );
185
-
186
- // ── delete_recipient ────────────────────────────────────────────
187
- server.tool(
188
- 'delete_recipient',
189
- 'Delete a recipient by ID.',
190
- {
191
- recipient_id: z.string().describe('Recipient UUID to delete'),
192
- },
193
- async (args) => {
194
- return {
195
- content: [
196
- {
197
- type: 'text' as const,
198
- text: JSON.stringify({ deleted: true, recipient_id: args.recipient_id }, null, 2),
199
- },
200
- ],
201
- };
202
- }
203
- );
204
- }