@indigoprotocol/indigo-mcp 0.2.13 → 0.3.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 (40) hide show
  1. package/README.md +271 -98
  2. package/dist/cli/setup.js +38 -8
  3. package/dist/index.js +59697 -50522
  4. package/dist/payment.d.ts +4 -0
  5. package/dist/payment.d.ts.map +1 -0
  6. package/dist/server.d.ts.map +1 -1
  7. package/dist/tools/analytics-tools.d.ts.map +1 -1
  8. package/dist/tools/asset-tools.d.ts.map +1 -1
  9. package/dist/tools/cdp-liquidation-tools.d.ts.map +1 -1
  10. package/dist/tools/cdp-mint-burn-tools.d.ts.map +1 -1
  11. package/dist/tools/cdp-tools.d.ts.map +1 -1
  12. package/dist/tools/cdp-write-tools.d.ts.map +1 -1
  13. package/dist/tools/dex-tools.d.ts.map +1 -1
  14. package/dist/tools/governance-tools.d.ts.map +1 -1
  15. package/dist/tools/index.d.ts.map +1 -1
  16. package/dist/tools/interest-tools.d.ts +3 -0
  17. package/dist/tools/interest-tools.d.ts.map +1 -0
  18. package/dist/tools/leverage-cdp-tools.d.ts.map +1 -1
  19. package/dist/tools/oracle-tools.d.ts +3 -0
  20. package/dist/tools/oracle-tools.d.ts.map +1 -0
  21. package/dist/tools/redemption-tools.d.ts.map +1 -1
  22. package/dist/tools/rob-write-tools.d.ts.map +1 -1
  23. package/dist/tools/sp-request-tools.d.ts.map +1 -1
  24. package/dist/tools/stability-pool-tools.d.ts.map +1 -1
  25. package/dist/tools/stability-pool-write-tools.d.ts.map +1 -1
  26. package/dist/tools/stableswap-tools.d.ts +3 -0
  27. package/dist/tools/stableswap-tools.d.ts.map +1 -0
  28. package/dist/tools/staking-reward-tools.d.ts.map +1 -1
  29. package/dist/tools/staking-tools.d.ts.map +1 -1
  30. package/dist/tools/staking-write-tools.d.ts.map +1 -1
  31. package/dist/utils/indexer-client.d.ts.map +1 -1
  32. package/dist/utils/sdk-config.d.ts +7 -1
  33. package/dist/utils/sdk-config.d.ts.map +1 -1
  34. package/dist/utils/tx-builder.d.ts +2 -2
  35. package/dist/utils/tx-builder.d.ts.map +1 -1
  36. package/dist/utils/v3-finders.d.ts +66 -0
  37. package/dist/utils/v3-finders.d.ts.map +1 -0
  38. package/dist/utils/validators.d.ts +1 -1
  39. package/dist/utils/validators.d.ts.map +1 -1
  40. package/package.json +8 -2
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
 
@@ -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,6 +125,7 @@ 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
 
@@ -139,6 +145,8 @@ nano ~/Library/Application\ Support/Claude/claude_desktop_config.json
139
145
  notepad "$env:APPDATA\Claude\claude_desktop_config.json"
140
146
  ```
141
147
 
148
+ **Standard config:**
149
+
142
150
  ```json
143
151
  {
144
152
  "mcpServers": {
@@ -146,7 +154,7 @@ notepad "$env:APPDATA\Claude\claude_desktop_config.json"
146
154
  "command": "npx",
147
155
  "args": ["-y", "@indigoprotocol/indigo-mcp"],
148
156
  "env": {
149
- "INDEXER_URL": "https://analytics.indigoprotocol.io/api/v1",
157
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
150
158
  "BLOCKFROST_API_KEY": "your-blockfrost-project-id"
151
159
  }
152
160
  }
@@ -154,6 +162,28 @@ notepad "$env:APPDATA\Claude\claude_desktop_config.json"
154
162
  }
