stables-mcp-server 1.4.0 → 2.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 (36) hide show
  1. package/README.md +52 -41
  2. package/build/index.js +3 -3
  3. package/build/index.js.map +1 -1
  4. package/build/lib/stables-client.d.ts +214 -126
  5. package/build/lib/stables-client.d.ts.map +1 -1
  6. package/build/lib/stables-client.js +54 -19
  7. package/build/lib/stables-client.js.map +1 -1
  8. package/build/tools/api-keys.d.ts.map +1 -1
  9. package/build/tools/api-keys.js +7 -3
  10. package/build/tools/api-keys.js.map +1 -1
  11. package/build/tools/customers.d.ts.map +1 -1
  12. package/build/tools/customers.js +239 -106
  13. package/build/tools/customers.js.map +1 -1
  14. package/build/tools/payment-methods.d.ts +12 -0
  15. package/build/tools/payment-methods.d.ts.map +1 -0
  16. package/build/tools/payment-methods.js +119 -0
  17. package/build/tools/payment-methods.js.map +1 -0
  18. package/build/tools/quotes.d.ts +5 -1
  19. package/build/tools/quotes.d.ts.map +1 -1
  20. package/build/tools/quotes.js +103 -59
  21. package/build/tools/quotes.js.map +1 -1
  22. package/build/tools/transfers.d.ts +4 -1
  23. package/build/tools/transfers.d.ts.map +1 -1
  24. package/build/tools/transfers.js +212 -112
  25. package/build/tools/transfers.js.map +1 -1
  26. package/build/tools/virtual-accounts.d.ts.map +1 -1
  27. package/build/tools/virtual-accounts.js +55 -69
  28. package/build/tools/virtual-accounts.js.map +1 -1
  29. package/build/tools/webhooks.d.ts.map +1 -1
  30. package/build/tools/webhooks.js +37 -19
  31. package/build/tools/webhooks.js.map +1 -1
  32. package/package.json +10 -3
  33. package/build/tools/notifications.d.ts +0 -8
  34. package/build/tools/notifications.d.ts.map +0 -1
  35. package/build/tools/notifications.js +0 -125
  36. package/build/tools/notifications.js.map +0 -1
@@ -1,66 +1,190 @@
1
1
  /**
2
2
  * Transfer Tools for Stables MCP Server
3
- * Synced with OpenAPI spec from https://api.stables.money/docs
3
+ *
4
+ * Mirrors POST /api/v1/transfer as of 2026-07-30. The wire is snake_case and the
5
+ * payout target is a discriminated `destination`, not the old nested
6
+ * `paymentMethod.bankTransfer`.
4
7
  */
5
8
  import { z } from "zod";
