stables-mcp-server 1.4.0 → 2.1.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 +70 -48
  2. package/build/index.js +3 -3
  3. package/build/index.js.map +1 -1
  4. package/build/lib/stables-client.d.ts +313 -136
  5. package/build/lib/stables-client.d.ts.map +1 -1
  6. package/build/lib/stables-client.js +107 -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/quotes.d.ts +5 -1
  15. package/build/tools/quotes.d.ts.map +1 -1
  16. package/build/tools/quotes.js +103 -59
  17. package/build/tools/quotes.js.map +1 -1
  18. package/build/tools/sandbox.d.ts +11 -0
  19. package/build/tools/sandbox.d.ts.map +1 -0
  20. package/build/tools/sandbox.js +78 -0
  21. package/build/tools/sandbox.js.map +1 -0
  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 +127 -84
  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 +98 -24
  31. package/build/tools/webhooks.js.map +1 -1
  32. package/package.json +12 -4
  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
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Stables MCP Server
2
2
 
3
- An MCP (Model Context Protocol) server that exposes the Stables fiat-to-crypto API to AI agents. This allows AI assistants like Claude, ChatGPT, and others to manage customers, create quotes, execute transfers, and handle virtual accounts programmatically.
3
+ An MCP (Model Context Protocol) server that exposes the Stables fiat-to-crypto API to AI agents. This allows AI assistants like Claude, ChatGPT, Cursor, Codex, and other MCP-compatible clients to manage customers, create USDC and USDT quotes, execute approved transfers, and handle virtual accounts programmatically.
4
+
5
+ Use it to build stablecoin payment workflows for AI agents and agentic commerce: payouts, virtual account deposits, treasury movement, fiat off-ramping, and webhook reconciliation.
4
6
 
5
7
  ## What is MCP?
6
8
 
@@ -8,7 +10,7 @@ MCP (Model Context Protocol) is an open standard that provides a standardized wa
8
10
 
9
11
  ## Features
10
12
 
11
- This MCP server provides 25 tools across 7 categories:
13
+ This MCP server provides 26 tools across 7 categories:
12
14
 
13
15
  ### Customer Management
14
16
  - `create_customer` - Create individual or business customers
@@ -31,9 +33,12 @@ This MCP server provides 25 tools across 7 categories:
31
33
  - `create_virtual_account` - Create virtual bank accounts for fiat deposits
32
34
  - `list_virtual_accounts` - List virtual accounts for a customer
33
35
  - `update_virtual_account` - Update virtual account settings
34
- - `deactivate_virtual_account` - Deactivate a virtual account
35
- - `reactivate_virtual_account` - Reactivate a deactivated virtual account
36
- - `get_virtual_account_history` - Get activity history for a virtual account
36
+ - `get_virtual_account_history` - Get deposits and their payouts for a payment route
37
+ - `update_route_destination` - Change the payout wallet on an existing route
38
+
39
+ ### Sandbox
40
+ - `simulate_route_deposit` - Simulate a fiat deposit into a payment route (sandbox only)
41
+ - `simulate_transfer_deposit` - Simulate the inbound crypto an off-ramp transfer awaits (sandbox only)
37
42
 
38
43
  ### API Keys
39
44
  - `create_api_key` - Create a new API key
@@ -45,9 +50,7 @@ This MCP server provides 25 tools across 7 categories:
45
50
  - `create_webhook` - Subscribe to events via webhook
46
51
  - `list_webhooks` - List all webhook subscriptions
47
52
  - `delete_webhook` - Delete a webhook subscription
48
-
49
- ### Notifications
50
- - `send_verification_sms` - Send a KYC verification link to a customer via SMS (requires Twilio)
53
+ - `list_webhook_deliveries` - Recent delivery attempts, status codes and retry state
51
54
 
52
55
  ## Installation
53
56
 
@@ -69,10 +72,26 @@ The server requires the following environment variables:
69
72
  | Variable | Required | Description |
70
73
  |----------|----------|-------------|
71
74
  | `STABLES_API_KEY` | Yes | Your Stables API key |