155
163
  ```
156
164
 
165
+ **For nvm users (multiple Node versions):**
166
+
167
+ If you use nvm and have multiple Node versions, you may need to specify the full path and set PATH explicitly:
168
+
169
+ ```json
170
+ {
171
+ "mcpServers": {
172
+ "indigo": {
173
+ "command": "/Users/YOUR_USERNAME/.nvm/versions/node/v22.22.0/bin/npx",
174
+ "args": ["-y", "@indigoprotocol/indigo-mcp"],
175
+ "env": {
176
+ "PATH": "/Users/YOUR_USERNAME/.nvm/versions/node/v22.22.0/bin:/usr/local/bin:/usr/bin:/bin",
177
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
178
+ "BLOCKFROST_API_KEY": "your-blockfrost-project-id"
179
+ }
180
+ }
181
+ }
182
+ }
183
+ ```
184
+
185
+ > **Note:** Replace `YOUR_USERNAME` and Node version with your actual values. Find your Node path with `which npx`.
186
+
157
187
  ### Claude Code (CLI)
158
188
 
159
189
  Add to `~/.claude/settings.json` or `.claude/settings.json` in your project:
@@ -169,7 +199,7 @@ nano ~/.claude/settings.json
169
199
  "command": "npx",
170
200
  "args": ["-y", "@indigoprotocol/indigo-mcp"],
171
201
  "env": {
172
- "INDEXER_URL": "https://analytics.indigoprotocol.io/api/v1",
202
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
173
203
  "BLOCKFROST_API_KEY": "your-blockfrost-project-id"
174
204
  }
175
205
  }
@@ -188,7 +218,7 @@ Add to `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project-level):
188
218
  "command": "npx",
189
219
  "args": ["-y", "@indigoprotocol/indigo-mcp"],
190
220
  "env": {
191
- "INDEXER_URL": "https://analytics.indigoprotocol.io/api/v1",
221
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
192
222
  "BLOCKFROST_API_KEY": "your-blockfrost-project-id"
193
223
  }
194
224
  }
@@ -207,7 +237,7 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
207
237
  "command": "npx",
208
238
  "args": ["-y", "@indigoprotocol/indigo-mcp"],
209
239
  "env": {
210
- "INDEXER_URL": "https://analytics.indigoprotocol.io/api/v1",
240
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
211
241
  "BLOCKFROST_API_KEY": "your-blockfrost-project-id"
212
242
  }
213
243
  }
