@moneygraph/mcp-server 1.1.1 → 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.
- package/README.md +74 -181
- package/bin/mcp-http.js +6 -8
- package/bin/mcp-server.js +3 -4
- package/package.json +23 -58
- package/src/config.js +50 -0
- package/src/http.js +32 -0
- package/src/index.js +20 -0
- package/src/prompts.js +80 -0
- package/src/resources.js +54 -0
- package/src/server.js +36 -0
- package/src/tools.js +250 -0
- package/dist/config.d.ts +0 -28
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -52
- package/dist/config.js.map +0 -1
- package/dist/http.d.ts +0 -15
- package/dist/http.d.ts.map +0 -1
- package/dist/http.js +0 -104
- package/dist/http.js.map +0 -1
- package/dist/index.d.ts +0 -18
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -164
- package/dist/index.js.map +0 -1
- package/dist/prompts/check-rates.d.ts +0 -6
- package/dist/prompts/check-rates.d.ts.map +0 -1
- package/dist/prompts/check-rates.js +0 -29
- package/dist/prompts/check-rates.js.map +0 -1
- package/dist/prompts/crypto-deposit.d.ts +0 -6
- package/dist/prompts/crypto-deposit.d.ts.map +0 -1
- package/dist/prompts/crypto-deposit.js +0 -36
- package/dist/prompts/crypto-deposit.js.map +0 -1
- package/dist/prompts/issue-card.d.ts +0 -6
- package/dist/prompts/issue-card.d.ts.map +0 -1
- package/dist/prompts/issue-card.js +0 -33
- package/dist/prompts/issue-card.js.map +0 -1
- package/dist/prompts/onboard-customer.d.ts +0 -6
- package/dist/prompts/onboard-customer.d.ts.map +0 -1
- package/dist/prompts/onboard-customer.js +0 -31
- package/dist/prompts/onboard-customer.js.map +0 -1
- package/dist/prompts/payout-status.d.ts +0 -6
- package/dist/prompts/payout-status.d.ts.map +0 -1
- package/dist/prompts/payout-status.js +0 -29
- package/dist/prompts/payout-status.js.map +0 -1
- package/dist/prompts/send-money.d.ts +0 -6
- package/dist/prompts/send-money.d.ts.map +0 -1
- package/dist/prompts/send-money.js +0 -34
- package/dist/prompts/send-money.js.map +0 -1
- package/dist/resources/corridors.d.ts +0 -8
- package/dist/resources/corridors.d.ts.map +0 -1
- package/dist/resources/corridors.js +0 -137
- package/dist/resources/corridors.js.map +0 -1
- package/dist/resources/status.d.ts +0 -7
- package/dist/resources/status.d.ts.map +0 -1
- package/dist/resources/status.js +0 -32
- package/dist/resources/status.js.map +0 -1
- package/dist/resources/wallets.d.ts +0 -7
- package/dist/resources/wallets.d.ts.map +0 -1
- package/dist/resources/wallets.js +0 -37
- package/dist/resources/wallets.js.map +0 -1
- package/dist/tools/cards.d.ts +0 -10
- package/dist/tools/cards.d.ts.map +0 -1
- package/dist/tools/cards.js +0 -229
- package/dist/tools/cards.js.map +0 -1
- package/dist/tools/crypto.d.ts +0 -10
- package/dist/tools/crypto.d.ts.map +0 -1
- package/dist/tools/crypto.js +0 -265
- package/dist/tools/crypto.js.map +0 -1
- package/dist/tools/currencies.d.ts +0 -10
- package/dist/tools/currencies.d.ts.map +0 -1
- package/dist/tools/currencies.js +0 -137
- package/dist/tools/currencies.js.map +0 -1
- package/dist/tools/customers.d.ts +0 -7
- package/dist/tools/customers.d.ts.map +0 -1
- package/dist/tools/customers.js +0 -311
- package/dist/tools/customers.js.map +0 -1
- package/dist/tools/directors.d.ts +0 -7
- package/dist/tools/directors.d.ts.map +0 -1
- package/dist/tools/directors.js +0 -148
- package/dist/tools/directors.js.map +0 -1
- package/dist/tools/fx.d.ts +0 -10
- package/dist/tools/fx.d.ts.map +0 -1
- package/dist/tools/fx.js +0 -193
- package/dist/tools/fx.js.map +0 -1
- package/dist/tools/ledger.d.ts +0 -7
- package/dist/tools/ledger.d.ts.map +0 -1
- package/dist/tools/ledger.js +0 -101
- package/dist/tools/ledger.js.map +0 -1
- package/dist/tools/payments.d.ts +0 -7
- package/dist/tools/payments.d.ts.map +0 -1
- package/dist/tools/payments.js +0 -93
- package/dist/tools/payments.js.map +0 -1
- package/dist/tools/payouts.d.ts +0 -10
- package/dist/tools/payouts.d.ts.map +0 -1
- package/dist/tools/payouts.js +0 -352
- package/dist/tools/payouts.js.map +0 -1
- package/dist/tools/recipients.d.ts +0 -7
- package/dist/tools/recipients.d.ts.map +0 -1
- package/dist/tools/recipients.js +0 -150
- package/dist/tools/recipients.js.map +0 -1
- package/dist/tools/recurring.d.ts +0 -7
- package/dist/tools/recurring.d.ts.map +0 -1
- package/dist/tools/recurring.js +0 -94
- package/dist/tools/recurring.js.map +0 -1
- package/dist/tools/reference.d.ts +0 -7
- package/dist/tools/reference.d.ts.map +0 -1
- package/dist/tools/reference.js +0 -83
- package/dist/tools/reference.js.map +0 -1
- package/dist/tools/transactions.d.ts +0 -7
- package/dist/tools/transactions.d.ts.map +0 -1
- package/dist/tools/transactions.js +0 -88
- package/dist/tools/transactions.js.map +0 -1
- package/dist/tools/wallets.d.ts +0 -7
- package/dist/tools/wallets.d.ts.map +0 -1
- package/dist/tools/wallets.js +0 -129
- package/dist/tools/wallets.js.map +0 -1
- package/scripts/patch-sdk.mjs +0 -32
package/README.md
CHANGED
|
@@ -1,42 +1,48 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @moneygraph/mcp-server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MCP server for the [MoneyGraph API](https://app.moneygraph.ai/docs/guide/introduction). Lets Claude, Cursor, Windsurf, VS Code, Cline, and any MCP client call cross-border payouts, FX swaps, virtual cards, virtual accounts, invoices, and payment collection as native tools.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Wraps `@moneygraph/sdk` v4+. All requests are HMAC-signed with per-request idempotency keys. One base URL for test and live — the key ID decides the mode.
|
|
6
6
|
|
|
7
|
+
- **40+ tools** covering the full API, plus an `mg_request` escape hatch
|
|
8
|
+
- **4 live-state resources** (assets, countries, transfer purposes, customers)
|
|
9
|
+
- **6 flow prompts** (send_money, onboard_customer, check_corridor, track_payout, issue_card, collect_payment)
|
|
10
|
+
- stdio and HTTP transports
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install -g @moneygraph/mcp-server
|
|
7
16
|
```
|
|
8
|
-
|
|
17
|
+
|
|
18
|
+
Or run on demand with `npx`:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx -y @moneygraph/mcp-server
|
|
9
22
|
```
|
|
10
23
|
|
|
11
|
-
|
|
24
|
+
Requires Node.js 18+.
|
|
12
25
|
|
|
13
|
-
|
|
26
|
+
## Configuration
|
|
14
27
|
|
|
15
|
-
|
|
28
|
+
Create a key in the dashboard: https://app.moneygraph.ai → **Developers → API keys**. Set:
|
|
16
29
|
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"moneygraph": {
|
|
21
|
-
"command": "npx",
|
|
22
|
-
"args": ["-y", "@moneygraph/mcp-server"],
|
|
23
|
-
"env": {
|
|
24
|
-
"MONEYGRAPH_API_KEY": "sk_sandbox_demo"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
30
|
+
```bash
|
|
31
|
+
export MG_KEY_ID=kid_...
|
|
32
|
+
export MG_SECRET=... # 64 chars, shown once at creation
|
|
29
33
|
```
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
Optional:
|
|
32
36
|
|
|
33
37
|
```bash
|
|
34
|
-
|
|
38
|
+
export MG_BASE_URL=https://app.moneygraph.ai/api/v1 # default
|
|
39
|
+
export MONEYGRAPH_TRANSPORT=http # default: stdio
|
|
40
|
+
export PORT=3200 # HTTP mode only
|
|
35
41
|
```
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
## Use with Claude Desktop
|
|
38
44
|
|
|
39
|
-
Add to
|
|
45
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
40
46
|
|
|
41
47
|
```json
|
|
42
48
|
{
|
|
@@ -45,179 +51,66 @@ Add to `.cursor/mcp.json`:
|
|
|
45
51
|
"command": "npx",
|
|
46
52
|
"args": ["-y", "@moneygraph/mcp-server"],
|
|
47
53
|
"env": {
|
|
48
|
-
"
|
|
54
|
+
"MG_KEY_ID": "kid_...",
|
|
55
|
+
"MG_SECRET": "..."
|
|
49
56
|
}
|
|
50
57
|
}
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
60
|
```
|
|
54
61
|
|
|
55
|
-
|
|
62
|
+
Restart Claude Desktop. The `send_money`, `onboard_customer`, and `collect_payment` prompts appear in the + menu.
|
|
56
63
|
|
|
57
|
-
|
|
64
|
+
## Use with Cursor / VS Code / Windsurf / Cline
|
|
58
65
|
|
|
59
|
-
|
|
60
|
-
{
|
|
61
|
-
"mcp.servers": {
|
|
62
|
-
"moneygraph": {
|
|
63
|
-
"command": "npx",
|
|
64
|
-
"args": ["-y", "@moneygraph/mcp-server"],
|
|
65
|
-
"env": {
|
|
66
|
-
"MONEYGRAPH_API_KEY": "sk_sandbox_demo"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Demo
|
|
74
|
-
|
|
75
|
-
> **You:** Send $500 to Friday Okoro at GTBank Nigeria, account 0123456789
|
|
76
|
-
|
|
77
|
-
> **Claude:**
|
|
78
|
-
> 1. Looked up USD→NGN corridor — rate: 1,580.50, fee: 1.5%
|
|
79
|
-
> 2. Created recipient at GTBank (SWIFT: GTBINGLA)
|
|
80
|
-
> 3. Created payout for 50000 minor units ($500.00)
|
|
81
|
-
> 4. ✅ Transaction `txn_abc123` — estimated delivery: 1-2 business days
|
|
82
|
-
|
|
83
|
-
All without writing a single line of code.
|
|
84
|
-
|
|
85
|
-
## Tools (45)
|
|
86
|
-
|
|
87
|
-
### Customers
|
|
88
|
-
| Tool | Description |
|
|
89
|
-
|------|-------------|
|
|
90
|
-
| `create_customer` | Create a personal customer |
|
|
91
|
-
| `create_business_customer` | Create a business customer with company details |
|
|
92
|
-
| `get_customer` | Get customer details by ID |
|
|
93
|
-
| `list_customers` | List all customers |
|
|
94
|
-
| `update_customer` | Update customer KYC data |
|
|
95
|
-
| `submit_kyc` | Submit KYC for review (auto-approves in sandbox) |
|
|
96
|
-
| `get_customer_wallets` | Get wallets for a customer |
|
|
97
|
-
|
|
98
|
-
### Directors (KYB)
|
|
99
|
-
| Tool | Description |
|
|
100
|
-
|------|-------------|
|
|
101
|
-
| `create_director` | Add a director to a business customer |
|
|
102
|
-
| `list_directors` | List directors for a customer |
|
|
103
|
-
| `delete_director` | Remove a director |
|
|
104
|
-
|
|
105
|
-
### Currencies & Rates
|
|
106
|
-
| Tool | Description |
|
|
107
|
-
|------|-------------|
|
|
108
|
-
| `get_currencies` | **THE critical tool** — returns FX rates, corridor UUIDs, delivery windows, fees, limits |
|
|
109
|
-
| `list_countries` | List all supported countries |
|
|
110
|
-
|
|
111
|
-
### Recipients
|
|
112
|
-
| Tool | Description |
|
|
113
|
-
|------|-------------|
|
|
114
|
-
| `create_recipient` | Create a payment recipient |
|
|
115
|
-
| `list_recipients` | List all recipients |
|
|
116
|
-
| `get_recipient` | Get recipient details |
|
|
117
|
-
| `update_recipient` | Update recipient |
|
|
118
|
-
| `delete_recipient` | Delete recipient |
|
|
119
|
-
|
|
120
|
-
### Payouts
|
|
121
|
-
| Tool | Description |
|
|
122
|
-
|------|-------------|
|
|
123
|
-
| `create_payout` | Create a payout to an existing recipient |
|
|
124
|
-
| `send_bank_payout` | **HERO** — one-call bank transfer (creates recipient + payout) |
|
|
125
|
-
| `send_mobile_money_payout` | **HERO** — one-call mobile money transfer |
|
|
126
|
-
| `simulate_payout_success` | Sandbox: mark payout as successful |
|
|
127
|
-
| `simulate_payout_decline` | Sandbox: mark payout as declined |
|
|
128
|
-
| `verify_bank` | Verify a bank by routing code |
|
|
129
|
-
|
|
130
|
-
### Wallets
|
|
131
|
-
| Tool | Description |
|
|
132
|
-
|------|-------------|
|
|
133
|
-
| `list_wallets` | List merchant wallets with balances |
|
|
134
|
-
| `swap_funds` | Swap currency between wallets |
|
|
135
|
-
| `transfer_to_customer` | Fund a customer wallet |
|
|
136
|
-
| `transfer_from_customer` | Pull funds from customer |
|
|
137
|
-
|
|
138
|
-
### Payments
|
|
139
|
-
| Tool | Description |
|
|
140
|
-
|------|-------------|
|
|
141
|
-
| `initiate_payment` | Start collecting a payment (returns checkout URL) |
|
|
142
|
-
| `verify_payment` | Check payment status |
|
|
143
|
-
|
|
144
|
-
### Recurring Plans
|
|
145
|
-
| Tool | Description |
|
|
146
|
-
|------|-------------|
|
|
147
|
-
| `create_plan` | Create a recurring payment plan |
|
|
148
|
-
| `list_plans` | List all plans |
|
|
149
|
-
| `get_plan` | Get plan details |
|
|
150
|
-
| `update_plan` | Update a plan |
|
|
151
|
-
| `delete_plan` | Delete a plan |
|
|
152
|
-
|
|
153
|
-
### Transactions
|
|
154
|
-
| Tool | Description |
|
|
155
|
-
|------|-------------|
|
|
156
|
-
| `list_transactions` | List all transactions |
|
|
157
|
-
| `get_transaction` | Get transaction details |
|
|
158
|
-
| `get_wallet_transactions` | Get transactions for a wallet |
|
|
159
|
-
|
|
160
|
-
### Reference Data
|
|
161
|
-
| Tool | Description |
|
|
162
|
-
|------|-------------|
|
|
163
|
-
| `list_transfer_purposes` | Transfer purpose codes |
|
|
164
|
-
| `list_source_of_funds` | Source of funds options |
|
|
165
|
-
| `list_mcc_codes` | MCC codes for businesses |
|
|
166
|
-
| `list_business_registration_types` | Business registration types |
|
|
167
|
-
| `list_mobile_networks` | Mobile money networks by country |
|
|
168
|
-
| `list_cash_pickup_agents` | Cash pickup agents by country |
|
|
169
|
-
|
|
170
|
-
### Blockchain Ledger
|
|
171
|
-
| Tool | Description |
|
|
172
|
-
|------|-------------|
|
|
173
|
-
| `create_ledger_entity` | Create an on-chain audit entity |
|
|
174
|
-
| `get_ledger_entity` | Get entity details |
|
|
175
|
-
| `ledger_credit` | Credit an entity |
|
|
176
|
-
| `ledger_debit` | Debit an entity |
|
|
177
|
-
| `ledger_transfer` | Transfer between entities |
|
|
178
|
-
|
|
179
|
-
## Resources (6)
|
|
180
|
-
|
|
181
|
-
| URI | Description |
|
|
182
|
-
|-----|-------------|
|
|
183
|
-
| `moneygraph://status` | Server mode, API health, rate limits |
|
|
184
|
-
| `moneygraph://wallets` | Live wallet balances (USD, GBP, EUR, CAD) |
|
|
185
|
-
| `moneygraph://rates/{base}` | All FX rates from a base currency |
|
|
186
|
-
| `moneygraph://rates/{from}/{to}` | Specific corridor rate |
|
|
187
|
-
| `moneygraph://corridors/{base}` | Remittance corridors with UUIDs |
|
|
188
|
-
| `moneygraph://delivery-windows/{currency}` | Delivery windows and speeds |
|
|
189
|
-
|
|
190
|
-
## Prompts (4)
|
|
191
|
-
|
|
192
|
-
| Prompt | Description |
|
|
193
|
-
|--------|-------------|
|
|
194
|
-
| `send-money` | Guided cross-border payment flow |
|
|
195
|
-
| `onboard-customer` | Customer creation + KYC walkthrough |
|
|
196
|
-
| `check-rates` | FX rate comparison |
|
|
197
|
-
| `track-payout` | Payout status check |
|
|
66
|
+
The same block goes into each client's `mcp` config. See each client's docs.
|
|
198
67
|
|
|
199
|
-
##
|
|
200
|
-
|
|
201
|
-
| Variable | Description | Default |
|
|
202
|
-
|----------|-------------|---------|
|
|
203
|
-
| `MONEYGRAPH_API_KEY` | Your MoneyGraph API key | Sandbox mode |
|
|
68
|
+
## HTTP mode
|
|
204
69
|
|
|
205
|
-
|
|
206
|
-
- `sk_live_*` → Production mode (real money, real compliance, 30 req/min)
|
|
70
|
+
For web clients or hosted deployments:
|
|
207
71
|
|
|
208
|
-
|
|
72
|
+
```bash
|
|
73
|
+
MONEYGRAPH_TRANSPORT=http MG_KEY_ID=... MG_SECRET=... moneygraph-mcp-http
|
|
74
|
+
# → MoneyGraph MCP server listening on http://0.0.0.0:3200/mcp
|
|
75
|
+
```
|
|
209
76
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
77
|
+
Deploy to Railway, Fly, Render — the included `railway.json` has defaults.
|
|
78
|
+
|
|
79
|
+
## Tool index
|
|
80
|
+
|
|
81
|
+
| Category | Tools |
|
|
82
|
+
|---|---|
|
|
83
|
+
| Lookups | `mg_list_countries`, `mg_list_assets`, `mg_list_mccs`, `mg_list_source_of_funds`, `mg_list_business_registration_types`, `mg_list_transfer_purposes` |
|
|
84
|
+
| Customers | `mg_create_customer`, `mg_list_customers`, `mg_get_customer`, `mg_get_customer_assets`, `mg_generate_kyc_link`, `mg_submit_kyc` |
|
|
85
|
+
| Counterparties | `mg_create_counterparty`, `mg_list_counterparties`, `mg_get_counterparty`, `mg_delete_counterparty` |
|
|
86
|
+
| Files | `mg_create_file`, `mg_list_files`, `mg_get_file` |
|
|
87
|
+
| Quotes & payouts | `mg_create_quote`, `mg_fund_quote`, `mg_list_quotes`, `mg_get_quote` |
|
|
88
|
+
| Transfers | `mg_transfer_asset` |
|
|
89
|
+
| Transactions | `mg_list_transactions`, `mg_get_transaction` |
|
|
90
|
+
| Virtual accounts | `mg_create_virtual_account`, `mg_list_virtual_accounts`, `mg_get_virtual_account` |
|
|
91
|
+
| Crypto wallets | `mg_create_crypto_wallet`, `mg_list_crypto_wallets`, `mg_get_crypto_wallet` |
|
|
92
|
+
| Cards | `mg_create_cardholder`, `mg_create_card`, `mg_list_cards`, `mg_get_card`, `mg_fund_card`, `mg_withdraw_card`, `mg_activate_card`, `mg_deactivate_card`, `mg_fetch_card_balance` |
|
|
93
|
+
| Payment collection | `mg_create_payment_session`, `mg_verify_payment` |
|
|
94
|
+
| Invoices | `mg_create_invoice`, `mg_list_invoices`, `mg_get_invoice`, `mg_create_invoice_recipient`, `mg_list_invoice_recipients` |
|
|
95
|
+
| Test simulators (test keys only) | `mg_test_approve_kyc`, `mg_test_approve_cardholder`, `mg_test_approve_virtual_account_holder`, `mg_test_payout_success`, `mg_test_payout_decline`, `mg_test_swap_success`, `mg_test_swap_decline`, `mg_test_virtual_account`, `mg_test_crypto_wallet`, `mg_test_online_card_transaction` |
|
|
96
|
+
| Escape hatch | `mg_request` — any method + path |
|
|
97
|
+
|
|
98
|
+
## Key facts for AI agents
|
|
99
|
+
|
|
100
|
+
The server's instructions tell the model:
|
|
101
|
+
|
|
102
|
+
- Amounts are **plain numbers in the source currency** — not minor units × 100.
|
|
103
|
+
- Payouts are **two-step**: `mg_create_quote` → `mg_fund_quote`. Quotes expire in 10 minutes.
|
|
104
|
+
- Dates in customer bodies are **DD-MM-YYYY**.
|
|
105
|
+
- `account_id` is an opaque string; everything else (`wallet_id`, `rail_id`, `counterparty_id`, `quote_id`, `file_id`) is a UUID.
|
|
106
|
+
- Errors return `{ok:false, code, http_status, field_errors}`. Branch on `code`.
|
|
214
107
|
|
|
215
108
|
## Links
|
|
216
109
|
|
|
217
|
-
-
|
|
218
|
-
-
|
|
219
|
-
-
|
|
220
|
-
-
|
|
110
|
+
- API docs: https://app.moneygraph.ai/docs/guide/introduction
|
|
111
|
+
- Dashboard: https://app.moneygraph.ai
|
|
112
|
+
- SDK (wrapped by this server): https://www.npmjs.com/package/@moneygraph/sdk
|
|
113
|
+
- Issues: https://github.com/moneygraph/mcp-server/issues
|
|
221
114
|
|
|
222
115
|
## License
|
|
223
116
|
|
package/bin/mcp-http.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
2
|
process.env.MONEYGRAPH_TRANSPORT = 'http';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
3
|
+
import('../src/index.js').then(({ startServer }) =>
|
|
4
|
+
startServer().catch((err) => {
|
|
5
|
+
console.error('MoneyGraph MCP server (HTTP) failed to start:', err instanceof Error ? err.message : err);
|
|
6
|
+
process.exit(1);
|
|
7
|
+
}),
|
|
8
|
+
);
|
package/bin/mcp-server.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { startServer } from '../src/index.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
startServer().catch((error) => {
|
|
6
|
-
console.error('Fatal: Failed to start MoneyGraph MCP Server:', error.message);
|
|
4
|
+
startServer().catch((err) => {
|
|
5
|
+
console.error('MoneyGraph MCP server failed to start:', err instanceof Error ? err.message : err);
|
|
7
6
|
process.exit(1);
|
|
8
7
|
});
|
package/package.json
CHANGED
|
@@ -1,76 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moneygraph/mcp-server",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "MCP server
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "MoneyGraph MCP server — cross-border payouts, FX swaps, virtual cards, virtual accounts, invoices, and payment collection for AI agents. Wraps @moneygraph/sdk.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"@moneygraph/mcp-server": "./bin/mcp-server.js",
|
|
8
8
|
"moneygraph-mcp": "./bin/mcp-server.js",
|
|
9
9
|
"moneygraph-mcp-http": "./bin/mcp-http.js"
|
|
10
10
|
},
|
|
11
|
-
"files": [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
"README.md",
|
|
16
|
-
"railway.json"
|
|
17
|
-
],
|
|
18
|
-
"main": "./dist/index.js",
|
|
19
|
-
"types": "./dist/index.d.ts",
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsc",
|
|
22
|
-
"start": "node dist/index.js",
|
|
23
|
-
"start:http": "MONEYGRAPH_TRANSPORT=http node dist/index.js",
|
|
24
|
-
"dev": "tsc --watch",
|
|
25
|
-
"postinstall": "node scripts/patch-sdk.mjs",
|
|
26
|
-
"test": "tsx test/smoke.test.mjs",
|
|
27
|
-
"prepublishOnly": "npm run build"
|
|
11
|
+
"files": ["src/", "bin/", "README.md", "LICENSE", "railway.json"],
|
|
12
|
+
"main": "./src/index.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": { "import": "./src/index.js" }
|
|
28
15
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
16
|
+
"scripts": {
|
|
17
|
+
"start": "node bin/mcp-server.js",
|
|
18
|
+
"start:http": "node bin/mcp-http.js",
|
|
19
|
+
"test": "node test/smoke.mjs"
|
|
31
20
|
},
|
|
21
|
+
"engines": { "node": ">=18" },
|
|
32
22
|
"keywords": [
|
|
33
|
-
"mcp",
|
|
34
|
-
"
|
|
35
|
-
"payments",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"claude",
|
|
41
|
-
"fintech",
|
|
42
|
-
"payout",
|
|
43
|
-
"fx",
|
|
44
|
-
"mobile-money",
|
|
45
|
-
"swift",
|
|
46
|
-
"africa",
|
|
47
|
-
"virtual-cards",
|
|
48
|
-
"card-issuance",
|
|
49
|
-
"crypto",
|
|
50
|
-
"usdc",
|
|
51
|
-
"usdt",
|
|
52
|
-
"bitcoin",
|
|
53
|
-
"ethereum",
|
|
54
|
-
"stablecoin"
|
|
23
|
+
"mcp", "model-context-protocol", "mcp-server",
|
|
24
|
+
"moneygraph", "moneygraph-mcp",
|
|
25
|
+
"payments", "payouts", "cross-border", "remittance",
|
|
26
|
+
"fx", "currency-swap", "mobile-money", "swift", "sepa", "ach",
|
|
27
|
+
"virtual-cards", "virtual-accounts", "invoicing", "payment-collection",
|
|
28
|
+
"ai-agent", "claude", "cursor", "windsurf", "cline",
|
|
29
|
+
"fintech", "africa"
|
|
55
30
|
],
|
|
56
|
-
"author": "MoneyGraph <
|
|
31
|
+
"author": "MoneyGraph <dev@moneygraph.ai>",
|
|
57
32
|
"license": "MIT",
|
|
58
|
-
"homepage": "https://moneygraph.ai",
|
|
59
|
-
"repository": {
|
|
60
|
-
|
|
61
|
-
"url": "https://github.com/moneygraph/mcp-server"
|
|
62
|
-
},
|
|
63
|
-
"bugs": {
|
|
64
|
-
"url": "https://github.com/moneygraph/mcp-server/issues"
|
|
65
|
-
},
|
|
33
|
+
"homepage": "https://app.moneygraph.ai/docs/guide/introduction",
|
|
34
|
+
"repository": { "type": "git", "url": "git+https://github.com/moneygraph/mcp-server.git" },
|
|
35
|
+
"bugs": { "url": "https://github.com/moneygraph/mcp-server/issues" },
|
|
66
36
|
"dependencies": {
|
|
67
37
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
68
|
-
"@moneygraph/sdk": "^
|
|
38
|
+
"@moneygraph/sdk": "^4.0.3",
|
|
69
39
|
"zod": "^3.23.0"
|
|
70
|
-
},
|
|
71
|
-
"devDependencies": {
|
|
72
|
-
"@types/node": "^20.0.0",
|
|
73
|
-
"tsx": "^4.21.0",
|
|
74
|
-
"typescript": "^5.5.0"
|
|
75
40
|
}
|
|
76
41
|
}
|
package/src/config.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Config loader + shared helpers.
|
|
2
|
+
|
|
3
|
+
import { MoneyGraphClient, MoneyGraphError } from '@moneygraph/sdk';
|
|
4
|
+
|
|
5
|
+
export function loadConfig() {
|
|
6
|
+
const keyId = process.env.MG_KEY_ID || process.env.MONEYGRAPH_KEY_ID;
|
|
7
|
+
const secret = process.env.MG_SECRET || process.env.MONEYGRAPH_SECRET;
|
|
8
|
+
const baseUrl = process.env.MG_BASE_URL || process.env.MONEYGRAPH_BASE_URL;
|
|
9
|
+
if (!keyId || !secret) {
|
|
10
|
+
throw new Error(
|
|
11
|
+
'MoneyGraph MCP server needs MG_KEY_ID and MG_SECRET environment variables. ' +
|
|
12
|
+
'Create a key in https://app.moneygraph.ai under Developers > API keys.'
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
const client = new MoneyGraphClient({
|
|
16
|
+
keyId, secret, baseUrl,
|
|
17
|
+
userAgent: `@moneygraph/mcp-server/${MCP_VERSION}`,
|
|
18
|
+
});
|
|
19
|
+
const mode = keyId.startsWith('kid_') ? 'live-or-test' : 'unknown';
|
|
20
|
+
return { client, keyId, mode };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const MCP_VERSION = '2.0.0';
|
|
24
|
+
|
|
25
|
+
// Wrap an SDK call so a thrown MoneyGraphError becomes an MCP tool result
|
|
26
|
+
// with the error details captured, instead of crashing the transport.
|
|
27
|
+
export async function safeCall(fn) {
|
|
28
|
+
try {
|
|
29
|
+
const data = await fn();
|
|
30
|
+
return { ok: true, data };
|
|
31
|
+
} catch (e) {
|
|
32
|
+
if (e instanceof MoneyGraphError) {
|
|
33
|
+
return {
|
|
34
|
+
ok: false,
|
|
35
|
+
error: e.message,
|
|
36
|
+
code: e.code,
|
|
37
|
+
http_status: e.httpStatus,
|
|
38
|
+
field_errors: e.errors || undefined,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return { ok: false, error: e instanceof Error ? e.message : String(e) };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function toMcpResult(result) {
|
|
46
|
+
return {
|
|
47
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
48
|
+
isError: result.ok === false,
|
|
49
|
+
};
|
|
50
|
+
}
|
package/src/http.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// HTTP (streamable) transport for web clients.
|
|
2
|
+
|
|
3
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
4
|
+
import { createServer } from 'node:http';
|
|
5
|
+
import { randomUUID } from 'node:crypto';
|
|
6
|
+
|
|
7
|
+
const PORT = parseInt(process.env.PORT || process.env.MCP_HTTP_PORT || '3200', 10);
|
|
8
|
+
const PATH = process.env.MCP_HTTP_PATH || '/mcp';
|
|
9
|
+
|
|
10
|
+
export async function startHttp(mcpServer) {
|
|
11
|
+
const transport = new StreamableHTTPServerTransport({
|
|
12
|
+
sessionIdGenerator: () => randomUUID(),
|
|
13
|
+
});
|
|
14
|
+
await mcpServer.connect(transport);
|
|
15
|
+
|
|
16
|
+
const http = createServer(async (req, res) => {
|
|
17
|
+
if (req.url?.split('?')[0] !== PATH) {
|
|
18
|
+
res.writeHead(404).end('not found');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
await transport.handleRequest(req, res);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
if (!res.headersSent) res.writeHead(500);
|
|
25
|
+
res.end(JSON.stringify({ error: e instanceof Error ? e.message : String(e) }));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
await new Promise((r) => http.listen(PORT, r));
|
|
30
|
+
console.error(`MoneyGraph MCP server listening on http://0.0.0.0:${PORT}${PATH}`);
|
|
31
|
+
return http;
|
|
32
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Entrypoint — picks transport based on MONEYGRAPH_TRANSPORT env.
|
|
2
|
+
// Default: stdio (Claude Desktop, Cursor, VS Code).
|
|
3
|
+
// MONEYGRAPH_TRANSPORT=http: HTTP transport for web clients.
|
|
4
|
+
|
|
5
|
+
import { buildServer } from './server.js';
|
|
6
|
+
|
|
7
|
+
export async function startServer() {
|
|
8
|
+
const transport = (process.env.MONEYGRAPH_TRANSPORT || 'stdio').toLowerCase();
|
|
9
|
+
const { server } = buildServer();
|
|
10
|
+
|
|
11
|
+
if (transport === 'http') {
|
|
12
|
+
const { startHttp } = await import('./http.js');
|
|
13
|
+
return startHttp(server);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const { StdioServerTransport } = await import('@modelcontextprotocol/sdk/server/stdio.js');
|
|
17
|
+
const t = new StdioServerTransport();
|
|
18
|
+
await server.connect(t);
|
|
19
|
+
// stdio stays open until the parent closes stdin
|
|
20
|
+
}
|
package/src/prompts.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// Common-flow prompts the AI agent can offer to the end-user.
|
|
2
|
+
|
|
3
|
+
export function registerPrompts(server) {
|
|
4
|
+
const P = (name, description, args, body) =>
|
|
5
|
+
server.registerPrompt(name, { description, argsSchema: args }, async (a) => ({
|
|
6
|
+
messages: [{ role: 'user', content: { type: 'text', text: body(a) } }],
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
P('send_money',
|
|
10
|
+
'Walk through creating a cross-border payout: pick corridor, save recipient, quote, fund.',
|
|
11
|
+
{
|
|
12
|
+
destination_country: { description: 'ISO2 country code (e.g. "NG")', required: true },
|
|
13
|
+
amount: { description: 'Amount in source currency (e.g. 100)', required: true },
|
|
14
|
+
source_currency: { description: 'USD, GBP, EUR or CAD', required: false },
|
|
15
|
+
},
|
|
16
|
+
(a) => `I want to send ${a.amount} ${a.source_currency || 'USD'} to ${a.destination_country}.
|
|
17
|
+
|
|
18
|
+
Please help me:
|
|
19
|
+
1. Call mg_list_assets to find the source wallet + the correct rail_id for ${a.destination_country}.
|
|
20
|
+
2. If I don't have a saved recipient yet, call mg_create_counterparty with rail_id, country, entity_type, and the recipient's bank details (ask me if needed).
|
|
21
|
+
3. Call mg_create_quote with type="fiat_payout", counterparty_id, asset_id (source), amount=${a.amount}.
|
|
22
|
+
4. Show me the quote (rate, fees, destination amount). I'll confirm before funding.
|
|
23
|
+
5. Call mg_fund_quote with the quote_id, my external_id, and a transfer_purpose from mg_list_transfer_purposes.`);
|
|
24
|
+
|
|
25
|
+
P('onboard_customer',
|
|
26
|
+
'Create a customer and run them through KYC.',
|
|
27
|
+
{
|
|
28
|
+
type: { description: 'personal or business', required: true },
|
|
29
|
+
country: { description: 'ISO2 country (e.g. "US")', required: true },
|
|
30
|
+
},
|
|
31
|
+
(a) => `Onboard a new ${a.type} customer in ${a.country}.
|
|
32
|
+
|
|
33
|
+
Steps:
|
|
34
|
+
1. If personal: call mg_list_source_of_funds first; I'll pick one.
|
|
35
|
+
If business: call mg_list_business_registration_types and mg_list_mccs; I'll pick.
|
|
36
|
+
2. Call mg_create_customer with the full body (ask me field by field).
|
|
37
|
+
3. Options for KYC:
|
|
38
|
+
(a) call mg_generate_kyc_link so the customer completes KYC themselves, OR
|
|
39
|
+
(b) ask me for docs (base64) and call mg_submit_kyc directly.
|
|
40
|
+
4. In test mode, call mg_test_approve_kyc to approve instantly.
|
|
41
|
+
5. Call mg_get_customer to confirm status.`);
|
|
42
|
+
|
|
43
|
+
P('check_corridor',
|
|
44
|
+
'Look up rates, fees and limits for a payout corridor before committing.',
|
|
45
|
+
{
|
|
46
|
+
destination_country: { description: 'ISO2 country code', required: true },
|
|
47
|
+
source_currency: { description: 'USD, GBP, EUR or CAD', required: false },
|
|
48
|
+
},
|
|
49
|
+
(a) => `Show me the live rates and fees for sending ${a.source_currency || 'USD'} to ${a.destination_country}.
|
|
50
|
+
|
|
51
|
+
Call mg_list_assets and find the entry whose settings.payout.rails[*].supported_countries includes "${a.destination_country}". For each matching rail, report: rail name, method (bank/mobile/cash), duration, min/max limits, fee (flat + percent + VAT), FX margin, and whether supporting docs or specific purpose codes are required.`);
|
|
52
|
+
|
|
53
|
+
P('track_payout',
|
|
54
|
+
'Check the current state of a payout.',
|
|
55
|
+
{ reference: { description: 'Transaction ID or external_id', required: true } },
|
|
56
|
+
(a) => `Call mg_get_transaction with reference="${a.reference}". Report: status, amount debited, destination amount, counterparty, delivery window. If status is "pending" and we're in test mode, offer to simulate success/decline with mg_test_payout_success or mg_test_payout_decline.`);
|
|
57
|
+
|
|
58
|
+
P('issue_card',
|
|
59
|
+
'Issue a USD virtual card to an approved customer.',
|
|
60
|
+
{ account_id: { description: 'Customer account_id', required: true } },
|
|
61
|
+
(a) => `Issue a virtual card to customer ${a.account_id}.
|
|
62
|
+
|
|
63
|
+
1. Call mg_create_cardholder with account_id="${a.account_id}".
|
|
64
|
+
2. In test mode, call mg_test_approve_cardholder to approve.
|
|
65
|
+
3. Call mg_create_card with account_id="${a.account_id}". The card details arrive via the card_issued webhook — explain that.
|
|
66
|
+
4. Optionally fund the card: ask me for amount, then mg_fund_card.`);
|
|
67
|
+
|
|
68
|
+
P('collect_payment',
|
|
69
|
+
'Accept a payment from a buyer using a hosted payment session.',
|
|
70
|
+
{
|
|
71
|
+
amount: { description: 'Amount in source currency', required: true },
|
|
72
|
+
currency: { description: '3-letter currency code', required: true },
|
|
73
|
+
external_reference: { description: 'Your unique order ID', required: true },
|
|
74
|
+
},
|
|
75
|
+
(a) => `Create a payment session to collect ${a.amount} ${a.currency} for order ${a.external_reference}.
|
|
76
|
+
|
|
77
|
+
1. Call mg_create_payment_session with currency, amount, external_reference, customer {email, first_name, last_name, ip_address}, billing_address, callback_url, title, description.
|
|
78
|
+
2. Return the checkout URL / client payload to the buyer.
|
|
79
|
+
3. After payment, call mg_verify_payment with external_reference="${a.external_reference}".`);
|
|
80
|
+
}
|
package/src/resources.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// MCP resources — read-only snapshots of merchant state that AI agents can browse.
|
|
2
|
+
|
|
3
|
+
import { safeCall } from './config.js';
|
|
4
|
+
|
|
5
|
+
function textResource(uri, name, description, fetcher) {
|
|
6
|
+
return {
|
|
7
|
+
uri, name, description, mimeType: 'application/json', fetcher,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function registerResources(server, client) {
|
|
12
|
+
const resources = [
|
|
13
|
+
textResource(
|
|
14
|
+
'moneygraph://assets',
|
|
15
|
+
'Merchant wallets & rails',
|
|
16
|
+
'Current balances for every wallet, plus the payout rails, fees, and limits per asset.',
|
|
17
|
+
() => client.listAssets(),
|
|
18
|
+
),
|
|
19
|
+
textResource(
|
|
20
|
+
'moneygraph://countries',
|
|
21
|
+
'Supported countries',
|
|
22
|
+
'All onboarding-supported countries with ISO2 codes and personal/business support flags.',
|
|
23
|
+
() => client.listCountries({ page: 'all' }),
|
|
24
|
+
),
|
|
25
|
+
textResource(
|
|
26
|
+
'moneygraph://transfer-purposes',
|
|
27
|
+
'Transfer purpose codes',
|
|
28
|
+
'Valid transfer purposes for funding a payout quote, plus per-currency document requirements.',
|
|
29
|
+
() => client.listTransferPurposes(),
|
|
30
|
+
),
|
|
31
|
+
textResource(
|
|
32
|
+
'moneygraph://customers',
|
|
33
|
+
'Recent customers',
|
|
34
|
+
'The most recently created customers on this account.',
|
|
35
|
+
() => client.listCustomers({ limit: 50 }),
|
|
36
|
+
),
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
for (const r of resources) {
|
|
40
|
+
server.registerResource(r.name, r.uri, {
|
|
41
|
+
description: r.description,
|
|
42
|
+
mimeType: r.mimeType,
|
|
43
|
+
}, async () => {
|
|
44
|
+
const res = await safeCall(r.fetcher);
|
|
45
|
+
return {
|
|
46
|
+
contents: [{
|
|
47
|
+
uri: r.uri,
|
|
48
|
+
mimeType: r.mimeType,
|
|
49
|
+
text: JSON.stringify(res.ok ? res.data : res, null, 2),
|
|
50
|
+
}],
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|