@indigoprotocol/indigo-mcp 0.2.14 → 0.4.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 (48) hide show
  1. package/README.md +270 -103
  2. package/dist/cardano_multiplatform_lib_bg.wasm +0 -0
  3. package/dist/cli/setup.js +2 -2
  4. package/dist/index.js +58737 -49299
  5. package/dist/payment.d.ts +4 -0
  6. package/dist/payment.d.ts.map +1 -0
  7. package/dist/server.d.ts.map +1 -1
  8. package/dist/tools/analytics-tools.d.ts.map +1 -1
  9. package/dist/tools/asset-tools.d.ts.map +1 -1
  10. package/dist/tools/cdp-liquidation-tools.d.ts.map +1 -1
  11. package/dist/tools/cdp-mint-burn-tools.d.ts.map +1 -1
  12. package/dist/tools/cdp-tools.d.ts.map +1 -1
  13. package/dist/tools/cdp-write-tools.d.ts.map +1 -1
  14. package/dist/tools/dex-tools.d.ts.map +1 -1
  15. package/dist/tools/governance-tools.d.ts.map +1 -1
  16. package/dist/tools/index.d.ts.map +1 -1
  17. package/dist/tools/interest-tools.d.ts +3 -0
  18. package/dist/tools/interest-tools.d.ts.map +1 -0
  19. package/dist/tools/leverage-cdp-tools.d.ts.map +1 -1
  20. package/dist/tools/oracle-tools.d.ts +3 -0
  21. package/dist/tools/oracle-tools.d.ts.map +1 -0
  22. package/dist/tools/redemption-tools.d.ts.map +1 -1
  23. package/dist/tools/rob-write-tools.d.ts.map +1 -1
  24. package/dist/tools/sp-request-tools.d.ts.map +1 -1
  25. package/dist/tools/stability-pool-tools.d.ts.map +1 -1
  26. package/dist/tools/stability-pool-write-tools.d.ts.map +1 -1
  27. package/dist/tools/stableswap-tools.d.ts +3 -0
  28. package/dist/tools/stableswap-tools.d.ts.map +1 -0
  29. package/dist/tools/staking-reward-tools.d.ts.map +1 -1
  30. package/dist/tools/staking-tools.d.ts.map +1 -1
  31. package/dist/tools/staking-write-tools.d.ts.map +1 -1
  32. package/dist/types/tx-types.d.ts +14 -0
  33. package/dist/types/tx-types.d.ts.map +1 -1
  34. package/dist/utils/index.d.ts +1 -0
  35. package/dist/utils/index.d.ts.map +1 -1
  36. package/dist/utils/indexer-client.d.ts +17 -0
  37. package/dist/utils/indexer-client.d.ts.map +1 -1
  38. package/dist/utils/pyth.d.ts +87 -0
  39. package/dist/utils/pyth.d.ts.map +1 -0
  40. package/dist/utils/sdk-config.d.ts +7 -1
  41. package/dist/utils/sdk-config.d.ts.map +1 -1
  42. package/dist/utils/tx-builder.d.ts +11 -3
  43. package/dist/utils/tx-builder.d.ts.map +1 -1
  44. package/dist/utils/v3-finders.d.ts +67 -0
  45. package/dist/utils/v3-finders.d.ts.map +1 -0
  46. package/dist/utils/validators.d.ts +1 -1
  47. package/dist/utils/validators.d.ts.map +1 -1
  48. package/package.json +7 -3