@@ -256,7 +286,7 @@ For full Cardano DeFi capabilities, use both Indigo MCP and [Cardano MCP](https:
256
286
  Run the server directly via stdio:
257
287
 
258
288
  ```bash
259
- INDEXER_URL=https://analytics.indigoprotocol.io/api/v1 \
289
+ INDEXER_URL=https://analytics.indigoprotocol.io/api \
260
290
  BLOCKFROST_API_KEY=your-blockfrost-project-id \
261
291
  npx @indigoprotocol/indigo-mcp
262
292
  ```
@@ -274,154 +304,183 @@ For any client that supports MCP over stdio, point it to the `npx @indigoprotoco
274
304
 
275
305
  ### Asset Tools
276
306
 
277
- | Tool | Description | Parameters |
278
- |------|-------------|------------|
279
- | `get_assets` | Get all Indigo iAssets with prices and interest data | None |
280
- | `get_asset` | Get details for a specific iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
281
- | `get_asset_price` | Get the current price for a specific iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
282
- | `get_ada_price` | Get the current ADA price in USD | None |
283
- | `get_indy_price` | Get the current INDY token price in ADA and USD | None |
307
+ | Tool | Description | Parameters |
308
+ | ----------------- | ---------------------------------------------------- | ---------------------------------- |
309
+ | `get_assets` | Get all Indigo iAssets with prices and interest data | None |
310
+ | `get_asset` | Get details for a specific iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
311
+ | `get_asset_price` | Get the current price for a specific iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
312
+ | `get_ada_price` | Get the current ADA price in USD | None |
313
+ | `get_indy_price` | Get the current INDY token price in ADA and USD | None |
284
314
 
285
315
  ### CDP / Loan Tools
286
316
 
287
- | Tool | Description | Parameters |
288
- |------|-------------|------------|
289
- | `get_all_cdps` | Get all CDPs/loans, optionally filtered by iAsset | `asset?`: iAsset filter; `limit?`: 1-500 (default 50); `offset?`: pagination offset |
290
- | `get_cdps_by_owner` | Get CDPs for a specific owner | `owner`: payment key hash (56-char hex) or bech32 address |
291
- | `get_cdps_by_address` | Get CDPs for a specific Cardano address | `address`: bech32 address (addr1... or addr_test1...) |
292
- | `analyze_cdp_health` | Analyze collateral ratios and liquidation risk | `owner`: payment key hash or bech32 address |
317
+ | Tool | Description | Parameters |
318
+ | --------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------- |
319
+ | `get_all_cdps` | Get all CDPs/loans, optionally filtered by iAsset | `asset?`: iAsset filter; `limit?`: 1-500 (default 50); `offset?`: pagination offset |
320
+ | `get_cdps_by_owner` | Get CDPs for a specific owner | `owner`: payment key hash (56-char hex) or bech32 address |
321
+ | `get_cdps_by_address` | Get CDPs for a specific Cardano address | `address`: bech32 address (addr1... or addr_test1...) |
322
+ | `analyze_cdp_health` | Analyze collateral ratios and liquidation risk | `owner`: payment key hash or bech32 address |
293
323
 
294
324
  ### CDP Write Tools
295
325
 
296
- | Tool | Description | Parameters |
297
- |------|-------------|------------|
298
- | `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 |
299
- | `deposit_cdp` | Deposit additional collateral into a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: lovelace |
300
- | `withdraw_cdp` | Withdraw collateral from a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: lovelace |
301
- | `close_cdp` | Close a CDP and reclaim collateral | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
326
+ | Tool | Description | Parameters |
327
+ | -------------- | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
328
+ | `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 |
329
+ | `deposit_cdp` | Deposit additional collateral into a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: lovelace |
330
+ | `withdraw_cdp` | Withdraw collateral from a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: lovelace |
331
+ | `close_cdp` | Close a CDP and reclaim collateral | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
302
332
 
303
333
  ### CDP Mint/Burn Tools
304
334
 
305
- | Tool | Description | Parameters |
306
- |------|-------------|------------|
335
+ | Tool | Description | Parameters |
336
+ | ---------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
307
337
  | `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 |
308
- | `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 |
338
+ | `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 |
309
339
 
310
340
  ### CDP Liquidation & Redemption Tools
311
341
 
312
- | Tool | Description | Parameters |
313
- |------|-------------|------------|
314
- | `liquidate_cdp` | Liquidate an undercollateralized CDP through the stability pool | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
315
- | `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 |
316
- | `freeze_cdp` | Freeze a CDP to prevent further operations | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
317
- | `merge_cdps` | Merge multiple CDPs into one | `address`: bech32 address; `cdpOutRefs`: array of `{txHash, outputIndex}` (min 2) |
342
+ | Tool | Description | Parameters |
343
+ | --------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
344
+ | `liquidate_cdp` | Liquidate an undercollateralized CDP through the stability pool | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
345
+ | `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 |
346
+ | `freeze_cdp` | Freeze a CDP to prevent further operations | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
347
+ | `merge_cdps` | Merge multiple CDPs into one | `address`: bech32 address; `cdpOutRefs`: array of `{txHash, outputIndex}` (min 2) |
318
348
 
319
349
  ### Leverage CDP Tools
320
350
 
321
- | Tool | Description | Parameters |
322
- |------|-------------|------------|
351
+ | Tool | Description | Parameters |
352
+ | -------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
323
353
  | `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 |
324
354
 
325
355
  ### Stability Pool Tools
326
356
 
327
- | Tool | Description | Parameters |
328
- |------|-------------|------------|
329
- | `get_stability_pools` | Get the latest stability pool state for each iAsset | None |
330
- | `get_stability_pool_accounts` | Get all open stability pool accounts, optionally filtered by iAsset | `asset?`: iUSD, iBTC, iETH, or iSOL |
331
- | `get_sp_account_by_owner` | Get stability pool accounts for specific owners | `owners`: array of payment key hashes or bech32 addresses |
357
+ | Tool | Description | Parameters |
358
+ | ----------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------- |
359
+ | `get_stability_pools` | Get the latest stability pool state for each iAsset | None |
360
+ | `get_stability_pool_accounts` | Get all open stability pool accounts, optionally filtered by iAsset | `asset?`: iUSD, iBTC, iETH, or iSOL |
361
+ | `get_sp_account_by_owner` | Get stability pool accounts for specific owners | `owners`: array of payment key hashes or bech32 addresses |
332
362
 
333
363
  ### Staking Tools
334
364
 
335
- | Tool | Description | Parameters |
336
- |------|-------------|------------|
337
- | `get_staking_info` | Get the current INDY staking manager state | None |
338
- | `get_staking_positions` | Get all open INDY staking positions | None |
339
- | `get_staking_positions_by_owner` | Get INDY staking positions for specific owners | `owners`: array of payment key hashes or bech32 addresses |
340
- | `get_staking_position_by_address` | Get INDY staking positions for a single address | `address`: Cardano bech32 address |
365
+ | Tool | Description | Parameters |
366
+ | --------------------------------- | ----------------------------------------------- | --------------------------------------------------------- |
367
+ | `get_staking_info` | Get the current INDY staking manager state | None |
368
+ | `get_staking_positions` | Get all open INDY staking positions | None |
369
+ | `get_staking_positions_by_owner` | Get INDY staking positions for specific owners | `owners`: array of payment key hashes or bech32 addresses |
370
+ | `get_staking_position_by_address` | Get INDY staking positions for a single address | `address`: Cardano bech32 address |
341
371
 
342
372
  ### Stability Pool Request Tools
343
373
 
344
- | Tool | Description | Parameters |
345
- |------|-------------|------------|
374
+ | Tool | Description | Parameters |
375
+ | -------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
346
376
  | `process_sp_request` | Process a pending stability pool request (protocol maintenance) | `address`: bech32 address; `asset`: iAsset; `accountTxHash`: account UTxO tx hash; `accountOutputIndex`: output index |
347
- | `annul_sp_request` | Cancel a pending stability pool request | `address`: bech32 address; `accountTxHash`: account UTxO tx hash; `accountOutputIndex`: output index |
377
+ | `annul_sp_request` | Cancel a pending stability pool request | `address`: bech32 address; `accountTxHash`: account UTxO tx hash; `accountOutputIndex`: output index |
348
378
 
349
379
  ### Staking Write Tools
350
380
 
351
- | Tool | Description | Parameters |
352
- |------|-------------|------------|
353
- | `open_staking_position` | Stake INDY tokens by creating a new staking position | `address`: bech32 address; `amount`: INDY amount in smallest unit |
381
+ | Tool | Description | Parameters |
382
+ | ------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
383
+ | `open_staking_position` | Stake INDY tokens by creating a new staking position | `address`: bech32 address; `amount`: INDY amount in smallest unit |
354
384
  | `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 |
355
- | `close_staking_position` | Close a staking position and unstake all INDY | `address`: bech32 address; `positionTxHash`: UTxO tx hash; `positionOutputIndex`: UTxO output index |
385
+ | `close_staking_position` | Close a staking position and unstake all INDY | `address`: bech32 address; `positionTxHash`: UTxO tx hash; `positionOutputIndex`: UTxO output index |
356
386
 
357
387
  ### Staking Reward Tools
358
388
 
359
- | Tool | Description | Parameters |
360
- |------|-------------|------------|
389
+ | Tool | Description | Parameters |
390
+ | ---------------------------- | ---------------------------------------------------------------- | -------------------------------------------------------------------------------- |
361
391
  | `distribute_staking_rewards` | Distribute collected ADA rewards from collector UTxOs to stakers | `address`: bech32 address; `collectorTxHashes`: array of `{txHash, outputIndex}` |
362
392
 
363
393
  ### Analytics & APR Tools
364
394
 
365
- | Tool | Description | Parameters |
366
- |------|-------------|------------|
367
- | `get_tvl` | Get historical TVL data from DefiLlama | None |
368
- | `get_apr_rewards` | Get all APR reward records | None |
369
- | `get_apr_by_key` | Get APR for a specific key | `key`: APR key (e.g. sp_iUSD_indy, stake_ada) |
370
- | `get_dex_yields` | Get DEX farm yields for iAsset pairs | None |
371
- | `get_protocol_stats` | Get aggregated protocol statistics | None |
395
+ | Tool | Description | Parameters |
396
+ | -------------------- | -------------------------------------- | --------------------------------------------- |
397
+ | `get_tvl` | Get historical TVL data from DefiLlama | None |
398
+ | `get_apr_rewards` | Get all APR reward records | None |
399
+ | `get_apr_by_key` | Get APR for a specific key | `key`: APR key (e.g. sp_iUSD_indy, stake_ada) |
400
+ | `get_dex_yields` | Get DEX farm yields for iAsset pairs | None |
401
+ | `get_protocol_stats` | Get aggregated protocol statistics | None |
372
402
 
373
403
  ### Governance Tools
374
404
 
375
- | Tool | Description | Parameters |
376
- |------|-------------|------------|
377
- | `get_protocol_params` | Get latest governance protocol parameters | None |
378
- | `get_temperature_checks` | Get temperature check polls | None |
379
- | `get_polls` | Get all governance polls | None |
405
+ | Tool | Description | Parameters |
406
+ | ------------------------ | ----------------------------------------- | ---------- |
407
+ | `get_protocol_params` | Get latest governance protocol parameters | None |
408
+ | `get_temperature_checks` | Get temperature check polls | None |
409
+ | `get_polls` | Get all governance polls | None |
380
410
 
381
411
  ### Redemption & Order Book Tools
382
412
 
383
- | Tool | Description | Parameters |
384
- |------|-------------|------------|
385
- | `get_order_book` | Get open limited redemption positions | `asset?`: iAsset filter; `owners?`: array of payment key hashes |
386
- | `get_redemption_orders` | Get redemption orders with optional filters | `timestamp?`: Unix ms; `in_range?`: filter by price range |
387
- | `get_redemption_queue` | Get aggregated redemption queue for an iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
413
+ | Tool | Description | Parameters |
414
+ | ----------------------- | --------------------------------------------- | --------------------------------------------------------------- |
415
+ | `get_order_book` | Get open limited redemption positions | `asset?`: iAsset filter; `owners?`: array of payment key hashes |
416
+ | `get_redemption_orders` | Get redemption orders with optional filters | `timestamp?`: Unix ms; `in_range?`: filter by price range |
417
+ | `get_redemption_queue` | Get aggregated redemption queue for an iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
388
418
 
389
419
  ### ROB Write Tools
390
420
 
391
- | Tool | Description | Parameters |
392
- |------|-------------|------------|
393
- | `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 |
394
- | `cancel_rob` | Cancel an existing ROB position | `address`: bech32 address; `robTxHash`: ROB UTxO tx hash; `robOutputIndex`: output index |
395
- | `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 |
396
- | `claim_rob` | Claim received iAssets from an ROB position | `address`: bech32 address; `robTxHash`: ROB UTxO tx hash; `robOutputIndex`: output index |
397
- | `redeem_rob` | Redeem iAssets against one or more ROB positions | `address`: bech32 address; `redemptionRobs`: array of `{txHash, outputIndex, iAssetAmount}`; `priceOracleTxHash`; `priceOracleOutputIndex`; `iassetTxHash`; `iassetOutputIndex` |
421
+ | Tool | Description | Parameters |
422
+ | ------------ | --------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
423
+ | `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 |
424
+ | `cancel_rob` | Cancel an existing ROB position | `address`: bech32 address; `robTxHash`: ROB UTxO tx hash; `robOutputIndex`: output index |
425
+ | `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 |
426
+ | `claim_rob` | Claim received iAssets from an ROB position | `address`: bech32 address; `robTxHash`: ROB UTxO tx hash; `robOutputIndex`: output index |
427
+ | `redeem_rob` | Redeem iAssets against one or more ROB positions | `address`: bech32 address; `redemptionRobs`: array of `{txHash, outputIndex, iAssetAmount}`; `priceOracleTxHash`; `priceOracleOutputIndex`; `iassetTxHash`; `iassetOutputIndex` |
398
428
 
399
429
  ### DEX Proxy Tools
400
430
 
401
- | Tool | Description | Parameters |
402
- |------|-------------|------------|
403
- | `get_steelswap_tokens` | Get all tokens available on Steelswap DEX | None |
404
- | `get_steelswap_estimate` | Get a swap estimate from Steelswap | `tokenIn`: input token; `tokenOut`: output token; `amountIn`: amount |
405
- | `get_iris_liquidity_pools` | Get liquidity pools from Iris | `tokenA?`: first token; `tokenB?`: second token; `dex?`: DEX filter |
406
- | `get_blockfrost_balances` | Get token balances for a Cardano address | `address`: Cardano bech32 address |
431
+ | Tool | Description | Parameters |
432
+ | -------------------------- | ----------------------------------------- | -------------------------------------------------------------------- |
433
+ | `get_steelswap_tokens` | Get all tokens available on Steelswap DEX | None |
434
+ | `get_steelswap_estimate` | Get a swap estimate from Steelswap | `tokenIn`: input token; `tokenOut`: output token; `amountIn`: amount |
435
+ | `get_iris_liquidity_pools` | Get liquidity pools from Iris | `tokenA?`: first token; `tokenB?`: second token; `dex?`: DEX filter |
436
+ | `get_blockfrost_balances` | Get token balances for a Cardano address | `address`: Cardano bech32 address |
407
437
 
408
438
  ### Collector & IPFS Tools
409
439
 
410
- | Tool | Description | Parameters |
411
- |------|-------------|------------|
440
+ | Tool | Description | Parameters |
441
+ | --------------------- | ---------------------------------------- | ------------------------------ |
412
442
  | `get_collector_utxos` | Get collector UTXOs for fee distribution | `length?`: max UTXOs to return |
413
- | `store_on_ipfs` | Store text content on IPFS | `text`: content to store |
414
- | `retrieve_from_ipfs` | Retrieve content from IPFS by CID | `cid`: IPFS content identifier |
443
+ | `store_on_ipfs` | Store text content on IPFS | `text`: content to store |
444
+ | `retrieve_from_ipfs` | Retrieve content from IPFS by CID | `cid`: IPFS content identifier |
445
+
446
+ ### Interest Tools (v3)
447
+
448
+ | Tool | Description | Parameters |
449
+ | ---------------------- | ------------------------------------------------------------ | --------------------------------------------- |
450
+ | `collect_interest` | Build a tx to collect accrued interest for one or more CDPs | `asset`, `cdps[]` |
451
+ | `distribute_interest` | Build a tx to distribute collected interest (admin) | `address` |
452
+ | `feed_interest_oracle` | Feed a new interest rate to the interest oracle (admin) | `address`, oracle params |
453
+ | `get_interest_oracle` | Read the current interest oracle state for an iAsset | `asset` |
454
+
455
+ ### Oracle / Pyth Tools (v3)
456
+
457
+ | Tool | Description | Parameters |
458
+ | ------------------- | ----------------------------------------------------------------- | ----------------------------------- |
459
+ | `get_oracle_price` | On-chain price for an iAsset (OracleNft / Delisted / Pyth) | `asset` |
460
+ | `get_pyth_price` | Read the Pyth price-feed config for an iAsset | `asset` |
461
+ | `feed_price_oracle` | Feed a new price to an OracleNft-backed price oracle (admin) | `address`, `oracleTxHash`, price |
462
+
463
+ ### Stableswap Tools (v3)
464
+
465
+ | Tool | Description | Parameters |
466
+ | ------------------------ | ------------------------------------------------------------ | ------------------------------------------- |
467
+ | `get_stableswap_pool` | Get the stableswap pool state for an (iAsset, collateral) | `asset` |
468
+ | `create_stableswap_order`| Build a tx to swap collateral↔iAsset via the stableswap pool | `address`, `asset`, `amount`, `minting` |
469
+ | `cancel_stableswap_order`| Build a tx to cancel a stableswap order | `address`, `orderTxHash`, `orderOutputIndex`|
415
470
 
416
471
  ## Environment Variables
417
472
 
418
- | Variable | Required | Default | Description |
419
- |----------|----------|---------|-------------|
420
- | `INDEXER_URL` | No | `https://analytics.indigoprotocol.io/api/v1` | Indigo analytics API base URL |
421
- | `BLOCKFROST_API_KEY` | For write ops | — | Blockfrost project ID for transaction building |
422
- | `CARDANO_NETWORK` | No | `mainnet` | Cardano network: `mainnet`, `preprod`, or `preview` |
423
- | `MCP_TRANSPORT` | No | `stdio` | Transport mode: `stdio` or `http` |
424
- | `PORT` | No | `3000` | HTTP server port (only used when `MCP_TRANSPORT=http`) |
473
+ | Variable | Required | Default | Description |
474
+ | ---------------------- | ------------- | -------------------------------------------- | ----------------------------------------------------------- |
475
+ | `INDEXER_URL` | No | `https://analytics.indigoprotocol.io/api` | Indigo analytics API base URL |
476
+ | `BLOCKFROST_API_KEY` | For write ops | — | Blockfrost project ID for transaction building |
477
+ | `CARDANO_NETWORK` | No | `mainnet` | Cardano network: `mainnet`, `preprod`, or `preview` |
478
+ | `MCP_TRANSPORT` | No | `stdio` | Transport mode: `stdio` or `http` |
479
+ | `PORT` | No | `3000` | HTTP server port (only used when `MCP_TRANSPORT=http`) |
480
+ | `X402_PRIVATE_KEY` | No | — | EVM private key (`0x…`) of the payer wallet — enables auto-payment via split flow |
481
+ | `PAYMENT_SERVER` | No | `https://mcp.openmm.io` | Settlement worker / proxy URL |
482
+ | `X402_TESTNET` | No | `false` | Use Base Sepolia testnet |
483
+ | `X402_FACILITATOR_URL` | No | — | Fallback facilitator (used only when `PAYMENT_SERVER` unset) |
425
484
 
426
485
  ## Example Queries
427
486
 
@@ -480,6 +539,8 @@ npm run test:watch # run tests in watch mode
480
539
  ```
481
540
  src/
482
541
  ├── index.ts # Server entry point (stdio transport)
542
+ ├── payment.ts # x402 configuration: chain addresses + tool price tiers
543
+ ├── payment-client.ts # withAutoPayment: client-side auto-pay on 402 responses
483
544
  ├── types/
484
545
  │ └── tx-types.ts # UnsignedTxResult, TxSummary types
485
546
  ├── tools/
@@ -527,6 +588,118 @@ npm run build
527
588
  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
528
589
  ```
529
590
 
591
+ ## x402 Payment Gating
592
+
593
+ 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.
594
+
595
+ ### How it works
596
+
597
+ Payment uses the **split execution** model — the same architecture as openMM-MCP:
598
+
599
+ 1. A tool is called (no payment header needed from the caller)
600
+ 2. The gate intercepts and contacts the **settlement worker** (`mcp.openmm.io` by default)
601
+ 3. Worker responds `402` with EIP-3009 requirements (amount, recipient, chain)
602
+ 4. Gate **signs locally** using `X402_PRIVATE_KEY` — the key never leaves this process
603
+ 5. Gate retries with the signed payment → worker verifies on-chain, issues a JWT
604
+ 6. Gate verifies JWT locally, executes the original tool handler
605
+ 7. Settlement tx hash is injected into the tool response
606
+
607
+ 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.
608
+
609
+ - Read tools (`get_tvl`, `get_asset_price`, …) cost **$0.001 USDC** per call
610
+ - Analysis tools (`analyze_cdp_health`) cost **$0.005 USDC** per call
611
+ - Write tools (`open_cdp`, `mint_cdp`, …) cost **$0.01 USDC** per call
612
+
613
+ ### Environment variables
614
+
615
+ | Variable | Required | Default | Description |
616
+ | ---------------------- | --------- | ----------------------- | ------------------------------------------------------------------------------ |
617
+ | `X402_PRIVATE_KEY` | to enable | — | EVM private key (`0x…`) of the payer wallet — enables split payment |
618
+ | `PAYMENT_SERVER` | optional | `https://mcp.openmm.io` | Settlement worker / proxy URL |
619
+ | `X402_TESTNET` | optional | `false` | Use Base Sepolia testnet |
620
+ | `X402_FACILITATOR_URL` | optional | — | Fallback facilitator URL (used only when `PAYMENT_SERVER` is not set) |
621
+
622
+ ### Split execution flow
623
+
624
+ When `X402_PRIVATE_KEY` is set, every paid tool call is handled transparently:
625
+
626
+ 1. Gate contacts `PAYMENT_SERVER` (`https://mcp.openmm.io` by default)
627
+ 2. Signs EIP-3009 locally — the private key never leaves this process
628
+ 3. Proxy verifies on-chain, issues a short-lived JWT
629
+ 4. Gate verifies JWT, executes tool, injects settlement tx hash into response
630
+
631
+ If `X402_PRIVATE_KEY` is not set the gate is disabled and all tools execute without payment.
632
+
633
+ ```bash
634
+ # Minimal: just set the payer key (proxy defaults to mcp.openmm.io)
635
+ X402_PRIVATE_KEY=0xYourPayerPrivateKey npx @indigoprotocol/indigo-mcp
636
+
637
+ # Self-hosted proxy
638
+ X402_PRIVATE_KEY=0xYourPayerPrivateKey \
639
+ PAYMENT_SERVER=https://your-own-proxy \
640
+ npx @indigoprotocol/indigo-mcp
641
+ ```
642
+
643
+ ### Local development
644
+
645
+ ```bash
646
+ # 1. Copy example env
647
+ cp .env.example .env
648
+ # Edit .env and set X402_PRIVATE_KEY to a funded Base Sepolia wallet
649
+
650
+ # 2. Start the HTTP server
651
+ MCP_TRANSPORT=http PORT=3000 npm run dev
652
+
653
+ # 3. Run the payment e2e tests
654
+ X402_TESTNET=true npm test -- x402-payment
655
+ ```
656
+
657
+ ### MCP client config with x402
658
+
659
+ Add the `env` block to whichever MCP config file your client uses:
660
+
661
+ **Claude Code** (`~/.claude/settings.json`):
662
+
663
+ ```json
664
+ {
665
+ "mcpServers": {
666
+ "indigo": {
667
+ "command": "npx",
668
+ "args": ["-y", "@indigoprotocol/indigo-mcp"],
669
+ "env": {
670
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
671
+ "BLOCKFROST_API_KEY": "your-blockfrost-project-id",
672
+ "X402_PRIVATE_KEY": "0xYourPayerPrivateKey",
673
+ "X402_TESTNET": "true"
674
+ }
675
+ }
676
+ }
677
+ }
678
+ ```
679
+
680
+ **Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`):
681
+
682
+ ```json
683
+ {
684
+ "mcpServers": {
685
+ "indigo": {
686
+ "command": "npx",
687
+ "args": ["-y", "@indigoprotocol/indigo-mcp"],
688
+ "env": {
689
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api",
690
+ "BLOCKFROST_API_KEY": "your-blockfrost-project-id",
691
+ "X402_PRIVATE_KEY": "0xYourPayerPrivateKey",
692
+ "X402_TESTNET": "true"
693
+ }
694
+ }
695
+ }
696
+ }
697
+ ```
698
+
699
+ **Cursor / Windsurf** — same `env` block applies to `~/.cursor/mcp.json` or `~/.codeium/windsurf/mcp_config.json`.
700
+
701
+ > Set `X402_TESTNET` to `false` (or omit it) for Base mainnet.
702
+
530
703
  ## License
531
704
 
532
705
  ISC
package/dist/cli/setup.js CHANGED
@@ -34,14 +34,38 @@ var CONFIG_PATHS = {
34
34
  linux: path.join(os.homedir(), ".codeium", "windsurf", "mcp_config.json")
35
35
  }
36
36
  };
37
- var INDIGO_SERVER_CONFIG = {
38
- command: "npx",
39
- args: ["-y", "@indigoprotocol/indigo-mcp"],
40
- env: {
41
- INDEXER_URL: "https://analytics.indigoprotocol.io/api/v1",
42
- BLOCKFROST_API_KEY: ""
37
+ function detectNvmPath() {
38
+ const nodePath = process.execPath;
39
+ const isNvm = nodePath.includes(".nvm/versions/node");
40
+ if (isNvm) {
41
+ const nodeDir = path.dirname(nodePath);
42
+ const npxPath = path.join(nodeDir, "npx");
43
+ return { isNvm: true, nodePath: nodeDir, npxPath };
43
44
  }
44
- };
45
+ return { isNvm: false, nodePath: null, npxPath: null };
46
+ }
47
+ function getIndigoServerConfig() {
48
+ const { isNvm, nodePath, npxPath } = detectNvmPath();
49
+ if (isNvm && npxPath && nodePath) {
50
+ return {
51
+ command: npxPath,
52
+ args: ["-y", "@indigoprotocol/indigo-mcp"],
53
+ env: {
54
+ PATH: `${nodePath}:/usr/local/bin:/usr/bin:/bin`,
55
+ INDEXER_URL: "https://analytics.indigoprotocol.io/api/v1",
56
+ BLOCKFROST_API_KEY: ""
57
+ }
58
+ };
59
+ }
60
+ return {
61
+ command: "npx",
62
+ args: ["-y", "@indigoprotocol/indigo-mcp"],
63
+ env: {
64
+ INDEXER_URL: "https://analytics.indigoprotocol.io/api/v1",
65
+ BLOCKFROST_API_KEY: ""
66
+ }
67
+ };
68
+ }
45
69
  function createReadlineInterface() {
46
70
  return readline.createInterface({
47
71
  input: process.stdin,
@@ -135,7 +159,13 @@ async function main() {
135
159
  const existingServers = config.mcpServers;
136
160
  const existingIndigo = existingServers["indigo"];
137
161
  const existingKey = existingIndigo?.env?.BLOCKFROST_API_KEY;
138
- const serverConfig = { ...INDIGO_SERVER_CONFIG };
162
+ const { isNvm, nodePath } = detectNvmPath();
163
+ if (isNvm) {
164
+ console.log(`
165
+ \u{1F527} Detected nvm (Node path: ${nodePath})`);
166
+ console.log(" Using full paths in config for compatibility.");
167
+ }
168
+ const serverConfig = getIndigoServerConfig();
139
169
  if (blockfrostKey) {
140
170
  serverConfig.env = { ...serverConfig.env, BLOCKFROST_API_KEY: blockfrostKey };
141
171
  } else if (existingKey && existingKey !== "your-blockfrost-project-id") {