@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.
Files changed (138) hide show
  1. package/.claude/settings.local.json +13 -0
  2. package/README.md +224 -0
  3. package/bin/mcp-http.js +10 -0
  4. package/bin/mcp-server.js +8 -0
  5. package/dist/config.d.ts +28 -0
  6. package/dist/config.d.ts.map +1 -0
  7. package/dist/config.js +53 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/http.d.ts +15 -0
  10. package/dist/http.d.ts.map +1 -0
  11. package/dist/http.js +104 -0
  12. package/dist/http.js.map +1 -0
  13. package/dist/index.d.ts +18 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +164 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/prompts/check-rates.d.ts +6 -0
  18. package/dist/prompts/check-rates.d.ts.map +1 -0
  19. package/dist/prompts/check-rates.js +29 -0
  20. package/dist/prompts/check-rates.js.map +1 -0
  21. package/dist/prompts/crypto-deposit.d.ts +6 -0
  22. package/dist/prompts/crypto-deposit.d.ts.map +1 -0
  23. package/dist/prompts/crypto-deposit.js +36 -0
  24. package/dist/prompts/crypto-deposit.js.map +1 -0
  25. package/dist/prompts/issue-card.d.ts +6 -0
  26. package/dist/prompts/issue-card.d.ts.map +1 -0
  27. package/dist/prompts/issue-card.js +33 -0
  28. package/dist/prompts/issue-card.js.map +1 -0
  29. package/dist/prompts/onboard-customer.d.ts +6 -0
  30. package/dist/prompts/onboard-customer.d.ts.map +1 -0
  31. package/dist/prompts/onboard-customer.js +31 -0
  32. package/dist/prompts/onboard-customer.js.map +1 -0
  33. package/dist/prompts/payout-status.d.ts +6 -0
  34. package/dist/prompts/payout-status.d.ts.map +1 -0
  35. package/dist/prompts/payout-status.js +29 -0
  36. package/dist/prompts/payout-status.js.map +1 -0
  37. package/dist/prompts/send-money.d.ts +6 -0
  38. package/dist/prompts/send-money.d.ts.map +1 -0
  39. package/dist/prompts/send-money.js +34 -0
  40. package/dist/prompts/send-money.js.map +1 -0
  41. package/dist/resources/corridors.d.ts +8 -0
  42. package/dist/resources/corridors.d.ts.map +1 -0
  43. package/dist/resources/corridors.js +137 -0
  44. package/dist/resources/corridors.js.map +1 -0
  45. package/dist/resources/status.d.ts +7 -0
  46. package/dist/resources/status.d.ts.map +1 -0
  47. package/dist/resources/status.js +32 -0
  48. package/dist/resources/status.js.map +1 -0
  49. package/dist/resources/wallets.d.ts +7 -0
  50. package/dist/resources/wallets.d.ts.map +1 -0
  51. package/dist/resources/wallets.js +37 -0
  52. package/dist/resources/wallets.js.map +1 -0
  53. package/dist/tools/cards.d.ts +10 -0
  54. package/dist/tools/cards.d.ts.map +1 -0
  55. package/dist/tools/cards.js +229 -0
  56. package/dist/tools/cards.js.map +1 -0
  57. package/dist/tools/crypto.d.ts +10 -0
  58. package/dist/tools/crypto.d.ts.map +1 -0
  59. package/dist/tools/crypto.js +265 -0
  60. package/dist/tools/crypto.js.map +1 -0
  61. package/dist/tools/currencies.d.ts +10 -0
  62. package/dist/tools/currencies.d.ts.map +1 -0
  63. package/dist/tools/currencies.js +84 -0
  64. package/dist/tools/currencies.js.map +1 -0
  65. package/dist/tools/customers.d.ts +7 -0
  66. package/dist/tools/customers.d.ts.map +1 -0
  67. package/dist/tools/customers.js +310 -0
  68. package/dist/tools/customers.js.map +1 -0
  69. package/dist/tools/directors.d.ts +7 -0
  70. package/dist/tools/directors.d.ts.map +1 -0
  71. package/dist/tools/directors.js +148 -0
  72. package/dist/tools/directors.js.map +1 -0
  73. package/dist/tools/fx.d.ts +10 -0
  74. package/dist/tools/fx.d.ts.map +1 -0
  75. package/dist/tools/fx.js +193 -0
  76. package/dist/tools/fx.js.map +1 -0
  77. package/dist/tools/ledger.d.ts +7 -0
  78. package/dist/tools/ledger.d.ts.map +1 -0
  79. package/dist/tools/ledger.js +101 -0
  80. package/dist/tools/ledger.js.map +1 -0
  81. package/dist/tools/payments.d.ts +7 -0
  82. package/dist/tools/payments.d.ts.map +1 -0
  83. package/dist/tools/payments.js +93 -0
  84. package/dist/tools/payments.js.map +1 -0
  85. package/dist/tools/payouts.d.ts +10 -0
  86. package/dist/tools/payouts.d.ts.map +1 -0
  87. package/dist/tools/payouts.js +352 -0
  88. package/dist/tools/payouts.js.map +1 -0
  89. package/dist/tools/recipients.d.ts +7 -0
  90. package/dist/tools/recipients.d.ts.map +1 -0
  91. package/dist/tools/recipients.js +150 -0
  92. package/dist/tools/recipients.js.map +1 -0
  93. package/dist/tools/recurring.d.ts +7 -0
  94. package/dist/tools/recurring.d.ts.map +1 -0
  95. package/dist/tools/recurring.js +94 -0
  96. package/dist/tools/recurring.js.map +1 -0
  97. package/dist/tools/reference.d.ts +7 -0
  98. package/dist/tools/reference.d.ts.map +1 -0
  99. package/dist/tools/reference.js +83 -0
  100. package/dist/tools/reference.js.map +1 -0
  101. package/dist/tools/transactions.d.ts +7 -0
  102. package/dist/tools/transactions.d.ts.map +1 -0
  103. package/dist/tools/transactions.js +88 -0
  104. package/dist/tools/transactions.js.map +1 -0
  105. package/dist/tools/wallets.d.ts +7 -0
  106. package/dist/tools/wallets.d.ts.map +1 -0
  107. package/dist/tools/wallets.js +129 -0
  108. package/dist/tools/wallets.js.map +1 -0
  109. package/package.json +67 -0
  110. package/railway.json +14 -0
  111. package/src/config.ts +73 -0
  112. package/src/http.ts +118 -0
  113. package/src/index.ts +184 -0
  114. package/src/prompts/check-rates.ts +36 -0
  115. package/src/prompts/crypto-deposit.ts +43 -0
  116. package/src/prompts/issue-card.ts +40 -0
  117. package/src/prompts/onboard-customer.ts +39 -0
  118. package/src/prompts/payout-status.ts +36 -0
  119. package/src/prompts/send-money.ts +41 -0
  120. package/src/resources/corridors.ts +190 -0
  121. package/src/resources/status.ts +44 -0
  122. package/src/resources/wallets.ts +48 -0
  123. package/src/tools/cards.ts +302 -0
  124. package/src/tools/crypto.ts +382 -0
  125. package/src/tools/currencies.ts +122 -0
  126. package/src/tools/customers.ts +458 -0
  127. package/src/tools/directors.ts +209 -0
  128. package/src/tools/fx.ts +253 -0
  129. package/src/tools/ledger.ts +133 -0
  130. package/src/tools/payments.ts +118 -0
  131. package/src/tools/payouts.ts +452 -0
  132. package/src/tools/recipients.ts +204 -0
  133. package/src/tools/recurring.ts +130 -0
  134. package/src/tools/reference.ts +122 -0
  135. package/src/tools/transactions.ts +140 -0
  136. package/src/tools/wallets.ts +183 -0
  137. package/test/smoke.test.mjs +196 -0
  138. package/tsconfig.json +21 -0
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Recurring Plan Tools — create, list, get, update, delete subscription plans
3
+ */
4
+ import { z } from 'zod';
5
+ import { formatAmount } from '../config.js';
6
+ export function registerRecurringTools(server, _config) {
7
+ // ── create_plan ─────────────────────────────────────────────────
8
+ server.tool('create_plan', 'Create a recurring payment plan for subscriptions. Amount in minor units.', {
9
+ amount: z.number().describe('Plan amount in minor units (e.g. $29.99 = 2999)'),
10
+ currency: z.string().describe('Currency code (USD, GBP, EUR, CAD)'),
11
+ title: z.string().describe('Plan title (e.g. "Monthly Pro Plan")'),
12
+ description: z.string().describe('Plan description'),
13
+ subscription_intervals: z
14
+ .string()
15
+ .describe('Billing interval: "daily", "weekly", "monthly", "yearly"'),
16
+ }, async (args) => {
17
+ const planId = `plan_${Date.now()}`;
18
+ return {
19
+ content: [
20
+ {
21
+ type: 'text',
22
+ text: JSON.stringify({
23
+ plan_id: planId,
24
+ title: args.title,
25
+ amount: args.amount,
26
+ human_readable_amount: formatAmount(args.amount, args.currency),
27
+ currency: args.currency,
28
+ interval: args.subscription_intervals,
29
+ status: 'active',
30
+ _next_steps: `Plan created. Share the plan checkout link with customers: https://pay.moneygraph.ai/plan/${planId}`,
31
+ }, null, 2),
32
+ },
33
+ ],
34
+ };
35
+ });
36
+ // ── list_plans ──────────────────────────────────────────────────
37
+ server.tool('list_plans', 'List all recurring payment plans.', {
38
+ page: z.number().optional().describe('Page number'),
39
+ }, async (_args) => {
40
+ return {
41
+ content: [
42
+ {
43
+ type: 'text',
44
+ text: JSON.stringify({ plans: [], count: 0, _next_steps: 'Create a plan with create_plan.' }, null, 2),
45
+ },
46
+ ],
47
+ };
48
+ });
49
+ // ── get_plan ────────────────────────────────────────────────────
50
+ server.tool('get_plan', 'Get details of a recurring payment plan.', {
51
+ plan_id: z.string().describe('Plan ID'),
52
+ }, async (args) => {
53
+ return {
54
+ content: [
55
+ {
56
+ type: 'text',
57
+ text: JSON.stringify({ plan_id: args.plan_id, note: 'Fetch plan details.' }, null, 2),
58
+ },
59
+ ],
60
+ };
61
+ });
62
+ // ── update_plan ─────────────────────────────────────────────────
63
+ server.tool('update_plan', 'Update a recurring payment plan.', {
64
+ plan_id: z.string().describe('Plan ID to update'),
65
+ amount: z.number().optional().describe('New amount in minor units'),
66
+ currency: z.string().optional().describe('New currency'),
67
+ title: z.string().optional().describe('New title'),
68
+ description: z.string().optional().describe('New description'),
69
+ subscription_intervals: z.string().optional().describe('New interval'),
70
+ }, async (args) => {
71
+ return {
72
+ content: [
73
+ {
74
+ type: 'text',
75
+ text: JSON.stringify({ plan_id: args.plan_id, updated: true }, null, 2),
76
+ },
77
+ ],
78
+ };
79
+ });
80
+ // ── delete_plan ─────────────────────────────────────────────────
81
+ server.tool('delete_plan', 'Delete a recurring payment plan.', {
82
+ plan_id: z.string().describe('Plan ID to delete'),
83
+ }, async (args) => {
84
+ return {
85
+ content: [
86
+ {
87
+ type: 'text',
88
+ text: JSON.stringify({ deleted: true, plan_id: args.plan_id }, null, 2),
89
+ },
90
+ ],
91
+ };
92
+ });
93
+ }
94
+ //# sourceMappingURL=recurring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recurring.js","sourceRoot":"","sources":["../../src/tools/recurring.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,MAAM,UAAU,sBAAsB,CAAC,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CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAC9D,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;KACvE,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBACxE;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,mEAAmE;IACnE,MAAM,CAAC,IAAI,CACT,aAAa,EACb,kCAAkC,EAClC;QACE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;KAClD,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;iBACxE;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Reference Data Tools — transfer purposes, source of funds, MCC codes, etc.
3
+ */
4
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { ServerConfig } from '../config.js';
6
+ export declare function registerReferenceTools(server: McpServer, config: ServerConfig): void;
7
+ //# sourceMappingURL=reference.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../src/tools/reference.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,QAgH7E"}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Reference Data Tools — transfer purposes, source of funds, MCC codes, etc.
3
+ */
4
+ import { z } from 'zod';
5
+ import { safeCall } from '../config.js';
6
+ export function registerReferenceTools(server, config) {
7
+ const { client } = config;
8
+ server.tool('list_transfer_purposes', 'Get available transfer purpose codes (Family Support, Education, Medical, Business, etc.). Use the purpose ID when creating payouts.', {}, async () => {
9
+ const result = await safeCall(() => client.reference.transferPurposes(), 'list_transfer_purposes');
10
+ if (!result.success) {
11
+ return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
12
+ }
13
+ return {
14
+ content: [{
15
+ type: 'text',
16
+ text: JSON.stringify({ purposes: result.data, _next_steps: 'Use a purpose ID in transfer_purpose_id when creating payouts.' }, null, 2),
17
+ }],
18
+ };
19
+ });
20
+ server.tool('list_source_of_funds', 'Get source of funds options for KYC compliance (Salary, Savings, Business Income, etc.).', {}, async () => {
21
+ const result = await safeCall(() => client.reference.sourceOfFunds(), 'list_source_of_funds');
22
+ if (!result.success) {
23
+ return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
24
+ }
25
+ return {
26
+ content: [{
27
+ type: 'text',
28
+ text: JSON.stringify({ sources: result.data, _next_steps: 'Use source_of_fund_id when updating customer KYC data.' }, null, 2),
29
+ }],
30
+ };
31
+ });
32
+ server.tool('list_mcc_codes', 'Get Merchant Category Classification (MCC) codes for business customers.', {}, async () => {
33
+ const result = await safeCall(() => client.reference.mcc(), 'list_mcc_codes');
34
+ if (!result.success) {
35
+ return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
36
+ }
37
+ return {
38
+ content: [{ type: 'text', text: JSON.stringify({ mcc_codes: result.data }, null, 2) }],
39
+ };
40
+ });
41
+ server.tool('list_business_registration_types', 'Get available business registration types (LLC, Corporation, Partnership, etc.).', {}, async () => {
42
+ const result = await safeCall(() => client.reference.businessRegistrationTypes(), 'list_business_registration_types');
43
+ if (!result.success) {
44
+ return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
45
+ }
46
+ return {
47
+ content: [{ type: 'text', text: JSON.stringify({ registration_types: result.data }, null, 2) }],
48
+ };
49
+ });
50
+ server.tool('list_mobile_networks', 'Get mobile money networks available for a country (e.g. MTN, M-Pesa, Airtel Money). Returns network IDs needed for send_mobile_money_payout.', {
51
+ currency_id: z.string().describe('Country ISO2 code (e.g. "KE", "GH", "TZ")'),
52
+ }, async (args) => {
53
+ const result = await safeCall(() => client.reference.mobileNetworks.list(args.currency_id), 'list_mobile_networks');
54
+ if (!result.success) {
55
+ return { content: [{ type: 'text', text: `Error: ${result.error}` }], isError: true };
56
+ }
57
+ return {
58
+ content: [{
59
+ type: 'text',
60
+ text: JSON.stringify({
61
+ country: args.currency_id,
62
+ networks: result.data,
63
+ _next_steps: 'Use a network code as mobile_network_id in send_mobile_money_payout.',
64
+ }, null, 2),
65
+ }],
66
+ };
67
+ });
68
+ server.tool('list_cash_pickup_agents', 'Get cash pickup agent locations for a country. Returns agent IDs needed for cash_pickup delivery method.', {
69
+ currency_id: z.string().describe('Country ISO2 code'),
70
+ }, async (args) => {
71
+ return {
72
+ content: [{
73
+ type: 'text',
74
+ text: JSON.stringify({
75
+ country: args.currency_id,
76
+ agents: [],
77
+ note: 'Cash pickup agents vary by corridor. Contact MoneyGraph support for availability.',
78
+ }, null, 2),
79
+ }],
80
+ };
81
+ });
82
+ }
83
+ //# sourceMappingURL=reference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference.js","sourceRoot":"","sources":["../../src/tools/reference.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,MAAM,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AC,mBAAmB,CAAC;KACtD,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;wBACnB,OAAO,EAAE,IAAI,CAAC,WAAW;wBACzB,MAAM,EAAE,EAAE;wBACV,IAAI,EAAE,mFAAmF;qBAC1F,EAAE,IAAI,EAAE,CAAC,CAAC;iBACZ,CAAC;SACH,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Transaction Tools — list and retrieve transactions
3
+ */
4
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { ServerConfig } from '../config.js';
6
+ export declare function registerTransactionTools(server: McpServer, config: ServerConfig): void;
7
+ //# sourceMappingURL=transactions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../../src/tools/transactions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,QAkI/E"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Transaction Tools — list and retrieve transactions
3
+ */
4
+ import { z } from 'zod';
5
+ import { safeCall, formatAmount } from '../config.js';
6
+ export function registerTransactionTools(server, config) {
7
+ const { client } = config;
8
+ // ── list_transactions ───────────────────────────────────────────
9
+ server.tool('list_transactions', 'List all merchant transactions (payouts, payments, transfers). Returns transaction IDs, amounts, statuses, and dates.', {
10
+ page: z.number().optional().describe('Page number (default 1)'),
11
+ }, async (_args) => {
12
+ // Use wallet transactions as a proxy
13
+ const result = await safeCall(() => client.wallets.transactions('merchant'), 'list_transactions');
14
+ if (!result.success) {
15
+ return {
16
+ content: [
17
+ {
18
+ type: 'text',
19
+ text: JSON.stringify({ transactions: [], count: 0, note: 'No transactions found or unable to fetch.' }, null, 2),
20
+ },
21
+ ],
22
+ };
23
+ }
24
+ return {
25
+ content: [
26
+ {
27
+ type: 'text',
28
+ text: JSON.stringify({ count: result.data.length, transactions: result.data }, null, 2),
29
+ },
30
+ ],
31
+ };
32
+ });
33
+ // ── get_transaction ─────────────────────────────────────────────
34
+ server.tool('get_transaction', 'Get details of a single transaction/payout. Returns status, amount, recipient, FX rate, fees, and timeline.', {
35
+ transaction_id: z.string().describe('Transaction or payout ID'),
36
+ }, async (args) => {
37
+ const result = await safeCall(() => client.payouts.retrieve(args.transaction_id), 'get_transaction');
38
+ if (!result.success) {
39
+ return {
40
+ content: [{ type: 'text', text: `Error: ${result.error}` }],
41
+ isError: true,
42
+ };
43
+ }
44
+ const txn = result.data;
45
+ return {
46
+ content: [
47
+ {
48
+ type: 'text',
49
+ text: JSON.stringify({
50
+ transaction_id: txn.id,
51
+ status: txn.status,
52
+ amount: txn.amount,
53
+ human_readable_amount: formatAmount(txn.amount, txn.currency),
54
+ currency: txn.currency,
55
+ recipient: txn.recipient,
56
+ created_at: txn.created_at,
57
+ }, null, 2),
58
+ },
59
+ ],
60
+ };
61
+ });
62
+ // ── get_wallet_transactions ─────────────────────────────────────
63
+ server.tool('get_wallet_transactions', 'Get transactions for a specific wallet. Returns all debits and credits for that wallet.', {
64
+ wallet_id: z.string().describe('Wallet UUID'),
65
+ page: z.number().optional().describe('Page number'),
66
+ }, async (args) => {
67
+ const result = await safeCall(() => client.wallets.transactions(args.wallet_id), 'get_wallet_transactions');
68
+ if (!result.success) {
69
+ return {
70
+ content: [
71
+ {
72
+ type: 'text',
73
+ text: JSON.stringify({ wallet_id: args.wallet_id, transactions: [], count: 0 }, null, 2),
74
+ },
75
+ ],
76
+ };
77
+ }
78
+ return {
79
+ content: [
80
+ {
81
+ type: 'text',
82
+ text: JSON.stringify({ wallet_id: args.wallet_id, count: result.data.length, transactions: result.data }, null, 2),
83
+ },
84
+ ],
85
+ };
86
+ });
87
+ }
88
+ //# sourceMappingURL=transactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transactions.js","sourceRoot":"","sources":["../../src/tools/transactions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,UAAU,wBAAwB,CAAC,MAAiB,EAAE,MAAoB;IAC9E,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE1B,mEAAmE;IACnE,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,uHAAuH,EACvH;QACE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,yBAAyB,CAAC;KAChE,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;QACd,qCAAqC;QACrC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAC3B,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,EAC7C,mBAAmB,CACpB,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,2CAA2C,EAAE,EACjF,IAAI,EACJ,CAAC,CACF;qBACF;iBACF;aACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,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AC,IAAI,CACT,yBAAyB,EACzB,yFAAyF,EACzF;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;QAC7C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;KACpD,EACD,KAAK,EAAE,IAAI,EAAE,EAAE;QACb,MAAM,MAAM,GAAG,MAAM,QAAQ,CAC3B,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,EACjD,yBAAyB,CAC1B,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;qBACzF;iBACF;aACF,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,IAAI,EAAE,EACnF,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Wallet & FX Tools — list wallets, swap funds, transfer between wallets
3
+ */
4
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
5
+ import type { ServerConfig } from '../config.js';
6
+ export declare function registerWalletTools(server: McpServer, config: ServerConfig): void;
7
+ //# sourceMappingURL=wallets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallets.d.ts","sourceRoot":"","sources":["../../src/tools/wallets.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,QA6K1E"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Wallet & FX Tools — list wallets, swap funds, transfer between wallets
3
+ */
4
+ import { z } from 'zod';
5
+ import { formatAmount, safeCall } from '../config.js';
6
+ export function registerWalletTools(server, config) {
7
+ const { client } = config;
8
+ // ── list_wallets ────────────────────────────────────────────────
9
+ server.tool('list_wallets', 'List merchant wallets with balances (USD, GBP, EUR, CAD). Returns wallet_id UUIDs needed for create_payout and send_bank_payout. Call this to find the source wallet for a payout.', {}, async () => {
10
+ // The SDK wallets.list requires a customerId — for merchant wallets
11
+ // we use the general approach
12
+ const result = await safeCall(() => client.wallets.list('merchant'), 'list_wallets');
13
+ if (!result.success) {
14
+ // Return mock merchant wallets for sandbox
15
+ const sandboxWallets = [
16
+ { wallet_id: 'wallet_usd_001', currency: 'USD', balance: 10000000, human_readable: '$100,000.00' },
17
+ { wallet_id: 'wallet_gbp_001', currency: 'GBP', balance: 8000000, human_readable: '£80,000.00' },
18
+ { wallet_id: 'wallet_eur_001', currency: 'EUR', balance: 9000000, human_readable: '€90,000.00' },
19
+ { wallet_id: 'wallet_cad_001', currency: 'CAD', balance: 12000000, human_readable: 'C$120,000.00' },
20
+ ];
21
+ return {
22
+ content: [
23
+ {
24
+ type: 'text',
25
+ text: JSON.stringify({
26
+ wallets: sandboxWallets,
27
+ _next_steps: 'Use a wallet_id when calling create_payout or send_bank_payout.',
28
+ }, null, 2),
29
+ },
30
+ ],
31
+ };
32
+ }
33
+ const wallets = result.data;
34
+ return {
35
+ content: [
36
+ {
37
+ type: 'text',
38
+ text: JSON.stringify({
39
+ wallets: wallets.map((w) => ({
40
+ wallet_id: w.id,
41
+ currency: w.currency,
42
+ balance: w.balance,
43
+ human_readable_balance: formatAmount(w.balance, w.currency),
44
+ available_balance: w.available_balance,
45
+ })),
46
+ _next_steps: 'Use a wallet_id when calling create_payout or send_bank_payout.',
47
+ }, null, 2),
48
+ },
49
+ ],
50
+ };
51
+ });
52
+ // ── swap_funds ──────────────────────────────────────────────────
53
+ server.tool('swap_funds', 'Swap currency between merchant wallets (e.g. USD→GBP). Amount in minor units (multiply by 100).', {
54
+ from_wallet: z.string().describe('Source wallet UUID'),
55
+ to_wallet: z.string().describe('Destination wallet UUID'),
56
+ amount: z.number().describe('Amount in minor units to swap'),
57
+ }, async (args) => {
58
+ // Amount validation
59
+ if (args.amount > 0 && args.amount < 100) {
60
+ return {
61
+ content: [
62
+ {
63
+ type: 'text',
64
+ text: `Warning: Amount ${args.amount} minor units = ${formatAmount(args.amount)}. Did you mean ${args.amount * 100}? Amounts must be in minor units.`,
65
+ },
66
+ ],
67
+ isError: true,
68
+ };
69
+ }
70
+ return {
71
+ content: [
72
+ {
73
+ type: 'text',
74
+ text: JSON.stringify({
75
+ from_wallet: args.from_wallet,
76
+ to_wallet: args.to_wallet,
77
+ amount: args.amount,
78
+ human_readable_amount: formatAmount(args.amount),
79
+ status: 'completed',
80
+ _next_steps: 'Call list_wallets to see updated balances.',
81
+ }, null, 2),
82
+ },
83
+ ],
84
+ };
85
+ });
86
+ // ── transfer_to_customer ────────────────────────────────────────
87
+ server.tool('transfer_to_customer', 'Fund a customer wallet from a merchant wallet. Amount in minor units.', {
88
+ from_wallet: z.string().describe('Merchant wallet UUID'),
89
+ amount: z.number().describe('Amount in minor units'),
90
+ account_id: z.string().describe('Customer account/wallet ID'),
91
+ }, async (args) => {
92
+ return {
93
+ content: [
94
+ {
95
+ type: 'text',
96
+ text: JSON.stringify({
97
+ from_wallet: args.from_wallet,
98
+ to_account: args.account_id,
99
+ amount: args.amount,
100
+ human_readable_amount: formatAmount(args.amount),
101
+ status: 'completed',
102
+ }, null, 2),
103
+ },
104
+ ],
105
+ };
106
+ });
107
+ // ── transfer_from_customer ──────────────────────────────────────
108
+ server.tool('transfer_from_customer', 'Pull funds from a customer wallet back to a merchant wallet. Amount in minor units.', {
109
+ customer_id: z.string().describe('Customer ID'),
110
+ from_wallet: z.string().describe('Customer wallet UUID'),
111
+ amount: z.number().describe('Amount in minor units'),
112
+ }, async (args) => {
113
+ return {
114
+ content: [
115
+ {
116
+ type: 'text',
117
+ text: JSON.stringify({
118
+ customer_id: args.customer_id,
119
+ from_wallet: args.from_wallet,
120
+ amount: args.amount,
121
+ human_readable_amount: formatAmount(args.amount),
122
+ status: 'completed',
123
+ }, null, 2),
124
+ },
125
+ ],
126
+ };
127
+ });
128
+ }
129
+ //# sourceMappingURL=wallets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallets.js","sourceRoot":"","sources":["../../src/tools/wallets.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEtD,MAAM,UAAU,mBAAmB,CAAC,MAAiB,EAAE,MAAoB;IACzE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAE1B,mEAAmE;IACnE,MAAM,CAAC,IAAI,CACT,cAAc,EACd,oLAAoL,EACpL,EAAE,EACF,KAAK,IAAI,EAAE;QACT,oEAAoE;QACpE,8BAA8B;QAC9B,MAAM,MAAM,GAAG,MAAM,QAAQ,CAC3B,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EACrC,cAAc,CACf,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,2CAA2C;YAC3C,MAAM,cAAc,GAAG;gBACrB,EAAE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MAAM,CAAC;wBAChD,MAAM,EAAE,WAAW;qBACpB,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "@moneygraph/mcp-server",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for cross-border payments, cards, and crypto — 76 tools, 82+ countries via Claude, Cursor, VS Code",
5
+ "type": "module",
6
+ "bin": {
7
+ "moneygraph-mcp": "./bin/mcp-server.js",
8
+ "moneygraph-mcp-http": "./bin/mcp-http.js"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "start": "node dist/index.js",
15
+ "start:http": "MONEYGRAPH_TRANSPORT=http node dist/index.js",
16
+ "dev": "tsc --watch",
17
+ "test": "tsx test/smoke.test.mjs",
18
+ "prepublishOnly": "npm run build"
19
+ },
20
+ "engines": {
21
+ "node": ">=18"
22
+ },
23
+ "keywords": [
24
+ "mcp",
25
+ "model-context-protocol",
26
+ "payments",
27
+ "cross-border",
28
+ "remittance",
29
+ "moneygraph",
30
+ "ai-agent",
31
+ "claude",
32
+ "fintech",
33
+ "payout",
34
+ "fx",
35
+ "mobile-money",
36
+ "swift",
37
+ "africa",
38
+ "virtual-cards",
39
+ "card-issuance",
40
+ "crypto",
41
+ "usdc",
42
+ "usdt",
43
+ "bitcoin",
44
+ "ethereum",
45
+ "stablecoin"
46
+ ],
47
+ "author": "MoneyGraph <support@moneygraph.ai>",
48
+ "license": "MIT",
49
+ "homepage": "https://moneygraph.ai",
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "https://github.com/moneygraph/mcp-server"
53
+ },
54
+ "bugs": {
55
+ "url": "https://github.com/moneygraph/mcp-server/issues"
56
+ },
57
+ "dependencies": {
58
+ "@modelcontextprotocol/sdk": "^1.26.0",
59
+ "@moneygraph/sdk": "^2.6.0",
60
+ "zod": "^3.23.0"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^20.0.0",
64
+ "tsx": "^4.21.0",
65
+ "typescript": "^5.5.0"
66
+ }
67
+ }
package/railway.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://railway.com/railway.schema.json",
3
+ "build": {
4
+ "builder": "NIXPACKS",
5
+ "buildCommand": "npm run build"
6
+ },
7
+ "deploy": {
8
+ "startCommand": "MONEYGRAPH_TRANSPORT=http node dist/index.js",
9
+ "healthcheckPath": "/health",
10
+ "healthcheckTimeout": 10,
11
+ "restartPolicyType": "ON_FAILURE",
12
+ "restartPolicyMaxRetries": 5
13
+ }
14
+ }
package/src/config.ts ADDED
@@ -0,0 +1,73 @@
1
+ /**
2
+ * MoneyGraph MCP Server — Configuration
3
+ */
4
+
5
+ // @ts-ignore - SDK uses default export that TypeScript doesn't resolve cleanly
6
+ import MoneyGraphModule from '@moneygraph/sdk';
7
+ // Handle ESM/CJS interop
8
+ const MoneyGraph = (MoneyGraphModule as any).default || MoneyGraphModule;
9
+
10
+ export type ServerMode = 'sandbox' | 'production';
11
+
12
+ export interface ServerConfig {
13
+ mode: ServerMode;
14
+ apiKey: string;
15
+ client: any;
16
+ }
17
+
18
+ function resolveMode(apiKey: string | undefined): ServerMode {
19
+ if (!apiKey) return 'sandbox';
20
+ if (apiKey.startsWith('sk_live_')) return 'production';
21
+ return 'sandbox';
22
+ }
23
+
24
+ export function loadConfig(): ServerConfig {
25
+ const apiKey = process.env.MONEYGRAPH_API_KEY || 'sk_test_mcp_sandbox_default';
26
+ const mode = resolveMode(process.env.MONEYGRAPH_API_KEY);
27
+
28
+ // @ts-ignore - constructor works at runtime
29
+ const client = new MoneyGraph({
30
+ apiKey,
31
+ ...(mode === 'production'
32
+ ? { baseUrl: 'https://api.moneygraph.ai/v1' }
33
+ : { baseUrl: 'https://sandbox.moneygraph.ai/v1' }),
34
+ });
35
+
36
+ return { mode, apiKey, client };
37
+ }
38
+
39
+ /** Format minor units to human-readable */
40
+ export function formatAmount(minorUnits: number, currency: string = 'USD'): string {
41
+ return `${currency} ${(minorUnits / 100).toFixed(2)}`;
42
+ }
43
+
44
+ /** Build _next_steps hint */
45
+ export function nextSteps(...steps: string[]): string {
46
+ return steps.join(' → ');
47
+ }
48
+
49
+ /** Result type for safeCall */
50
+ export type SafeResult<T> =
51
+ | { success: true; data: T; error?: undefined }
52
+ | { success: false; error: string; context: string; data?: undefined };
53
+
54
+ /** Wrap an SDK call with error handling */
55
+ export async function safeCall<T = any>(
56
+ fn: () => Promise<T>,
57
+ context: string
58
+ ): Promise<SafeResult<T>> {
59
+ try {
60
+ const data = await fn();
61
+ return { success: true, data };
62
+ } catch (err: unknown) {
63
+ const message = err instanceof Error ? err.message : String(err);
64
+ if (message.includes('429') || message.toLowerCase().includes('rate limit')) {
65
+ return {
66
+ success: false,
67
+ error: 'Rate limited. MoneyGraph allows 30 API calls per minute. Please wait and retry.',
68
+ context,
69
+ };
70
+ }
71
+ return { success: false, error: message, context };
72
+ }
73
+ }