starkfi 0.3.2 → 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 (300) hide show
  1. package/MCP.md +1 -1
  2. package/README.md +27 -6
  3. package/dist/index.js +289 -197
  4. package/package.json +22 -20
  5. package/skills/config/SKILL.md +9 -0
  6. package/skills/lending/SKILL.md +20 -9
  7. package/skills/portfolio/SKILL.md +1 -1
  8. package/skills/staking/SKILL.md +1 -1
  9. package/dist/commands/auth/import.d.ts +0 -3
  10. package/dist/commands/auth/import.d.ts.map +0 -1
  11. package/dist/commands/auth/import.js +0 -56
  12. package/dist/commands/auth/import.js.map +0 -1
  13. package/dist/commands/auth/login.d.ts +0 -3
  14. package/dist/commands/auth/login.d.ts.map +0 -1
  15. package/dist/commands/auth/login.js +0 -23
  16. package/dist/commands/auth/login.js.map +0 -1
  17. package/dist/commands/auth/logout.d.ts +0 -3
  18. package/dist/commands/auth/logout.d.ts.map +0 -1
  19. package/dist/commands/auth/logout.js +0 -14
  20. package/dist/commands/auth/logout.js.map +0 -1
  21. package/dist/commands/auth/verify.d.ts +0 -3
  22. package/dist/commands/auth/verify.d.ts.map +0 -1
  23. package/dist/commands/auth/verify.js +0 -64
  24. package/dist/commands/auth/verify.js.map +0 -1
  25. package/dist/commands/batch/batch.d.ts +0 -3
  26. package/dist/commands/batch/batch.d.ts.map +0 -1
  27. package/dist/commands/batch/batch.js +0 -155
  28. package/dist/commands/batch/batch.js.map +0 -1
  29. package/dist/commands/chain/tx-status.d.ts +0 -3
  30. package/dist/commands/chain/tx-status.d.ts.map +0 -1
  31. package/dist/commands/chain/tx-status.js +0 -39
  32. package/dist/commands/chain/tx-status.js.map +0 -1
  33. package/dist/commands/config/config.d.ts +0 -3
  34. package/dist/commands/config/config.d.ts.map +0 -1
  35. package/dist/commands/config/config.js +0 -111
  36. package/dist/commands/config/config.js.map +0 -1
  37. package/dist/commands/lending/lending.d.ts +0 -9
  38. package/dist/commands/lending/lending.d.ts.map +0 -1
  39. package/dist/commands/lending/lending.js +0 -347
  40. package/dist/commands/lending/lending.js.map +0 -1
  41. package/dist/commands/portfolio/portfolio.d.ts +0 -3
  42. package/dist/commands/portfolio/portfolio.d.ts.map +0 -1
  43. package/dist/commands/portfolio/portfolio.js +0 -76
  44. package/dist/commands/portfolio/portfolio.js.map +0 -1
  45. package/dist/commands/staking/staking.d.ts +0 -8
  46. package/dist/commands/staking/staking.d.ts.map +0 -1
  47. package/dist/commands/staking/staking.js +0 -355
  48. package/dist/commands/staking/staking.js.map +0 -1
  49. package/dist/commands/trade/multi-swap.d.ts +0 -3
  50. package/dist/commands/trade/multi-swap.d.ts.map +0 -1
  51. package/dist/commands/trade/multi-swap.js +0 -141
  52. package/dist/commands/trade/multi-swap.js.map +0 -1
  53. package/dist/commands/trade/status.d.ts +0 -3
  54. package/dist/commands/trade/status.d.ts.map +0 -1
  55. package/dist/commands/trade/status.js +0 -41
  56. package/dist/commands/trade/status.js.map +0 -1
  57. package/dist/commands/trade/swap.d.ts +0 -3
  58. package/dist/commands/trade/swap.d.ts.map +0 -1
  59. package/dist/commands/trade/swap.js +0 -101
  60. package/dist/commands/trade/swap.js.map +0 -1
  61. package/dist/commands/wallet/address.d.ts +0 -3
  62. package/dist/commands/wallet/address.d.ts.map +0 -1
  63. package/dist/commands/wallet/address.js +0 -20
  64. package/dist/commands/wallet/address.js.map +0 -1
  65. package/dist/commands/wallet/balance.d.ts +0 -3
  66. package/dist/commands/wallet/balance.d.ts.map +0 -1
  67. package/dist/commands/wallet/balance.js +0 -63
  68. package/dist/commands/wallet/balance.js.map +0 -1
  69. package/dist/commands/wallet/deploy.d.ts +0 -3
  70. package/dist/commands/wallet/deploy.d.ts.map +0 -1
  71. package/dist/commands/wallet/deploy.js +0 -74
  72. package/dist/commands/wallet/deploy.js.map +0 -1
  73. package/dist/commands/wallet/send.d.ts +0 -3
  74. package/dist/commands/wallet/send.d.ts.map +0 -1
  75. package/dist/commands/wallet/send.js +0 -88
  76. package/dist/commands/wallet/send.js.map +0 -1
  77. package/dist/index.d.ts +0 -3
  78. package/dist/index.d.ts.map +0 -1
  79. package/dist/index.js.map +0 -1
  80. package/dist/lib/banner.d.ts +0 -6
  81. package/dist/lib/banner.d.ts.map +0 -1
  82. package/dist/lib/banner.js +0 -78
  83. package/dist/lib/banner.js.map +0 -1
  84. package/dist/lib/brand.d.ts +0 -5
  85. package/dist/lib/brand.d.ts.map +0 -1
  86. package/dist/lib/brand.js +0 -15
  87. package/dist/lib/brand.js.map +0 -1
  88. package/dist/lib/cache.d.ts +0 -3
  89. package/dist/lib/cache.d.ts.map +0 -1
  90. package/dist/lib/cache.js +0 -33
  91. package/dist/lib/cache.js.map +0 -1
  92. package/dist/lib/command.d.ts +0 -3
  93. package/dist/lib/command.d.ts.map +0 -1
  94. package/dist/lib/command.js +0 -6
  95. package/dist/lib/command.js.map +0 -1
  96. package/dist/lib/concurrency.d.ts +0 -2
  97. package/dist/lib/concurrency.d.ts.map +0 -1
  98. package/dist/lib/concurrency.js +0 -21
  99. package/dist/lib/concurrency.js.map +0 -1
  100. package/dist/lib/config.d.ts +0 -5
  101. package/dist/lib/config.d.ts.map +0 -1
  102. package/dist/lib/config.js +0 -10
  103. package/dist/lib/config.js.map +0 -1
  104. package/dist/lib/errors.d.ts +0 -41
  105. package/dist/lib/errors.d.ts.map +0 -1
  106. package/dist/lib/errors.js +0 -47
  107. package/dist/lib/errors.js.map +0 -1
  108. package/dist/lib/fetch.d.ts +0 -4
  109. package/dist/lib/fetch.d.ts.map +0 -1
  110. package/dist/lib/fetch.js +0 -13
  111. package/dist/lib/fetch.js.map +0 -1
  112. package/dist/lib/format.d.ts +0 -20
  113. package/dist/lib/format.d.ts.map +0 -1
  114. package/dist/lib/format.js +0 -105
  115. package/dist/lib/format.js.map +0 -1
  116. package/dist/lib/retry.d.ts +0 -8
  117. package/dist/lib/retry.d.ts.map +0 -1
  118. package/dist/lib/retry.js +0 -25
  119. package/dist/lib/retry.js.map +0 -1
  120. package/dist/lib/types.d.ts +0 -6
  121. package/dist/lib/types.d.ts.map +0 -1
  122. package/dist/lib/types.js +0 -2
  123. package/dist/lib/types.js.map +0 -1
  124. package/dist/lib/validation.d.ts +0 -2
  125. package/dist/lib/validation.d.ts.map +0 -1
  126. package/dist/lib/validation.js +0 -6
  127. package/dist/lib/validation.js.map +0 -1
  128. package/dist/mcp/handlers/auth.d.ts +0 -7
  129. package/dist/mcp/handlers/auth.d.ts.map +0 -1
  130. package/dist/mcp/handlers/auth.js +0 -22
  131. package/dist/mcp/handlers/auth.js.map +0 -1
  132. package/dist/mcp/handlers/batch.d.ts +0 -13
  133. package/dist/mcp/handlers/batch.d.ts.map +0 -1
  134. package/dist/mcp/handlers/batch.js +0 -33
  135. package/dist/mcp/handlers/batch.js.map +0 -1
  136. package/dist/mcp/handlers/config.d.ts +0 -10
  137. package/dist/mcp/handlers/config.d.ts.map +0 -1
  138. package/dist/mcp/handlers/config.js +0 -78
  139. package/dist/mcp/handlers/config.js.map +0 -1
  140. package/dist/mcp/handlers/index.d.ts +0 -10
  141. package/dist/mcp/handlers/index.d.ts.map +0 -1
  142. package/dist/mcp/handlers/index.js +0 -10
  143. package/dist/mcp/handlers/index.js.map +0 -1
  144. package/dist/mcp/handlers/lending.d.ts +0 -73
  145. package/dist/mcp/handlers/lending.d.ts.map +0 -1
  146. package/dist/mcp/handlers/lending.js +0 -145
  147. package/dist/mcp/handlers/lending.js.map +0 -1
  148. package/dist/mcp/handlers/multi-swap.d.ts +0 -27
  149. package/dist/mcp/handlers/multi-swap.d.ts.map +0 -1
  150. package/dist/mcp/handlers/multi-swap.js +0 -73
  151. package/dist/mcp/handlers/multi-swap.js.map +0 -1
  152. package/dist/mcp/handlers/portfolio.d.ts +0 -7
  153. package/dist/mcp/handlers/portfolio.d.ts.map +0 -1
  154. package/dist/mcp/handlers/portfolio.js +0 -11
  155. package/dist/mcp/handlers/portfolio.js.map +0 -1
  156. package/dist/mcp/handlers/staking.d.ts +0 -68
  157. package/dist/mcp/handlers/staking.d.ts.map +0 -1
  158. package/dist/mcp/handlers/staking.js +0 -123
  159. package/dist/mcp/handlers/staking.js.map +0 -1
  160. package/dist/mcp/handlers/trade.d.ts +0 -23
  161. package/dist/mcp/handlers/trade.d.ts.map +0 -1
  162. package/dist/mcp/handlers/trade.js +0 -71
  163. package/dist/mcp/handlers/trade.js.map +0 -1
  164. package/dist/mcp/handlers/utils.d.ts +0 -13
  165. package/dist/mcp/handlers/utils.d.ts.map +0 -1
  166. package/dist/mcp/handlers/utils.js +0 -7
  167. package/dist/mcp/handlers/utils.js.map +0 -1
  168. package/dist/mcp/handlers/wallet.d.ts +0 -34
  169. package/dist/mcp/handlers/wallet.d.ts.map +0 -1
  170. package/dist/mcp/handlers/wallet.js +0 -102
  171. package/dist/mcp/handlers/wallet.js.map +0 -1
  172. package/dist/mcp/handlers.d.ts +0 -108
  173. package/dist/mcp/handlers.d.ts.map +0 -1
  174. package/dist/mcp/handlers.js +0 -325
  175. package/dist/mcp/handlers.js.map +0 -1
  176. package/dist/mcp/server.d.ts +0 -2
  177. package/dist/mcp/server.d.ts.map +0 -1
  178. package/dist/mcp/server.js +0 -54
  179. package/dist/mcp/server.js.map +0 -1
  180. package/dist/mcp/tools/auth.d.ts +0 -3
  181. package/dist/mcp/tools/auth.d.ts.map +0 -1
  182. package/dist/mcp/tools/auth.js +0 -17
  183. package/dist/mcp/tools/auth.js.map +0 -1
  184. package/dist/mcp/tools/error-handling.d.ts +0 -12
  185. package/dist/mcp/tools/error-handling.d.ts.map +0 -1
  186. package/dist/mcp/tools/error-handling.js +0 -28
  187. package/dist/mcp/tools/error-handling.js.map +0 -1
  188. package/dist/mcp/tools/index.d.ts +0 -11
  189. package/dist/mcp/tools/index.d.ts.map +0 -1
  190. package/dist/mcp/tools/index.js +0 -19
  191. package/dist/mcp/tools/index.js.map +0 -1
  192. package/dist/mcp/tools/lending.d.ts +0 -3
  193. package/dist/mcp/tools/lending.d.ts.map +0 -1
  194. package/dist/mcp/tools/lending.js +0 -71
  195. package/dist/mcp/tools/lending.js.map +0 -1
  196. package/dist/mcp/tools/staking.d.ts +0 -3
  197. package/dist/mcp/tools/staking.d.ts.map +0 -1
  198. package/dist/mcp/tools/staking.js +0 -50
  199. package/dist/mcp/tools/staking.js.map +0 -1
  200. package/dist/mcp/tools/trade.d.ts +0 -3
  201. package/dist/mcp/tools/trade.d.ts.map +0 -1
  202. package/dist/mcp/tools/trade.js +0 -63
  203. package/dist/mcp/tools/trade.js.map +0 -1
  204. package/dist/mcp/tools/wallet.d.ts +0 -3
  205. package/dist/mcp/tools/wallet.d.ts.map +0 -1
  206. package/dist/mcp/tools/wallet.js +0 -27
  207. package/dist/mcp/tools/wallet.js.map +0 -1
  208. package/dist/mcp/tools.d.ts +0 -3
  209. package/dist/mcp/tools.d.ts.map +0 -1
  210. package/dist/mcp/tools.js +0 -240
  211. package/dist/mcp/tools.js.map +0 -1
  212. package/dist/services/api/client.d.ts +0 -14
  213. package/dist/services/api/client.d.ts.map +0 -1
  214. package/dist/services/api/client.js +0 -50
  215. package/dist/services/api/client.js.map +0 -1
  216. package/dist/services/auth/session.d.ts +0 -16
  217. package/dist/services/auth/session.d.ts.map +0 -1
  218. package/dist/services/auth/session.js +0 -57
  219. package/dist/services/auth/session.js.map +0 -1
  220. package/dist/services/batch/batch.d.ts +0 -35
  221. package/dist/services/batch/batch.d.ts.map +0 -1
  222. package/dist/services/batch/batch.js +0 -110
  223. package/dist/services/batch/batch.js.map +0 -1
  224. package/dist/services/config/config.d.ts +0 -23
  225. package/dist/services/config/config.d.ts.map +0 -1
  226. package/dist/services/config/config.js +0 -78
  227. package/dist/services/config/config.js.map +0 -1
  228. package/dist/services/fibrous/balances.d.ts +0 -8
  229. package/dist/services/fibrous/balances.d.ts.map +0 -1
  230. package/dist/services/fibrous/balances.js +0 -23
  231. package/dist/services/fibrous/balances.js.map +0 -1
  232. package/dist/services/fibrous/config.d.ts +0 -4
  233. package/dist/services/fibrous/config.d.ts.map +0 -1
  234. package/dist/services/fibrous/config.js +0 -4
  235. package/dist/services/fibrous/config.js.map +0 -1
  236. package/dist/services/fibrous/health.d.ts +0 -5
  237. package/dist/services/fibrous/health.d.ts.map +0 -1
  238. package/dist/services/fibrous/health.js +0 -24
  239. package/dist/services/fibrous/health.js.map +0 -1
  240. package/dist/services/fibrous/route.d.ts +0 -51
  241. package/dist/services/fibrous/route.d.ts.map +0 -1
  242. package/dist/services/fibrous/route.js +0 -102
  243. package/dist/services/fibrous/route.js.map +0 -1
  244. package/dist/services/fibrous/tokens.d.ts +0 -6
  245. package/dist/services/fibrous/tokens.d.ts.map +0 -1
  246. package/dist/services/fibrous/tokens.js +0 -34
  247. package/dist/services/fibrous/tokens.js.map +0 -1
  248. package/dist/services/portfolio/portfolio.d.ts +0 -31
  249. package/dist/services/portfolio/portfolio.d.ts.map +0 -1
  250. package/dist/services/portfolio/portfolio.js +0 -104
  251. package/dist/services/portfolio/portfolio.js.map +0 -1
  252. package/dist/services/simulate/simulate.d.ts +0 -10
  253. package/dist/services/simulate/simulate.d.ts.map +0 -1
  254. package/dist/services/simulate/simulate.js +0 -57
  255. package/dist/services/simulate/simulate.js.map +0 -1
  256. package/dist/services/staking/staking.d.ts +0 -49
  257. package/dist/services/staking/staking.d.ts.map +0 -1
  258. package/dist/services/staking/staking.js +0 -162
  259. package/dist/services/staking/staking.js.map +0 -1
  260. package/dist/services/staking/validators.d.ts +0 -5
  261. package/dist/services/staking/validators.d.ts.map +0 -1
  262. package/dist/services/staking/validators.js +0 -14
  263. package/dist/services/staking/validators.js.map +0 -1
  264. package/dist/services/starkzap/client.d.ts +0 -19
  265. package/dist/services/starkzap/client.d.ts.map +0 -1
  266. package/dist/services/starkzap/client.js +0 -83
  267. package/dist/services/starkzap/client.js.map +0 -1
  268. package/dist/services/starkzap/config.d.ts +0 -6
  269. package/dist/services/starkzap/config.d.ts.map +0 -1
  270. package/dist/services/starkzap/config.js +0 -13
  271. package/dist/services/starkzap/config.js.map +0 -1
  272. package/dist/services/tokens/balances.d.ts +0 -8
  273. package/dist/services/tokens/balances.d.ts.map +0 -1
  274. package/dist/services/tokens/balances.js +0 -23
  275. package/dist/services/tokens/balances.js.map +0 -1
  276. package/dist/services/tokens/tokens.d.ts +0 -4
  277. package/dist/services/tokens/tokens.d.ts.map +0 -1
  278. package/dist/services/tokens/tokens.js +0 -19
  279. package/dist/services/tokens/tokens.js.map +0 -1
  280. package/dist/services/vesu/api.d.ts +0 -28
  281. package/dist/services/vesu/api.d.ts.map +0 -1
  282. package/dist/services/vesu/api.js +0 -91
  283. package/dist/services/vesu/api.js.map +0 -1
  284. package/dist/services/vesu/config.d.ts +0 -9
  285. package/dist/services/vesu/config.d.ts.map +0 -1
  286. package/dist/services/vesu/config.js +0 -32
  287. package/dist/services/vesu/config.js.map +0 -1
  288. package/dist/services/vesu/index.d.ts +0 -5
  289. package/dist/services/vesu/index.d.ts.map +0 -1
  290. package/dist/services/vesu/index.js +0 -5
  291. package/dist/services/vesu/index.js.map +0 -1
  292. package/dist/services/vesu/lending.d.ts +0 -21
  293. package/dist/services/vesu/lending.d.ts.map +0 -1
  294. package/dist/services/vesu/lending.js +0 -269
  295. package/dist/services/vesu/lending.js.map +0 -1
  296. package/dist/services/vesu/pools.d.ts +0 -7
  297. package/dist/services/vesu/pools.d.ts.map +0 -1
  298. package/dist/services/vesu/pools.js +0 -15
  299. package/dist/services/vesu/pools.js.map +0 -1
  300. package/scripts/patch-esm.mjs +0 -151