package/README.md CHANGED
@@ -8,10 +8,10 @@ MCP server for [Indigo Protocol](https://indigoprotocol.io/) — exposes Indigo
8
8
 
9
9
  ## ⚡ Quick Start — Full Cardano DeFi Stack
10
10
 
11
- ### MCP Servers (63 tools)
11
+ ### MCP Servers (75 tools)
12
12
 
13
13
  ```bash
14
- # 1. Install & Setup Indigo MCP (57 tools)
14
+ # 1. Install & Setup Indigo MCP (69 tools)
15
15
  npm install -g @indigoprotocol/indigo-mcp
16
16
  npx @indigoprotocol/indigo-mcp setup
17
17
 
@@ -47,7 +47,7 @@ npx @indigoprotocol/cardano-skills
47
47
  ║ ██║ ╚═╝ ██║╚██████╗██║ ║
48
48
  ║ ╚═╝ ╚═╝ ╚═════╝╚═╝ ║
49
49
  ║ ║
50
- ║ 63 tools • 13 skills for Cardano DeFi ║
50
+ ║ 75 tools • 13 skills for Cardano DeFi ║
51
51
  ║ ║
52
52
  ╚═══════════════════════════════════════════════════════════════╝
53
53
  ```
@@ -56,7 +56,7 @@ The setup commands auto-configure Claude Desktop, Claude Code, Cursor, or Windsu
56
56
 
57
57
  ## Features
58
58
 
59
- - Real-time iAsset prices (iUSD, iBTC, iETH, iSOL)
59
+ - Real-time iAsset prices (iUSD, iBTC, iETH, iSOL, iEUR, iJPY)
60
60
  - ADA and INDY token price feeds
61
61
  - CDP/loan browsing with pagination and filtering
62
62
  - Owner lookup by payment key hash or bech32 address
@@ -75,6 +75,10 @@ The setup commands auto-configure Claude Desktop, Claude Code, Cursor, or Windsu
75
75
  - Staking reward distribution
76
76
  - Collector UTXOs, IPFS storage and retrieval
77
77
 
78
+ ## Hosted deployment
79
+
80
+ A hosted deployment is available on [Fronteir AI](https://fronteir.ai/mcp/indigoprotocol-indigo-mcp).
81
+
78
82
  ## Quick Start
79
83
 
80
84
  ### Automatic Setup (Recommended)
@@ -86,6 +90,7 @@ npx @indigoprotocol/indigo-mcp setup
86
90
  ```
87
91
 
88
92
  This will:
93
+
89
94
  1. Ask which client you're using (Claude Desktop, Claude Code, Cursor, Windsurf)
90
95
  2. Prompt for your Blockfrost API key
91
96
  3. Automatically update your config file
@@ -120,9 +125,16 @@ MCP_TRANSPORT=http PORT=3000 npx @indigoprotocol/indigo-mcp
120
125
  ```
121
126
 
122
127
  This starts an HTTP server with:
128
+
123
129
  - `POST /mcp` — MCP endpoint (Streamable HTTP with SSE)
124
130
  - `GET /health` — Health check
125
131
 
132
+ Each client gets its own session: `initialize` returns an `Mcp-Session-Id` that
133
+ subsequent requests must send back. A client that restarts can simply
134
+ `initialize` again — existing sessions are unaffected and the server does not
135
+ need restarting. Bind address and port come from `HOST` and `PORT` (`MCP_PORT`
136
+ is accepted as an alias for `PORT`).
137
+
126
138
  ## Configuration
127
139
 
128
140
  > **Note:** `BLOCKFROST_API_KEY` is required for write operations (transaction building). Read-only tools work without it. Get a free key at [blockfrost.io](https://blockfrost.io/).
@@ -140,6 +152,7 @@ notepad "$env:APPDATA\Claude\claude_desktop_config.json"
140
152
  ```
141
153
 
142
154
  **Standard config:**
155
+
143
156
  ```json
144
157
  {
145
158
  "mcpServers": {
@@ -147,7 +160,7 @@ notepad "$env:APPDATA\Claude\claude_desktop_config.json"
147
160
  "command": "npx",
148
161
  "args": ["-y", "@indigoprotocol/indigo-mcp"],
149
162
  "env": {
150
- "INDEXER_URL": "https://analytics.indigoprotocol.io/api/v1",
163
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
151
164
  "BLOCKFROST_API_KEY": "your-blockfrost-project-id"
152
165
  }
153
166
  }
@@ -167,7 +180,7 @@ If you use nvm and have multiple Node versions, you may need to specify the full
167
180
  "args": ["-y", "@indigoprotocol/indigo-mcp"],
168
181
  "env": {
169
182
  "PATH": "/Users/YOUR_USERNAME/.nvm/versions/node/v22.22.0/bin:/usr/local/bin:/usr/bin:/bin",
170
- "INDEXER_URL": "https://analytics.indigoprotocol.io/api/v1",
183
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
171
184
  "BLOCKFROST_API_KEY": "your-blockfrost-project-id"
172
185
  }
173
186
  }
@@ -192,7 +205,7 @@ nano ~/.claude/settings.json
192
205
  "command": "npx",
193
206
  "args": ["-y", "@indigoprotocol/indigo-mcp"],
194
207
  "env": {
195
- "INDEXER_URL": "https://analytics.indigoprotocol.io/api/v1",
208
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
196
209
  "BLOCKFROST_API_KEY": "your-blockfrost-project-id"
197
210
  }
198
211
  }
@@ -211,7 +224,7 @@ Add to `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project-level):
211
224
  "command": "npx",
212
225
  "args": ["-y", "@indigoprotocol/indigo-mcp"],
213
226
  "env": {
214
- "INDEXER_URL": "https://analytics.indigoprotocol.io/api/v1",
227
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
215
228
  "BLOCKFROST_API_KEY": "your-blockfrost-project-id"
216
229
  }
217
230
  }
@@ -230,7 +243,7 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
230
243
  "command": "npx",
231
244
  "args": ["-y", "@indigoprotocol/indigo-mcp"],
232
245
  "env": {
233
- "INDEXER_URL": "https://analytics.indigoprotocol.io/api/v1",
246
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
234
247
  "BLOCKFROST_API_KEY": "your-blockfrost-project-id"
235
248
  }
236
249
  }
@@ -279,7 +292,7 @@ For full Cardano DeFi capabilities, use both Indigo MCP and [Cardano MCP](https:
279
292
  Run the server directly via stdio:
280
293
 
281
294
  ```bash
282
- INDEXER_URL=https://analytics.indigoprotocol.io/api/v1 \
295
+ INDEXER_URL=https://analytics.indigoprotocol.io/api \
283
296
  BLOCKFROST_API_KEY=your-blockfrost-project-id \
284
297
  npx @indigoprotocol/indigo-mcp
285
298
  ```
@@ -297,154 +310,194 @@ For any client that supports MCP over stdio, point it to the `npx @indigoprotoco
297
310
 
298
311
  ### Asset Tools
299
312
 
300
- | Tool | Description | Parameters |
301
- |------|-------------|------------|
302
- | `get_assets` | Get all Indigo iAssets with prices and interest data | None |
303
- | `get_asset` | Get details for a specific iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
304
- | `get_asset_price` | Get the current price for a specific iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
305
- | `get_ada_price` | Get the current ADA price in USD | None |
306
- | `get_indy_price` | Get the current INDY token price in ADA and USD | None |
313
+ | Tool | Description | Parameters |
314
+ | ----------------- | ---------------------------------------------------- | ---------------------------------- |
315
+ | `get_assets` | Get all Indigo iAssets with prices and interest data | None |
316
+ | `get_asset` | Get details for a specific iAsset | `asset`: iUSD, iBTC, iETH, iSOL, iEUR, iJPY, or iADA |
317
+ | `get_asset_price` | Get the current price for a specific iAsset | `asset`: iUSD, iBTC, iETH, iSOL, iEUR, iJPY, or iADA |
318
+ | `get_ada_price` | Get the current ADA price in USD | None |
319
+ | `get_indy_price` | Get the current INDY token price in ADA and USD | None |
307
320
 
308
321
  ### CDP / Loan Tools
309
322
 
310
- | Tool | Description | Parameters |
311
- |------|-------------|------------|
312
- | `get_all_cdps` | Get all CDPs/loans, optionally filtered by iAsset | `asset?`: iAsset filter; `limit?`: 1-500 (default 50); `offset?`: pagination offset |
313
- | `get_cdps_by_owner` | Get CDPs for a specific owner | `owner`: payment key hash (56-char hex) or bech32 address |
314
- | `get_cdps_by_address` | Get CDPs for a specific Cardano address | `address`: bech32 address (addr1... or addr_test1...) |
315
- | `analyze_cdp_health` | Analyze collateral ratios and liquidation risk | `owner`: payment key hash or bech32 address |
323
+ | Tool | Description | Parameters |
324
+ | --------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------- |
325
+ | `get_all_cdps` | Get all CDPs/loans, optionally filtered by iAsset | `asset?`: iAsset filter; `limit?`: 1-500 (default 50); `offset?`: pagination offset |
326
+ | `get_cdps_by_owner` | Get CDPs for a specific owner | `owner`: payment key hash (56-char hex) or bech32 address |
327
+ | `get_cdps_by_address` | Get CDPs for a specific Cardano address | `address`: bech32 address (addr1... or addr_test1...) |
328
+ | `analyze_cdp_health` | Analyze collateral ratios and liquidation risk | `owner`: payment key hash or bech32 address |
316
329
 
317
330
  ### CDP Write Tools
318
331
 
319
- | Tool | Description | Parameters |
320
- |------|-------------|------------|
321
- | `open_cdp` | Open a new CDP position (returns unsigned CBOR tx) | `address`: bech32 address; `asset`: iUSD, iBTC, iETH, or iSOL; `collateralAmount`: lovelace; `mintAmount`: iAsset smallest unit |
322
- | `deposit_cdp` | Deposit additional collateral into a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: lovelace |
323
- | `withdraw_cdp` | Withdraw collateral from a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: lovelace |
324
- | `close_cdp` | Close a CDP and reclaim collateral | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
332
+ > **Pyth-priced iAssets have a submission deadline.** Every iAsset is currently
333
+ > priced through Pyth, and the on-chain feed validator only accepts a transaction
334
+ > for **280 seconds** after the price update it embeds. Price-dependent write
335
+ > tools (`open_cdp`, `withdraw_cdp`, `mint_cdp`, `redeem_cdp`, `freeze_cdp`,
336
+ > `leverage_cdp`, `redeem_rob`) therefore return a `summary.pyth` block with the
337
+ > price, its timestamp and a `submitBefore` deadline. If signing takes longer
338
+ > than that — a hardware wallet, or a human approving in a browser — rebuild the
339
+ > transaction rather than submitting a stale one. A price update that has already
340
+ > expired is rejected at build time with a retry hint.
341
+
342
+ | Tool | Description | Parameters |
343
+ | -------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
344
+ | `open_cdp` | Open a new CDP position (returns unsigned CBOR tx) | `address`: bech32 address; `asset`: iUSD, iBTC, iETH, iSOL, iEUR, iJPY, or iADA; `collateralAmount`: lovelace; `mintAmount`: iAsset smallest unit |
345
+ | `deposit_cdp` | Deposit additional collateral into a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: lovelace |
346
+ | `withdraw_cdp` | Withdraw collateral from a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: lovelace |
347
+ | `close_cdp` | Close a CDP and reclaim collateral | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
325
348
 
326
349
  ### CDP Mint/Burn Tools
327
350
 
328
- | Tool | Description | Parameters |
329
- |------|-------------|------------|
330
- | `mint_cdp` | Mint additional iAssets from an existing CDP (increases debt) | `address`: bech32 address; `asset`: iUSD, iBTC, iETH, or iSOL; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: CDP UTxO output index; `amount`: iAsset amount in smallest unit |
331
- | `burn_cdp` | Burn iAssets to reduce CDP debt | `address`: bech32 address; `asset`: iUSD, iBTC, iETH, or iSOL; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: CDP UTxO output index; `amount`: iAsset amount in smallest unit |
351
+ | Tool | Description | Parameters |
352
+ | ---------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
353
+ | `mint_cdp` | Mint additional iAssets from an existing CDP (increases debt) | `address`: bech32 address; `asset`: iUSD, iBTC, iETH, iSOL, iEUR, iJPY, or iADA; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: CDP UTxO output index; `amount`: iAsset amount in smallest unit |
354
+ | `burn_cdp` | Burn iAssets to reduce CDP debt | `address`: bech32 address; `asset`: iUSD, iBTC, iETH, iSOL, iEUR, iJPY, or iADA; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: CDP UTxO output index; `amount`: iAsset amount in smallest unit |
332
355
 
333
356
  ### CDP Liquidation & Redemption Tools
334
357
 
335
- | Tool | Description | Parameters |
336
- |------|-------------|------------|
337
- | `liquidate_cdp` | Liquidate an undercollateralized CDP through the stability pool | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
338
- | `redeem_cdp` | Redeem iAssets from a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: iAsset amount in smallest unit |
339
- | `freeze_cdp` | Freeze a CDP to prevent further operations | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
340
- | `merge_cdps` | Merge multiple CDPs into one | `address`: bech32 address; `cdpOutRefs`: array of `{txHash, outputIndex}` (min 2) |
358
+ | Tool | Description | Parameters |
359
+ | --------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
360
+ | `liquidate_cdp` | Liquidate an undercollateralized CDP through the stability pool | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
361
+ | `redeem_cdp` | Redeem iAssets from a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: iAsset amount in smallest unit |
362
+ | `freeze_cdp` | Freeze a CDP to prevent further operations | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
363
+ | `merge_cdps` | Merge multiple CDPs into one | `address`: bech32 address; `cdpOutRefs`: array of `{txHash, outputIndex}` (min 2) |
341
364
 
342
365
  ### Leverage CDP Tools
343
366
 
344
- | Tool | Description | Parameters |
345
- |------|-------------|------------|
367
+ | Tool | Description | Parameters |
368
+ | -------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
346
369
  | `leverage_cdp` | Open a leveraged CDP by redeeming against ROB positions | `address`: bech32 address; `asset`: iAsset; `leverage`: multiplier (e.g. 2.0); `baseCollateral`: lovelace amount |
347
370
 
348
371
  ### Stability Pool Tools
349
372
 
350
- | Tool | Description | Parameters |
351
- |------|-------------|------------|
352
- | `get_stability_pools` | Get the latest stability pool state for each iAsset | None |
353
- | `get_stability_pool_accounts` | Get all open stability pool accounts, optionally filtered by iAsset | `asset?`: iUSD, iBTC, iETH, or iSOL |
354
- | `get_sp_account_by_owner` | Get stability pool accounts for specific owners | `owners`: array of payment key hashes or bech32 addresses |
373
+ | Tool | Description | Parameters |
374
+ | ----------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------- |
375
+ | `get_stability_pools` | Get the latest stability pool state for each iAsset | None |
376
+ | `get_stability_pool_accounts` | Get all open stability pool accounts, optionally filtered by iAsset | `asset?`: iUSD, iBTC, iETH, iSOL, iEUR, iJPY, or iADA |
377
+ | `get_sp_account_by_owner` | Get stability pool accounts for specific owners | `owners`: array of payment key hashes or bech32 addresses |
355
378
 
356
379
  ### Staking Tools
357
380
 
358
- | Tool | Description | Parameters |
359
- |------|-------------|------------|
360
- | `get_staking_info` | Get the current INDY staking manager state | None |
361
- | `get_staking_positions` | Get all open INDY staking positions | None |
362
- | `get_staking_positions_by_owner` | Get INDY staking positions for specific owners | `owners`: array of payment key hashes or bech32 addresses |
363
- | `get_staking_position_by_address` | Get INDY staking positions for a single address | `address`: Cardano bech32 address |
381
+ | Tool | Description | Parameters |
382
+ | --------------------------------- | ----------------------------------------------- | --------------------------------------------------------- |
383
+ | `get_staking_info` | Get the current INDY staking manager state | None |
384
+ | `get_staking_positions` | Get all open INDY staking positions | None |
385
+ | `get_staking_positions_by_owner` | Get INDY staking positions for specific owners | `owners`: array of payment key hashes or bech32 addresses |
386
+ | `get_staking_position_by_address` | Get INDY staking positions for a single address | `address`: Cardano bech32 address |
364
387
 
365
388
  ### Stability Pool Request Tools
366
389
 
367
- | Tool | Description | Parameters |
368
- |------|-------------|------------|
390
+ | Tool | Description | Parameters |
391
+ | -------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
369
392
  | `process_sp_request` | Process a pending stability pool request (protocol maintenance) | `address`: bech32 address; `asset`: iAsset; `accountTxHash`: account UTxO tx hash; `accountOutputIndex`: output index |
370
- | `annul_sp_request` | Cancel a pending stability pool request | `address`: bech32 address; `accountTxHash`: account UTxO tx hash; `accountOutputIndex`: output index |
393
+ | `annul_sp_request` | Cancel a pending stability pool request | `address`: bech32 address; `accountTxHash`: account UTxO tx hash; `accountOutputIndex`: output index |
371
394
 
372
395
  ### Staking Write Tools
373
396
 
374
- | Tool | Description | Parameters |
375
- |------|-------------|------------|
376
- | `open_staking_position` | Stake INDY tokens by creating a new staking position | `address`: bech32 address; `amount`: INDY amount in smallest unit |
397
+ | Tool | Description | Parameters |
398
+ | ------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
399
+ | `open_staking_position` | Stake INDY tokens by creating a new staking position | `address`: bech32 address; `amount`: INDY amount in smallest unit |
377
400
  | `adjust_staking_position` | Adjust an existing staking position (add or remove INDY) | `address`: bech32 address; `amount`: positive=stake more, negative=unstake; `positionTxHash`: UTxO tx hash; `positionOutputIndex`: UTxO output index |
378
- | `close_staking_position` | Close a staking position and unstake all INDY | `address`: bech32 address; `positionTxHash`: UTxO tx hash; `positionOutputIndex`: UTxO output index |
401
+ | `close_staking_position` | Close a staking position and unstake all INDY | `address`: bech32 address; `positionTxHash`: UTxO tx hash; `positionOutputIndex`: UTxO output index |
379
402
 
380
403
  ### Staking Reward Tools
381
404
 
382
- | Tool | Description | Parameters |
383
- |------|-------------|------------|
405
+ | Tool | Description | Parameters |
406
+ | ---------------------------- | ---------------------------------------------------------------- | -------------------------------------------------------------------------------- |
384
407
  | `distribute_staking_rewards` | Distribute collected ADA rewards from collector UTxOs to stakers | `address`: bech32 address; `collectorTxHashes`: array of `{txHash, outputIndex}` |
385
408
 
386
409
  ### Analytics & APR Tools
387
410
 
388
- | Tool | Description | Parameters |
389
- |------|-------------|------------|
390
- | `get_tvl` | Get historical TVL data from DefiLlama | None |
391
- | `get_apr_rewards` | Get all APR reward records | None |
392
- | `get_apr_by_key` | Get APR for a specific key | `key`: APR key (e.g. sp_iUSD_indy, stake_ada) |
393
- | `get_dex_yields` | Get DEX farm yields for iAsset pairs | None |
394
- | `get_protocol_stats` | Get aggregated protocol statistics | None |
411
+ | Tool | Description | Parameters |
412
+ | -------------------- | -------------------------------------- | --------------------------------------------- |
413
+ | `get_tvl` | Get historical TVL data from DefiLlama | None |
414
+ | `get_apr_rewards` | Get all APR reward records | None |
415
+ | `get_apr_by_key` | Get APR for a specific key | `key`: APR key (e.g. sp_iUSD_indy, stake_ada) |
416
+ | `get_dex_yields` | Get DEX farm yields for iAsset pairs | None |
417
+ | `get_protocol_stats` | Get aggregated protocol statistics | None |
395
418
 
396
419
  ### Governance Tools
397
420
 
398
- | Tool | Description | Parameters |
399
- |------|-------------|------------|
400
- | `get_protocol_params` | Get latest governance protocol parameters | None |
401
- | `get_temperature_checks` | Get temperature check polls | None |
402
- | `get_polls` | Get all governance polls | None |
421
+ | Tool | Description | Parameters |
422
+ | ------------------------ | ----------------------------------------- | ---------- |
423
+ | `get_protocol_params` | Get latest governance protocol parameters | None |
424
+ | `get_temperature_checks` | Get temperature check polls | None |
425
+ | `get_polls` | Get all governance polls | None |
403
426
 
404
427
  ### Redemption & Order Book Tools
405
428
 
406
- | Tool | Description | Parameters |
407
- |------|-------------|------------|
408
- | `get_order_book` | Get open limited redemption positions | `asset?`: iAsset filter; `owners?`: array of payment key hashes |
409
- | `get_redemption_orders` | Get redemption orders with optional filters | `timestamp?`: Unix ms; `in_range?`: filter by price range |
410
- | `get_redemption_queue` | Get aggregated redemption queue for an iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
429
+ | Tool | Description | Parameters |
430
+ | ----------------------- | --------------------------------------------- | --------------------------------------------------------------- |
431
+ | `get_order_book` | Get open ROB (redemption order book) positions | `asset?`: iAsset filter; `owners?`: array of payment key hashes |
432
+ | `get_redemption_orders` | Get executed redemption orders | `asset?`: iAsset filter; `limit?`: max records (default 100) |
433
+ | `get_redemption_queue` | Get open ROB order-book entries for an iAsset | `asset`: iUSD, iBTC, iETH, iSOL, iEUR, iJPY, or iADA |
411
434
 
412
435
  ### ROB Write Tools
413
436
 
414
- | Tool | Description | Parameters |
415
- |------|-------------|------------|
416
- | `open_rob` | Open a new ROB position with ADA and a max price limit | `address`: bech32 address; `asset`: iAsset; `lovelacesAmount`: lovelace to deposit; `maxPrice`: on-chain integer string |
417
- | `cancel_rob` | Cancel an existing ROB position | `address`: bech32 address; `robTxHash`: ROB UTxO tx hash; `robOutputIndex`: output index |
418
- | `adjust_rob` | Adjust ADA in a ROB (positive to add, negative to remove) | `address`: bech32 address; `robTxHash`: ROB UTxO tx hash; `robOutputIndex`: output index; `lovelacesAdjustAmount`: adjustment; `newMaxPrice?`: optional new max price |
419
- | `claim_rob` | Claim received iAssets from an ROB position | `address`: bech32 address; `robTxHash`: ROB UTxO tx hash; `robOutputIndex`: output index |
420
- | `redeem_rob` | Redeem iAssets against one or more ROB positions | `address`: bech32 address; `redemptionRobs`: array of `{txHash, outputIndex, iAssetAmount}`; `priceOracleTxHash`; `priceOracleOutputIndex`; `iassetTxHash`; `iassetOutputIndex` |
437
+ | Tool | Description | Parameters |
438
+ | ------------ | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
439
+ | `open_rob` | Open a new ROB position with ADA and a max price limit | `address`: bech32 address; `asset`: iAsset; `lovelacesAmount`: lovelace to deposit; `maxPriceNumerator` + `maxPriceDenominator`: rational max price |
440
+ | `cancel_rob` | Cancel an existing ROB position | `address`: bech32 address; `robTxHash`: ROB UTxO tx hash; `robOutputIndex`: output index |
441
+ | `adjust_rob` | Adjust ADA in a ROB (positive to add, negative to remove) | `address`: bech32 address; `robTxHash`: ROB UTxO tx hash; `robOutputIndex`: output index; `lovelacesAdjustAmount`: adjustment; `newMaxPriceNumerator?` + `newMaxPriceDenominator?`: optional new rational max price |
442
+ | `claim_rob` | Claim received iAssets from an ROB position | `address`: bech32 address; `robTxHash`: ROB UTxO tx hash; `robOutputIndex`: output index |
443
+ | `redeem_rob` | Redeem iAssets against one or more ROB positions | `address`: bech32 address; `asset`: iAsset; `redemptionRobs`: array of `{txHash, outputIndex, amount}` |
421
444
 
422
445
  ### DEX Proxy Tools
423
446
 
424
- | Tool | Description | Parameters |
425
- |------|-------------|------------|
426
- | `get_steelswap_tokens` | Get all tokens available on Steelswap DEX | None |
427
- | `get_steelswap_estimate` | Get a swap estimate from Steelswap | `tokenIn`: input token; `tokenOut`: output token; `amountIn`: amount |
428
- | `get_iris_liquidity_pools` | Get liquidity pools from Iris | `tokenA?`: first token; `tokenB?`: second token; `dex?`: DEX filter |
429
- | `get_blockfrost_balances` | Get token balances for a Cardano address | `address`: Cardano bech32 address |
447
+ | Tool | Description | Parameters |
448
+ | -------------------------- | ----------------------------------------- | -------------------------------------------------------------------- |
449
+ | `get_steelswap_tokens` | Get all tokens available on Steelswap DEX | None |
450
+ | `get_steelswap_estimate` | Get a swap estimate from Steelswap | `tokenIn`: input token; `tokenOut`: output token; `amountIn`: amount |
451
+ | `get_iris_liquidity_pools` | Get liquidity pools from Iris | `tokenA?`: first token; `tokenB?`: second token; `dex?`: DEX filter |
452
+ | `get_blockfrost_balances` | Get token balances for a Cardano address | `address`: Cardano bech32 address |
430
453
 
431
454
  ### Collector & IPFS Tools
432
455
 
433
- | Tool | Description | Parameters |
434
- |------|-------------|------------|
456
+ | Tool | Description | Parameters |
457
+ | --------------------- | ---------------------------------------- | ------------------------------ |
435
458
  | `get_collector_utxos` | Get collector UTXOs for fee distribution | `length?`: max UTXOs to return |
436
- | `store_on_ipfs` | Store text content on IPFS | `text`: content to store |
437
- | `retrieve_from_ipfs` | Retrieve content from IPFS by CID | `cid`: IPFS content identifier |
459
+ | `store_on_ipfs` | Store text content on IPFS | `text`: content to store |
460
+ | `retrieve_from_ipfs` | Retrieve content from IPFS by CID | `cid`: IPFS content identifier |
461
+
462
+ ### Interest Tools (v3)
463
+
464
+ | Tool | Description | Parameters |
465
+ | ---------------------- | ------------------------------------------------------------ | --------------------------------------------- |
466
+ | `collect_interest` | Build a tx to collect accrued interest for one or more CDPs | `asset`, `cdps[]` |
467
+ | `distribute_interest` | Build a tx to distribute collected interest (admin) | `address` |
468
+ | `feed_interest_oracle` | Feed a new interest rate to the interest oracle (admin) | `address`, oracle params |
469
+ | `get_interest_oracle` | Read the current interest oracle state for an iAsset | `asset` |
470
+
471
+ ### Oracle / Pyth Tools (v3)
472
+
473
+ | Tool | Description | Parameters |
474
+ | ------------------- | ----------------------------------------------------------------- | ----------------------------------- |
475
+ | `get_oracle_price` | On-chain price for an iAsset (OracleNft / Delisted / Pyth) | `asset` |
476
+ | `get_pyth_price` | Current Pyth price for an iAsset, plus its on-chain feed config | `asset` |
477
+ | `feed_price_oracle` | Feed a new price to an OracleNft-backed price oracle (admin) | `address`, `oracleTxHash`, price |
478
+
479
+ ### Stableswap Tools (v3)
480
+
481
+ | Tool | Description | Parameters |
482
+ | ------------------------ | ------------------------------------------------------------ | ------------------------------------------- |
483
+ | `get_stableswap_pool` | Get the stableswap pool state for an (iAsset, collateral) | `asset` |
484
+ | `create_stableswap_order`| Build a tx to swap collateral↔iAsset via the stableswap pool | `address`, `asset`, `amount`, `minting` |
485
+ | `cancel_stableswap_order`| Build a tx to cancel a stableswap order | `address`, `orderTxHash`, `orderOutputIndex`|
438
486
 
439
487
  ## Environment Variables
440
488
 
441
- | Variable | Required | Default | Description |
442
- |----------|----------|---------|-------------|
443
- | `INDEXER_URL` | No | `https://analytics.indigoprotocol.io/api/v1` | Indigo analytics API base URL |
444
- | `BLOCKFROST_API_KEY` | For write ops | — | Blockfrost project ID for transaction building |
445
- | `CARDANO_NETWORK` | No | `mainnet` | Cardano network: `mainnet`, `preprod`, or `preview` |
446
- | `MCP_TRANSPORT` | No | `stdio` | Transport mode: `stdio` or `http` |
447
- | `PORT` | No | `3000` | HTTP server port (only used when `MCP_TRANSPORT=http`) |
489
+ | Variable | Required | Default | Description |
490
+ | ---------------------- | ------------- | -------------------------------------------- | ----------------------------------------------------------- |
491
+ | `INDEXER_URL` | No | `https://analytics.indigoprotocol.io/api` | Indigo analytics API base URL |
492
+ | `BLOCKFROST_API_KEY` | For write ops | — | Blockfrost project ID for transaction building |
493
+ | `CARDANO_NETWORK` | No | `mainnet` | Cardano network: `mainnet`, `preprod`, or `preview` |
494
+ | `MCP_TRANSPORT` | No | `stdio` | Transport mode: `stdio` or `http` |
495
+ | `PORT` | No | `3000` | HTTP server port (only used when `MCP_TRANSPORT=http`); `MCP_PORT` is accepted as an alias |
496
+ | `HOST` | No | `0.0.0.0` | HTTP bind address (only used when `MCP_TRANSPORT=http`); set `127.0.0.1` to bind locally only |
497
+ | `X402_PRIVATE_KEY` | No | — | EVM private key (`0x…`) of the payer wallet — enables auto-payment via split flow |
498
+ | `PAYMENT_SERVER` | No | `https://mcp.openmm.io` | Settlement worker / proxy URL |
499
+ | `X402_TESTNET` | No | `false` | Use Base Sepolia testnet |
500
+ | `X402_FACILITATOR_URL` | No | — | Fallback facilitator (used only when `PAYMENT_SERVER` unset) |
448
501
 
449
502
  ## Example Queries
450
503
 
@@ -471,7 +524,7 @@ When connected to an LLM agent, you can ask natural language questions like:
471
524
 
472
525
  ### Prerequisites
473
526
 
474
- - Node.js >= 18
527
+ - Node.js >= 20 (the bundled `undici` requires the `File` global, added in Node 20)
475
528
  - npm
476
529
 
477
530
  ### Setup
@@ -503,6 +556,8 @@ npm run test:watch # run tests in watch mode
503
556
  ```
504
557
  src/
505
558
  ├── index.ts # Server entry point (stdio transport)
559
+ ├── payment.ts # x402 configuration: chain addresses + tool price tiers
560
+ ├── payment-client.ts # withAutoPayment: client-side auto-pay on 402 responses
506
561
  ├── types/
507
562
  │ └── tx-types.ts # UnsignedTxResult, TxSummary types
508
563
  ├── tools/
@@ -550,6 +605,118 @@ npm run build
550
605
  echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0.1.0"}}}' | node dist/index.js
551
606
  ```
552
607
 
608
+ ## x402 Payment Gating
609
+
610
+ Indigo MCP optionally gates tools behind per-call micropayments using the [x402 protocol](https://x402.org). Payment is disabled by default — set at least one wallet address to enable it.
611
+
612
+ ### How it works
613
+
614
+ Payment uses the **split execution** model — the same architecture as openMM-MCP:
615
+
616
+ 1. A tool is called (no payment header needed from the caller)
617
+ 2. The gate intercepts and contacts the **settlement worker** (`mcp.openmm.io` by default)
618
+ 3. Worker responds `402` with EIP-3009 requirements (amount, recipient, chain)
619
+ 4. Gate **signs locally** using `X402_PRIVATE_KEY` — the key never leaves this process
620
+ 5. Gate retries with the signed payment → worker verifies on-chain, issues a JWT
621
+ 6. Gate verifies JWT locally, executes the original tool handler
622
+ 7. Settlement tx hash is injected into the tool response
623
+
624
+ This keeps process isolation clean: indigo-mcp never holds the recipient wallet — only the payer key. Verification and settlement are handled by the openmm.io proxy.
625
+
626
+ - Read tools (`get_tvl`, `get_asset_price`, …) cost **$0.001 USDC** per call
627
+ - Analysis tools (`analyze_cdp_health`) cost **$0.005 USDC** per call
628
+ - Write tools (`open_cdp`, `mint_cdp`, …) cost **$0.01 USDC** per call
629
+
630
+ ### Environment variables
631
+
632
+ | Variable | Required | Default | Description |
633
+ | ---------------------- | --------- | ----------------------- | ------------------------------------------------------------------------------ |
634
+ | `X402_PRIVATE_KEY` | to enable | — | EVM private key (`0x…`) of the payer wallet — enables split payment |
635
+ | `PAYMENT_SERVER` | optional | `https://mcp.openmm.io` | Settlement worker / proxy URL |
636
+ | `X402_TESTNET` | optional | `false` | Use Base Sepolia testnet |
637
+ | `X402_FACILITATOR_URL` | optional | — | Fallback facilitator URL (used only when `PAYMENT_SERVER` is not set) |
638
+
639
+ ### Split execution flow
640
+
641
+ When `X402_PRIVATE_KEY` is set, every paid tool call is handled transparently:
642
+
643
+ 1. Gate contacts `PAYMENT_SERVER` (`https://mcp.openmm.io` by default)
644
+ 2. Signs EIP-3009 locally — the private key never leaves this process
645
+ 3. Proxy verifies on-chain, issues a short-lived JWT
646
+ 4. Gate verifies JWT, executes tool, injects settlement tx hash into response
647
+
648
+ If `X402_PRIVATE_KEY` is not set the gate is disabled and all tools execute without payment.
649
+
650
+ ```bash
651
+ # Minimal: just set the payer key (proxy defaults to mcp.openmm.io)
652
+ X402_PRIVATE_KEY=0xYourPayerPrivateKey npx @indigoprotocol/indigo-mcp
653
+
654
+ # Self-hosted proxy
655
+ X402_PRIVATE_KEY=0xYourPayerPrivateKey \
656
+ PAYMENT_SERVER=https://your-own-proxy \
657
+ npx @indigoprotocol/indigo-mcp
658
+ ```
659
+
660
+ ### Local development
661
+
662
+ ```bash
663
+ # 1. Copy example env
664
+ cp .env.example .env
665
+ # Edit .env and set X402_PRIVATE_KEY to a funded Base Sepolia wallet
666
+
667
+ # 2. Start the HTTP server
668
+ MCP_TRANSPORT=http PORT=3000 npm run dev
669
+
670
+ # 3. Run the payment e2e tests
671
+ X402_TESTNET=true npm test -- x402-payment
672
+ ```
673
+
674
+ ### MCP client config with x402
675
+
676
+ Add the `env` block to whichever MCP config file your client uses:
677
+
678
+ **Claude Code** (`~/.claude/settings.json`):
679
+
680
+ ```json
681
+ {
682
+ "mcpServers": {
683
+ "indigo": {
684
+ "command": "npx",
685
+ "args": ["-y", "@indigoprotocol/indigo-mcp"],
686
+ "env": {
687
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
688
+ "BLOCKFROST_API_KEY": "your-blockfrost-project-id",
689
+ "X402_PRIVATE_KEY": "0xYourPayerPrivateKey",
690
+ "X402_TESTNET": "true"
691
+ }
692
+ }
693
+ }
694
+ }
695
+ ```
696
+
697
+ **Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
698
+
699
+ ```json
700
+ {
701
+ "mcpServers": {
702
+ "indigo": {
703
+ "command": "npx",
704
+ "args": ["-y", "@indigoprotocol/indigo-mcp"],
705
+ "env": {
706
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
707
+ "BLOCKFROST_API_KEY": "your-blockfrost-project-id",
708
+ "X402_PRIVATE_KEY": "0xYourPayerPrivateKey",
709
+ "X402_TESTNET": "true"
710
+ }
711
+ }
712
+ }
713
+ }
714
+ ```
715
+
716
+ **Cursor / Windsurf** — same `env` block applies to `~/.cursor/mcp.json` or `~/.codeium/windsurf/mcp_config.json`.
717
+
718
+ > Set `X402_TESTNET` to `false` (or omit it) for Base mainnet.
719
+
553
720
  ## License
554
721
 
555
722
  ISC
package/dist/cli/setup.js CHANGED
@@ -52,7 +52,7 @@ function getIndigoServerConfig() {
52
52
  args: ["-y", "@indigoprotocol/indigo-mcp"],
53
53
  env: {
54
54
  PATH: `${nodePath}:/usr/local/bin:/usr/bin:/bin`,
55
- INDEXER_URL: "https://analytics.indigoprotocol.io/api/v1",
55
+ INDEXER_URL: "https://analytics.indigoprotocol.io/api",
56
56
  BLOCKFROST_API_KEY: ""
57
57
  }
58
58
  };
@@ -61,7 +61,7 @@ function getIndigoServerConfig() {
61
61
  command: "npx",
62
62
  args: ["-y", "@indigoprotocol/indigo-mcp"],
63
63
  env: {
64
- INDEXER_URL: "https://analytics.indigoprotocol.io/api/v1",
64
+ INDEXER_URL: "https://analytics.indigoprotocol.io/api",
65
65
  BLOCKFROST_API_KEY: ""
66
66
  }
67
67
  };