9
+ /**
10
+ * Currencies whose payouts require a fuller beneficiary record. Named in the
11
+ * tool description so the model collects them up front rather than after a
12
+ * rejection — and because two of the three fail late, as a stuck transfer
13
+ * rather than a clean 400.
14
+ */
15
+ const ENHANCED_BENEFICIARY_CURRENCIES = "AED, CAD, EUR, GBP, MXN, USD";
16
+ const STATUS_EXPLANATIONS = {
17
+ created: "Transfer has been created and is awaiting processing.",
18
+ compliance_hold: "Transfer is on hold pending compliance review.",
19
+ awaiting_funds_collection: "Waiting for the customer to send crypto funds.",
20
+ funds_collected: "Crypto funds have been received, payout is being prepared.",
21
+ in_progress: "Transfer is being processed.",
22
+ payment_submitted: "Bank payment has been submitted for processing.",
23
+ payment_processed: "Bank payment has been processed successfully.",
24
+ completed: "Transfer completed successfully!",
25
+ failed: "Transfer failed. Check with support for details.",
26
+ cancelled: "Transfer was cancelled.",
27
+ expired: "Transfer expired before completion.",
28
+ unknown: "Transfer state could not be determined.",
29
+ };
30
+ function describeType(type) {
31
+ return type === "onramp" ? "On-ramp (Fiat to Crypto)" : "Off-ramp (Crypto to Fiat)";
32
+ }
33
+ function depositBlock(transfer) {
34
+ const deposit = transfer.source_deposit_instructions;
35
+ const wallet = deposit?.["wallet_address"];
36
+ if (!wallet)
37
+ return "";
38
+ return `
39
+ Deposit Instructions (share with customer):
40
+ Wallet Address: ${String(wallet)}
41
+ Currency: ${String(deposit?.["currency"] ?? "-")}
42
+ Network: ${String(deposit?.["network"] ?? "-")}
43
+ Amount: ${String(deposit?.["amount"] ?? "-")}
44
+
45
+ The customer must send this amount to that address. Once received, Stables processes the payout.`;
46
+ }
6
47
  export function registerTransferTools(server, client) {
7
48
  // Create Transfer
8
- server.tool("create_transfer", "Execute a transfer using an active quote. The quote must not be expired. This initiates the actual money movement. Bank/payment details are required for off-ramp (crypto to fiat) transfers.", {
49
+ server.tool("create_transfer", "Execute a transfer using an active quote. The quote must not be expired. This initiates real money movement, so get explicit human approval first. " +
50
+ `For payouts in ${ENHANCED_BENEFICIARY_CURRENCIES} you must also supply recipientType, the full beneficiary address, and dateOfBirth when the recipient is an individual. ` +
51
+ "Use validate_payment_method first to check the details without spending the quote.", {
9
52
  customerId: z.string().describe("The customer ID for this transfer"),
10
53
  quoteId: z.string().describe("The quote ID to execute"),
11
- accountHolderName: z.string().optional().describe("Bank account holder's full name (required for off-ramp)"),
12
- iban: z.string().optional().describe("IBAN for the destination bank account (EU/international)"),
13
- accountNumber: z.string().optional().describe("Bank account number (if not using IBAN)"),
14
- bankName: z.string().optional().describe("Name of the destination bank (required for off-ramp)"),
15
- bankCountry: z.string().optional().describe("Two-letter country code of the bank (e.g., 'AU', 'US')"),
16
- bankCurrency: z.string().optional().describe("Currency for the bank payout (e.g., 'EUR', 'USD', 'AUD')"),
17
- accountType: z.enum(["savings", "checking", "payment"]).optional().describe("Type of bank account"),
18
- swiftCode: z.string().optional().describe("SWIFT/BIC code for international transfers"),
54
+ destinationType: z
55
+ .enum(["bank", "crypto"])
56
+ .default("bank")
57
+ .describe("Payout target: a bank account (off-ramp) or a wallet address"),
58
+ accountHolderName: z
59
+ .string()
60
+ .optional()
61
+ .describe("Account holder's full name, or the company name when recipientType is business"),
62
+ bankName: z.string().optional().describe("Name of the destination bank"),
63
+ bankCountry: z.string().optional().describe("Bank country, ISO 2-letter (e.g. 'AU', 'US')"),
64
+ bankCurrency: z.string().optional().describe("Payout currency, ISO 3-letter (e.g. 'EUR')"),
65
+ recipientType: z
66
+ .enum(["individual", "business"])
67
+ .optional()
68
+ .describe(`Beneficiary type. Required for ${ENHANCED_BENEFICIARY_CURRENCIES}`),
69
+ dateOfBirth: z
70
+ .string()
71
+ .optional()
72
+ .describe(`Beneficiary date of birth, YYYY-MM-DD. Required when recipientType is individual for ${ENHANCED_BENEFICIARY_CURRENCIES}`),
73
+ addressStreet: z.string().optional().describe("Beneficiary street address"),
74
+ addressCity: z.string().optional().describe("Beneficiary city"),
75
+ addressState: z.string().optional().describe("Beneficiary state or region"),
76
+ addressPostalCode: z.string().optional().describe("Beneficiary postal code"),
77
+ addressCountry: z
78
+ .string()
79
+ .optional()
80
+ .describe(`Beneficiary country, ISO 2-letter. The complete address is required for ${ENHANCED_BENEFICIARY_CURRENCIES}`),
81
+ iban: z.string().optional().describe("IBAN (EU/international)"),
82
+ accountNumber: z.string().optional().describe("Bank account number, if not using IBAN"),
83
+ accountType: z
84
+ .enum(["savings", "checking", "payment"])
85
+ .optional()
86
+ .describe("Account type. Required for CAD and USD bank payouts"),
87
+ payId: z.string().optional().describe("PayID alias (AUD only). Requires payIdType"),
88
+ payIdType: z
89
+ .enum(["email", "phone", "abn", "org_id"])
90
+ .optional()
91
+ .describe("PayID alias type. Required when payId is given"),
92
+ swiftCode: z.string().optional().describe("SWIFT code"),
93
+ bicCode: z.string().optional().describe("BIC (EUR/GBP international)"),
19
94
  routingNumber: z.string().optional().describe("ABA routing number (US)"),
20
95
  sortCode: z.string().optional().describe("Sort code (UK)"),
21
96
  ifscCode: z.string().optional().describe("IFSC code (India)"),
22
97
  bsbCode: z.string().optional().describe("BSB code (Australia)"),
23
- metadata: z.record(z.string()).optional().describe("Optional metadata to attach to the transfer"),
24
- }, async ({ customerId, quoteId, accountHolderName, iban, accountNumber, bankName, bankCountry, bankCurrency, accountType, swiftCode, routingNumber, sortCode, ifscCode, bsbCode, metadata }) => {
98
+ bankCode: z.string().optional().describe("Bank code / institution number (CAD)"),
99
+ branchCode: z.string().optional().describe("Branch code / transit number (CAD)"),
100
+ cnaps: z.string().optional().describe("CNAPS (China)"),
101
+ destinationCurrency: z
102
+ .string()
103
+ .optional()
104
+ .describe("Stablecoin to deliver when destinationType is crypto (e.g. 'USDT')"),
105
+ destinationNetwork: z
106
+ .string()
107
+ .optional()
108
+ .describe("Blockchain network when destinationType is crypto (e.g. 'polygon')"),
109
+ destinationAddress: z
110
+ .string()
111
+ .optional()
112
+ .describe("Wallet address when destinationType is crypto"),
113
+ purposeCode: z
114
+ .string()
115
+ .optional()
116
+ .describe("Purpose of the transfer (e.g. 'SALARY'). Required on some corridors"),
117
+ metadata: z.record(z.string()).optional().describe("Optional metadata"),
118
+ }, async (input) => {
25
119
  try {
26
- // Build payment method if bank details provided
27
- const paymentMethod = accountHolderName ? {
28
- bankTransfer: {
29
- accountHolderName,
30
- ...(iban && { iban }),
31
- ...(accountNumber && { accountNumber }),
32
- bankName: bankName || "",
33
- bankCountry: bankCountry || "",
34
- currency: bankCurrency || "",
35
- ...(accountType && { accountType }),
36
- bankCodes: (swiftCode || routingNumber || sortCode || ifscCode || bsbCode) ? {
37
- ...(swiftCode && { swiftCode }),
38
- ...(routingNumber && { abaCode: routingNumber }),
39
- ...(sortCode && { sortCode }),
40
- ...(ifscCode && { ifscCode }),
41
- ...(bsbCode && { bsbCode }),
42
- } : undefined,
43
- },
44
- } : undefined;
120
+ let destination;
121
+ if (input.destinationType === "crypto") {
122
+ if (!input.destinationCurrency ||
123
+ !input.destinationNetwork ||
124
+ !input.destinationAddress) {
125
+ throw new Error("A crypto destination needs destinationCurrency, destinationNetwork and destinationAddress");
126
+ }
127
+ destination = {
128
+ type: "crypto",
129
+ currency: input.destinationCurrency,
130
+ network: input.destinationNetwork,
131
+ address: input.destinationAddress,
132
+ };
133
+ }
134
+ else {
135
+ if (!input.accountHolderName ||
136
+ !input.bankName ||
137
+ !input.bankCountry ||
138
+ !input.bankCurrency) {
139
+ throw new Error("A bank destination needs accountHolderName, bankName, bankCountry and bankCurrency");
140
+ }
141
+ // Sent only when complete. Each sub-field is validated separately, so
142
+ // half an address is rejected the same as none but is harder to debug.
143
+ const hasAddress = Boolean(input.addressStreet &&
144
+ input.addressCity &&
145
+ input.addressState &&
146
+ input.addressPostalCode &&
147
+ input.addressCountry);
148
+ destination = {
149
+ type: "bank",
150
+ account_holder_name: input.accountHolderName,
151
+ bank_name: input.bankName,
152
+ bank_country: input.bankCountry,
153
+ currency: input.bankCurrency,
154
+ ...(input.recipientType && { recipient_type: input.recipientType }),
155
+ ...(input.dateOfBirth && { date_of_birth: input.dateOfBirth }),
156
+ ...(hasAddress && {
157
+ address: {
158
+ street: input.addressStreet,
159
+ city: input.addressCity,
160
+ state: input.addressState,
161
+ postal_code: input.addressPostalCode,
162
+ country: input.addressCountry,
163
+ },
164
+ }),
165
+ ...(input.iban && { iban: input.iban }),
166
+ ...(input.accountNumber && { account_number: input.accountNumber }),
167
+ ...(input.accountType && { account_type: input.accountType }),
168
+ ...(input.payId && { pay_id: input.payId }),
169
+ ...(input.payIdType && { pay_id_type: input.payIdType }),
170
+ ...(input.swiftCode && { swift_code: input.swiftCode }),
171
+ ...(input.bicCode && { bic_code: input.bicCode }),
172
+ ...(input.routingNumber && { aba_code: input.routingNumber }),
173
+ ...(input.sortCode && { sort_code: input.sortCode }),
174
+ ...(input.ifscCode && { ifsc_code: input.ifscCode }),
175
+ ...(input.bsbCode && { bsb_code: input.bsbCode }),
176
+ ...(input.bankCode && { bank_code: input.bankCode }),
177
+ ...(input.branchCode && { branch_code: input.branchCode }),
178
+ ...(input.cnaps && { cnaps: input.cnaps }),
179
+ };
180
+ }
45
181
  const transfer = await client.createTransfer({
46
- customerId,
47
- quoteId,
48
- paymentMethod,
49
- metadata,
182
+ customer_id: input.customerId,
183
+ quote_id: input.quoteId,
184
+ destination,
185
+ ...(input.purposeCode && { purpose_code: input.purposeCode }),
186
+ ...(input.metadata && { metadata: input.metadata }),
50
187
  });
51
- const typeDisplay = transfer.type === "TRANSFER_TYPE_ONRAMP" ? "On-ramp (Fiat to Crypto)" : "Off-ramp (Crypto to Fiat)";
52
- let collectionInfo = "";
53
- if (transfer.collectionInstructions) {
54
- const ci = transfer.collectionInstructions;
55
- collectionInfo = `
56
- Collection Instructions (share with customer):
57
- Wallet Address: ${ci.walletAddress}
58
- Currency: ${ci.currency}
59
- Network: ${ci.network}
60
- Amount: ${ci.amount}
61
-
62
- The customer must send the specified amount to this wallet address. Once received, Stables will process the payout to the bank account.`;
63
- }
64
188
  return {
65
189
  content: [
66
190
  {
@@ -68,13 +192,13 @@ The customer must send the specified amount to this wallet address. Once receive
68
192
  text: `Transfer created successfully!
69
193
 
70
194
  Transfer ID: ${transfer.id}
71
- Type: ${typeDisplay}
195
+ Type: ${describeType(transfer.type)}
72
196
  Status: ${transfer.status}
73
- Customer ID: ${transfer.customerId}
74
- Quote ID: ${transfer.quoteId}
197
+ Customer ID: ${transfer.customer_id}
198
+ Quote ID: ${transfer.quote_id}
75
199
 
76
- Created: ${transfer.createdAt}
77
- ${collectionInfo}
200
+ Created: ${transfer.created_at}
201
+ ${depositBlock(transfer)}
78
202
 
79
203
  Use 'get_transfer' to check the status.`,
80
204
  },
@@ -83,7 +207,11 @@ Use 'get_transfer' to check the status.`,
83
207
  }
84
208
  catch (error) {
85
209
  const apiError = error;
86
- const details = apiError.errorBody ? `\nAPI Response: ${JSON.stringify(apiError.errorBody, null, 2)}` : "";
210
+ // The API returns a `fields` array on beneficiary validation failures;
211
+ // dumping the body keeps that detail instead of flattening it away.
212
+ const details = apiError.errorBody
213
+ ? `\nAPI Response: ${JSON.stringify(apiError.errorBody, null, 2)}`
214
+ : "";
87
215
  const status = apiError.statusCode ? ` (HTTP ${apiError.statusCode})` : "";
88
216
  return {
89
217
  content: [
@@ -102,50 +230,7 @@ Use 'get_transfer' to check the status.`,
102
230
  }, async ({ transferId }) => {
103
231
  try {
104
232
  const transfer = await client.getTransfer(transferId);
105
- const typeDisplay = transfer.type === "TRANSFER_TYPE_ONRAMP" ? "On-ramp (Fiat to Crypto)" : "Off-ramp (Crypto to Fiat)";
106
- let statusInfo = "";
107
- switch (transfer.status) {
108
- case "CREATED":
109
- statusInfo = "Transfer has been created and is awaiting processing.";
110
- break;
111
- case "COMPLIANCE_HOLD":
112
- statusInfo = "Transfer is on hold pending compliance review.";
113
- break;
114
- case "AWAITING_FUNDS_COLLECTION":
115
- statusInfo = "Waiting for the customer to send crypto funds.";
116
- break;
117
- case "FUNDS_COLLECTED":
118
- statusInfo = "Crypto funds have been received, payout is being prepared.";
119
- break;
120
- case "PAYMENT_SUBMITTED":
121
- statusInfo = "Bank payment has been submitted for processing.";
122
- break;
123
- case "PAYMENT_PROCESSED":
124
- statusInfo = "Bank payment has been processed successfully.";
125
- break;
126
- case "COMPLETED":
127
- statusInfo = "Transfer completed successfully!";
128
- break;
129
- case "FAILED":
130
- statusInfo = "Transfer failed. Check with support for details.";
131
- break;
132
- case "CANCELLED":
133
- statusInfo = "Transfer was cancelled.";
134
- break;
135
- case "EXPIRED":
136
- statusInfo = "Transfer expired before completion.";
137
- break;
138
- }
139
- let collectionInfo = "";
140
- if (transfer.collectionInstructions) {
141
- const ci = transfer.collectionInstructions;
142
- collectionInfo = `
143
- Collection Instructions:
144
- Wallet Address: ${ci.walletAddress}
145
- Currency: ${ci.currency}
146
- Network: ${ci.network}
147
- Amount: ${ci.amount}`;
148
- }
233
+ const statusInfo = STATUS_EXPLANATIONS[transfer.status] ?? "";
149
234
  return {
150
235
  content: [
151
236
  {
@@ -153,14 +238,14 @@ Collection Instructions:
153
238
  text: `Transfer Details:
154
239
 
155
240
  Transfer ID: ${transfer.id}
156
- Type: ${typeDisplay}
241
+ Type: ${describeType(transfer.type)}
157
242
  Status: ${transfer.status}
158
- Customer ID: ${transfer.customerId}
159
- Quote ID: ${transfer.quoteId}
243
+ Customer ID: ${transfer.customer_id}
244
+ Quote ID: ${transfer.quote_id}
160
245
 
161
- Created: ${transfer.createdAt}
162
- Updated: ${transfer.updatedAt}
163
- ${collectionInfo}
246
+ Created: ${transfer.created_at}
247
+ Updated: ${transfer.updated_at}
248
+ ${depositBlock(transfer)}
164
249
 
165
250
  ${statusInfo}`,
166
251
  },
@@ -181,10 +266,23 @@ ${statusInfo}`,
181
266
  });
182
267
  // List Transfers
183
268
  server.tool("list_transfers", "List transfers with optional filters for status, type, or customer", {
184
- status: z.enum(["CREATED", "COMPLIANCE_HOLD", "AWAITING_FUNDS_COLLECTION", "FUNDS_COLLECTED", "PAYMENT_SUBMITTED", "PAYMENT_PROCESSED", "COMPLETED", "FAILED", "CANCELLED", "EXPIRED"]).optional()
269
+ status: z
270
+ .enum([
271
+ "created",
272
+ "compliance_hold",
273
+ "awaiting_funds_collection",
274
+ "funds_collected",
275
+ "in_progress",
276
+ "payment_submitted",
277
+ "payment_processed",
278
+ "completed",
279
+ "failed",
280
+ "cancelled",
281
+ "expired",
282
+ ])
283
+ .optional()
185
284
  .describe("Filter by transfer status"),
186
- type: z.enum(["TRANSFER_TYPE_ONRAMP", "TRANSFER_TYPE_OFFRAMP"]).optional()
187
- .describe("Filter by transfer type"),
285
+ type: z.enum(["onramp", "offramp"]).optional().describe("Filter by transfer type"),
188
286
  customerId: z.string().optional().describe("Filter by customer ID"),
189
287
  pageSize: z.number().optional().describe("Number of transfers per page (default: 20)"),
190
288
  pageToken: z.string().optional().describe("Token for the next page of results"),
@@ -207,10 +305,12 @@ ${statusInfo}`,
207
305
  ],
208
306
  };
209
307
  }
210
- const transferList = response.transfers.map((t) => {
211
- const typeShort = t.type === "TRANSFER_TYPE_ONRAMP" ? "On-ramp" : "Off-ramp";
212
- return `- ${t.id}: ${typeShort} - ${t.status} (Customer: ${t.customerId})`;
213
- }).join("\n");
308
+ const transferList = response.transfers
309
+ .map((t) => {
310
+ const typeShort = t.type === "onramp" ? "On-ramp" : "Off-ramp";
311
+ return `- ${t.id}: ${typeShort} - ${t.status} (Customer: ${t.customer_id})`;
312
+ })
313
+ .join("\n");
214
314
  return {
215
315
  content: [
216
316
  {
@@ -218,7 +318,7 @@ ${statusInfo}`,
218
318
  text: `Transfers (${response.transfers.length} of ${response.page.total}):
219
319
 
220
320
  ${transferList}
221
- ${response.page.nextPageToken ? `\nMore results available. Use pageToken: "${response.page.nextPageToken}"` : ""}`,
321
+ ${response.page.next_page_token ? `\nMore results available. Use pageToken: "${response.page.next_page_token}"` : ""}`,
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2BAA2B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,QA2TtF"}
1
+ {"version":3,"file":"virtual-accounts.d.ts","sourceRoot":"","sources":["../../src/tools/virtual-accounts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,QAuTtF"}
@@ -7,15 +7,34 @@ export function registerVirtualAccountTools(server, client) {
7
7
  // Create Virtual Account
8
8
  server.tool("create_virtual_account", "Create a virtual bank account for a customer to receive fiat deposits. Deposits can automatically convert to crypto and payout to a wallet.", {
9
9
  customerId: z.string().describe("The customer ID to create the virtual account for"),
10
- sourceCurrency: z.string().describe("Currency for the virtual account (e.g., 'USD', 'EUR', 'GBP')"),
11
- depositHandlingMode: z.enum(["auto_payout", "hold", "manual"]).optional()
10
+ sourceCurrency: z
11
+ .string()
12
+ .describe("Currency for the virtual account (e.g., 'USD', 'EUR', 'GBP')"),
13
+ depositHandlingMode: z
14
+ .enum(["auto_payout", "hold", "manual"])
15
+ .optional()
12
16
  .describe("How to handle deposits: 'auto_payout' converts and sends to wallet, 'hold' keeps as fiat, 'manual' requires approval"),
13
17
  destinationAddress: z.string().optional().describe("Crypto wallet address for payouts"),
14
- destinationPaymentRail: z.enum(["arbitrum", "avalanche_c_chain", "base", "celo", "ethereum", "optimism", "polygon", "solana", "stellar", "tron"]).optional()
18
+ destinationPaymentRail: z
19
+ .enum([
20
+ "arbitrum",
21
+ "avalanche_c_chain",
22
+ "base",
23
+ "celo",
24
+ "ethereum",
25
+ "optimism",
26
+ "polygon",
27
+ "solana",
28
+ "stellar",
29
+ "tron",
30
+ ])
31
+ .optional()
15
32
  .describe("Blockchain network for the destination wallet"),
16
- destinationCurrency: z.enum(["usdc", "usdt", "dai", "pyusd", "eurc"]).optional()
33
+ destinationCurrency: z
34
+ .enum(["usdc", "usdt", "dai", "pyusd", "eurc"])
35
+ .optional()
17
36
  .describe("Stablecoin to receive (default: usdc)"),
18
- }, async ({ customerId, sourceCurrency, depositHandlingMode, destinationAddress, destinationPaymentRail, destinationCurrency }) => {
37
+ }, async ({ customerId, sourceCurrency, depositHandlingMode, destinationAddress, destinationPaymentRail, destinationCurrency, }) => {
19
38
  try {
20
39
  const request = {
21
40
  source: { currency: sourceCurrency },
@@ -89,7 +108,9 @@ Share the deposit instructions with the customer to receive funds.`,
89
108
  // List Virtual Accounts (by customer)
90
109
  server.tool("list_virtual_accounts", "List all virtual accounts for a customer", {
91
110
  customerId: z.string().describe("The customer ID to list virtual accounts for"),
92
- status: z.enum(["activated", "deactivated", "pending", "closed"]).optional()
111
+ status: z
112
+ .enum(["activated", "deactivated", "pending", "closed"])
113
+ .optional()
93
114
  .describe("Filter by account status"),
94
115
  limit: z.number().optional().describe("Maximum number of accounts to return"),
95
116
  }, async ({ customerId, status, limit }) => {
@@ -105,13 +126,17 @@ Share the deposit instructions with the customer to receive funds.`,
105
126
  ],
106
127
  };
107
128
  }
108
- const accountList = response.data.map((a) => {
129
+ const accountList = response.data
130
+ .map((a) => {
109
131
  const dest = a.destination
110
132
  ? `Payout: ${a.destination.address.slice(0, 10)}... (${a.destination.payment_rail})`
111
133
  : "No payout destination";
112
- const balance = a.held_balance ? ` | Balance: ${a.held_balance.amount} ${a.held_balance.currency}` : "";
134
+ const balance = a.held_balance
135
+ ? ` | Balance: ${a.held_balance.amount} ${a.held_balance.currency}`
136
+ : "";
113
137
  return `- ${a.id}: ${a.source_deposit_instructions.currency} (${a.status}) - ${dest}${balance}`;
114
- }).join("\n");
138
+ })
139
+ .join("\n");
115
140
  return {
116
141
  content: [
117
142
  {
@@ -139,7 +164,9 @@ ${accountList}`,
139
164
  server.tool("update_virtual_account", "Update virtual account settings (e.g., deposit handling mode)", {
140
165
  customerId: z.string().describe("The customer ID"),
141
166
  virtualAccountId: z.string().describe("The virtual account ID to update"),
142
- depositHandlingMode: z.enum(["auto_payout", "hold", "manual"]).describe("New deposit handling mode"),
167
+ depositHandlingMode: z
168
+ .enum(["auto_payout", "hold", "manual"])
169
+ .describe("New deposit handling mode"),
143
170
  }, async ({ customerId, virtualAccountId, depositHandlingMode }) => {
144
171
  try {
145
172
  const account = await client.updateVirtualAccount(customerId, virtualAccountId, {
@@ -168,68 +195,25 @@ Status: ${account.status}`,
168
195
  };
169
196
  }
170
197
  });
171
- // Deactivate Virtual Account
172
- server.tool("deactivate_virtual_account", "Deactivate a virtual account to prevent new incoming transactions", {
173
- customerId: z.string().describe("The customer ID"),
174
- virtualAccountId: z.string().describe("The virtual account ID to deactivate"),
175
- }, async ({ customerId, virtualAccountId }) => {
176
- try {
177
- const account = await client.deactivateVirtualAccount(customerId, virtualAccountId);
178
- return {
179
- content: [
180
- {
181
- type: "text",
182
- text: `Virtual account ${account.id} has been deactivated. No new deposits will be accepted.`,
183
- },
184
- ],
185
- };
186
- }
187
- catch (error) {
188
- return {
189
- content: [
190
- {
191
- type: "text",
192
- text: `Failed to deactivate virtual account: ${error instanceof Error ? error.message : "Unknown error"}`,
193
- },
194
- ],
195
- isError: true,
196
- };
197
- }
198
- });
199
- // Reactivate Virtual Account
200
- server.tool("reactivate_virtual_account", "Reactivate a previously deactivated virtual account", {
201
- customerId: z.string().describe("The customer ID"),
202
- virtualAccountId: z.string().describe("The virtual account ID to reactivate"),
203
- }, async ({ customerId, virtualAccountId }) => {
204
- try {
205
- const account = await client.reactivateVirtualAccount(customerId, virtualAccountId);
206
- return {
207
- content: [
208
- {
209
- type: "text",
210
- text: `Virtual account ${account.id} has been reactivated. Status: ${account.status}`,
211
- },
212
- ],
213
- };
214
- }
215
- catch (error) {
216
- return {
217
- content: [
218
- {
219
- type: "text",
220
- text: `Failed to reactivate virtual account: ${error instanceof Error ? error.message : "Unknown error"}`,
221
- },
222
- ],
223
- isError: true,
224
- };
225
- }
226
- });
227
198
  // Get Virtual Account History
228
199
  server.tool("get_virtual_account_history", "Get the activity history for a virtual account (deposits, payouts, etc.)", {
229
200
  customerId: z.string().describe("The customer ID"),
230
201
  virtualAccountId: z.string().describe("The virtual account ID"),
231
202
  limit: z.number().optional().describe("Maximum number of events to return (default: 10)"),
232
- eventType: z.enum(["funds_scheduled", "funds_received", "payment_submitted", "payment_processed", "in_review", "refund", "microdeposit", "account_update", "deactivation", "activation"]).optional()
203
+ eventType: z
204
+ .enum([
205
+ "funds_scheduled",
206
+ "funds_received",
207
+ "payment_submitted",
208
+ "payment_processed",
209
+ "in_review",
210
+ "refund",
211
+ "microdeposit",
212
+ "account_update",
213
+ "deactivation",
214
+ "activation",
215
+ ])
216
+ .optional()
233
217
  .describe("Filter by event type"),
234
218
  }, async ({ customerId, virtualAccountId, limit, eventType: _eventType }) => {
235
219
  try {
@@ -246,9 +230,11 @@ Status: ${account.status}`,
246
230
  ],
247
231
  };
248
232
  }
249
- const eventList = response.data.map((e) => {
233
+ const eventList = response.data
234
+ .map((e) => {
250
235
  return `- ${e.created_at}: ${e.type} - ${e.amount} ${e.currency}${e.deposit_id ? ` (Deposit: ${e.deposit_id})` : ""}`;
251
- }).join("\n");
236
+ })
237
+ .join("\n");
252
238
  return {
253
239
  content: [
254
240
  {