@guiie/buda-mcp 1.5.0 → 1.5.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 (59) hide show
  1. package/.cursor/rules/marketplace-docs-sync.mdc +32 -0
  2. package/CHANGELOG.md +40 -0
  3. package/PUBLISH_CHECKLIST.md +40 -88
  4. package/README.md +446 -78
  5. package/dist/client.d.ts +1 -0
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +2 -1
  8. package/dist/http.js +42 -6
  9. package/dist/index.js +12 -3
  10. package/dist/tools/batch_orders.d.ts +5 -0
  11. package/dist/tools/batch_orders.d.ts.map +1 -1
  12. package/dist/tools/batch_orders.js +35 -1
  13. package/dist/tools/cancel_order.js +1 -1
  14. package/dist/tools/dead_mans_switch.d.ts +1 -1
  15. package/dist/tools/dead_mans_switch.d.ts.map +1 -1
  16. package/dist/tools/dead_mans_switch.js +33 -3
  17. package/dist/tools/lightning.d.ts.map +1 -1
  18. package/dist/tools/lightning.js +15 -1
  19. package/dist/tools/place_order.d.ts.map +1 -1
  20. package/dist/tools/place_order.js +31 -0
  21. package/dist/tools/receive_addresses.d.ts +5 -0
  22. package/dist/tools/receive_addresses.d.ts.map +1 -1
  23. package/dist/tools/receive_addresses.js +26 -2
  24. package/dist/tools/remittances.d.ts +5 -0
  25. package/dist/tools/remittances.d.ts.map +1 -1
  26. package/dist/tools/remittances.js +27 -3
  27. package/dist/tools/technical_indicators.d.ts.map +1 -1
  28. package/dist/tools/technical_indicators.js +2 -1
  29. package/dist/tools/withdrawals.d.ts.map +1 -1
  30. package/dist/tools/withdrawals.js +11 -1
  31. package/dist/utils.d.ts.map +1 -1
  32. package/dist/utils.js +4 -1
  33. package/dist/validation.d.ts +6 -0
  34. package/dist/validation.d.ts.map +1 -1
  35. package/dist/validation.js +26 -0
  36. package/dist/version.d.ts.map +1 -1
  37. package/dist/version.js +8 -1
  38. package/marketplace/README.md +1 -1
  39. package/marketplace/claude-listing.md +75 -4
  40. package/marketplace/gemini-tools.json +325 -2
  41. package/marketplace/openapi.yaml +160 -1
  42. package/package.json +2 -1
  43. package/server.json +2 -2
  44. package/src/client.ts +3 -1
  45. package/src/http.ts +50 -6
  46. package/src/index.ts +10 -3
  47. package/src/tools/batch_orders.ts +40 -1
  48. package/src/tools/cancel_order.ts +1 -1
  49. package/src/tools/dead_mans_switch.ts +39 -3
  50. package/src/tools/lightning.ts +17 -1
  51. package/src/tools/place_order.ts +32 -0
  52. package/src/tools/receive_addresses.ts +29 -3
  53. package/src/tools/remittances.ts +30 -4
  54. package/src/tools/technical_indicators.ts +2 -1
  55. package/src/tools/withdrawals.ts +12 -1
  56. package/src/utils.ts +3 -1
  57. package/src/validation.ts +29 -0
  58. package/src/version.ts +11 -3
  59. package/test/unit.ts +261 -18
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Node.js >=18](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org/)
6
6
 
