@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,48 +0,0 @@
1
- /**
2
- * Wallets Resource — merchant wallet balances
3
- */
4
-
5
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
6
- import type { ServerConfig } from '../config.js';
7
- import { safeCall, formatAmount } from '../config.js';
8
-
9
- export function registerWalletsResource(server: McpServer, config: ServerConfig) {
10
- const { client } = config;
11
-
12
- server.resource(
13
- 'Merchant Wallets',
14
- 'moneygraph://wallets',
15
- {
16
- description: 'Live wallet balances for all base currencies (USD, GBP, EUR, CAD)',
17
- mimeType: 'application/json',
18
- },
19
- async () => {
20
- const result = await safeCall(() => client.wallets.list('merchant'), 'resource_wallets');
21
-
22
- const wallets = result.success
23
- ? result.data.map((w) => ({
24
- wallet_id: w.id,
25
- currency: w.currency,
26
- balance: w.balance,
27
- human_readable: formatAmount(w.balance, w.currency),
28
- available_balance: w.available_balance,
29
- }))
30
- : [
31
- { wallet_id: 'wallet_usd_001', currency: 'USD', balance: 10000000, human_readable: '$100,000.00' },
32
- { wallet_id: 'wallet_gbp_001', currency: 'GBP', balance: 8000000, human_readable: '£80,000.00' },
33
- { wallet_id: 'wallet_eur_001', currency: 'EUR', balance: 9000000, human_readable: '€90,000.00' },
34
- { wallet_id: 'wallet_cad_001', currency: 'CAD', balance: 12000000, human_readable: 'C$120,000.00' },
35
- ];
36
-
37
- return {
38
- contents: [
39
- {
40
- uri: 'moneygraph://wallets',
41
- mimeType: 'application/json',
42
- text: JSON.stringify({ wallets }, null, 2),
43
- },
44
- ],
45
- };
46
- }
47
- );
48
- }
@@ -1,302 +0,0 @@
1
- /**
2
- * Card Tools — virtual/physical card issuance, funding, management
3
- *
4
- * Maps to SDK: mg.cards.create, retrieve, list, fund, freeze, unfreeze,
5
- * update, cancel, replace, transactions
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 registerCardTools(server: McpServer, config: ServerConfig) {
14
- const { client } = config;
15
-
16
- // ── create_card ─────────────────────────────────────────────────
17
- server.tool(
18
- 'create_card',
19
- 'Issue a virtual or physical debit card for a customer. Requires APPROVED KYC. Virtual cards are instant; physical cards ship to the customer address.',
20
- {
21
- customer_id: z.string().describe('Customer ID (must have APPROVED KYC)'),
22
- type: z.enum(['virtual', 'physical']).describe('Card type: "virtual" (instant) or "physical" (shipped)'),
23
- currency: z.string().describe('Card currency (e.g. "USD", "GBP", "EUR")'),
24
- label: z.string().optional().describe('Friendly name for the card (e.g. "Travel Card")'),
25
- spending_limit_amount: z.number().optional().describe('Spending limit in minor units'),
26
- spending_limit_interval: z.string().optional().describe('Limit interval: "daily", "weekly", "monthly", "lifetime"'),
27
- },
28
- async (args) => {
29
- const params: Record<string, unknown> = {
30
- customer_id: args.customer_id,
31
- type: args.type,
32
- currency: args.currency,
33
- };
34
- if (args.label) params.label = args.label;
35
- if (args.spending_limit_amount && args.spending_limit_interval) {
36
- params.spending_limit = {
37
- amount: args.spending_limit_amount,
38
- interval: args.spending_limit_interval,
39
- };
40
- }
41
-
42
- const result = await safeCall(() => client.cards.create(params), 'create_card');
43
- if (!result.success) {
44
- return { content: [{ type: 'text' as const, text: `Error creating card: ${result.error}` }], isError: true };
45
- }
46
-
47
- const card = result.data;
48
- return {
49
- content: [{
50
- type: 'text' as const,
51
- text: JSON.stringify({
52
- card_id: card.id,
53
- type: card.type,
54
- status: card.status,
55
- masked_pan: card.masked_pan,
56
- currency: card.currency,
57
- balance: formatAmount(card.balance, card.currency),
58
- expiry: `${card.expiry_month}/${card.expiry_year}`,
59
- ...(card.card_number && { card_number: card.card_number }),
60
- ...(card.cvv && { cvv: card.cvv }),
61
- created_at: card.created_at,
62
- _next_steps: nextSteps(
63
- `fund the card with fund_card card_id="${card.id}"`,
64
- 'card is ready to use once funded'
65
- ),
66
- }, null, 2),
67
- }],
68
- };
69
- }
70
- );
71
-
72
- // ── get_card ────────────────────────────────────────────────────
73
- server.tool(
74
- 'get_card',
75
- 'Retrieve card details including balance, status, and masked PAN.',
76
- {
77
- card_id: z.string().describe('Card ID'),
78
- },
79
- async (args) => {
80
- const result = await safeCall(() => client.cards.retrieve(args.card_id), 'get_card');
81
- if (!result.success) {
82
- return { content: [{ type: 'text' as const, text: `Error: ${result.error}` }], isError: true };
83
- }
84
-
85
- const card = result.data;
86
- return {
87
- content: [{
88
- type: 'text' as const,
89
- text: JSON.stringify({
90
- card_id: card.id,
91
- customer_id: card.customer_id,
92
- type: card.type,
93
- status: card.status,
94
- masked_pan: card.masked_pan,
95
- currency: card.currency,
96
- balance: formatAmount(card.balance, card.currency),
97
- available_balance: formatAmount(card.available_balance, card.currency),
98
- pending_balance: formatAmount(card.pending_balance, card.currency),
99
- spending_limit: card.spending_limit,
100
- expiry: `${card.expiry_month}/${card.expiry_year}`,
101
- created_at: card.created_at,
102
- }, null, 2),
103
- }],
104
- };
105
- }
106
- );
107
-
108
- // ── list_cards ──────────────────────────────────────────────────
109
- server.tool(
110
- 'list_cards',
111
- 'List all cards for a customer. Returns card IDs, types, statuses, and balances.',
112
- {
113
- customer_id: z.string().describe('Customer ID'),
114
- },
115
- async (args) => {
116
- const result = await safeCall(() => client.cards.list(args.customer_id), 'list_cards');
117
- if (!result.success) {
118
- return { content: [{ type: 'text' as const, text: `Error: ${result.error}` }], isError: true };
119
- }
120
-
121
- return {
122
- content: [{
123
- type: 'text' as const,
124
- text: JSON.stringify({
125
- customer_id: args.customer_id,
126
- count: result.data.length,
127
- cards: result.data.map((c) => ({
128
- card_id: c.id,
129
- type: c.type,
130
- status: c.status,
131
- masked_pan: c.masked_pan,
132
- currency: c.currency,
133
- balance: formatAmount(c.balance, c.currency),
134
- })),
135
- }, null, 2),
136
- }],
137
- };
138
- }
139
- );
140
-
141
- // ── fund_card ───────────────────────────────────────────────────
142
- server.tool(
143
- 'fund_card',
144
- 'Add funds to a card from a wallet. Amount in minor units (multiply dollars by 100).',
145
- {
146
- card_id: z.string().describe('Card ID to fund'),
147
- wallet_id: z.string().describe('Source wallet UUID'),
148
- amount: z.number().describe('Amount in minor units (e.g. $50 = 5000)'),
149
- currency: z.string().describe('Currency code (e.g. "USD")'),
150
- },
151
- async (args) => {
152
- if (args.amount > 0 && args.amount < 100) {
153
- return {
154
- content: [{ type: 'text' as const, text: `Warning: Amount ${args.amount} minor units = ${formatAmount(args.amount)}. Did you mean ${args.amount * 100}? Amounts must be in minor units.` }],
155
- isError: true,
156
- };
157
- }
158
-
159
- const result = await safeCall(
160
- () => client.cards.fund({
161
- card_id: args.card_id,
162
- wallet_id: args.wallet_id,
163
- amount: args.amount,
164
- currency: args.currency,
165
- }),
166
- 'fund_card'
167
- );
168
-
169
- if (!result.success) {
170
- return { content: [{ type: 'text' as const, text: `Error funding card: ${result.error}` }], isError: true };
171
- }
172
-
173
- return {
174
- content: [{
175
- type: 'text' as const,
176
- text: JSON.stringify({
177
- card_id: args.card_id,
178
- funded_amount: formatAmount(result.data.amount, result.data.currency),
179
- new_balance: formatAmount(result.data.card_balance, result.data.currency),
180
- _next_steps: 'Card is funded and ready to use.',
181
- }, null, 2),
182
- }],
183
- };
184
- }
185
- );
186
-
187
- // ── freeze_card ─────────────────────────────────────────────────
188
- server.tool(
189
- 'freeze_card',
190
- 'Temporarily freeze a card. No transactions will be processed until unfrozen.',
191
- {
192
- card_id: z.string().describe('Card ID to freeze'),
193
- },
194
- async (args) => {
195
- const result = await safeCall(() => client.cards.freeze(args.card_id), 'freeze_card');
196
- if (!result.success) {
197
- return { content: [{ type: 'text' as const, text: `Error: ${result.error}` }], isError: true };
198
- }
199
-
200
- return {
201
- content: [{
202
- type: 'text' as const,
203
- text: JSON.stringify({
204
- card_id: args.card_id,
205
- status: 'frozen',
206
- note: 'Card is frozen. No transactions will be processed. Call unfreeze_card to reactivate.',
207
- }, null, 2),
208
- }],
209
- };
210
- }
211
- );
212
-
213
- // ── unfreeze_card ───────────────────────────────────────────────
214
- server.tool(
215
- 'unfreeze_card',
216
- 'Unfreeze a previously frozen card. Transactions will resume processing.',
217
- {
218
- card_id: z.string().describe('Card ID to unfreeze'),
219
- },
220
- async (args) => {
221
- const result = await safeCall(() => client.cards.unfreeze(args.card_id), 'unfreeze_card');
222
- if (!result.success) {
223
- return { content: [{ type: 'text' as const, text: `Error: ${result.error}` }], isError: true };
224
- }
225
-
226
- return {
227
- content: [{
228
- type: 'text' as const,
229
- text: JSON.stringify({
230
- card_id: args.card_id,
231
- status: 'active',
232
- note: 'Card is active again. Transactions will be processed normally.',
233
- }, null, 2),
234
- }],
235
- };
236
- }
237
- );
238
-
239
- // ── cancel_card ─────────────────────────────────────────────────
240
- server.tool(
241
- 'cancel_card',
242
- 'Permanently cancel a card. This is irreversible. Any remaining balance will be returned to the wallet.',
243
- {
244
- card_id: z.string().describe('Card ID to cancel'),
245
- reason: z.string().optional().describe('Cancellation reason'),
246
- },
247
- async (args) => {
248
- const result = await safeCall(
249
- () => client.cards.cancel(args.card_id, { reason: args.reason || 'user_requested' }),
250
- 'cancel_card'
251
- );
252
- if (!result.success) {
253
- return { content: [{ type: 'text' as const, text: `Error: ${result.error}` }], isError: true };
254
- }
255
-
256
- return {
257
- content: [{
258
- type: 'text' as const,
259
- text: JSON.stringify({
260
- card_id: args.card_id,
261
- status: 'cancelled',
262
- note: 'Card permanently cancelled. Any remaining balance has been returned.',
263
- }, null, 2),
264
- }],
265
- };
266
- }
267
- );
268
-
269
- // ── get_card_transactions ───────────────────────────────────────
270
- server.tool(
271
- 'get_card_transactions',
272
- 'Get transaction history for a card. Returns purchases, refunds, and funding events.',
273
- {
274
- card_id: z.string().describe('Card ID'),
275
- },
276
- async (args) => {
277
- const result = await safeCall(
278
- () => client.cards.transactions(args.card_id),
279
- 'get_card_transactions'
280
- );
281
- if (!result.success) {
282
- return {
283
- content: [{
284
- type: 'text' as const,
285
- text: JSON.stringify({ card_id: args.card_id, transactions: [], count: 0 }, null, 2),
286
- }],
287
- };
288
- }
289
-
290
- return {
291
- content: [{
292
- type: 'text' as const,
293
- text: JSON.stringify({
294
- card_id: args.card_id,
295
- count: result.data.length,
296
- transactions: result.data,
297
- }, null, 2),
298
- }],
299
- };
300
- }
301
- );
302
- }