72
- | `STABLES_API_URL` | No | API base URL (default: `https://api.sandbox.stables.money`). Must use HTTPS. |
73
- | `TWILIO_ACCOUNT_SID` | No | Twilio Account SID (required for `send_verification_sms`) |
74
- | `TWILIO_AUTH_TOKEN` | No | Twilio Auth Token (required for `send_verification_sms`) |
75
- | `TWILIO_PHONE_NUMBER` | No | Twilio phone number to send from (required for `send_verification_sms`) |
75
+ | `STABLES_API_URL` | No | API base URL. Defaults to the environment your key belongs to (see below). Must use HTTPS. |
76
+
77
+ ### Which environment you're talking to
78
+
79
+ Stables keys carry their environment: `sti_test_…` is a sandbox key, `sti_live_…`
80
+ is a production key, and the API refuses a key that arrives at the wrong
81
+ environment. So you don't have to set a URL — leave `STABLES_API_URL` unset and
82
+ the key decides:
83
+
84
+ | Your key | Where requests go |
85
+ |----------|-------------------|
86
+ | `sti_test_…` | `https://api.sandbox.stables.money` |
87
+ | `sti_live_…` | `https://api.stables.money` — **real money** |
88
+ | `sti_local_…` or anything else | production, unless you set `STABLES_API_URL` |
89
+
90
+ Setting `STABLES_API_URL` always wins, which is how you reach staging, dev or a
91
+ local deployment.
92
+
93
+ **Start with a sandbox key.** An agent holding a live key can move real money on
94
+ your behalf; see [agent safety](https://docs.stables.money/get-started/getting-started/quickstart/building-with-ai/agent-safety).
76
95
 
77
96
  ## Usage
78
97
 
@@ -97,6 +116,29 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
97
116
 
98
117
  Then restart Claude Desktop.
99
118
 
119
+ ### With Cursor, Codex, ChatGPT, or another MCP client
120
+
121
+ Use the same command and environment variables in any MCP-compatible client:
122
+
123
+ ```json
124
+ {
125
+ "mcpServers": {
126
+ "stables": {
127
+ "command": "npx",
128
+ "args": ["stables-mcp-server"],
129
+ "env": {
130
+ "STABLES_API_KEY": "your-api-key",
131
+ "STABLES_API_URL": "https://api.sandbox.stables.money"
132
+ }
133
+ }
134
+ }
135
+ }
136
+ ```
137
+
138
+ ## Agent safety
139
+
140
+ Stables is financial infrastructure. Agents should create quotes, prepare payment objects, and reconcile webhooks, but should require explicit human approval before creating transfers or other money movement. Check customer KYC/KYB status and entitlements before transactional actions, and treat sanctions, unsupported jurisdiction, verification, or compliance failures as hard stops.
141
+
100
142
  ### With MCP Inspector (for testing)
101
143
 
102
144
  ```bash
@@ -118,11 +160,11 @@ STABLES_API_KEY=your-api-key node build/index.js
118
160
 
119
161
  ### Creating a customer and getting a quote
120
162
 
121
- **User:** "Create a customer for john@example.com and get a quote to convert 1000 USDC to EUR"
163
+ **User:** "Create a customer for john@example.com and get a quote to convert 1000 USDT to EUR"
122
164
 
123
165
  **AI (using MCP tools):**
124
166
  1. Calls `create_customer` with email and type
125
- 2. Calls `create_quote` with USDC, amount, EUR destination, network, country, and payment method
167
+ 2. Calls `create_quote` with source USDT + network, destination EUR + country, and `destinationNetwork` (`swift` or `bank`)
126
168
  3. Returns customer details and quote information
127
169
 
128
170
  ### Checking transfer status
@@ -130,16 +172,24 @@ STABLES_API_KEY=your-api-key node build/index.js
130
172
  **User:** "What's the status of all my pending transfers?"
131
173
 
132
174
  **AI (using MCP tools):**
133
- 1. Calls `list_transfers` with `status=PENDING`
134
- 2. Returns formatted list of pending transfers
175
+ 1. Calls `list_transfers` with `status=created` or `status=in_progress` (statuses are lowercase)
176
+ 2. Returns a formatted list of in-flight transfers
135
177
 
136
178
  ### Setting up auto-payout
137
179
 
138
- **User:** "Create a virtual USD account for customer abc123 that auto-pays to my Polygon USDC wallet 0x..."
180
+ **User:** "Create a payment route for customer abc123 that pays AUD deposits out to my Polygon USDT wallet 0x..."
181
+
182
+ **AI (using MCP tools):**
183
+ 1. Calls `create_virtual_account` with the customer ID, AUD source currency, and the Polygon destination (the payout address is mandatory)
184
+ 2. Returns the deposit instructions to share with the customer
185
+
186
+ ### Paying out to a European beneficiary
187
+
188
+ **User:** "Pay 500 EUR to this German bank account"
139
189
 
140
190
  **AI (using MCP tools):**
141
- 1. Calls `create_virtual_account` with customer ID, USD currency, and Polygon destination
142
- 2. Returns virtual account details with deposit instructions
191
+ 1. Collects the extra beneficiary details EUR requires — `recipientType`, a full address, and `dateOfBirth` for individuals — before doing anything else
192
+ 2. Calls `create_quote`, then `create_transfer` once a human approves
143
193
 
144
194
  ## Development
145
195
 
@@ -179,7 +229,7 @@ stables-mcp-server/
179
229
  │ ├── virtual-accounts.ts # Virtual account tools (6)
180
230
  │ ├── api-keys.ts # API key tools (4)
181
231
  │ ├── webhooks.ts # Webhook tools (3)
182
- │ └── notifications.ts # Notification tools (1)
232
+ │ └── sandbox.ts # Sandbox deposit simulation (2)
183
233
  ├── package.json
184
234
  ├── tsconfig.json
185
235
  ├── vitest.config.ts
@@ -336,22 +386,6 @@ Update virtual account settings.
336
386
  | virtualAccountId | string | Yes | Virtual account ID |
337
387
  | depositHandlingMode | string | Yes | New deposit handling mode |
338
388
 
339
- #### deactivate_virtual_account
340
- Deactivate a virtual account to prevent new deposits.
341
-
342
- | Parameter | Type | Required | Description |
343
- |-----------|------|----------|-------------|
344
- | customerId | string | Yes | Customer ID |
345
- | virtualAccountId | string | Yes | Virtual account ID |
346
-
347
- #### reactivate_virtual_account
348
- Reactivate a previously deactivated virtual account.
349
-
350
- | Parameter | Type | Required | Description |
351
- |-----------|------|----------|-------------|
352
- | customerId | string | Yes | Customer ID |
353
- | virtualAccountId | string | Yes | Virtual account ID |
354
-
355
389
  #### get_virtual_account_history
356
390
  Get activity history for a virtual account.
357
391
 
@@ -429,18 +463,6 @@ Delete a webhook subscription.
429
463
  |-----------|------|----------|-------------|
430
464
  | webhookId | string | Yes | Webhook subscription ID |
431
465
 
432
- ### Notification Tools
433
-
434
- #### send_verification_sms
435
- Send a KYC verification link to a customer via SMS. Requires Twilio environment variables.
436
-
437
- | Parameter | Type | Required | Description |
438
- |-----------|------|----------|-------------|
439
- | customerId | string | Yes | Customer ID to send verification to |
440
- | phone | string | No | Override phone number (uses customer's phone if not provided) |
441
- | botName | string | No | Name of the assistant sending the message |
442
- | verificationLinkTtlSecs | number | No | Verification link expiry in seconds (default: 1800) |
443
-
444
466
  ## Security
445
467
 
446
468
  - API keys are only read from environment variables
package/build/index.js CHANGED
@@ -32,7 +32,7 @@ import { registerTransferTools } from "./tools/transfers.js";
32
32
  import { registerVirtualAccountTools } from "./tools/virtual-accounts.js";
33
33
  import { registerApiKeyTools } from "./tools/api-keys.js";
34
34
  import { registerWebhookTools } from "./tools/webhooks.js";
35
- import { registerNotificationTools } from "./tools/notifications.js";
35
+ import { registerSandboxTools } from "./tools/sandbox.js";
36
36
  // Validate environment
37
37
  const apiKey = process.env.STABLES_API_KEY;
38
38
  if (!apiKey) {
@@ -43,7 +43,7 @@ if (!apiKey) {
43
43
  // Create the MCP server
44
44
  const server = new McpServer({
45
45
  name: "stables-mcp-server",
46
- version: "1.2.0",
46
+ version: "2.1.0",
47
47
  description: "Stables fiat-to-crypto API for AI agents - manage customers, quotes, transfers, and virtual accounts",
48
48
  });
49
49
  // Create the Stables API client
@@ -55,7 +55,7 @@ registerTransferTools(server, stablesClient);
55
55
  registerVirtualAccountTools(server, stablesClient);
56
56
  registerApiKeyTools(server, stablesClient);
57
57
  registerWebhookTools(server, stablesClient);
58
- registerNotificationTools(server, stablesClient);
58
+ registerSandboxTools(server, stablesClient);
59
59
  // Start the server with STDIO transport
60
60
  async function main() {
61
61
  const transport = new StdioServerTransport();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,E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