7
- MCP server for [Buda.com](https://www.buda.com/) — the leading cryptocurrency exchange in Chile, Colombia, and Peru. Gives any MCP-compatible AI assistant live access to market data, order books, trade history, spreads, and (when credentials are provided) private account tools.
7
+ MCP server for [Buda.com](https://www.buda.com/) — the leading cryptocurrency exchange in Chile, Colombia, and Peru. Gives any MCP-compatible AI assistant live access to market data, order books, trade history, spreads, and (when credentials are provided) full private account tools including order management, withdrawals, deposits, and Lightning Network payments.
8
8
 
9
9
  ---
10
10
 
@@ -63,18 +63,22 @@ claude mcp add buda-mcp -- npx -y @guiie/buda-mcp
63
63
 
64
64
  ### Public tools (no credentials required)
65
65
 
66
+ #### `get_market_summary` ⭐ Start here
67
+ One-call summary: last price, bid/ask, spread %, 24h volume, price change, and `liquidity_rating` (`high` / `medium` / `low`). Best first tool when a user asks about any specific market.
68
+
69
+ | Parameter | Type | Required | Description |
70
+ |-----------|------|----------|-------------|
71
+ | `market_id` | string | Yes | Market ID (e.g. `BTC-CLP`). |
72
+
73
+ ---
74
+
66
75
  #### `get_markets`
67
- List all 26 trading pairs on Buda.com, or get details for a specific market.
76
+ List all 26 trading pairs on Buda.com, or get details for a specific market (fees, minimum order size, discount tiers).
68
77
 
69
78
  | Parameter | Type | Required | Description |
70
79
  |-----------|------|----------|-------------|
71
80
  | `market_id` | string | No | Market ID (e.g. `BTC-CLP`). Omit to list all markets. |
72
81
 
73
- **Example prompts:**
74
- - *"List all markets available on Buda.com"*
75
- - *"What are the trading fees for BTC-CLP?"*
76
- - *"What's the minimum order size for ETH-COP?"*
77
-
78
82
  ---
79
83
 
80
84
  #### `get_ticker`
@@ -84,29 +88,20 @@ Current snapshot: last price, best bid/ask, 24h volume, and price change over 24
84
88
  |-----------|------|----------|-------------|
85
89
  | `market_id` | string | Yes | Market ID (e.g. `BTC-CLP`, `ETH-COP`). |
86
90
 
87
- **Example prompts:**
88
- - *"What is the current Bitcoin price in Chilean pesos?"*
89
- - *"Show me the ETH-COP ticker"*
90
- - *"How much has BTC changed in the last 7 days on Buda?"*
91
-
92
91
  ---
93
92
 
94
93
  #### `get_orderbook`
95
- Current order book: sorted bids and asks as `[price, amount]` pairs.
94
+ Current order book: sorted bids and asks as `{price, amount}` objects.
96
95
 
97
96
  | Parameter | Type | Required | Description |
98
97
  |-----------|------|----------|-------------|
99
98
  | `market_id` | string | Yes | Market ID. |
100
99
  | `limit` | number | No | Max price levels per side (default: all). |
101
100
 
102
- **Example prompts:**
103
- - *"Show me the BTC-CLP order book — top 10 bids and asks"*
104
- - *"How deep is the ETH-BTC order book?"*
105
-
106
101
  ---
107
102
 
108
103
  #### `get_trades`
109
- Recent trade history. Each entry: `[timestamp_ms, amount, price, direction]`.
104
+ Recent trade history as typed objects: `{timestamp_ms, amount, price, direction}`.
110
105
 
111
106
  | Parameter | Type | Required | Description |
112
107
  |-----------|------|----------|-------------|
@@ -114,10 +109,6 @@ Recent trade history. Each entry: `[timestamp_ms, amount, price, direction]`.
114
109
  | `limit` | number | No | Number of trades (default 50, max 100). |
115
110
  | `timestamp` | number | No | Unix seconds — returns trades older than this (pagination). |
116
111
 
117
- **Example prompts:**
118
- - *"Show the last 20 trades on BTC-CLP"*
119
- - *"Were there more buys or sells in the last 50 BTC-COP trades?"*
120
-
121
112
  ---
122
113
 
123
114
  #### `get_market_volume`
@@ -127,10 +118,6 @@ Recent trade history. Each entry: `[timestamp_ms, amount, price, direction]`.
127
118
  |-----------|------|----------|-------------|
128
119
  | `market_id` | string | Yes | Market ID. |
129
120
 
130
- **Example prompts:**
131
- - *"How much ETH was traded on Buda in the last 7 days?"*
132
- - *"What's the BTC-CLP buy vs sell volume over 24 hours?"*
133
-
134
121
  ---
135
122
 
136
123
  #### `get_spread`
@@ -140,38 +127,101 @@ Bid/ask spread: absolute value and percentage of the ask price.
140
127
  |-----------|------|----------|-------------|
141
128
  | `market_id` | string | Yes | Market ID. |
142
129
 
143
- **Example prompts:**
144
- - *"What's the spread on BTC-COP right now?"*
145
- - *"Is the ETH-CLP spread tighter than BTC-CLP?"*
146
-
147
130
  ---
148
131
 
149
132
  #### `compare_markets`
150
- Side-by-side ticker data for all pairs of a given base currency (CLP, COP, PEN, USDC…).
133
+ Side-by-side ticker data for all pairs of a given base currency across all quote currencies.
151
134
 
152
135
  | Parameter | Type | Required | Description |
153
136
  |-----------|------|----------|-------------|
154
- | `base_currency` | string | Yes | Base currency to compare (e.g. `BTC`, `ETH`). |
155
-
156
- **Example prompts:**
157
- - *"Compare the Bitcoin price across all Buda markets"*
158
- - *"Show me ETH in CLP, COP, and PEN side by side"*
159
- - *"Which Buda market has the highest BTC trading volume?"*
137
+ | `base_currency` | string | Yes | Base currency (e.g. `BTC`, `ETH`). |
160
138
 
161
139
  ---
162
140
 
163
141
  #### `get_price_history`
164
- OHLCV candles derived from recent trade history (Buda has no native candlestick endpoint — candles are aggregated client-side from raw trades). Candle timestamps are UTC bucket boundaries. Increasing `limit` gives deeper history at the cost of a slower response.
142
+ OHLCV candles aggregated from raw trade history (Buda has no native candlestick endpoint). Supports `5m`, `15m`, `30m`, `1h`, `4h`, `1d` periods.
165
143
 
166
144
  | Parameter | Type | Required | Description |
167
145
  |-----------|------|----------|-------------|
168
146
  | `market_id` | string | Yes | Market ID. |
169
- | `period` | `1h` \| `4h` \| `1d` | No | Candle period (default `1h`). |
147
+ | `period` | string | No | `5m` / `15m` / `30m` / `1h` / `4h` / `1d` (default `1h`). |
170
148
  | `limit` | number | No | Raw trades to fetch before aggregation (default 100, max 1000). |
171
149
 
172
- **Example prompts:**
173
- - *"Show me hourly price candles for BTC-CLP"*
174
- - *"What were the daily open/high/low/close for ETH-COP?"*
150
+ ---
151
+
152
+ #### `get_arbitrage_opportunities`
153
+ Detects cross-country price discrepancies for an asset across Buda's CLP, COP, and PEN markets, normalized to USDC.
154
+
155
+ | Parameter | Type | Required | Description |
156
+ |-----------|------|----------|-------------|
157
+ | `base_currency` | string | Yes | e.g. `BTC`. |
158
+ | `threshold_pct` | number | No | Minimum discrepancy to report (default 0.5). |
159
+
160
+ ---
161
+
162
+ #### `simulate_order`
163
+ Simulates a buy or sell order using live ticker data — no order is ever placed. Returns `estimated_fill_price`, `fee_amount`, `total_cost`, `slippage_vs_mid_pct`. All responses include `simulation: true`.
164
+
165
+ | Parameter | Type | Required | Description |
166
+ |-----------|------|----------|-------------|
167
+ | `market_id` | string | Yes | Market ID. |
168
+ | `side` | `buy` \| `sell` | Yes | Order side. |
169
+ | `amount` | number | Yes | Order size in base currency. |
170
+ | `price` | number | No | Omit for market order simulation. |
171
+
172
+ ---
173
+
174
+ #### `calculate_position_size`
175
+ Kelly-style position sizing from capital, risk %, entry, and stop-loss. Fully client-side — no API call.
176
+
177
+ | Parameter | Type | Required | Description |
178
+ |-----------|------|----------|-------------|
179
+ | `market_id` | string | Yes | Market ID (for context). |
180
+ | `capital` | number | Yes | Total capital to size from. |
181
+ | `risk_pct` | number | Yes | % of capital to risk (0.1–10). |
182
+ | `entry_price` | number | Yes | Entry price. |
183
+ | `stop_loss_price` | number | Yes | Stop-loss price. |
184
+
185
+ ---
186
+
187
+ #### `get_market_sentiment`
188
+ Composite sentiment score (−100 to +100) from three components: 24h price variation (40%), volume vs 7-day average (35%), spread vs market-type baseline (25%). Returns `score`, `label`, `component_breakdown`, and a `disclaimer`.
189
+
190
+ | Parameter | Type | Required | Description |
191
+ |-----------|------|----------|-------------|
192
+ | `market_id` | string | Yes | Market ID. |
193
+
194
+ ---
195
+
196
+ #### `get_technical_indicators`
197
+ RSI (14), MACD (12/26/9), Bollinger Bands (20, 2σ), SMA 20, SMA 50 — computed server-side from Buda trade history (no external libraries). Returns signal interpretations and a structured warning if fewer than 20 candles are available. Includes `disclaimer`.
198
+
199
+ | Parameter | Type | Required | Description |
200
+ |-----------|------|----------|-------------|
201
+ | `market_id` | string | Yes | Market ID. |
202
+ | `period` | string | No | `1h` / `4h` / `1d` (default `1h`). |
203
+ | `limit` | number | No | Raw trades to fetch (500–1000). |
204
+
205
+ ---
206
+
207
+ #### `get_real_quotation`
208
+ Returns a real-time quotation for a given order amount and direction, showing exact fill price, fee, and balance changes without placing an order.
209
+
210
+ | Parameter | Type | Required | Description |
211
+ |-----------|------|----------|-------------|
212
+ | `market_id` | string | Yes | Market ID. |
213
+ | `type` | `Bid` \| `Ask` | Yes | Order side. |
214
+ | `amount` | number | Yes | Order size in base currency. |
215
+ | `limit_price` | number | No | Limit price for limit quotations. |
216
+
217
+ ---
218
+
219
+ #### `get_available_banks`
220
+ Lists available banks for fiat deposits/withdrawals in a given currency's country.
221
+
222
+ | Parameter | Type | Required | Description |
223
+ |-----------|------|----------|-------------|
224
+ | `currency` | string | Yes | Fiat currency code (e.g. `CLP`, `COP`, `PEN`). |
175
225
 
176
226
  ---
177
227
 
@@ -181,8 +231,13 @@ Available only when `BUDA_API_KEY` and `BUDA_API_SECRET` environment variables a
181
231
 
182
232
  > **Warning:** Authenticated instances must be run **locally only**. Never expose a server with API credentials to the internet.
183
233
 
234
+ #### `get_account_info`
235
+ Returns the authenticated account profile: email, name, and monthly transacted amount.
236
+
237
+ ---
238
+
184
239
  #### `get_balances`
185
- All currency balances: total, available, frozen, and pending withdrawal.
240
+ All currency balances: total, available, frozen, and pending withdrawal — as floats with `_currency` fields.
186
241
 
187
242
  **Example prompts:**
188
243
  - *"What's my BTC balance on Buda?"*
@@ -190,6 +245,15 @@ All currency balances: total, available, frozen, and pending withdrawal.
190
245
 
191
246
  ---
192
247
 
248
+ #### `get_balance`
249
+ Balance for a single currency.
250
+
251
+ | Parameter | Type | Required | Description |
252
+ |-----------|------|----------|-------------|
253
+ | `currency` | string | Yes | Currency code (e.g. `BTC`, `CLP`). |
254
+
255
+ ---
256
+
193
257
  #### `get_orders`
194
258
  Orders for a given market, filterable by state.
195
259
 
@@ -200,16 +264,30 @@ Orders for a given market, filterable by state.
200
264
  | `per` | number | No | Results per page (default 20, max 300). |
201
265
  | `page` | number | No | Page number (default 1). |
202
266
 
203
- **Example prompts:**
204
- - *"Show my open orders on BTC-CLP"*
205
- - *"List my last 10 traded orders on ETH-COP"*
267
+ ---
268
+
269
+ #### `get_order`
270
+ Returns a single order by its numeric ID.
271
+
272
+ | Parameter | Type | Required | Description |
273
+ |-----------|------|----------|-------------|
274
+ | `order_id` | number | Yes | Numeric order ID. |
275
+
276
+ ---
277
+
278
+ #### `get_order_by_client_id`
279
+ Returns an order by the client-assigned string ID set at placement.
280
+
281
+ | Parameter | Type | Required | Description |
282
+ |-----------|------|----------|-------------|
283
+ | `client_id` | string | Yes | Client ID string. |
206
284
 
207
285
  ---
208
286
 
209
287
  #### `place_order`
210
- Place a limit or market order.
288
+ Place a limit or market order. Supports optional time-in-force flags and stop orders.
211
289
 
212
- **Requires `confirmation_token="CONFIRM"`** — prevents accidental execution from ambiguous prompts.
290
+ **Requires `confirmation_token="CONFIRM"`** — prevents accidental execution.
213
291
 
214
292
  | Parameter | Type | Required | Description |
215
293
  |-----------|------|----------|-------------|
@@ -218,15 +296,18 @@ Place a limit or market order.
218
296
  | `price_type` | `limit` \| `market` | Yes | Order type. |
219
297
  | `amount` | number | Yes | Order size in base currency. |
220
298
  | `limit_price` | number | No | Required for limit orders. |
299
+ | `ioc` | boolean | No | Immediate-or-cancel. Mutually exclusive with `fok`, `post_only`, `gtd_timestamp`. |
300
+ | `fok` | boolean | No | Fill-or-kill. Mutually exclusive with other TIF flags. |
301
+ | `post_only` | boolean | No | Rejected if it would execute as taker. Mutually exclusive with other TIF flags. |
302
+ | `gtd_timestamp` | string | No | Good-till-date (ISO 8601). Mutually exclusive with other TIF flags. |
303
+ | `stop_price` | number | No | Stop trigger price. Must be paired with `stop_type`. |
304
+ | `stop_type` | `>=` \| `<=` | No | Stop trigger direction. Must be paired with `stop_price`. |
221
305
  | `confirmation_token` | string | Yes | Must equal `"CONFIRM"` to execute. |
222
306
 
223
- **Example prompts:**
224
- - *"Place a limit buy order for 0.001 BTC at 60,000,000 CLP on BTC-CLP, confirmation_token=CONFIRM"*
225
-
226
307
  ---
227
308
 
228
309
  #### `cancel_order`
229
- Cancel an open order by ID.
310
+ Cancel an open order by numeric ID.
230
311
 
231
312
  **Requires `confirmation_token="CONFIRM"`**.
232
313
 
@@ -237,14 +318,264 @@ Cancel an open order by ID.
237
318
 
238
319
  ---
239
320
 
321
+ #### `cancel_order_by_client_id`
322
+ Cancel an open order by its client-assigned string ID.
323
+
324
+ **Requires `confirmation_token="CONFIRM"`**.
325
+
326
+ | Parameter | Type | Required | Description |
327
+ |-----------|------|----------|-------------|
328
+ | `client_id` | string | Yes | Client ID string. |
329
+ | `confirmation_token` | string | Yes | Must equal `"CONFIRM"` to cancel. |
330
+
331
+ ---
332
+
333
+ #### `cancel_all_orders`
334
+ Cancel all open orders in a specific market or across all markets.
335
+
336
+ **Requires `confirmation_token="CONFIRM"`**.
337
+
338
+ | Parameter | Type | Required | Description |
339
+ |-----------|------|----------|-------------|
340
+ | `market_id` | string | Yes | Market ID (e.g. `BTC-CLP`) or `"*"` to cancel all markets. |
341
+ | `confirmation_token` | string | Yes | Must equal `"CONFIRM"` to cancel. |
342
+
343
+ ---
344
+
345
+ #### `place_batch_orders`
346
+ Place up to 20 orders sequentially. All orders are pre-validated before any API call — a validation failure aborts with zero orders placed. Partial API failures do not roll back placed orders; a `warning` field surfaces this.
347
+
348
+ **Requires `confirmation_token="CONFIRM"`**.
349
+
350
+ | Parameter | Type | Required | Description |
351
+ |-----------|------|----------|-------------|
352
+ | `orders` | array | Yes | Array of 1–20 order objects (`market_id`, `type`, `price_type`, `amount`, optional `limit_price`). |
353
+ | `confirmation_token` | string | Yes | Must equal `"CONFIRM"` to execute. |
354
+
355
+ ---
356
+
357
+ #### `get_network_fees`
358
+ Returns withdrawal fee information for a currency.
359
+
360
+ | Parameter | Type | Required | Description |
361
+ |-----------|------|----------|-------------|
362
+ | `currency` | string | Yes | Currency code (e.g. `BTC`, `ETH`). |
363
+
364
+ ---
365
+
366
+ #### `get_deposit_history`
367
+ Deposit history for a currency, filterable by state with pagination.
368
+
369
+ | Parameter | Type | Required | Description |
370
+ |-----------|------|----------|-------------|
371
+ | `currency` | string | Yes | Currency code. |
372
+ | `state` | string | No | `pending_info`, `pending`, `confirmed`, `anulled`, `retained`. |
373
+ | `per` | number | No | Results per page (default 20, max 300). |
374
+ | `page` | number | No | Page number (default 1). |
375
+
376
+ ---
377
+
378
+ #### `create_fiat_deposit`
379
+ Record a fiat deposit. **Calling twice creates duplicate records — the confirmation guard is critical.**
380
+
381
+ **Requires `confirmation_token="CONFIRM"`**.
382
+
383
+ | Parameter | Type | Required | Description |
384
+ |-----------|------|----------|-------------|
385
+ | `currency` | string | Yes | Fiat currency code (e.g. `CLP`, `COP`, `PEN`). |
386
+ | `amount` | number | Yes | Deposit amount. |
387
+ | `bank` | string | No | Bank name or identifier. |
388
+ | `confirmation_token` | string | Yes | Must equal `"CONFIRM"` to execute. |
389
+
390
+ ---
391
+
392
+ #### `get_withdrawal_history`
393
+ Withdrawal history for a currency, filterable by state with pagination.
394
+
395
+ | Parameter | Type | Required | Description |
396
+ |-----------|------|----------|-------------|
397
+ | `currency` | string | Yes | Currency code. |
398
+ | `state` | string | No | `pending_signature`, `pending`, `confirmed`, `rejected`, `anulled`. |
399
+ | `per` | number | No | Results per page (default 20, max 300). |
400
+ | `page` | number | No | Page number (default 1). |
401
+
402
+ ---
403
+
404
+ #### `create_withdrawal`
405
+ Create a crypto or fiat withdrawal. Exactly one of `address` (crypto) or `bank_account_id` (fiat) must be provided.
406
+
407
+ **Requires `confirmation_token="CONFIRM"`**.
408
+
409
+ | Parameter | Type | Required | Description |
410
+ |-----------|------|----------|-------------|
411
+ | `currency` | string | Yes | Currency code (e.g. `BTC`, `CLP`). |
412
+ | `amount` | number | Yes | Withdrawal amount. |
413
+ | `address` | string | No | Destination crypto address. Mutually exclusive with `bank_account_id`. |
414
+ | `network` | string | No | Blockchain network (e.g. `bitcoin`, `ethereum`). |
415
+ | `bank_account_id` | number | No | Fiat bank account ID. Mutually exclusive with `address`. |
416
+ | `confirmation_token` | string | Yes | Must equal `"CONFIRM"` to execute. |
417
+
418
+ ---
419
+
420
+ #### `list_receive_addresses`
421
+ Lists all receive addresses for a currency.
422
+
423
+ | Parameter | Type | Required | Description |
424
+ |-----------|------|----------|-------------|
425
+ | `currency` | string | Yes | Currency code (e.g. `BTC`). |
426
+
427
+ ---
428
+
429
+ #### `get_receive_address`
430
+ Returns the current active receive address for a currency.
431
+
432
+ | Parameter | Type | Required | Description |
433
+ |-----------|------|----------|-------------|
434
+ | `currency` | string | Yes | Currency code. |
435
+
436
+ ---
437
+
438
+ #### `create_receive_address`
439
+ Generate a new receive address for a crypto currency. Not idempotent — each call creates a distinct address.
440
+
441
+ **Requires `confirmation_token="CONFIRM"`**.
442
+
443
+ | Parameter | Type | Required | Description |
444
+ |-----------|------|----------|-------------|
445
+ | `currency` | string | Yes | Crypto currency code (e.g. `BTC`, `ETH`). |
446
+ | `confirmation_token` | string | Yes | Must equal `"CONFIRM"` to generate a new address. |
447
+
448
+ ---
449
+
450
+ #### `list_remittances`
451
+ Lists remittances on the account with pagination.
452
+
453
+ | Parameter | Type | Required | Description |
454
+ |-----------|------|----------|-------------|
455
+ | `per` | number | No | Results per page (default 20, max 300). |
456
+ | `page` | number | No | Page number (default 1). |
457
+
458
+ ---
459
+
460
+ #### `get_remittance`
461
+ Returns a single remittance by ID.
462
+
463
+ | Parameter | Type | Required | Description |
464
+ |-----------|------|----------|-------------|
465
+ | `id` | number | Yes | Remittance ID. |
466
+
467
+ ---
468
+
469
+ #### `quote_remittance`
470
+ Request a remittance quote for a given recipient and amount. Not idempotent — each call creates a new remittance record.
471
+
472
+ **Requires `confirmation_token="CONFIRM"`**.
473
+
474
+ | Parameter | Type | Required | Description |
475
+ |-----------|------|----------|-------------|
476
+ | `currency` | string | Yes | Currency code. |
477
+ | `amount` | number | Yes | Amount to remit. |
478
+ | `recipient_id` | number | Yes | Remittance recipient ID. |
479
+ | `confirmation_token` | string | Yes | Must equal `"CONFIRM"` to create the quote. |
480
+
481
+ ---
482
+
483
+ #### `accept_remittance_quote`
484
+ Accept a remittance quote to execute the transfer.
485
+
486
+ **Requires `confirmation_token="CONFIRM"`**.
487
+
488
+ | Parameter | Type | Required | Description |
489
+ |-----------|------|----------|-------------|
490
+ | `id` | number | Yes | Remittance ID to accept. |
491
+ | `confirmation_token` | string | Yes | Must equal `"CONFIRM"` to execute. |
492
+
493
+ ---
494
+
495
+ #### `list_remittance_recipients`
496
+ Lists saved remittance recipients with pagination.
497
+
498
+ | Parameter | Type | Required | Description |
499
+ |-----------|------|----------|-------------|
500
+ | `per` | number | No | Results per page. |
501
+ | `page` | number | No | Page number. |
502
+
503
+ ---
504
+
505
+ #### `get_remittance_recipient`
506
+ Returns a single remittance recipient by ID.
507
+
508
+ | Parameter | Type | Required | Description |
509
+ |-----------|------|----------|-------------|
510
+ | `id` | number | Yes | Recipient ID. |
511
+
512
+ ---
513
+
514
+ #### `lightning_withdrawal`
515
+ Pay a Bitcoin Lightning Network BOLT-11 invoice from the LN-BTC reserve. Funds leave immediately on success.
516
+
517
+ **Requires `confirmation_token="CONFIRM"`**.
518
+
519
+ | Parameter | Type | Required | Description |
520
+ |-----------|------|----------|-------------|
521
+ | `invoice` | string | Yes | BOLT-11 invoice string (starts with `lnbc`, `lntb`, etc.). |
522
+ | `confirmation_token` | string | Yes | Must equal `"CONFIRM"` to execute. |
523
+
524
+ ---
525
+
526
+ #### `create_lightning_invoice`
527
+ Create a Bitcoin Lightning Network receive invoice. No confirmation required — no funds leave the account.
528
+
529
+ | Parameter | Type | Required | Description |
530
+ |-----------|------|----------|-------------|
531
+ | `amount_satoshis` | number | Yes | Invoice amount in satoshis. |
532
+ | `description` | string | No | Payment description (max 140 characters). |
533
+ | `expiry_seconds` | number | No | Invoice expiry in seconds (60–86400, default 3600). |
534
+
535
+ ---
536
+
537
+ #### `schedule_cancel_all`
538
+ Arms an in-memory dead man's switch: if not renewed within `ttl_seconds`, all open orders for the market are automatically cancelled.
539
+
540
+ **Requires `confirmation_token="CONFIRM"`**.
541
+
542
+ > **Warning:** Timer state is lost on server restart. Use only on locally-run instances — never Railway or hosted deployments.
543
+
544
+ | Parameter | Type | Required | Description |
545
+ |-----------|------|----------|-------------|
546
+ | `market_id` | string | Yes | Market ID to cancel orders for. |
547
+ | `ttl_seconds` | number | Yes | Seconds before auto-cancel fires (10–300). |
548
+ | `confirmation_token` | string | Yes | Must equal `"CONFIRM"` to arm. |
549
+
550
+ ---
551
+
552
+ #### `renew_cancel_timer`
553
+ Resets the dead man's switch TTL for a market. No confirmation required.
554
+
555
+ | Parameter | Type | Required | Description |
556
+ |-----------|------|----------|-------------|
557
+ | `market_id` | string | Yes | Market ID. |
558
+
559
+ ---
560
+
561
+ #### `disarm_cancel_timer`
562
+ Disarms the dead man's switch without cancelling any orders. Safe to call with no active timer.
563
+
564
+ | Parameter | Type | Required | Description |
565
+ |-----------|------|----------|-------------|
566
+ | `market_id` | string | Yes | Market ID. |
567
+
568
+ ---
569
+
240
570
  ## MCP Resources
241
571
 
242
- In addition to tools, the server exposes two MCP Resources that clients can read directly:
572
+ In addition to tools, the server exposes MCP Resources that clients can read directly:
243
573
 
244
574
  | URI | Description |
245
575
  |-----|-------------|
246
576
  | `buda://markets` | JSON list of all Buda.com markets |
247
577
  | `buda://ticker/{market}` | JSON ticker for a specific market (e.g. `buda://ticker/BTC-CLP`) |
578
+ | `buda://summary/{market}` | Full market summary with liquidity rating (e.g. `buda://summary/BTC-CLP`) |
248
579
 
249
580
  ---
250
581
 
@@ -252,7 +583,7 @@ In addition to tools, the server exposes two MCP Resources that clients can read
252
583
 
253
584
  The server defaults to **public-only mode** — no API key needed, no breaking changes for existing users.
254
585
 
255
- To enable authenticated tools, copy `.env.example` to `.env` and fill in your credentials, then set them as environment variables before running:
586
+ To enable authenticated tools, set environment variables before running:
256
587
 
257
588
  ```bash
258
589
  BUDA_API_KEY=your_api_key BUDA_API_SECRET=your_api_secret npx @guiie/buda-mcp
@@ -304,10 +635,12 @@ node dist/index.js # stdio (for MCP clients)
304
635
  node dist/http.js # HTTP on port 3000 (for Railway / hosted)
305
636
  ```
306
637
 
307
- Run tests (requires live internet access):
638
+ Run tests:
308
639
 
309
640
  ```bash
310
- npm test
641
+ npm run test:unit # 138 unit tests, no network required
642
+ npm run test:integration # live API tests (skips if unreachable)
643
+ npm test # both
311
644
  ```
312
645
 
313
646
  ---
@@ -320,7 +653,17 @@ The `dist/http.js` entrypoint runs an Express server with:
320
653
  - `GET /health` — health check (`{ status, version, auth_mode }`)
321
654
  - `GET /.well-known/mcp/server-card.json` — Smithery-compatible static tool manifest
322
655
 
323
- Set `PORT` environment variable to override the default `3000`.
656
+ ### Environment variables
657
+
658
+ | Variable | Required | Description |
659
+ |---|---|---|
660
+ | `PORT` | No | HTTP listen port (default: `3000`) |
661
+ | `MCP_AUTH_TOKEN` | **Yes, when credentials are set** | Bearer token that all `/mcp` requests must include (`Authorization: Bearer <token>`). If `BUDA_API_KEY`/`BUDA_API_SECRET` are set but this is absent, the server refuses to start. |
662
+ | `MCP_RATE_LIMIT` | No | Max requests per IP per minute on `/mcp` (default: `120`) |
663
+ | `BUDA_API_KEY` | No | Buda.com API key — enables auth-gated tools |
664
+ | `BUDA_API_SECRET` | No | Buda.com API secret — required together with `BUDA_API_KEY` |
665
+
666
+ > **Security:** Never expose the HTTP server publicly without setting `MCP_AUTH_TOKEN`. The server will exit at startup if credentials are present but the token is missing.
324
667
 
325
668
  ---
326
669
 
@@ -328,29 +671,54 @@ Set `PORT` environment variable to override the default `3000`.
328
671
 
329
672
  ```
330
673
  src/
331
- client.ts BudaClient (HTTP + HMAC auth)
332
- cache.ts In-memory TTL cache
333
- types.ts TypeScript types for Buda API responses
334
- index.ts stdio MCP server entrypoint
335
- http.ts HTTP/SSE MCP server entrypoint
674
+ client.ts BudaClient (HTTP + HMAC auth + 429 retry)
675
+ cache.ts In-memory TTL cache with in-flight deduplication
676
+ types.ts TypeScript types for Buda API responses
677
+ validation.ts validateMarketId(), validateCurrency(), validateCryptoAddress()
678
+ utils.ts flattenAmount(), aggregateTradesToCandles(), getLiquidityRating()
679
+ version.ts Single source of truth for version string
680
+ index.ts stdio MCP server entrypoint
681
+ http.ts HTTP/SSE MCP server entrypoint
336
682
  tools/
337
- markets.ts get_markets
338
- ticker.ts get_ticker
339
- orderbook.ts get_orderbook
340
- trades.ts get_trades
341
- volume.ts get_market_volume
342
- spread.ts get_spread
343
- compare_markets.ts compare_markets
344
- price_history.ts get_price_history
345
- balances.ts get_balances (auth)
346
- orders.ts get_orders (auth)
347
- place_order.ts place_order (auth)
348
- cancel_order.ts cancel_order (auth)
683
+ markets.ts get_markets
684
+ ticker.ts get_ticker
685
+ orderbook.ts get_orderbook
686
+ trades.ts get_trades
687
+ volume.ts get_market_volume
688
+ spread.ts get_spread
689
+ compare_markets.ts compare_markets
690
+ price_history.ts get_price_history
691
+ arbitrage.ts get_arbitrage_opportunities
692
+ market_summary.ts get_market_summary
693
+ simulate_order.ts simulate_order
694
+ calculate_position_size.ts calculate_position_size
695
+ market_sentiment.ts get_market_sentiment
696
+ technical_indicators.ts get_technical_indicators
697
+ banks.ts get_available_banks
698
+ quotation.ts get_real_quotation
699
+ account.ts get_account_info (auth)
700
+ balance.ts get_balance (auth)
701
+ balances.ts get_balances (auth)
702
+ orders.ts get_orders (auth)
703
+ order_lookup.ts get_order, get_order_by_client_id (auth)
704
+ place_order.ts place_order (auth)
705
+ cancel_order.ts cancel_order (auth)
706
+ cancel_all_orders.ts cancel_all_orders (auth)
707
+ cancel_order_by_client_id.ts cancel_order_by_client_id (auth)
708
+ batch_orders.ts place_batch_orders (auth)
709
+ fees.ts get_network_fees (auth)
710
+ deposits.ts get_deposit_history, create_fiat_deposit (auth)
711
+ withdrawals.ts get_withdrawal_history, create_withdrawal (auth)
712
+ receive_addresses.ts list/get/create_receive_address (auth)
713
+ remittances.ts list/get/quote/accept remittances (auth)
714
+ remittance_recipients.ts list/get remittance recipients (auth)
715
+ lightning.ts lightning_withdrawal, create_lightning_invoice (auth)
716
+ dead_mans_switch.ts schedule_cancel_all, renew/disarm_cancel_timer (auth)
349
717
  marketplace/
350
- cursor-mcp.json Cursor MCP config example
351
- claude-listing.md Claude registry listing
352
- openapi.yaml OpenAPI spec (GPT Actions / HTTP wrapper)
353
- gemini-tools.json Gemini function declarations
718
+ cursor-mcp.json Cursor MCP config example
719
+ claude-listing.md Claude registry listing
720
+ openapi.yaml OpenAPI spec (GPT Actions / HTTP wrapper)
721
+ gemini-tools.json Gemini function declarations
354
722
  ```
355
723
 
356
724
  ---
package/dist/client.d.ts CHANGED
@@ -10,6 +10,7 @@ export declare class BudaClient {
10
10
  private readonly apiSecret;
11
11
  constructor(baseUrl?: string, apiKey?: string, apiSecret?: string);
12
12
  hasAuth(): boolean;
13
+ private _nonceCounter;
13
14
  private nonce;
14
15
  private sign;
15
16
  private authHeaders;