@@ -1,325 +0,0 @@
1
- import { loadSession, requireSession } from "../services/auth/session.js";
2
- import { initSDKAndWallet } from "../services/starkzap/client.js";
3
- import { checkFibrousHealth } from "../services/fibrous/health.js";
4
- import { getBalances } from "../services/fibrous/balances.js";
5
- import { resolveToken, resolveTokenPreset } from "../services/fibrous/tokens.js";
6
- import { getCalldata } from "../services/fibrous/route.js";
7
- import * as stakingService from "../services/staking/staking.js";
8
- import { getValidators, findValidator } from "../services/staking/validators.js";
9
- import { ConfigService } from "../services/config/config.js";
10
- import { Amount, fromAddress } from "starkzap";
11
- import { FIBROUS_ROUTER_ADDRESS, GASLESS_SUPPORTED_TOKENS } from "../lib/config.js";
12
- function textResult(text) {
13
- return { content: [{ type: "text", text }] };
14
- }
15
- function jsonResult(data) {
16
- return textResult(JSON.stringify(data, null, 2));
17
- }
18
- export async function handleGetAuthStatus() {
19
- const session = loadSession();
20
- const health = await checkFibrousHealth();
21
- if (!session) {
22
- return jsonResult({
23
- authenticated: false,
24
- fibrous: health,
25
- message: "Not authenticated. Use 'starkfi auth login' or 'starkfi auth import'.",
26
- });
27
- }
28
- return jsonResult({
29
- authenticated: true,
30
- type: session.type,
31
- network: session.network,
32
- address: session.address,
33
- fibrous: health,
34
- });
35
- }
36
- export async function handleGetBalance(args) {
37
- const session = requireSession();
38
- const { wallet } = await initSDKAndWallet(session);
39
- if (args.token) {
40
- const tokenType = await resolveTokenPreset(args.token);
41
- if (!tokenType) {
42
- return textResult(`Token ${args.token} not found.`);
43
- }
44
- const balanceAmount = await wallet.balanceOf(tokenType);
45
- return jsonResult({
46
- symbol: tokenType.symbol,
47
- name: tokenType.name,
48
- balance: balanceAmount.toUnit(),
49
- });
50
- }
51
- const balances = await getBalances(wallet);
52
- return jsonResult({
53
- network: session.network,
54
- address: session.address,
55
- balances,
56
- });
57
- }
58
- export async function handleDeployAccount() {
59
- const session = requireSession();
60
- const { wallet } = await initSDKAndWallet(session);
61
- const deployed = await wallet.isDeployed();
62
- if (deployed) {
63
- return jsonResult({
64
- alreadyDeployed: true,
65
- address: session.address,
66
- network: session.network,
67
- message: "Account is already deployed. No action needed.",
68
- });
69
- }
70
- const tx = await wallet.deploy();
71
- await tx.wait();
72
- return jsonResult({
73
- alreadyDeployed: false,
74
- success: true,
75
- address: session.address,
76
- network: session.network,
77
- txHash: tx.hash,
78
- explorerUrl: tx.explorerUrl,
79
- message: "Account deployed successfully. You can now send, swap, and stake.",
80
- });
81
- }
82
- export async function handleSwapTokens(args) {
83
- const session = requireSession();
84
- const { wallet } = await initSDKAndWallet(session);
85
- await wallet.ensureReady({ deploy: "if_needed" });
86
- const tokenIn = await resolveToken(args.from_token);
87
- const tokenOut = await resolveToken(args.to_token);
88
- const parsedAmount = Amount.parse(args.amount, tokenIn);
89
- const rawAmount = parsedAmount.toBase().toString();
90
- const calldataResponse = await getCalldata(tokenIn, tokenOut, rawAmount, args.slippage ?? 0.5, session.address);
91
- const tx = await wallet
92
- .tx()
93
- .approve(tokenIn, fromAddress(FIBROUS_ROUTER_ADDRESS), parsedAmount)
94
- .add({
95
- contractAddress: FIBROUS_ROUTER_ADDRESS,
96
- entrypoint: "swap",
97
- calldata: calldataResponse.calldata,
98
- })
99
- .send();
100
- await tx.wait();
101
- const outputAmount = Amount.fromRaw(calldataResponse.route.outputAmount, tokenOut);
102
- const outputFormatted = outputAmount.toUnit();
103
- return jsonResult({
104
- success: true,
105
- txHash: tx.hash,
106
- explorerUrl: tx.explorerUrl,
107
- amountIn: `${args.amount} ${tokenIn.symbol}`,
108
- amountOut: `~${outputFormatted} ${tokenOut.symbol}`,
109
- slippage: `${args.slippage ?? 0.5}%`,
110
- });
111
- }
112
- export async function handleSendTokens(args) {
113
- const session = requireSession();
114
- const { wallet } = await initSDKAndWallet(session);
115
- await wallet.ensureReady({ deploy: "if_needed" });
116
- const token = await resolveTokenPreset(args.token);
117
- if (!token) {
118
- return textResult(`Token ${args.token} not found.`);
119
- }
120
- const amount = Amount.parse(args.amount, token);
121
- const balance = await wallet.balanceOf(token);
122
- if (balance.lt(amount)) {
123
- return jsonResult({
124
- success: false,
125
- error: `Insufficient balance. You have: ${balance.toFormatted()}, attempting to send: ${amount.toFormatted()}`,
126
- });
127
- }
128
- const tx = await wallet.transfer(token, [{ to: fromAddress(args.recipient), amount }]);
129
- await tx.wait();
130
- return jsonResult({
131
- success: true,
132
- txHash: tx.hash,
133
- explorerUrl: tx.explorerUrl,
134
- amount: `${args.amount} ${args.token.toUpperCase()}`,
135
- to: args.recipient,
136
- });
137
- }
138
- export async function handleGetTxStatus(args) {
139
- const session = requireSession();
140
- const { sdk } = await initSDKAndWallet(session);
141
- const provider = sdk.getProvider();
142
- const receipt = await provider.getTransactionReceipt(args.hash);
143
- const actualFee = "actual_fee" in receipt ? String(receipt.actual_fee) : undefined;
144
- const blockNumber = "block_number" in receipt ? receipt.block_number : undefined;
145
- return jsonResult({
146
- hash: args.hash,
147
- status: receipt.statusReceipt,
148
- actualFee,
149
- blockNumber,
150
- });
151
- }
152
- export async function handleStakeTokens(args) {
153
- const session = requireSession();
154
- const { wallet } = await initSDKAndWallet(session);
155
- await wallet.ensureReady({ deploy: "if_needed" });
156
- const result = await stakingService.stake(wallet, args.pool, args.amount);
157
- return jsonResult({
158
- success: true,
159
- txHash: result.hash,
160
- explorerUrl: result.explorerUrl,
161
- amount: `${args.amount} STRK`,
162
- pool: args.pool,
163
- });
164
- }
165
- export async function handleUnstakeTokens(args) {
166
- const session = requireSession();
167
- const { wallet } = await initSDKAndWallet(session);
168
- await wallet.ensureReady({ deploy: "if_needed" });
169
- if (args.action === "intent") {
170
- if (!args.amount) {
171
- return textResult("Amount is required for exit intent.");
172
- }
173
- const result = await stakingService.exitPoolIntent(wallet, args.pool, args.amount);
174
- return jsonResult({
175
- success: true,
176
- action: "exit_intent",
177
- txHash: result.hash,
178
- explorerUrl: result.explorerUrl,
179
- message: "Exit intent declared. Wait for cooldown period, then call with action='exit'.",
180
- });
181
- }
182
- // action === "exit"
183
- const result = await stakingService.exitPool(wallet, args.pool);
184
- return jsonResult({
185
- success: true,
186
- action: "exit_complete",
187
- txHash: result.hash,
188
- explorerUrl: result.explorerUrl,
189
- message: "Tokens withdrawn from pool.",
190
- });
191
- }
192
- export async function handleGetStakingInfo(args) {
193
- const session = requireSession();
194
- const { wallet } = await initSDKAndWallet(session);
195
- const position = await stakingService.getPosition(wallet, args.pool);
196
- if (!position) {
197
- return jsonResult({
198
- isMember: false,
199
- pool: args.pool,
200
- message: "Not a member of this pool.",
201
- });
202
- }
203
- return jsonResult({
204
- isMember: true,
205
- pool: args.pool,
206
- staked: position.staked,
207
- rewards: position.rewards,
208
- total: position.total,
209
- unpooling: position.unpooling,
210
- cooldownEndsAt: position.unpoolTime ? position.unpoolTime.toISOString() : null,
211
- commissionPercent: position.commissionPercent,
212
- });
213
- }
214
- export async function handleListPools(args) {
215
- const session = requireSession();
216
- const { sdk, wallet } = await initSDKAndWallet(session);
217
- const found = findValidator(args.validator, session.network);
218
- const stakerAddress = found ? found.stakerAddress.toString() : args.validator;
219
- const pools = await stakingService.getValidatorPools(sdk, stakerAddress, wallet);
220
- return jsonResult({
221
- validator: found ? found.name : args.validator,
222
- stakerAddress,
223
- pools,
224
- });
225
- }
226
- export async function handleListValidators() {
227
- const session = requireSession();
228
- const validators = getValidators(session.network);
229
- return jsonResult({
230
- network: session.network,
231
- count: validators.length,
232
- validators: validators.map((v) => ({
233
- name: v.name,
234
- stakerAddress: v.stakerAddress.toString(),
235
- })),
236
- });
237
- }
238
- export async function handleCompoundRewards(args) {
239
- const session = requireSession();
240
- const { wallet } = await initSDKAndWallet(session);
241
- await wallet.ensureReady({ deploy: "if_needed" });
242
- const result = await stakingService.compoundRewards(wallet, args.pool);
243
- return jsonResult({
244
- success: true,
245
- txHash: result.hash,
246
- explorerUrl: result.explorerUrl,
247
- compounded: result.compounded,
248
- });
249
- }
250
- export async function handleConfigAction(args) {
251
- const configService = ConfigService.getInstance();
252
- switch (args.action) {
253
- case "set-rpc": {
254
- if (!args.value)
255
- return textResult("RPC URL value is required.");
256
- configService.set("rpcUrl", args.value);
257
- return jsonResult({ success: true, rpcUrl: args.value });
258
- }
259
- case "get-rpc": {
260
- const rpcUrl = configService.get("rpcUrl");
261
- return jsonResult({ rpcUrl: rpcUrl || "default (Cartridge RPC)" });
262
- }
263
- case "set-network": {
264
- if (!args.value || !["mainnet", "sepolia"].includes(args.value)) {
265
- return textResult("Network must be 'mainnet' or 'sepolia'.");
266
- }
267
- configService.set("network", args.value);
268
- return jsonResult({ success: true, network: args.value });
269
- }
270
- case "set-gasless": // deprecated alias
271
- case "set-gasfree": {
272
- if (!args.value || !["on", "off"].includes(args.value)) {
273
- return textResult("Gasfree mode must be 'on' or 'off'.");
274
- }
275
- const enabled = args.value === "on";
276
- configService.set("gasfreeMode", enabled);
277
- if (enabled)
278
- configService.delete("gasToken"); // mutually exclusive
279
- return jsonResult({
280
- success: true,
281
- gasfreeMode: enabled,
282
- note: enabled
283
- ? "Developer sponsors gas via AVNU Paymaster (requires API key + credits)"
284
- : "Gasfree disabled",
285
- });
286
- }
287
- case "set-gas-token": {
288
- if (!args.value)
289
- return textResult("Token symbol or 'off' is required.");
290
- if (args.value.toLowerCase() === "off") {
291
- configService.delete("gasToken");
292
- return jsonResult({
293
- success: true,
294
- gasToken: null,
295
- note: "Reverted to default STRK gas",
296
- });
297
- }
298
- const upper = args.value.toUpperCase();
299
- if (!GASLESS_SUPPORTED_TOKENS.includes(upper)) {
300
- return textResult(`Unsupported token '${args.value}'. Supported: ${GASLESS_SUPPORTED_TOKENS.join(", ")}`);
301
- }
302
- configService.delete("gasfreeMode"); // mutually exclusive
303
- configService.set("gasToken", upper);
304
- return jsonResult({
305
- success: true,
306
- gasToken: upper,
307
- note: `Gasless mode: user pays gas in ${upper} (no STRK needed, no API key required)`,
308
- });
309
- }
310
- case "list": {
311
- const all = configService.getAll();
312
- const gasfreeMode = all.gasfreeMode === true;
313
- const gasToken = all.gasToken;
314
- let feeMode = "default (pays STRK)";
315
- if (gasfreeMode)
316
- feeMode = "gasfree (developer-sponsored via AVNU)";
317
- else if (gasToken)
318
- feeMode = `gasless (user pays in ${gasToken})`;
319
- return jsonResult({ ...all, feeMode });
320
- }
321
- default:
322
- return textResult(`Unknown action: ${args.action}`);
323
- }
324
- }
325
- //# sourceMappingURL=handlers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/mcp/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EA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AC;YACpD,IAAI,OAAO,GAAG,qBAAqB,CAAC;YACpC,IAAI,WAAW;gBAAE,OAAO,GAAG,wCAAwC,CAAC;iBAC/D,IAAI,QAAQ;gBAAE,OAAO,GAAG,yBAAyB,QAAQ,GAAG,CAAC;YAClE,OAAO,UAAU,CAAC,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;QACxC,CAAC;QACD;YACC,OAAO,UAAU,CAAC,mBAAmB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;AACF,CAAC"}
@@ -1,2 +0,0 @@
1
- export declare function startMcpServer(): Promise<void>;
2
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AA8CA,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAkBpD"}
@@ -1,54 +0,0 @@
1
- import { createRequire } from "node:module";
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
- const require = createRequire(import.meta.url);
6
- const pkg = require("../../package.json");
7
- const MCP_INSTRUCTIONS = `StarkFi is a Starknet DeFi toolkit. You can:
8
- - Check auth status and configure settings (network, RPC, gas payment mode)
9
- - Query balances, deploy accounts, send tokens, and view full portfolio
10
- - Get swap quotes and execute token swaps via Fibrous aggregation
11
- - Execute multi-swaps (2-3 pairs) and batch multiple DeFi operations in a single transaction
12
- - Stake/unstake tokens across validators, claim and compound rewards
13
- - Supply, borrow, repay, withdraw, and close positions on Vesu V2 lending pools
14
-
15
- Always call get_swap_quote before swap_tokens. Always call list_validators before staking. Always call list_lending_pools before lending operations. Use simulate=true on transactional tools to preview fees before execution.`;
16
- function printBanner(summary) {
17
- const version = pkg.version;
18
- const line = "═".repeat(49);
19
- const maxNameLen = Math.max(...summary.categories.map((c) => c.name.length));
20
- const lines = [
21
- "",
22
- ` ${line}`,
23
- ` StarkFi MCP Server v${version}`,
24
- ` Transport: stdio`,
25
- ` ${line}`,
26
- "",
27
- ` Tools (${summary.total}):`,
28
- ...summary.categories.map((c) => {
29
- const dots = "·".repeat(maxNameLen - c.name.length + 4);
30
- return ` ${c.name} ${dots} ${c.count} tools`;
31
- }),
32
- "",
33
- ` ✓ Server ready — awaiting client connection`,
34
- ` ${line}`,
35
- "",
36
- ];
37
- // MCP stdio transport reserves stdout for JSON-RPC.
38
- // All human-readable output MUST go to stderr.
39
- process.stderr.write(lines.join("\n") + "\n");
40
- }
41
- export async function startMcpServer() {
42
- const server = new McpServer({
43
- name: pkg.name,
44
- version: pkg.version,
45
- }, {
46
- instructions: MCP_INSTRUCTIONS,
47
- capabilities: { logging: {} },
48
- });
49
- const summary = registerTools(server);
50
- const transport = new StdioServerTransport();
51
- await server.connect(transport);
52
- printBanner(summary);
53
- }
54
- //# sourceMappingURL=server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAoB,MAAM,kBAAkB,CAAC;AAEnE,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAsC,CAAC;AAE/E,MAAM,gBAAgB,GAAG;;;;;;;;gOAQuM,CAAC;AAEjO,SAAS,WAAW,CAAC,OAAoB;IACxC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAC5B,MAAM,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAA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OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,WAAW,CAAC,OAAO,CAAC,CAAC;AACtB,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare function registerAuthAndConfigTools(server: McpServer): number;
3
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/auth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIzE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CA8BpE"}
@@ -1,17 +0,0 @@
1
- import { z } from "zod";
2
- import { handleGetAuthStatus, handleConfigAction } from "../handlers/index.js";
3
- import { withErrorHandling } from "./error-handling.js";
4
- export function registerAuthAndConfigTools(server) {
5
- server.tool("get_auth_status", "Check authentication status and Fibrous API health on Starknet. Use this to verify the user's active wallet.", {}, { readOnlyHint: true, destructiveHint: false }, withErrorHandling(handleGetAuthStatus));
6
- server.tool("config_action", "View and modify starkfi global configuration such as active network, RPC URL, and Gas Payment mechanisms.", {
7
- action: z
8
- .enum(["list", "set-rpc", "get-rpc", "set-network", "set-gasfree", "set-gas-token"])
9
- .describe("list: view all. set-gasfree: dev pays gas using paymaster credits. set-gas-token: user pays gas in ERC20 token instead of STRK."),
10
- value: z
11
- .string()
12
- .optional()
13
- .describe("set-gasfree: 'on'/'off'. set-gas-token: symbol 'USDC'/'ETH' or 'off'. set-rpc: URL string. set-network: 'mainnet'/'sepolia'."),
14
- }, { readOnlyHint: false, destructiveHint: false }, withErrorHandling(handleConfigAction));
15
- return 2;
16
- }
17
- //# sourceMappingURL=auth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/mcp/tools/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,UAAU,0BAA0B,CAAC,MAAiB;IAC3D,MAAM,CAAC,IAAI,CACV,iBAAiB,EACjB,8GAA8G,EAC9G,EAAE,EACF,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,EAC9C,iBAAiB,CAAC,mBAAmB,CAAC,CACtC,CAAC;IAEF,MAAM,CAAC,IAAI,CACV,eAAe,EACf,2GAA2G,EAC3G;QACC,MAAM,EAAE,CAAC;aACP,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;aACnF,QAAQ,CACR,iIAAiI,CACjI;QACF,KAAK,EAAE,CAAC;aACN,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACR,8HAA8H,CAC9H;KACF,EACD,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,EAC/C,iBAAiB,CAAC,kBAAkB,CAAC,CACrC,CAAC;IAEF,OAAO,CAAC,CAAC;AACV,CAAC"}
@@ -1,12 +0,0 @@
1
- export declare function withErrorHandling<T extends (...args: never[]) => Promise<{
2
- content: {
3
- type: "text";
4
- text: string;
5
- }[];
6
- }>>(fn: T): (...args: Parameters<T>) => Promise<{
7
- content: {
8
- type: "text";
9
- text: string;
10
- }[];
11
- }>;
12
- //# sourceMappingURL=error-handling.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/error-handling.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAChC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,EACrF,EAAE,EAAE,CAAC,IAEL,GAAG,MAAM,UAAU,CAAC,CAAC,CAAC,KACpB,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,CA4BzD"}
@@ -1,28 +0,0 @@
1
- import { StarkfiError } from "../../lib/errors.js";
2
- export function withErrorHandling(fn) {
3
- return async (...args) => {
4
- try {
5
- return await fn(...args);
6
- }
7
- catch (error) {
8
- const isStarkfiError = error instanceof StarkfiError;
9
- const message = error instanceof Error ? error.message : String(error);
10
- return {
11
- content: [
12
- {
13
- type: "text",
14
- text: JSON.stringify({
15
- success: false,
16
- error: message,
17
- code: isStarkfiError ? error.code : "UNKNOWN_ERROR",
18
- ...(isStarkfiError && error.details
19
- ? { details: error.details }
20
- : {}),
21
- }, null, 2),
22
- },
23
- ],
24
- };
25
- }
26
- };
27
- }
28
- //# sourceMappingURL=error-handling.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-handling.js","sourceRoot":"","sources":["../../../src/mcp/tools/error-handling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,UAAU,iBAAiB,CAE/B,EAAK;IACN,OAAO,KAAK,EACX,GAAG,IAAmB,EACmC,EAAE;QAC3D,IAAI,CAAC;YACJ,OAAO,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,cAAc,GAAG,KAAK,YAAY,YAAY,CAAC;YACrD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAEvE,OAAO;gBACN,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CACnB;4BACC,OAAO,EAAE,KAAK;4BACd,KAAK,EAAE,OAAO;4BACd,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe;4BACnD,GAAG,CAAC,cAAc,IAAI,KAAK,CAAC,OAAO;gCAClC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE;gCAC5B,CAAC,CAAC,EAAE,CAAC;yBACN,EACD,IAAI,EACJ,CAAC,CACD;qBACD;iBACD;aACD,CAAC;QACH,CAAC;IACF,CAAC,CAAC;AACH,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export interface ToolCategory {
3
- name: string;
4
- count: number;
5
- }
6
- export interface ToolSummary {
7
- total: number;
8
- categories: ToolCategory[];
9
- }
10
- export declare function registerTools(server: McpServer): ToolSummary;
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,WAAW,CAa5D"}
@@ -1,19 +0,0 @@
1
- import { registerAuthAndConfigTools } from "./auth.js";
2
- import { registerWalletTools } from "./wallet.js";
3
- import { registerTradeTools } from "./trade.js";
4
- import { registerStakingTools } from "./staking.js";
5
- import { registerLendingTools } from "./lending.js";
6
- export function registerTools(server) {
7
- const categories = [
8
- { name: "Auth & Config", count: registerAuthAndConfigTools(server) },
9
- { name: "Wallet", count: registerWalletTools(server) },
10
- { name: "Trade", count: registerTradeTools(server) },
11
- { name: "Staking", count: registerStakingTools(server) },
12
- { name: "Lending", count: registerLendingTools(server) },
13
- ];
14
- return {
15
- total: categories.reduce((sum, c) => sum + c.count, 0),
16
- categories,
17
- };
18
- }
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAYpD,MAAM,UAAU,aAAa,CAAC,MAAiB;IAC9C,MAAM,UAAU,GAAmB;QAClC,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,0BAA0B,CAAC,MAAM,CAAC,EAAE;QACpE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,mBAAmB,CAAC,MAAM,CAAC,EAAE;QACtD,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,CAAC,MAAM,CAAC,EAAE;QACpD,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,oBAAoB,CAAC,MAAM,CAAC,EAAE;QACxD,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,oBAAoB,CAAC,MAAM,CAAC,EAAE;KACxD,CAAC;IAEF,OAAO;QACN,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;QACtD,UAAU;KACV,CAAC;AACH,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare function registerLendingTools(server: McpServer): number;
3
- //# sourceMappingURL=lending.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lending.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/lending.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAuH9D"}
@@ -1,71 +0,0 @@
1
- import { z } from "zod";
2
- import { handleListLendingPools, handleGetLendingPosition, handleSupplyAssets, handleWithdrawAssets, handleBorrowAssets, handleRepayDebt, handleClosePosition, } from "../handlers/index.js";
3
- import { withErrorHandling } from "./error-handling.js";
4
- export function registerLendingTools(server) {
5
- server.tool("list_lending_pools", "List available Vesu V2 lending pools on Starknet with their supported collateral/debt pairs. Use this FIRST to discover available pools before supplying, borrowing, or checking positions.", {
6
- name: z
7
- .string()
8
- .optional()
9
- .describe("Filter pools by name (partial match). Omit to list all."),
10
- }, { readOnlyHint: true, destructiveHint: false }, withErrorHandling(handleListLendingPools));
11
- server.tool("get_lending_position", "Get the user's lending position (supplied collateral and outstanding debt) in a specific Vesu pool.", {
12
- pool: z
13
- .string()
14
- .describe("Pool name (e.g. 'Prime', 'Re7') or contract address (0x...)"),
15
- collateral_token: z.string().describe("Collateral token symbol (e.g. 'ETH', 'STRK')"),
16
- borrow_token: z
17
- .string()
18
- .optional()
19
- .describe("Borrow token symbol (e.g. 'USDC', 'USDT')"),
20
- }, { readOnlyHint: true, destructiveHint: false }, withErrorHandling(handleGetLendingPosition));
21
- server.tool("supply_assets", "Supply (lend) tokens into a Vesu V2 pool to earn interest. The tokens are deposited into the pool's ERC-4626 vToken vault.", {
22
- pool: z
23
- .string()
24
- .describe("Pool name (e.g. 'Prime', 'Re7') or contract address (0x...)"),
25
- amount: z.string().describe("Amount to supply (e.g. '100', '0.5')"),
26
- token: z.string().describe("Token symbol to supply (e.g. 'STRK', 'ETH', 'USDC')"),
27
- }, { readOnlyHint: false, destructiveHint: true, idempotentHint: false }, withErrorHandling(handleSupplyAssets));
28
- server.tool("withdraw_assets", "Withdraw previously supplied tokens from a Vesu V2 lending pool.", {
29
- pool: z
30
- .string()
31
- .describe("Pool name (e.g. 'Prime', 'Re7') or contract address (0x...)"),
32
- amount: z.string().describe("Amount to withdraw (e.g. '100', '0.5')"),
33
- token: z.string().describe("Token symbol to withdraw (e.g. 'STRK', 'ETH', 'USDC')"),
34
- }, { readOnlyHint: false, destructiveHint: true, idempotentHint: false }, withErrorHandling(handleWithdrawAssets));
35
- server.tool("borrow_assets", "Borrow tokens from a Vesu V2 pool by supplying collateral. Atomically deposits collateral and borrows the debt asset in a single transaction.", {
36
- pool: z
37
- .string()
38
- .describe("Pool name (e.g. 'Prime', 'Re7') or contract address (0x...)"),
39
- collateral_amount: z.string().describe("Collateral amount to deposit (e.g. '1000')"),
40
- collateral_token: z.string().describe("Collateral token symbol (e.g. 'STRK', 'ETH')"),
41
- borrow_amount: z.string().describe("Amount to borrow (e.g. '100')"),
42
- borrow_token: z.string().describe("Token to borrow (e.g. 'USDC', 'USDT')"),
43
- use_supplied: z
44
- .boolean()
45
- .optional()
46
- .describe("Set to true to use previously supplied yield tokens as collateral via Multicall instead of transferring fresh tokens from wallet."),
47
- }, { readOnlyHint: false, destructiveHint: true, idempotentHint: false }, withErrorHandling(handleBorrowAssets));
48
- server.tool("repay_debt", "Repay borrowed tokens on an existing Vesu V2 lending position. Approves and repays the specified amount of debt.", {
49
- pool: z
50
- .string()
51
- .describe("Pool name (e.g. 'Prime', 'Re7') or contract address (0x...)"),
52
- amount: z.string().describe("Amount to repay (e.g. '50', '100')"),
53
- token: z.string().describe("Token to repay (e.g. 'USDC', 'USDT')"),
54
- collateral_token: z
55
- .string()
56
- .describe("Collateral token of the position (e.g. 'ETH', 'STRK'). Needed to identify the position."),
57
- }, { readOnlyHint: false, destructiveHint: true, idempotentHint: false }, withErrorHandling(handleRepayDebt));
58
- server.tool("close_position", "Atomically close an active Vesu V2 lending position. Repays all outstanding debt and withdraws all collateral in a single transaction.", {
59
- pool: z
60
- .string()
61
- .describe("Pool name (e.g. 'Prime', 'Re7') or contract address (0x...)"),
62
- collateral_token: z
63
- .string()
64
- .describe("Collateral token symbol of the position (e.g. 'STRK', 'ETH')"),
65
- debt_token: z
66
- .string()
67
- .describe("Borrowed token symbol of the position (e.g. 'USDC', 'USDT')"),
68
- }, { readOnlyHint: false, destructiveHint: true, idempotentHint: false }, withErrorHandling(handleClosePosition));
69
- return 7;
70
- }
71
- //# sourceMappingURL=lending.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lending.js","sourceRoot":"","sources":["../../../src/mcp/tools/lending.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACN,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,mBAAmB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,UAAU,oBAAoB,CAAC,MAAiB;IACrD,MAAM,CAAC,IAAI,CACV,oBAAoB,EACpB,6LAA6L,EAC7L;QACC,IAAI,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CAAC,yDAAyD,CAAC;KACrE,EACD,EAAE,YAAY,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,EAC9C,iBAAiB,CAAC,sBAAsB,CAAC,CACzC,CAAC;IAEF,MAAM,CAAC,IAAI,CACV,sBAAsB,EACtB,qGAAqG,EACrG;QACC,IAAI,EAAE,CAAC;aACL,MAAM,EAAE;aACR,QAAQ,CAAC,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,CAAC,8DAA8D,CAAC;QAC1E,UAAU,EAAE,CAAC;aACX,MAAM,EAAE;aACR,QAAQ,CAAC,6DAA6D,CAAC;KACzE,EACD,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,EACrE,iBAAiB,CAAC,mBAAmB,CAAC,CACtC,CAAC;IAEF,OAAO,CAAC,CAAC;AACV,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare function registerStakingTools(server: McpServer): number;
3
- //# sourceMappingURL=staking.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/staking.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAazE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CA2G9D"}