@indigoprotocol/indigo-mcp 0.2.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 (122) hide show
  1. package/README.md +324 -0
  2. package/dist/index.d.ts +4 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +26 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/resources/index.d.ts +3 -0
  7. package/dist/resources/index.d.ts.map +1 -0
  8. package/dist/resources/index.js +4 -0
  9. package/dist/resources/index.js.map +1 -0
  10. package/dist/tools/analytics-tools.d.ts +3 -0
  11. package/dist/tools/analytics-tools.d.ts.map +1 -0
  12. package/dist/tools/analytics-tools.js +127 -0
  13. package/dist/tools/analytics-tools.js.map +1 -0
  14. package/dist/tools/asset-tools.d.ts +3 -0
  15. package/dist/tools/asset-tools.d.ts.map +1 -0
  16. package/dist/tools/asset-tools.js +134 -0
  17. package/dist/tools/asset-tools.js.map +1 -0
  18. package/dist/tools/cdp-liquidation-tools.d.ts +3 -0
  19. package/dist/tools/cdp-liquidation-tools.d.ts.map +1 -0
  20. package/dist/tools/cdp-liquidation-tools.js +231 -0
  21. package/dist/tools/cdp-liquidation-tools.js.map +1 -0
  22. package/dist/tools/cdp-mint-burn-tools.d.ts +3 -0
  23. package/dist/tools/cdp-mint-burn-tools.d.ts.map +1 -0
  24. package/dist/tools/cdp-mint-burn-tools.js +161 -0
  25. package/dist/tools/cdp-mint-burn-tools.js.map +1 -0
  26. package/dist/tools/cdp-tools.d.ts +3 -0
  27. package/dist/tools/cdp-tools.d.ts.map +1 -0
  28. package/dist/tools/cdp-tools.js +174 -0
  29. package/dist/tools/cdp-tools.js.map +1 -0
  30. package/dist/tools/cdp-write-tools.d.ts +3 -0
  31. package/dist/tools/cdp-write-tools.d.ts.map +1 -0
  32. package/dist/tools/cdp-write-tools.js +284 -0
  33. package/dist/tools/cdp-write-tools.js.map +1 -0
  34. package/dist/tools/collector-tools.d.ts +3 -0
  35. package/dist/tools/collector-tools.d.ts.map +1 -0
  36. package/dist/tools/collector-tools.js +70 -0
  37. package/dist/tools/collector-tools.js.map +1 -0
  38. package/dist/tools/dex-tools.d.ts +3 -0
  39. package/dist/tools/dex-tools.d.ts.map +1 -0
  40. package/dist/tools/dex-tools.js +95 -0
  41. package/dist/tools/dex-tools.js.map +1 -0
  42. package/dist/tools/governance-tools.d.ts +3 -0
  43. package/dist/tools/governance-tools.d.ts.map +1 -0
  44. package/dist/tools/governance-tools.js +88 -0
  45. package/dist/tools/governance-tools.js.map +1 -0
  46. package/dist/tools/index.d.ts +3 -0
  47. package/dist/tools/index.d.ts.map +1 -0
  48. package/dist/tools/index.js +41 -0
  49. package/dist/tools/index.js.map +1 -0
  50. package/dist/tools/leverage-cdp-tools.d.ts +3 -0
  51. package/dist/tools/leverage-cdp-tools.d.ts.map +1 -0
  52. package/dist/tools/leverage-cdp-tools.js +143 -0
  53. package/dist/tools/leverage-cdp-tools.js.map +1 -0
  54. package/dist/tools/lrp-write-tools.d.ts +3 -0
  55. package/dist/tools/lrp-write-tools.d.ts.map +1 -0
  56. package/dist/tools/lrp-write-tools.js +221 -0
  57. package/dist/tools/lrp-write-tools.js.map +1 -0
  58. package/dist/tools/oracle-write-tools.d.ts +3 -0
  59. package/dist/tools/oracle-write-tools.d.ts.map +1 -0
  60. package/dist/tools/oracle-write-tools.js +135 -0
  61. package/dist/tools/oracle-write-tools.js.map +1 -0
  62. package/dist/tools/redemption-tools.d.ts +3 -0
  63. package/dist/tools/redemption-tools.d.ts.map +1 -0
  64. package/dist/tools/redemption-tools.js +91 -0
  65. package/dist/tools/redemption-tools.js.map +1 -0
  66. package/dist/tools/sp-request-tools.d.ts +3 -0
  67. package/dist/tools/sp-request-tools.d.ts.map +1 -0
  68. package/dist/tools/sp-request-tools.js +145 -0
  69. package/dist/tools/sp-request-tools.js.map +1 -0
  70. package/dist/tools/stability-pool-tools.d.ts +3 -0
  71. package/dist/tools/stability-pool-tools.d.ts.map +1 -0
  72. package/dist/tools/stability-pool-tools.js +76 -0
  73. package/dist/tools/stability-pool-tools.js.map +1 -0
  74. package/dist/tools/stability-pool-write-tools.d.ts +3 -0
  75. package/dist/tools/stability-pool-write-tools.d.ts.map +1 -0
  76. package/dist/tools/stability-pool-write-tools.js +121 -0
  77. package/dist/tools/stability-pool-write-tools.js.map +1 -0
  78. package/dist/tools/staking-reward-tools.d.ts +3 -0
  79. package/dist/tools/staking-reward-tools.d.ts.map +1 -0
  80. package/dist/tools/staking-reward-tools.js +43 -0
  81. package/dist/tools/staking-reward-tools.js.map +1 -0
  82. package/dist/tools/staking-tools.d.ts +3 -0
  83. package/dist/tools/staking-tools.d.ts.map +1 -0
  84. package/dist/tools/staking-tools.js +92 -0
  85. package/dist/tools/staking-tools.js.map +1 -0
  86. package/dist/tools/staking-write-tools.d.ts +3 -0
  87. package/dist/tools/staking-write-tools.d.ts.map +1 -0
  88. package/dist/tools/staking-write-tools.js +120 -0
  89. package/dist/tools/staking-write-tools.js.map +1 -0
  90. package/dist/types/tx-types.d.ts +12 -0
  91. package/dist/types/tx-types.d.ts.map +1 -0
  92. package/dist/types/tx-types.js +2 -0
  93. package/dist/types/tx-types.js.map +1 -0
  94. package/dist/utils/address.d.ts +2 -0
  95. package/dist/utils/address.d.ts.map +1 -0
  96. package/dist/utils/address.js +16 -0
  97. package/dist/utils/address.js.map +1 -0
  98. package/dist/utils/index.d.ts +7 -0
  99. package/dist/utils/index.d.ts.map +1 -0
  100. package/dist/utils/index.js +7 -0
  101. package/dist/utils/index.js.map +1 -0
  102. package/dist/utils/indexer-client.d.ts +4 -0
  103. package/dist/utils/indexer-client.d.ts.map +1 -0
  104. package/dist/utils/indexer-client.js +22 -0
  105. package/dist/utils/indexer-client.js.map +1 -0
  106. package/dist/utils/lucid-provider.d.ts +5 -0
  107. package/dist/utils/lucid-provider.d.ts.map +1 -0
  108. package/dist/utils/lucid-provider.js +39 -0
  109. package/dist/utils/lucid-provider.js.map +1 -0
  110. package/dist/utils/sdk-config.d.ts +4 -0
  111. package/dist/utils/sdk-config.d.ts.map +1 -0
  112. package/dist/utils/sdk-config.js +19 -0
  113. package/dist/utils/sdk-config.js.map +1 -0
  114. package/dist/utils/tx-builder.d.ts +4 -0
  115. package/dist/utils/tx-builder.d.ts.map +1 -0
  116. package/dist/utils/tx-builder.js +14 -0
  117. package/dist/utils/tx-builder.js.map +1 -0
  118. package/dist/utils/validators.d.ts +3 -0
  119. package/dist/utils/validators.d.ts.map +1 -0
  120. package/dist/utils/validators.js +3 -0
  121. package/dist/utils/validators.js.map +1 -0
  122. package/package.json +64 -0
package/README.md ADDED
@@ -0,0 +1,324 @@
1
+ # Indigo MCP
2
+
3
+ MCP server for [Indigo Protocol](https://indigoprotocol.io/) — exposes Indigo iAsset data, prices, and CDP/loan analytics to LLM agents via the [Model Context Protocol](https://modelcontextprotocol.io/).
4
+
5
+ ## Features
6
+
7
+ - Real-time iAsset prices (iUSD, iBTC, iETH, iSOL)
8
+ - ADA and INDY token price feeds
9
+ - CDP/loan browsing with pagination and filtering
10
+ - Owner lookup by payment key hash or bech32 address
11
+ - CDP health analysis with collateral ratio and liquidation risk status
12
+ - Stability pool state and account queries
13
+ - INDY staking positions and manager state
14
+ - Protocol analytics: TVL, APR rewards, DEX yields, aggregated stats
15
+ - Governance: protocol parameters, polls, temperature checks
16
+ - Redemption order book and queue aggregation
17
+ - DEX proxy: Steelswap swaps, Iris liquidity pools, Blockfrost balances
18
+ - CDP liquidation, redemption, freeze, and merge operations
19
+ - Leveraged CDP opening via LRP positions
20
+ - LRP (Limit Redemption Protocol) position management
21
+ - Oracle interest rate feeding and initialization
22
+ - Stability pool request processing and cancellation
23
+ - Staking reward distribution
24
+ - Collector UTXOs, IPFS storage and retrieval
25
+
26
+ ## Quick Start
27
+
28
+ ```bash
29
+ npm install
30
+ npm run build
31
+ npm start
32
+ ```
33
+
34
+ ### Docker
35
+
36
+ ```bash
37
+ docker build -t indigo-mcp .
38
+ docker run -i indigo-mcp
39
+ ```
40
+
41
+ ## Claude Desktop Configuration
42
+
43
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
44
+
45
+ ```json
46
+ {
47
+ "mcpServers": {
48
+ "indigo": {
49
+ "command": "node",
50
+ "args": ["/path/to/indigo-mcp/dist/index.js"],
51
+ "env": {
52
+ "INDEXER_URL": "https://analytics.indigoprotocol.io/api/v1"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ ## Available Tools
60
+
61
+ ### Asset Tools
62
+
63
+ | Tool | Description | Parameters |
64
+ |------|-------------|------------|
65
+ | `get_assets` | Get all Indigo iAssets with prices and interest data | None |
66
+ | `get_asset` | Get details for a specific iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
67
+ | `get_asset_price` | Get the current price for a specific iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
68
+ | `get_ada_price` | Get the current ADA price in USD | None |
69
+ | `get_indy_price` | Get the current INDY token price in ADA and USD | None |
70
+
71
+ ### CDP / Loan Tools
72
+
73
+ | Tool | Description | Parameters |
74
+ |------|-------------|------------|
75
+ | `get_all_cdps` | Get all CDPs/loans, optionally filtered by iAsset | `asset?`: iAsset filter; `limit?`: 1-500 (default 50); `offset?`: pagination offset |
76
+ | `get_cdps_by_owner` | Get CDPs for a specific owner | `owner`: payment key hash (56-char hex) or bech32 address |
77
+ | `get_cdps_by_address` | Get CDPs for a specific Cardano address | `address`: bech32 address (addr1... or addr_test1...) |
78
+ | `analyze_cdp_health` | Analyze collateral ratios and liquidation risk | `owner`: payment key hash or bech32 address |
79
+
80
+ ### CDP Write Tools
81
+
82
+ | Tool | Description | Parameters |
83
+ |------|-------------|------------|
84
+ | `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 |
85
+ | `deposit_cdp` | Deposit additional collateral into a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: lovelace |
86
+ | `withdraw_cdp` | Withdraw collateral from a CDP | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index; `amount`: lovelace |
87
+ | `close_cdp` | Close a CDP and reclaim collateral | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
88
+
89
+ ### CDP Mint/Burn Tools
90
+
91
+ | Tool | Description | Parameters |
92
+ |------|-------------|------------|
93
+ | `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 |
94
+ | `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 |
95
+
96
+ ### CDP Liquidation & Redemption Tools
97
+
98
+ | Tool | Description | Parameters |
99
+ |------|-------------|------------|
100
+ | `liquidate_cdp` | Liquidate an undercollateralized CDP through the stability pool | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
101
+ | `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 |
102
+ | `freeze_cdp` | Freeze a CDP to prevent further operations | `address`: bech32 address; `asset`: iAsset; `cdpTxHash`: CDP UTxO tx hash; `cdpOutputIndex`: output index |
103
+ | `merge_cdps` | Merge multiple CDPs into one | `address`: bech32 address; `cdpOutRefs`: array of `{txHash, outputIndex}` (min 2) |
104
+
105
+ ### Leverage CDP Tools
106
+
107
+ | Tool | Description | Parameters |
108
+ |------|-------------|------------|
109
+ | `leverage_cdp` | Open a leveraged CDP by redeeming against LRP positions | `address`: bech32 address; `asset`: iAsset; `leverage`: multiplier (e.g. 2.0); `baseCollateral`: lovelace amount |
110
+
111
+ ### Stability Pool Tools
112
+
113
+ | Tool | Description | Parameters |
114
+ |------|-------------|------------|
115
+ | `get_stability_pools` | Get the latest stability pool state for each iAsset | None |
116
+ | `get_stability_pool_accounts` | Get all open stability pool accounts, optionally filtered by iAsset | `asset?`: iUSD, iBTC, iETH, or iSOL |
117
+ | `get_sp_account_by_owner` | Get stability pool accounts for specific owners | `owners`: array of payment key hashes or bech32 addresses |
118
+
119
+ ### Staking Tools
120
+
121
+ | Tool | Description | Parameters |
122
+ |------|-------------|------------|
123
+ | `get_staking_info` | Get the current INDY staking manager state | None |
124
+ | `get_staking_positions` | Get all open INDY staking positions | None |
125
+ | `get_staking_positions_by_owner` | Get INDY staking positions for specific owners | `owners`: array of payment key hashes or bech32 addresses |
126
+ | `get_staking_position_by_address` | Get INDY staking positions for a single address | `address`: Cardano bech32 address |
127
+
128
+ ### Stability Pool Request Tools
129
+
130
+ | Tool | Description | Parameters |
131
+ |------|-------------|------------|
132
+ | `process_sp_request` | Process a pending stability pool request (protocol maintenance) | `address`: bech32 address; `asset`: iAsset; `accountTxHash`: account UTxO tx hash; `accountOutputIndex`: output index |
133
+ | `annul_sp_request` | Cancel a pending stability pool request | `address`: bech32 address; `accountTxHash`: account UTxO tx hash; `accountOutputIndex`: output index |
134
+
135
+ ### Staking Write Tools
136
+
137
+ | Tool | Description | Parameters |
138
+ |------|-------------|------------|
139
+ | `open_staking_position` | Stake INDY tokens by creating a new staking position | `address`: bech32 address; `amount`: INDY amount in smallest unit |
140
+ | `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 |
141
+ | `close_staking_position` | Close a staking position and unstake all INDY | `address`: bech32 address; `positionTxHash`: UTxO tx hash; `positionOutputIndex`: UTxO output index |
142
+
143
+ ### Staking Reward Tools
144
+
145
+ | Tool | Description | Parameters |
146
+ |------|-------------|------------|
147
+ | `distribute_staking_rewards` | Distribute collected ADA rewards from collector UTxOs to stakers | `address`: bech32 address; `collectorTxHashes`: array of `{txHash, outputIndex}` |
148
+
149
+ ### Analytics & APR Tools
150
+
151
+ | Tool | Description | Parameters |
152
+ |------|-------------|------------|
153
+ | `get_tvl` | Get historical TVL data from DefiLlama | None |
154
+ | `get_apr_rewards` | Get all APR reward records | None |
155
+ | `get_apr_by_key` | Get APR for a specific key | `key`: APR key (e.g. sp_iUSD_indy, stake_ada) |
156
+ | `get_dex_yields` | Get DEX farm yields for iAsset pairs | None |
157
+ | `get_protocol_stats` | Get aggregated protocol statistics | None |
158
+
159
+ ### Governance Tools
160
+
161
+ | Tool | Description | Parameters |
162
+ |------|-------------|------------|
163
+ | `get_protocol_params` | Get latest governance protocol parameters | None |
164
+ | `get_temperature_checks` | Get temperature check polls | None |
165
+ | `get_sync_status` | Get indexer sync status | None |
166
+ | `get_polls` | Get all governance polls | None |
167
+
168
+ ### Redemption & Order Book Tools
169
+
170
+ | Tool | Description | Parameters |
171
+ |------|-------------|------------|
172
+ | `get_order_book` | Get open limited redemption positions | `asset?`: iAsset filter; `owners?`: array of payment key hashes |
173
+ | `get_redemption_orders` | Get redemption orders with optional filters | `timestamp?`: Unix ms; `in_range?`: filter by price range |
174
+ | `get_redemption_queue` | Get aggregated redemption queue for an iAsset | `asset`: iUSD, iBTC, iETH, or iSOL |
175
+
176
+ ### LRP Write Tools
177
+
178
+ | Tool | Description | Parameters |
179
+ |------|-------------|------------|
180
+ | `open_lrp` | Open a new LRP position with ADA and a max price limit | `address`: bech32 address; `asset`: iAsset; `lovelacesAmount`: lovelace to deposit; `maxPrice`: on-chain integer string |
181
+ | `cancel_lrp` | Cancel an existing LRP position | `address`: bech32 address; `lrpTxHash`: LRP UTxO tx hash; `lrpOutputIndex`: output index |
182
+ | `adjust_lrp` | Adjust ADA in an LRP (positive to add, negative to remove) | `address`: bech32 address; `lrpTxHash`: LRP UTxO tx hash; `lrpOutputIndex`: output index; `lovelacesAdjustAmount`: adjustment; `newMaxPrice?`: optional new max price |
183
+ | `claim_lrp` | Claim received iAssets from an LRP position | `address`: bech32 address; `lrpTxHash`: LRP UTxO tx hash; `lrpOutputIndex`: output index |
184
+ | `redeem_lrp` | Redeem iAssets against one or more LRP positions | `address`: bech32 address; `redemptionLrps`: array of `{txHash, outputIndex, iAssetAmount}`; `priceOracleTxHash`; `priceOracleOutputIndex`; `iassetTxHash`; `iassetOutputIndex` |
185
+
186
+ ### Oracle Write Tools
187
+
188
+ | Tool | Description | Parameters |
189
+ |------|-------------|------------|
190
+ | `feed_interest_oracle` | Feed a new interest rate to the interest oracle (oracle operator only) | `address`: operator bech32 address; `asset`: iAsset; `newInterestRate`: bigint string; `biasTime`: ms bigint string; `owner`: operator pub key hash |
191
+ | `start_interest_oracle` | Initialize a new interest oracle (admin one-time setup) | `address`: admin bech32 address; `initialUnitaryInterest`; `initialInterestRate`; `initialLastInterestUpdate`; `biasTime`; `owner`: operator pub key hash |
192
+
193
+ ### DEX Proxy Tools
194
+
195
+ | Tool | Description | Parameters |
196
+ |------|-------------|------------|
197
+ | `get_steelswap_tokens` | Get all tokens available on Steelswap DEX | None |
198
+ | `get_steelswap_estimate` | Get a swap estimate from Steelswap | `tokenIn`: input token; `tokenOut`: output token; `amountIn`: amount |
199
+ | `get_iris_liquidity_pools` | Get liquidity pools from Iris | `tokenA?`: first token; `tokenB?`: second token; `dex?`: DEX filter |
200
+ | `get_blockfrost_balances` | Get token balances for a Cardano address | `address`: Cardano bech32 address |
201
+
202
+ ### Collector & IPFS Tools
203
+
204
+ | Tool | Description | Parameters |
205
+ |------|-------------|------------|
206
+ | `get_collector_utxos` | Get collector UTXOs for fee distribution | `length?`: max UTXOs to return |
207
+ | `store_on_ipfs` | Store text content on IPFS | `text`: content to store |
208
+ | `retrieve_from_ipfs` | Retrieve content from IPFS by CID | `cid`: IPFS content identifier |
209
+
210
+ ## Environment Variables
211
+
212
+ | Variable | Required | Default | Description |
213
+ |----------|----------|---------|-------------|
214
+ | `INDEXER_URL` | No | `https://analytics.indigoprotocol.io/api/v1` | Indigo analytics API base URL |
215
+ | `BLOCKFROST_API_KEY` | For write ops | — | Blockfrost project ID for transaction building |
216
+ | `CARDANO_NETWORK` | No | `mainnet` | Cardano network: `mainnet`, `preprod`, or `preview` |
217
+
218
+ ## Example Queries
219
+
220
+ When connected to an LLM agent, you can ask natural language questions like:
221
+
222
+ - "What are the current prices of all Indigo iAssets?"
223
+ - "What is the price of iUSD right now?"
224
+ - "How much is ADA worth in USD?"
225
+ - "Show me all iETH CDPs"
226
+ - "What CDPs does this address own?" (paste a Cardano address)
227
+ - "Analyze the health of my CDPs" (with your address or payment key hash)
228
+ - "Are any of my positions at risk of liquidation?"
229
+ - "Show me the current stability pool state"
230
+ - "What are my stability pool deposits?" (with your address)
231
+ - "How much INDY am I staking?" (with your address)
232
+ - "What's the current TVL of Indigo?"
233
+ - "What APR can I earn on iUSD stability pool?"
234
+ - "What are the current governance protocol parameters?"
235
+ - "Show me the iUSD redemption queue"
236
+ - "Get a Steelswap estimate for swapping 100 ADA to iUSD"
237
+ - "What are the current DEX yields for iAsset pairs?"
238
+
239
+ ## Development
240
+
241
+ ### Prerequisites
242
+
243
+ - Node.js >= 18
244
+ - npm
245
+
246
+ ### Setup
247
+
248
+ ```bash
249
+ git clone https://github.com/IndigoProtocol/indigo-mcp.git
250
+ cd indigo-mcp
251
+ npm install
252
+ npm run dev # run with tsx (hot reload)
253
+ ```
254
+
255
+ ### Scripts
256
+
257
+ ```bash
258
+ npm run build # compile TypeScript
259
+ npm run start # run compiled server
260
+ npm run dev # run with tsx (hot reload)
261
+ npm run typecheck # type-check without emitting
262
+ npm run lint # eslint
263
+ npm run lint:fix # eslint --fix
264
+ npm run format # prettier
265
+ npm run format:check # prettier --check
266
+ npm run test # run tests
267
+ npm run test:watch # run tests in watch mode
268
+ ```
269
+
270
+ ### Project Structure
271
+
272
+ ```
273
+ src/
274
+ ├── index.ts # Server entry point (stdio transport)
275
+ ├── types/
276
+ │ └── tx-types.ts # UnsignedTxResult, TxSummary types
277
+ ├── tools/
278
+ │ ├── index.ts # Tool registration hub
279
+ │ ├── asset-tools.ts # 5 asset/price tools
280
+ │ ├── cdp-tools.ts # 4 CDP/loan tools
281
+ │ ├── stability-pool-tools.ts # 3 stability pool tools
282
+ │ ├── staking-tools.ts # 4 INDY staking tools
283
+ │ ├── staking-write-tools.ts # 3 INDY staking write tools
284
+ │ ├── staking-reward-tools.ts # 1 staking reward distribution tool
285
+ │ ├── cdp-liquidation-tools.ts # 4 CDP liquidation/redemption/freeze/merge tools
286
+ │ ├── leverage-cdp-tools.ts # 1 leveraged CDP tool
287
+ │ ├── lrp-write-tools.ts # 5 LRP write tools
288
+ │ ├── oracle-write-tools.ts # 2 oracle write tools
289
+ │ ├── sp-request-tools.ts # 2 SP request processing tools
290
+ │ ├── analytics-tools.ts # 5 analytics/APR tools
291
+ │ ├── governance-tools.ts # 4 governance tools
292
+ │ ├── redemption-tools.ts # 3 redemption/order book tools
293
+ │ ├── dex-tools.ts # 4 DEX proxy tools
294
+ │ └── collector-tools.ts # 3 collector/IPFS tools
295
+ ├── resources/
296
+ │ └── index.ts # MCP resource definitions
297
+ ├── tests/
298
+ │ ├── unit/
299
+ │ │ ├── tools/ # Unit tests for each tool module
300
+ │ │ └── utils/ # Unit tests for validators, address
301
+ │ └── integration/
302
+ │ └── indexer-client.test.ts # Integration test for HTTP client
303
+ └── utils/
304
+ ├── index.ts # Re-exports
305
+ ├── indexer-client.ts # Axios client for Indigo analytics API
306
+ ├── validators.ts # Zod validators (AssetParam enum)
307
+ ├── address.ts # Bech32 address → payment credential
308
+ ├── lucid-provider.ts # Lucid + Blockfrost singleton provider
309
+ ├── sdk-config.ts # SystemParams loader with cache
310
+ └── tx-builder.ts # Transaction builder → unsigned CBOR
311
+ ```
312
+
313
+ ### Testing via stdin
314
+
315
+ The server communicates over stdio using JSON-RPC. You can test tools directly:
316
+
317
+ ```bash
318
+ npm run build
319
+ 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
320
+ ```
321
+
322
+ ## License
323
+
324
+ ISC
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ export declare function createServer(): McpServer;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAQpE,wBAAgB,YAAY,IAAI,SAAS,CAUxC"}
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { registerTools } from './tools/index.js';
5
+ import { registerResources } from './resources/index.js';
6
+ const SERVER_NAME = 'indigo-mcp';
7
+ const SERVER_VERSION = '0.2.0';
8
+ export function createServer() {
9
+ const server = new McpServer({
10
+ name: SERVER_NAME,
11
+ version: SERVER_VERSION,
12
+ });
13
+ registerTools(server);
14
+ registerResources(server);
15
+ return server;
16
+ }
17
+ async function main() {
18
+ const server = createServer();
19
+ const transport = new StdioServerTransport();
20
+ await server.connect(transport);
21
+ }
22
+ main().catch((error) => {
23
+ process.stderr.write(`Indigo MCP error: ${error}\n`);
24
+ process.exit(1);
25
+ });
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;IAEH,aAAa,CAAC,MAAM,CAAC,CAAC;IACtB,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAE1B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,KAAK,IAAI,CAAC,CAAC;IACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerResources(_server: McpServer): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAE1D"}
@@ -0,0 +1,4 @@
1
+ export function registerResources(_server) {
2
+ // Resources will be registered here
3
+ }
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,OAAkB;IAClD,oCAAoC;AACtC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerAnalyticsTools(server: McpServer): void;
3
+ //# sourceMappingURL=analytics-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics-tools.d.ts","sourceRoot":"","sources":["../../src/tools/analytics-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmI9D"}
@@ -0,0 +1,127 @@
1
+ import { z } from 'zod';
2
+ import { getIndexerClient } from '../utils/indexer-client.js';
3
+ export function registerAnalyticsTools(server) {
4
+ // 1. get_tvl - No params → GET /analytics/tvl
5
+ server.tool('get_tvl', 'Get historical TVL data from DefiLlama', {}, async () => {
6
+ try {
7
+ const client = getIndexerClient();
8
+ const response = await client.get('/analytics/tvl');
9
+ return {
10
+ content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
11
+ };
12
+ }
13
+ catch (error) {
14
+ return {
15
+ content: [
16
+ {
17
+ type: 'text',
18
+ text: `Error fetching TVL: ${error instanceof Error ? error.message : String(error)}`,
19
+ },
20
+ ],
21
+ isError: true,
22
+ };
23
+ }
24
+ });
25
+ // 2. get_apr_rewards - No params → GET /apr/
26
+ server.tool('get_apr_rewards', 'Get all APR reward records', {}, async () => {
27
+ try {
28
+ const client = getIndexerClient();
29
+ const response = await client.get('/apr/');
30
+ return {
31
+ content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
32
+ };
33
+ }
34
+ catch (error) {
35
+ return {
36
+ content: [
37
+ {
38
+ type: 'text',
39
+ text: `Error fetching APR rewards: ${error instanceof Error ? error.message : String(error)}`,
40
+ },
41
+ ],
42
+ isError: true,
43
+ };
44
+ }
45
+ });
46
+ // 3. get_apr_by_key - POST /apr/ with { key }
47
+ server.tool('get_apr_by_key', 'Get APR for a specific key', { key: z.string().describe('APR key, e.g. sp_iUSD_indy, sp_iUSD_ada, stake_ada') }, async ({ key }) => {
48
+ try {
49
+ const client = getIndexerClient();
50
+ const response = await client.post('/apr/', { key });
51
+ return {
52
+ content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
53
+ };
54
+ }
55
+ catch (error) {
56
+ return {
57
+ content: [
58
+ {
59
+ type: 'text',
60
+ text: `Error fetching APR by key: ${error instanceof Error ? error.message : String(error)}`,
61
+ },
62
+ ],
63
+ isError: true,
64
+ };
65
+ }
66
+ });
67
+ // 4. get_dex_yields - No params → GET /dex/yields
68
+ server.tool('get_dex_yields', 'Get DEX farm yields for iAsset pairs', {}, async () => {
69
+ try {
70
+ const client = getIndexerClient();
71
+ const response = await client.get('/dex/yields');
72
+ return {
73
+ content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }],
74
+ };
75
+ }
76
+ catch (error) {
77
+ return {
78
+ content: [
79
+ {
80
+ type: 'text',
81
+ text: `Error fetching DEX yields: ${error instanceof Error ? error.message : String(error)}`,
82
+ },
83
+ ],
84
+ isError: true,
85
+ };
86
+ }
87
+ });
88
+ // 5. get_protocol_stats - Aggregated stats from multiple endpoints
89
+ server.tool('get_protocol_stats', 'Get aggregated protocol statistics', {}, async () => {
90
+ try {
91
+ const client = getIndexerClient();
92
+ const [assetsRes, adaRes, tvlRes, stakingRes] = await Promise.all([
93
+ client.get('/assets/'),
94
+ client.get('/analytics/ada'),
95
+ client.get('/analytics/tvl'),
96
+ client.get('/staking/'),
97
+ ]);
98
+ const assets = assetsRes.data;
99
+ const adaPrice = adaRes.data;
100
+ const tvlData = tvlRes.data;
101
+ const stakingData = stakingRes.data;
102
+ const latestTvl = tvlData.length > 0 ? tvlData[tvlData.length - 1].tvl : null;
103
+ const stats = {
104
+ assetCount: assets.length,
105
+ assets: assets.map((a) => ({ name: a.name, price: a.price.price })),
106
+ adaPrice,
107
+ tvl: latestTvl,
108
+ totalStake: stakingData.totalStake,
109
+ };
110
+ return {
111
+ content: [{ type: 'text', text: JSON.stringify(stats, null, 2) }],
112
+ };
113
+ }
114
+ catch (error) {
115
+ return {
116
+ content: [
117
+ {
118
+ type: 'text',
119
+ text: `Error fetching protocol stats: ${error instanceof Error ? error.message : String(error)}`,
120
+ },
121
+ ],
122
+ isError: true,
123
+ };
124
+ }
125
+ });
126
+ }
127
+ //# sourceMappingURL=analytics-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"analytics-tools.js","sourceRoot":"","sources":["../../src/tools/analytics-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,MAAM,UAAU,sBAAsB,CAAC,MAAiB;IACtD,8CAA8C;IAC9C,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,wCAAwC,EAAE,EAAE,EAAE,KAAK,IAAI,EAAE;QAC9E,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAC;YAClC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;YACpD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aACnF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IA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AO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aAC3E,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,kCAAkC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;qBACjG;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ export declare function registerAssetTools(server: McpServer): void;
3
+ //# sourceMappingURL=asset-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-tools.d.ts","sourceRoot":"","sources":["../../src/tools/asset-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAmJ1D"}