@oracle-agent/oracle 0.14.1 → 0.15.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 (447) hide show
  1. package/README.md +2 -2
  2. package/SETUP.md +4 -4
  3. package/dist/action-receipts.mjs +1 -0
  4. package/dist/action-semantics.mjs +1 -0
  5. package/dist/address-book.mjs +2 -0
  6. package/dist/bin/desk-server.mjs +59 -0
  7. package/dist/bin/oracle-data-mcp.mjs +8 -0
  8. package/dist/bin/oracle-equities.mjs +20 -0
  9. package/dist/bin/oracle-init.mjs +24 -0
  10. package/dist/bin/oracle-public-server.mjs +5 -0
  11. package/dist/bin/oracle-route.mjs +22 -0
  12. package/dist/bin/oracle-scan.mjs +18 -0
  13. package/dist/bin/oracle-upgrade.mjs +21 -0
  14. package/dist/bin/oracle.mjs +61 -0
  15. package/dist/chains.mjs +1 -0
  16. package/dist/cli/commands/auth.mjs +16 -0
  17. package/dist/cli/commands/bootstrap.mjs +18 -0
  18. package/dist/cli/commands/chain.mjs +21 -0
  19. package/dist/cli/commands/chat.mjs +45 -0
  20. package/dist/cli/commands/credential.mjs +1 -0
  21. package/dist/cli/commands/data-mcp.mjs +2 -0
  22. package/dist/cli/commands/data.mjs +12 -0
  23. package/dist/cli/commands/doctor.mjs +5 -0
  24. package/dist/cli/commands/equities.mjs +15 -0
  25. package/dist/cli/commands/farm.mjs +59 -0
  26. package/dist/cli/commands/fees.mjs +10 -0
  27. package/dist/cli/commands/follow.mjs +28 -0
  28. package/dist/cli/commands/harness.mjs +15 -0
  29. package/dist/cli/commands/help.mjs +1 -0
  30. package/dist/cli/commands/init.mjs +3 -0
  31. package/dist/cli/commands/mcp.mjs +36 -0
  32. package/dist/cli/commands/model.mjs +54 -0
  33. package/dist/cli/commands/plugins.mjs +43 -0
  34. package/dist/cli/commands/prepare.mjs +2 -0
  35. package/dist/cli/commands/public.mjs +3 -0
  36. package/dist/cli/commands/resolve.mjs +23 -0
  37. package/dist/cli/commands/route.mjs +2 -0
  38. package/dist/cli/commands/runner.mjs +1 -0
  39. package/dist/cli/commands/scan.mjs +2 -0
  40. package/dist/cli/commands/setup.mjs +34 -0
  41. package/dist/cli/commands/sign.mjs +4 -0
  42. package/dist/cli/commands/signer.mjs +1 -0
  43. package/dist/cli/commands/swap.mjs +36 -0
  44. package/dist/cli/commands/upgrade.mjs +2 -0
  45. package/dist/cli/commands/vault.mjs +1 -0
  46. package/dist/cli/commands/version.mjs +2 -0
  47. package/dist/data/desk-data.mjs +55 -0
  48. package/dist/data/names.mjs +2 -0
  49. package/dist/data/providers/farming.mjs +2 -0
  50. package/dist/equities/index.mjs +1 -0
  51. package/dist/index.mjs +60 -0
  52. package/dist/nft-gas-war-guard.mjs +1 -0
  53. package/dist/onboarding/harness-configs.mjs +4 -0
  54. package/dist/portfolio-risk.mjs +1 -0
  55. package/dist/prepare-envelope.mjs +1 -0
  56. package/dist/public-api/agent-grants.mjs +3 -0
  57. package/dist/public-control/policy-schema.mjs +1 -0
  58. package/dist/router/index.mjs +2 -0
  59. package/dist/scanner/index.mjs +4 -0
  60. package/dist/signals/index.mjs +1 -0
  61. package/dist/watch-preferences.mjs +1 -0
  62. package/package.json +32 -78
  63. package/public/oracle-splash/_variants/ice.html +5 -18
  64. package/public/oracle-splash/_variants/ivory.html +5 -18
  65. package/public/oracle-splash/index.html +114 -34
  66. package/CONTRIBUTING.md +0 -99
  67. package/bin/desk-server.mjs +0 -473
  68. package/bin/oracle-data-mcp.mjs +0 -1252
  69. package/bin/oracle-equities.mjs +0 -168
  70. package/bin/oracle-init.mjs +0 -525
  71. package/bin/oracle-public-server.mjs +0 -36
  72. package/bin/oracle-route.mjs +0 -254
  73. package/bin/oracle-scan.mjs +0 -192
  74. package/bin/oracle-upgrade.mjs +0 -42
  75. package/bin/oracle.mjs +0 -34
  76. package/docs/adding-a-chain.md +0 -229
  77. package/docs/architecture.md +0 -139
  78. package/docs/buzz-integration.md +0 -115
  79. package/docs/cli.md +0 -143
  80. package/docs/connectors.md +0 -13
  81. package/docs/hyperliquid-builder-code.md +0 -50
  82. package/docs/locals-only-fee-waiver.md +0 -34
  83. package/docs/oracle-pack-standard.md +0 -29
  84. package/docs/profiles.md +0 -151
  85. package/docs/public-surface.md +0 -206
  86. package/examples/add-a-chain.mjs +0 -65
  87. package/examples/oracle-pack-template.mjs +0 -38
  88. package/examples/research-a-token.mjs +0 -70
  89. package/plugins/oracle-owner-gate/__init__.py +0 -288
  90. package/plugins/oracle-owner-gate/plugin.yaml +0 -9
  91. package/protocols/templates/safe-erc20/SECURITY.md +0 -16
  92. package/protocols/templates/safe-erc20/foundry.toml +0 -12
  93. package/protocols/templates/safe-erc20/remappings.txt +0 -2
  94. package/protocols/templates/safe-erc20/src/SafeERC20.sol +0 -53
  95. package/protocols/templates/safe-erc20/test/SafeERC20.t.sol +0 -72
  96. package/scripts/adversarial-bench.mjs +0 -114
  97. package/scripts/build-dist.mjs +0 -119
  98. package/scripts/build-inscription.py +0 -230
  99. package/scripts/check-doc-drift.mjs +0 -123
  100. package/scripts/check-test-count.mjs +0 -105
  101. package/scripts/e2e-hl-markets.mjs +0 -21
  102. package/scripts/e2e-hl-perps.mjs +0 -48
  103. package/scripts/e2e-hypercore-staking.mjs +0 -128
  104. package/scripts/e2e-solana-bitcoin.mjs +0 -183
  105. package/scripts/guard-publish.mjs +0 -22
  106. package/scripts/protocol-template-gate.mjs +0 -15
  107. package/scripts/public-api-scan.mjs +0 -23
  108. package/scripts/publish-dist.mjs +0 -67
  109. package/scripts/record-hero-cli.sh +0 -80
  110. package/scripts/secret-scan.mjs +0 -169
  111. package/scripts/smoke-dist-bins.mjs +0 -89
  112. package/scripts/verify-dist.mjs +0 -29
  113. package/scripts/verify-v3-venues.mjs +0 -233
  114. package/skins/oracle.yaml +0 -56
  115. package/src/action-receipts.mjs +0 -265
  116. package/src/action-semantics.mjs +0 -62
  117. package/src/address-book.mjs +0 -208
  118. package/src/agent-auth.mjs +0 -206
  119. package/src/approval-guard.mjs +0 -282
  120. package/src/attestation-secret.mjs +0 -94
  121. package/src/audit-log.mjs +0 -196
  122. package/src/auth/oauth.mjs +0 -672
  123. package/src/auto-slippage.mjs +0 -378
  124. package/src/capability-posture.mjs +0 -125
  125. package/src/cards.mjs +0 -422
  126. package/src/chains.mjs +0 -62
  127. package/src/cli/chain-catalog.mjs +0 -215
  128. package/src/cli/chain-state.mjs +0 -74
  129. package/src/cli/commands/auth.mjs +0 -193
  130. package/src/cli/commands/bootstrap.mjs +0 -87
  131. package/src/cli/commands/chain.mjs +0 -143
  132. package/src/cli/commands/chat.mjs +0 -465
  133. package/src/cli/commands/credential.mjs +0 -9
  134. package/src/cli/commands/data-mcp.mjs +0 -18
  135. package/src/cli/commands/data.mjs +0 -75
  136. package/src/cli/commands/doctor.mjs +0 -136
  137. package/src/cli/commands/equities.mjs +0 -41
  138. package/src/cli/commands/farm.mjs +0 -129
  139. package/src/cli/commands/fees.mjs +0 -109
  140. package/src/cli/commands/follow.mjs +0 -130
  141. package/src/cli/commands/harness.mjs +0 -63
  142. package/src/cli/commands/help.mjs +0 -7
  143. package/src/cli/commands/init.mjs +0 -27
  144. package/src/cli/commands/mcp.mjs +0 -154
  145. package/src/cli/commands/model.mjs +0 -106
  146. package/src/cli/commands/plugins.mjs +0 -275
  147. package/src/cli/commands/prepare.mjs +0 -12
  148. package/src/cli/commands/public.mjs +0 -20
  149. package/src/cli/commands/resolve.mjs +0 -64
  150. package/src/cli/commands/route.mjs +0 -12
  151. package/src/cli/commands/runner.mjs +0 -9
  152. package/src/cli/commands/scan.mjs +0 -12
  153. package/src/cli/commands/setup.mjs +0 -294
  154. package/src/cli/commands/sign.mjs +0 -21
  155. package/src/cli/commands/signer.mjs +0 -9
  156. package/src/cli/commands/swap.mjs +0 -102
  157. package/src/cli/commands/upgrade.mjs +0 -12
  158. package/src/cli/commands/vault.mjs +0 -9
  159. package/src/cli/commands/version.mjs +0 -22
  160. package/src/cli/first-run.mjs +0 -23
  161. package/src/cli/kernel.mjs +0 -262
  162. package/src/cli/mcp-targets/chatgpt.mjs +0 -51
  163. package/src/cli/mcp-targets/claude-code.mjs +0 -39
  164. package/src/cli/mcp-targets/claude-desktop.mjs +0 -24
  165. package/src/cli/mcp-targets/codex.mjs +0 -41
  166. package/src/cli/mcp-targets/cursor.mjs +0 -32
  167. package/src/cli/mcp-targets/shared.mjs +0 -71
  168. package/src/cli/mcp-targets/vscode.mjs +0 -39
  169. package/src/cli/messaging-platforms.mjs +0 -217
  170. package/src/cli/model-config.mjs +0 -78
  171. package/src/cli/operator-dispatch.mjs +0 -194
  172. package/src/cli/oracle-harness.py +0 -415
  173. package/src/cli/paths.mjs +0 -107
  174. package/src/cli/runtime.mjs +0 -351
  175. package/src/cli/setup-state.mjs +0 -168
  176. package/src/cli/spawn-child.mjs +0 -43
  177. package/src/data/catalog.mjs +0 -858
  178. package/src/data/desk-data.mjs +0 -877
  179. package/src/data/http.mjs +0 -253
  180. package/src/data/names.mjs +0 -188
  181. package/src/data/provider-endpoint.mjs +0 -94
  182. package/src/data/providers/aave-v3.mjs +0 -139
  183. package/src/data/providers/across-bridge.mjs +0 -41
  184. package/src/data/providers/aerodrome.mjs +0 -245
  185. package/src/data/providers/aevo.mjs +0 -33
  186. package/src/data/providers/approval-indexer.mjs +0 -133
  187. package/src/data/providers/approvals.mjs +0 -594
  188. package/src/data/providers/babylon-staking.mjs +0 -149
  189. package/src/data/providers/balancer.mjs +0 -209
  190. package/src/data/providers/beefy-yields.mjs +0 -45
  191. package/src/data/providers/birdeye-tokens.mjs +0 -33
  192. package/src/data/providers/bisq-markets.mjs +0 -145
  193. package/src/data/providers/bitcoin-esplora.mjs +0 -216
  194. package/src/data/providers/bitcoin-meta.mjs +0 -378
  195. package/src/data/providers/blockscout.mjs +0 -14
  196. package/src/data/providers/bob-rootstock.mjs +0 -198
  197. package/src/data/providers/braiins-insights.mjs +0 -103
  198. package/src/data/providers/bridge-aggregator.mjs +0 -259
  199. package/src/data/providers/bridges.mjs +0 -242
  200. package/src/data/providers/bungee.mjs +0 -29
  201. package/src/data/providers/celestia-da.mjs +0 -38
  202. package/src/data/providers/changenow.mjs +0 -135
  203. package/src/data/providers/compound.mjs +0 -32
  204. package/src/data/providers/connext.mjs +0 -28
  205. package/src/data/providers/convex.mjs +0 -30
  206. package/src/data/providers/cow-protocol.mjs +0 -110
  207. package/src/data/providers/cowswap.mjs +0 -415
  208. package/src/data/providers/curve.mjs +0 -201
  209. package/src/data/providers/das-assets.mjs +0 -59
  210. package/src/data/providers/debridge.mjs +0 -109
  211. package/src/data/providers/defillama.mjs +0 -88
  212. package/src/data/providers/dexscreener.mjs +0 -43
  213. package/src/data/providers/drift.mjs +0 -32
  214. package/src/data/providers/dydx.mjs +0 -41
  215. package/src/data/providers/evm-rpc.mjs +0 -225
  216. package/src/data/providers/farming.mjs +0 -291
  217. package/src/data/providers/geckoterminal.mjs +0 -34
  218. package/src/data/providers/gmx.mjs +0 -496
  219. package/src/data/providers/hiro-stacks.mjs +0 -150
  220. package/src/data/providers/hl-assets.mjs +0 -165
  221. package/src/data/providers/hl-info.mjs +0 -108
  222. package/src/data/providers/hl-markets.mjs +0 -210
  223. package/src/data/providers/hl-outcome.mjs +0 -61
  224. package/src/data/providers/hl-perps.mjs +0 -419
  225. package/src/data/providers/hl-staking.mjs +0 -353
  226. package/src/data/providers/hl-ws.mjs +0 -119
  227. package/src/data/providers/hyperevm-dex.mjs +0 -49
  228. package/src/data/providers/jito-mev.mjs +0 -117
  229. package/src/data/providers/jupiter-venues.mjs +0 -119
  230. package/src/data/providers/jupiter.mjs +0 -315
  231. package/src/data/providers/kamino-strategies.mjs +0 -143
  232. package/src/data/providers/l2beat-tvl.mjs +0 -42
  233. package/src/data/providers/lifi.mjs +0 -166
  234. package/src/data/providers/liquid-esplora.mjs +0 -152
  235. package/src/data/providers/magiceden-ordinals.mjs +0 -141
  236. package/src/data/providers/magiceden-sol.mjs +0 -406
  237. package/src/data/providers/mempool-lightning.mjs +0 -144
  238. package/src/data/providers/mempool-mining.mjs +0 -142
  239. package/src/data/providers/meteora-dlmm.mjs +0 -168
  240. package/src/data/providers/morpho.mjs +0 -177
  241. package/src/data/providers/nft-gallery.mjs +0 -163
  242. package/src/data/providers/nft-portfolio.mjs +0 -494
  243. package/src/data/providers/odos.mjs +0 -156
  244. package/src/data/providers/ondo.mjs +0 -31
  245. package/src/data/providers/oneinch.mjs +0 -174
  246. package/src/data/providers/opensea-multichain.mjs +0 -136
  247. package/src/data/providers/opensea-nft.mjs +0 -371
  248. package/src/data/providers/orca.mjs +0 -29
  249. package/src/data/providers/ordinals-runes.mjs +0 -180
  250. package/src/data/providers/pancakeswap.mjs +0 -28
  251. package/src/data/providers/paraswap.mjs +0 -125
  252. package/src/data/providers/pendle.mjs +0 -188
  253. package/src/data/providers/poly-clob.mjs +0 -283
  254. package/src/data/providers/poly-public.mjs +0 -96
  255. package/src/data/providers/poly-ws.mjs +0 -103
  256. package/src/data/providers/polygon-staking.mjs +0 -227
  257. package/src/data/providers/portfolio-history.mjs +0 -394
  258. package/src/data/providers/portfolio.mjs +0 -600
  259. package/src/data/providers/pyth-price-feeds.mjs +0 -172
  260. package/src/data/providers/raydium.mjs +0 -35
  261. package/src/data/providers/relayscan-mev.mjs +0 -72
  262. package/src/data/providers/rfq.mjs +0 -15
  263. package/src/data/providers/rh-agent.mjs +0 -59
  264. package/src/data/providers/sanctum-lst.mjs +0 -180
  265. package/src/data/providers/satflow.mjs +0 -341
  266. package/src/data/providers/signed-material-guard.mjs +0 -108
  267. package/src/data/providers/solana-rpc.mjs +0 -197
  268. package/src/data/providers/solend-lending.mjs +0 -166
  269. package/src/data/providers/spark-lend.mjs +0 -42
  270. package/src/data/providers/squid-router.mjs +0 -29
  271. package/src/data/providers/stargate.mjs +0 -29
  272. package/src/data/providers/sushiswap.mjs +0 -30
  273. package/src/data/providers/symbiotic-restaking.mjs +0 -41
  274. package/src/data/providers/thorchain.mjs +0 -36
  275. package/src/data/providers/traderjoe.mjs +0 -28
  276. package/src/data/providers/twap.mjs +0 -152
  277. package/src/data/providers/uniswap-v3.mjs +0 -457
  278. package/src/data/providers/uniswap-v4.mjs +0 -414
  279. package/src/data/providers/vertex.mjs +0 -41
  280. package/src/data/providers/wallet-watch.mjs +0 -264
  281. package/src/data/providers/wormhole.mjs +0 -28
  282. package/src/data/providers/yearn.mjs +0 -31
  283. package/src/data/providers/zerox.mjs +0 -167
  284. package/src/data/public-api-scan.mjs +0 -61
  285. package/src/data/quote-placeholder.mjs +0 -31
  286. package/src/desk/swap-prepare.mjs +0 -194
  287. package/src/equities/bridge.mjs +0 -388
  288. package/src/equities/fixtures/bridge_routes.json +0 -159
  289. package/src/equities/fixtures/dst_transitions.json +0 -29
  290. package/src/equities/fixtures/equity_dex_pools.json +0 -154
  291. package/src/equities/fixtures/hip3_l2books.json +0 -2711
  292. package/src/equities/fixtures/nyse_holidays.json +0 -1
  293. package/src/equities/fixtures/oracles.json +0 -100
  294. package/src/equities/fixtures/rh_pool_state.json +0 -244
  295. package/src/equities/fixtures/solana_xstocks.json +0 -704
  296. package/src/equities/fixtures/ton_xstocks.json +0 -35
  297. package/src/equities/fixtures/universe.json +0 -411
  298. package/src/equities/fixtures/venues.json +0 -3542
  299. package/src/equities/fixtures.mjs +0 -405
  300. package/src/equities/funding.mjs +0 -142
  301. package/src/equities/index.mjs +0 -166
  302. package/src/equities/liveness.mjs +0 -148
  303. package/src/equities/marketHours.mjs +0 -249
  304. package/src/equities/normalize.mjs +0 -295
  305. package/src/equities/num.mjs +0 -146
  306. package/src/equities/prepare.mjs +0 -95
  307. package/src/equities/rank.mjs +0 -260
  308. package/src/equities/sourceNum.mjs +0 -69
  309. package/src/equities/types.mjs +0 -220
  310. package/src/equities/venues/arcus-perp.mjs +0 -84
  311. package/src/equities/venues/arcus-spot.mjs +0 -105
  312. package/src/equities/venues/hyperliquid-hip3.mjs +0 -224
  313. package/src/equities/venues/rh-uniswap.mjs +0 -216
  314. package/src/equities/venues/solana-xstocks.mjs +0 -139
  315. package/src/equities/venues/ton-stonfi.mjs +0 -139
  316. package/src/exact-integer.mjs +0 -72
  317. package/src/exec-policy.mjs +0 -419
  318. package/src/flags.mjs +0 -15
  319. package/src/fresh-window.mjs +0 -76
  320. package/src/gmx-attestation.mjs +0 -176
  321. package/src/index.mjs +0 -107
  322. package/src/licensing/locals-only.mjs +0 -25
  323. package/src/nft-gas-war-guard.mjs +0 -139
  324. package/src/onboarding/agent-keys.mjs +0 -161
  325. package/src/onboarding/harness-configs.mjs +0 -102
  326. package/src/onboarding/index.mjs +0 -18
  327. package/src/onboarding/tiers.mjs +0 -139
  328. package/src/oracle-env.mjs +0 -55
  329. package/src/package-manifest.mjs +0 -42
  330. package/src/plugins/agent-plugin-loader.mjs +0 -225
  331. package/src/portfolio-risk.mjs +0 -170
  332. package/src/prepare-envelope.mjs +0 -204
  333. package/src/profile-upgrade.mjs +0 -277
  334. package/src/protocol-execution.mjs +0 -84
  335. package/src/protocol-templates/gate.mjs +0 -179
  336. package/src/protocol-templates/prepare-deploy.mjs +0 -81
  337. package/src/public-api/agent-grants.mjs +0 -57
  338. package/src/public-api/buzz-integration.mjs +0 -267
  339. package/src/public-api/connect-agent.mjs +0 -424
  340. package/src/public-api/grants.mjs +0 -142
  341. package/src/public-api/http.mjs +0 -707
  342. package/src/public-api/metering.mjs +0 -111
  343. package/src/public-control/aa-adapter.mjs +0 -402
  344. package/src/public-control/build-registry.mjs +0 -227
  345. package/src/public-control/bundler-client.mjs +0 -357
  346. package/src/public-control/grant-indexer.mjs +0 -296
  347. package/src/public-control/policy-render.mjs +0 -69
  348. package/src/public-control/policy-schema.mjs +0 -322
  349. package/src/public-control/runtime-config.mjs +0 -275
  350. package/src/public-control/session-key-model.mjs +0 -379
  351. package/src/public-control/session-orchestrator.mjs +0 -418
  352. package/src/rfq/intent.mjs +0 -180
  353. package/src/rfq/sources.mjs +0 -181
  354. package/src/route-attestation.mjs +0 -132
  355. package/src/router/best-execution.mjs +0 -326
  356. package/src/router/index.mjs +0 -250
  357. package/src/router/integrator-fee.mjs +0 -135
  358. package/src/router/prepare-bridge.mjs +0 -293
  359. package/src/router/prepare-route.mjs +0 -398
  360. package/src/router/proposal.mjs +0 -311
  361. package/src/router/risk-classifier.mjs +0 -119
  362. package/src/router/route-sources.mjs +0 -364
  363. package/src/scanner/chains.config.mjs +0 -543
  364. package/src/scanner/contract.mjs +0 -270
  365. package/src/scanner/evm-scanner.mjs +0 -394
  366. package/src/scanner/index.mjs +0 -9
  367. package/src/scanner/v2-venue.mjs +0 -351
  368. package/src/scanner/v3-venue.mjs +0 -308
  369. package/src/scopes.mjs +0 -44
  370. package/src/sell-simulation.mjs +0 -167
  371. package/src/signals/engine.mjs +0 -146
  372. package/src/signals/index.mjs +0 -1
  373. package/src/token-transfer-guard.mjs +0 -188
  374. package/src/tui/app.mjs +0 -438
  375. package/src/tui/backend.mjs +0 -215
  376. package/src/tui/format.mjs +0 -272
  377. package/src/tui/gateway-client.mjs +0 -177
  378. package/src/tui/input.mjs +0 -501
  379. package/src/tui/memory.mjs +0 -105
  380. package/src/tui/meta-learn.mjs +0 -85
  381. package/src/tui/renderer.mjs +0 -443
  382. package/src/tui/scheduler.mjs +0 -205
  383. package/src/tui/skills-loader.mjs +0 -140
  384. package/src/tui/standalone-client.mjs +0 -752
  385. package/src/tui/theme.mjs +0 -81
  386. package/src/vault-attestation.mjs +0 -146
  387. package/src/venues.mjs +0 -206
  388. package/src/watch-preferences.mjs +0 -85
  389. /package/{profiles → dist/assets/profiles}/_template/SOUL.md +0 -0
  390. /package/{profiles → dist/assets/profiles}/_template/profile.json +0 -0
  391. /package/{profiles → dist/assets/profiles}/bitcoin-agent/SOUL.md +0 -0
  392. /package/{profiles → dist/assets/profiles}/bitcoin-agent/profile.json +0 -0
  393. /package/{profiles → dist/assets/profiles}/hyperliquid-agent/SOUL.md +0 -0
  394. /package/{profiles → dist/assets/profiles}/hyperliquid-agent/profile.json +0 -0
  395. /package/{profiles → dist/assets/profiles}/oracle/SOUL.md +0 -0
  396. /package/{profiles → dist/assets/profiles}/oracle/profile.json +0 -0
  397. /package/{profiles → dist/assets/profiles}/polymarket-agent/SOUL.md +0 -0
  398. /package/{profiles → dist/assets/profiles}/polymarket-agent/profile.json +0 -0
  399. /package/{profiles → dist/assets/profiles}/profile.schema.json +0 -0
  400. /package/{profiles → dist/assets/profiles}/protocol-builder/SOUL.md +0 -0
  401. /package/{profiles → dist/assets/profiles}/protocol-builder/profile.json +0 -0
  402. /package/{profiles → dist/assets/profiles}/robinhood-agent/SOUL.md +0 -0
  403. /package/{profiles → dist/assets/profiles}/robinhood-agent/profile.json +0 -0
  404. /package/{profiles → dist/assets/profiles}/solana-agent/SOUL.md +0 -0
  405. /package/{profiles → dist/assets/profiles}/solana-agent/profile.json +0 -0
  406. /package/{profiles → dist/assets/profiles}/stable-agent/SOUL.md +0 -0
  407. /package/{profiles → dist/assets/profiles}/stable-agent/profile.json +0 -0
  408. /package/{skills → dist/assets/skills}/balance/SKILL.md +0 -0
  409. /package/{skills → dist/assets/skills}/bitcoin-l1.md +0 -0
  410. /package/{skills → dist/assets/skills}/chain-defi-ecosystem-profiling.md +0 -0
  411. /package/{skills → dist/assets/skills}/evm-contract-research.md +0 -0
  412. /package/{skills → dist/assets/skills}/hyperliquid.md +0 -0
  413. /package/{skills → dist/assets/skills}/multichain-exec-desk.md +0 -0
  414. /package/{skills → dist/assets/skills}/oracle-action-semantics/SKILL.md +0 -0
  415. /package/{skills → dist/assets/skills}/oracle-best-execution/SKILL.md +0 -0
  416. /package/{skills → dist/assets/skills}/oracle-best-execution.md +0 -0
  417. /package/{skills → dist/assets/skills}/oracle-bitcoin/SKILL.md +0 -0
  418. /package/{skills → dist/assets/skills}/oracle-chain-graphs-telegram-cards/SKILL.md +0 -0
  419. /package/{skills → dist/assets/skills}/oracle-chat/SKILL.md +0 -0
  420. /package/{skills → dist/assets/skills}/oracle-chat/chain.SKILL.md +0 -0
  421. /package/{skills → dist/assets/skills}/oracle-chat/setup.SKILL.md +0 -0
  422. /package/{skills → dist/assets/skills}/oracle-circuit-breaker/SKILL.md +0 -0
  423. /package/{skills → dist/assets/skills}/oracle-contract-research/SKILL.md +0 -0
  424. /package/{skills → dist/assets/skills}/oracle-desk/SKILL.md +0 -0
  425. /package/{skills → dist/assets/skills}/oracle-desk.md +0 -0
  426. /package/{skills → dist/assets/skills}/oracle-dex-launch/SKILL.md +0 -0
  427. /package/{skills → dist/assets/skills}/oracle-equities/SKILL.md +0 -0
  428. /package/{skills → dist/assets/skills}/oracle-grants/SKILL.md +0 -0
  429. /package/{skills → dist/assets/skills}/oracle-hypercore-staking/SKILL.md +0 -0
  430. /package/{skills → dist/assets/skills}/oracle-hyperliquid/SKILL.md +0 -0
  431. /package/{skills → dist/assets/skills}/oracle-meme-token-sniper/SKILL.md +0 -0
  432. /package/{skills → dist/assets/skills}/oracle-multichain-nft-launch/SKILL.md +0 -0
  433. /package/{skills → dist/assets/skills}/oracle-multichain-token-launch/SKILL.md +0 -0
  434. /package/{skills → dist/assets/skills}/oracle-nft-gacha-launch/SKILL.md +0 -0
  435. /package/{skills → dist/assets/skills}/oracle-nft-mint-gas-war/SKILL.md +0 -0
  436. /package/{skills → dist/assets/skills}/oracle-polymarket/SKILL.md +0 -0
  437. /package/{skills → dist/assets/skills}/oracle-protocol-builder/SKILL.md +0 -0
  438. /package/{skills → dist/assets/skills}/oracle-protocol-security/SKILL.md +0 -0
  439. /package/{skills → dist/assets/skills}/oracle-public-product/SKILL.md +0 -0
  440. /package/{skills → dist/assets/skills}/oracle-receipts/SKILL.md +0 -0
  441. /package/{skills → dist/assets/skills}/oracle-receipts.md +0 -0
  442. /package/{skills → dist/assets/skills}/oracle-rfq-tokenized-assets/SKILL.md +0 -0
  443. /package/{skills → dist/assets/skills}/oracle-smart-wallet-scanner/SKILL.md +0 -0
  444. /package/{skills → dist/assets/skills}/oracle-solana/SKILL.md +0 -0
  445. /package/{skills → dist/assets/skills}/oracle-solana-nft/SKILL.md +0 -0
  446. /package/{skills → dist/assets/skills}/oracle-token-research/SKILL.md +0 -0
  447. /package/{skills → dist/assets/skills}/solana.md +0 -0
@@ -1,1252 +0,0 @@
1
- #!/usr/bin/env node
2
- // Oracle data MCP — read-only multichain market/discovery plane.
3
- // Loaded by an Oracle/Hermes profile. Never expose signing or broadcast here.
4
- //
5
- // Every tool is a READ or a prepared unsigned action. No key handling, signing,
6
- // or broadcast. Routes to the Oracle data server read/prepare plane (/data/call),
7
- // which is unauthenticated on loopback.
8
- // This is the "scan all public APIs" surface: DeFiLlama protocol TVL, DexScreener
9
- // token/search, LI.FI + Uniswap quotes, multi-chain RPC balances/blocks.
10
- //
11
- // Mirrors the Oracle exec MCP stdio JSON-RPC shape.
12
-
13
- import fs from "node:fs";
14
- import process from "node:process";
15
- import { fileURLToPath } from "node:url";
16
- import { env } from "../src/oracle-env.mjs";
17
- import { listAddresses, lookupAddress, rememberAddress, forgetAddress } from "../src/address-book.mjs";
18
-
19
- const DATA_URL = (env("ORACLE_DATA_URL", "MAD_DESK_URL", "http://127.0.0.1:8787")).replace(/\/$/, "");
20
-
21
- const tools = [
22
- {
23
- name: "data_catalog",
24
- description:
25
- "List every read-plane provider the desk exposes (id, venue, chainIds, ops). Use this to discover what public APIs are available before calling data_call. Read-only.",
26
- inputSchema: { type: "object", properties: {} },
27
- },
28
- {
29
- name: "data_health",
30
- description:
31
- "Health of every read-plane provider (which public APIs are up / configured). Read-only.",
32
- inputSchema: { type: "object", properties: {} },
33
- },
34
- {
35
- name: "data_call",
36
- description:
37
- "Generic escape hatch: call any provider/op from the catalog. provider+op are required; args is a free-form object matching that op. Read-only. Use data_catalog first to see valid provider/op pairs.",
38
- inputSchema: {
39
- type: "object",
40
- required: ["provider", "op"],
41
- properties: {
42
- provider: { type: "string", description: "provider id, e.g. defillama, dexscreener, lifi, evm-rpc" },
43
- op: { type: "string", description: "op name for that provider, e.g. protocols, search, quote" },
44
- args: { type: "object", description: "op arguments (free-form)" },
45
- },
46
- },
47
- },
48
- {
49
- name: "llama_protocols",
50
- description:
51
- "DeFiLlama: full protocol list with TVL, chain(s), category, 1d/7d change. The primary cross-chain protocol scanner. Read-only. Large payload — filter client-side.",
52
- inputSchema: { type: "object", properties: {} },
53
- },
54
- {
55
- name: "llama_prices",
56
- description:
57
- "DeFiLlama current prices for coins keyed 'chain:address' or 'coingecko:id' (comma-joined or array). Read-only.",
58
- inputSchema: {
59
- type: "object",
60
- required: ["coins"],
61
- properties: {
62
- coins: { type: "string", description: "comma-joined coin keys, e.g. 'ethereum:0x...,coingecko:bitcoin'" },
63
- },
64
- },
65
- },
66
- {
67
- name: "dex_search",
68
- description:
69
- "DexScreener search across all chains by symbol/name/address. Returns matching pairs with price, liquidity, volume, chain. Read-only.",
70
- inputSchema: {
71
- type: "object",
72
- required: ["q"],
73
- properties: { q: { type: "string", description: "query: symbol, name, or token address" } },
74
- },
75
- },
76
- {
77
- name: "dex_token",
78
- description:
79
- "DexScreener pairs for a specific token address (any chain). Price, liquidity, volume, pair addresses. Read-only.",
80
- inputSchema: {
81
- type: "object",
82
- required: ["address"],
83
- properties: { address: { type: "string" } },
84
- },
85
- },
86
- {
87
- name: "lifi_quote",
88
- description:
89
- "LI.FI cross-chain / DEX aggregator quote (no key). Best route + expected out for a swap or bridge. Read-only.",
90
- inputSchema: {
91
- type: "object",
92
- required: ["fromChain", "toChain", "fromToken", "toToken", "fromAmount"],
93
- properties: {
94
- fromChain: { type: "number" },
95
- toChain: { type: "number" },
96
- fromToken: { type: "string" },
97
- toToken: { type: "string" },
98
- fromAmount: { type: "string", description: "raw integer amount (wei-scale)" },
99
- fromAddress: { type: "string", description: "optional; defaults to operator wallet" },
100
- },
101
- },
102
- },
103
- {
104
- name: "portfolio_balance",
105
- description:
106
- "Read-only balance aggregation across every configured EVM chain plus Solana, Bitcoin, and Hyperliquid. Reports native assets, supported token/collectible reads, failed or missing providers, unverified assets, timestamps, and known priced value without pretending it is a complete total. Public addresses only; never signs or broadcasts.",
107
- inputSchema: {
108
- type: "object",
109
- properties: {
110
- addresses: {
111
- type: "object",
112
- description: "Optional public wallet addresses by family. Omit configured families to use ORACLE_*_ADDRESS defaults.",
113
- properties: {
114
- evm: { type: "string" },
115
- solana: { type: "string" },
116
- bitcoin: { type: "string" },
117
- hyperliquid: { type: "string" },
118
- },
119
- },
120
- evmChainIds: {
121
- type: "array",
122
- items: { type: "number" },
123
- description: "Optional EVM chain subset. Default is every configured EVM chain.",
124
- },
125
- includeTokens: { type: "boolean", description: "Include supported token reads. Default true." },
126
- includeCollectibles: { type: "boolean", description: "Include supported collectible reads. Default true." },
127
- includePrices: { type: "boolean", description: "Fetch current DeFiLlama native prices. Default true." },
128
- },
129
- },
130
- },
131
- {
132
- name: "portfolio_snapshot",
133
- description:
134
- "Query the current multichain balance and NFT inventory, then append one compact profile-local observation for historical tracking. Stores public-address fingerprint, coverage, breakdown, and known priced value only; no keys, signatures, executable payloads, or raw NFT metadata. Returns the live balance, NFT result, and recorded snapshot.",
135
- inputSchema: {
136
- type: "object",
137
- properties: {
138
- addresses: {
139
- type: "object",
140
- properties: {
141
- evm: { type: "string" },
142
- solana: { type: "string" },
143
- bitcoin: { type: "string" },
144
- hyperliquid: { type: "string" },
145
- },
146
- },
147
- evmChainIds: { type: "array", items: { type: "number" } },
148
- includeTokens: { type: "boolean" },
149
- includeCollectibles: { type: "boolean" },
150
- includePrices: { type: "boolean" },
151
- includeNfts: { type: "boolean", description: "Include provider-estimated NFT value. Default true." },
152
- },
153
- },
154
- },
155
- {
156
- name: "portfolio_history",
157
- description:
158
- "Read profile-local portfolio observations in a time range. Unknown or unavailable values remain null and are never converted to zero. Defaults to the configured public-address portfolio fingerprint.",
159
- inputSchema: {
160
- type: "object",
161
- properties: {
162
- addresses: {
163
- type: "object",
164
- properties: {
165
- evm: { type: "string" },
166
- solana: { type: "string" },
167
- bitcoin: { type: "string" },
168
- hyperliquid: { type: "string" },
169
- },
170
- },
171
- portfolioId: { type: "string" },
172
- allPortfolios: { type: "boolean", description: "Return observations for every public-address fingerprint in this profile." },
173
- since: { type: "string", description: "Inclusive ISO 8601 lower bound." },
174
- until: { type: "string", description: "Inclusive ISO 8601 upper bound." },
175
- limit: { type: "number", description: "1-1000, default 100." },
176
- order: { type: "string", enum: ["asc", "desc"] },
177
- },
178
- },
179
- },
180
- {
181
- name: "portfolio_value_graph",
182
- description:
183
- "Render a static SVG line graph from profile-local portfolio snapshots. Plots known priced value only, labels incomplete coverage, includes provider-estimated NFT values when recorded, and omits unavailable observations instead of plotting fake zeroes.",
184
- inputSchema: {
185
- type: "object",
186
- properties: {
187
- addresses: {
188
- type: "object",
189
- properties: {
190
- evm: { type: "string" },
191
- solana: { type: "string" },
192
- bitcoin: { type: "string" },
193
- hyperliquid: { type: "string" },
194
- },
195
- },
196
- portfolioId: { type: "string" },
197
- allPortfolios: { type: "boolean" },
198
- since: { type: "string" },
199
- until: { type: "string" },
200
- limit: { type: "number", description: "Historical observations to consider, max 1000." },
201
- maxPoints: { type: "number", description: "Rendered point cap, 2-500, default 200." },
202
- },
203
- },
204
- },
205
- {
206
- name: "nft_inventory",
207
- description:
208
- "Read all discoverable NFTs for configured EVM, Solana, and Bitcoin addresses. Returns normalized assets, image URLs, estimated values, per-chain partial failures, flagged/NSFW items separated from visible items, listing coverage, and explicit unsupported chains. Read-only.",
209
- inputSchema: {
210
- type: "object",
211
- properties: {
212
- addresses: {
213
- type: "object",
214
- properties: {
215
- evm: { type: "string" },
216
- solana: { type: "string" },
217
- bitcoin: { type: "string" },
218
- },
219
- },
220
- chains: { type: "array", items: { type: "string" }, description: "Optional chain slug subset." },
221
- pageSize: { type: "number", description: "OpenSea items per page, max 200." },
222
- maxPages: { type: "number", description: "Maximum pages per chain, max 25." },
223
- bitcoinLimit: { type: "number" },
224
- includePnl: { type: "boolean", description: "Include OpenSea-indexed account PnL when available. Default true." },
225
- costBasis: { type: "object", description: "Optional user-supplied assetKey -> {costUsd,feesUsd,acquiredAt,source}. Missing basis stays unavailable, never zero." },
226
- },
227
- },
228
- },
229
- {
230
- name: "nft_gallery",
231
- description:
232
- "Generate one static NFT contact-sheet image page from wallet inventory or supplied normalized items. External metadata is never rendered as HTML; only allowlisted JPEG/PNG/WebP bytes are embedded and unsafe or missing media becomes a placeholder.",
233
- inputSchema: {
234
- type: "object",
235
- properties: {
236
- addresses: {
237
- type: "object",
238
- properties: { evm: { type: "string" }, solana: { type: "string" }, bitcoin: { type: "string" } },
239
- },
240
- chains: { type: "array", items: { type: "string" } },
241
- items: { type: "array", items: { type: "object" }, description: "Optional normalized inventory items. Omit to scan configured wallets." },
242
- page: { type: "number", description: "1-based gallery page." },
243
- pageSize: { type: "number", description: "1-12 items per page." },
244
- },
245
- },
246
- },
247
- {
248
- name: "nft_pnl",
249
- description:
250
- "NFT PnL with explicit methodology. Returns OpenSea-indexed account-level PnL where available plus per-item unrealized estimates only when both user-supplied acquisition cost and provider estimated current value exist. Missing history is unavailable, never zero.",
251
- inputSchema: {
252
- type: "object",
253
- properties: {
254
- addresses: {
255
- type: "object",
256
- properties: { evm: { type: "string" }, solana: { type: "string" }, bitcoin: { type: "string" } },
257
- },
258
- chains: { type: "array", items: { type: "string" } },
259
- costBasis: { type: "object" },
260
- },
261
- },
262
- },
263
- {
264
- name: "nft_prepare_list",
265
- description:
266
- "Prepare an NFT listing for OpenSea EVM, Magic Eden Solana, or Satflow Bitcoin after explicit user review. Requires userConfirmed=true plus asset, marketplace, price, currency where applicable, and future expiry. Magic Eden Solana also requires confirmation exactly: list <tokenMint> on magiceden-sol for <priceSol> SOL until <expiry>. Returns approval/signing actions, an unsigned Solana transaction, or an unsigned Bitcoin PSBT. Never signs, submits, or broadcasts.",
267
- inputSchema: {
268
- type: "object",
269
- required: ["marketplace", "userConfirmed"],
270
- properties: {
271
- marketplace: { type: "string", enum: ["opensea", "magiceden", "magiceden-sol", "satflow"] },
272
- userConfirmed: { type: "boolean" },
273
- chain: { type: "string" },
274
- seller: { type: "string" },
275
- contract: { type: "string" },
276
- tokenId: { type: "string" },
277
- quantity: { type: "number" },
278
- priceAmount: { type: "string" },
279
- currency: { type: "string" },
280
- endTime: { type: "string" },
281
- useCreatorFee: { type: "boolean" },
282
- taker: { type: "string" },
283
- tokenMint: { type: "string" },
284
- tokenATA: { type: "string" },
285
- auctionHouse: { type: "string" },
286
- priceSol: { type: "string" },
287
- expiry: { description: "Future ISO 8601 timestamp or Unix seconds. Magic Eden Solana listings require finite future expiry; no-expiry is refused." },
288
- confirmation: { type: "string", description: "Required for Magic Eden Solana listings. Exact phrase: list <tokenMint> on magiceden-sol for <priceSol> SOL until <expiry>." },
289
- inscriptionId: { type: "string" },
290
- runesOutput: { type: "string" },
291
- ordAddress: { type: "string" },
292
- receiveAddress: { type: "string" },
293
- priceSats: { type: "string" },
294
- tapKey: { type: "string" },
295
- collectionSlug: { type: "string" },
296
- },
297
- },
298
- },
299
- {
300
- name: "rpc_balance",
301
- description:
302
- "Native token balance of an address on a chain via public RPC. Read-only. Omit address to read the operator wallet.",
303
- inputSchema: {
304
- type: "object",
305
- required: ["chainId"],
306
- properties: {
307
- chainId: { type: "number" },
308
- address: { type: "string" },
309
- },
310
- },
311
- },
312
- {
313
- name: "rpc_block",
314
- description: "Latest block number on a chain via public RPC. Read-only.",
315
- inputSchema: {
316
- type: "object",
317
- required: ["chainId"],
318
- properties: { chainId: { type: "number" } },
319
- },
320
- },
321
- {
322
- name: "solana_balance",
323
- description: "Solana mainnet SOL balance for a base58 public key. Read-only; no signing or broadcast.",
324
- inputSchema: {
325
- type: "object",
326
- required: ["address"],
327
- properties: { address: { type: "string" }, commitment: { type: "string" } },
328
- },
329
- },
330
- {
331
- name: "solana_token_accounts",
332
- description: "Solana SPL token accounts for an owner, optionally filtered by mint. Read-only.",
333
- inputSchema: {
334
- type: "object",
335
- required: ["owner"],
336
- properties: { owner: { type: "string" }, mint: { type: "string" }, commitment: { type: "string" } },
337
- },
338
- },
339
- {
340
- name: "solana_simulate",
341
- description: "Simulate a base64 Solana transaction through RPC. Read-only; never signs or broadcasts.",
342
- inputSchema: {
343
- type: "object",
344
- required: ["transaction"],
345
- properties: { transaction: { type: "string" }, sigVerify: { type: "boolean" }, replaceRecentBlockhash: { type: "boolean" } },
346
- },
347
- },
348
- {
349
- name: "jupiter_venues",
350
- description: "Jupiter Solana venue map, optionally verified on-chain against executable BPF loader ownership. Read-only.",
351
- inputSchema: {
352
- type: "object",
353
- properties: { verify: { type: "boolean" }, rpc: { type: "string" } },
354
- },
355
- },
356
- {
357
- name: "jupiter_quote",
358
- description: "Jupiter Solana Swap API quote with a hard <=100 bps slippage cap. Read-only.",
359
- inputSchema: {
360
- type: "object",
361
- required: ["inputMint", "outputMint", "amount"],
362
- properties: { inputMint: { type: "string" }, outputMint: { type: "string" }, amount: { type: "string" }, slippageBps: { type: "number" } },
363
- },
364
- },
365
- {
366
- name: "jupiter_prepare",
367
- description: "Prepare an unsigned Jupiter swap transaction for the user's Solana wallet to sign. No local signer, no broadcast.",
368
- inputSchema: {
369
- type: "object",
370
- required: ["userPublicKey"],
371
- properties: { userPublicKey: { type: "string" }, quoteResponse: { type: "object" }, inputMint: { type: "string" }, outputMint: { type: "string" }, amount: { type: "string" }, slippageBps: { type: "number" } },
372
- },
373
- },
374
- {
375
- name: "btc_health",
376
- description: "Bitcoin L1 Esplora health + tip height (mempool.space by default). No Core RPC, no keys. Read-only.",
377
- inputSchema: { type: "object", properties: {} },
378
- },
379
- {
380
- name: "btc_fees",
381
- description: "Recommended Bitcoin fee rates (sats/vB). Read-only.",
382
- inputSchema: { type: "object", properties: {} },
383
- },
384
- {
385
- name: "btc_balance",
386
- description: "Bitcoin address balance in sats via Esplora. Read-only.",
387
- inputSchema: {
388
- type: "object",
389
- required: ["address"],
390
- properties: { address: { type: "string", description: "bc1…/1…/3… address" } },
391
- },
392
- },
393
- {
394
- name: "btc_utxos",
395
- description: "UTXOs for a Bitcoin address via Esplora. Read-only.",
396
- inputSchema: {
397
- type: "object",
398
- required: ["address"],
399
- properties: { address: { type: "string" } },
400
- },
401
- },
402
- {
403
- name: "btc_tx",
404
- description: "Lookup a Bitcoin transaction by txid via Esplora. Read-only.",
405
- inputSchema: {
406
- type: "object",
407
- required: ["txid"],
408
- properties: { txid: { type: "string" } },
409
- },
410
- },
411
- {
412
- name: "btc_meta_health",
413
- description:
414
- "Ordinals/runes indexer health. Reports whether BTC_META_API_URL / vendor API keys are configured. Read-only.",
415
- inputSchema: { type: "object", properties: {} },
416
- },
417
- {
418
- name: "btc_rune_balance",
419
- description:
420
- "Rune balances for a Bitcoin address (requires configured indexer + optional API key). Read-only.",
421
- inputSchema: {
422
- type: "object",
423
- required: ["address"],
424
- properties: { address: { type: "string" } },
425
- },
426
- },
427
- {
428
- name: "btc_inscriptions",
429
- description:
430
- "Inscriptions controlled by an address. REQUIRES a keyed indexer (ordinals.com has no address index). Returns unknownNotEmpty:true when unconfigured — that means UNKNOWN, never 'wallet holds none'. Protect these UTXOs from fee spends.",
431
- inputSchema: {
432
- type: "object",
433
- required: ["address"],
434
- properties: { address: { type: "string" }, limit: { type: "number" } },
435
- },
436
- },
437
- {
438
- name: "btc_inscription_info",
439
- description:
440
- "Inscription metadata by inscription id (content type/length, height, sat, fee). KEYLESS via ordinals.com recursive. Read-only.",
441
- inputSchema: {
442
- type: "object",
443
- required: ["inscriptionId"],
444
- properties: {
445
- inscriptionId: { type: "string", description: "<64-hex-txid>i<index>" },
446
- },
447
- },
448
- },
449
- {
450
- name: "btc_inscription_children",
451
- description:
452
- "Child inscriptions of a parent (collections). KEYLESS via ordinals.com recursive. Read-only.",
453
- inputSchema: {
454
- type: "object",
455
- required: ["inscriptionId"],
456
- properties: {
457
- inscriptionId: { type: "string", description: "<64-hex-txid>i<index>" },
458
- page: { type: "number" },
459
- },
460
- },
461
- },
462
- {
463
- name: "btc_ord_block_info",
464
- description:
465
- "Ord node block info / indexer tip. KEYLESS. Use to confirm the ordinals indexer is at the same tip as Esplora before trusting metaprotocol reads.",
466
- inputSchema: {
467
- type: "object",
468
- properties: { height: { type: "number", description: "omit for current tip" } },
469
- },
470
- },
471
- {
472
- name: "satflow_health",
473
- description:
474
- "Satflow marketplace health (primary BTC ordinals/runes market after Magic Eden BTC sunset). Needs SATFLOW_API_KEY. Read-only.",
475
- inputSchema: { type: "object", properties: {} },
476
- },
477
- {
478
- name: "satflow_floors",
479
- description: "Satflow collection floor prices. type=ordinals|runes. Read-only.",
480
- inputSchema: {
481
- type: "object",
482
- properties: {
483
- type: { type: "string", description: "ordinals or runes" },
484
- ids: { type: "string", description: "optional comma-separated collection ids" },
485
- },
486
- },
487
- },
488
- {
489
- name: "satflow_wallet",
490
- description: "Satflow wallet contents (ordinals/runes) for an address. Read-only.",
491
- inputSchema: {
492
- type: "object",
493
- required: ["address"],
494
- properties: { address: { type: "string" }, type: { type: "string" }, limit: { type: "number" } },
495
- },
496
- },
497
- {
498
- name: "satflow_item",
499
- description: "Satflow item detail for an inscription id (listing + bids + meta). Read-only.",
500
- inputSchema: {
501
- type: "object",
502
- required: ["inscriptionId"],
503
- properties: { inscriptionId: { type: "string" } },
504
- },
505
- },
506
- {
507
- name: "satflow_floor_listings",
508
- description: "Satflow floor listings for collection id(s). Read-only.",
509
- inputSchema: {
510
- type: "object",
511
- required: ["collectionIds"],
512
- properties: { collectionIds: { type: "string" }, limit: { type: "number" } },
513
- },
514
- },
515
- {
516
- name: "scanner_coverage",
517
- description:
518
- "Which chains the on-chain scanner supports and which capabilities each one has " +
519
- "(blockNumber, nativeBalance, tokenBalance, resolveToken, resolvePools, scanBlocks, " +
520
- "scoreRisk, quote, sellSimulation, prepareUnsignedTx). Read-only.",
521
- inputSchema: { type: "object", properties: {} },
522
- },
523
- {
524
- name: "scan_token",
525
- description:
526
- "Resolve a token on an EVM chain: metadata, its pools, and a risk score. Works on " +
527
- "chains no indexer covers because it reads the chain directly. Read-only.",
528
- inputSchema: {
529
- type: "object",
530
- properties: {
531
- chainId: { type: "number", description: "EVM chain id, e.g. 4663 for Robinhood Chain" },
532
- token: { type: "string", description: "token contract address" },
533
- },
534
- required: ["chainId", "token"],
535
- },
536
- },
537
- {
538
- name: "wallet_balances",
539
- description:
540
- "Native balance for an address on an EVM chain, plus one token balance when a token " +
541
- "address is supplied. Read-only; never signs.",
542
- inputSchema: {
543
- type: "object",
544
- properties: {
545
- chainId: { type: "number" },
546
- address: { type: "string", description: "wallet address to inspect" },
547
- token: { type: "string", description: "optional token contract for a token balance" },
548
- },
549
- required: ["chainId", "address"],
550
- },
551
- },
552
- {
553
- name: "address_book_remember",
554
- description:
555
- "Remember a wallet address with a label. Call this whenever someone states their address " +
556
- "or an agent/counterparty wallet is discovered, so it survives the conversation. " +
557
- "Stores labels only — never private keys, seeds, or passphrases.",
558
- inputSchema: {
559
- type: "object",
560
- required: ["address", "label"],
561
- properties: {
562
- address: { type: "string", description: "0x address" },
563
- label: { type: "string", description: "short name, e.g. research-agent" },
564
- who: { type: "string", description: "person or entity the wallet belongs to" },
565
- role: { type: "string", description: "agent | owner | person | counterparty | venue" },
566
- chainIds: { type: "array", items: { type: "number" } },
567
- notes: { type: "string" },
568
- },
569
- },
570
- },
571
- {
572
- name: "address_book_list",
573
- description:
574
- "List remembered wallets (owner, agent, people, counterparties). Read-only. " +
575
- "Check this before sending or bridging to a person.",
576
- inputSchema: {
577
- type: "object",
578
- properties: {
579
- q: { type: "string", description: "search across label, who, address, notes" },
580
- role: { type: "string" },
581
- who: { type: "string" },
582
- },
583
- },
584
- },
585
- {
586
- name: "address_book_lookup",
587
- description: "Look up one 0x address in the durable address book. Read-only.",
588
- inputSchema: {
589
- type: "object",
590
- required: ["address"],
591
- properties: { address: { type: "string" } },
592
- },
593
- },
594
- {
595
- name: "address_book_forget",
596
- description: "Remove a remembered address, optionally only one label for it.",
597
- inputSchema: {
598
- type: "object",
599
- required: ["address"],
600
- properties: { address: { type: "string" }, label: { type: "string" } },
601
- },
602
- },
603
- {
604
- name: "rfq_quote",
605
- description:
606
- "Create a cross-chain RFQ intent and fan it out to reviewed solver or venue sources. " +
607
- "Returns firm quote objects with intentHash, firmQuoteHash, expiry, min receive, " +
608
- "and unsigned executable artifacts. Never signs or broadcasts.",
609
- inputSchema: {
610
- type: "object",
611
- required: ["fromChainId", "toChainId", "sellToken", "buyToken", "sellAmount", "receiver", "deadlineMs"],
612
- properties: {
613
- fromChainId: { type: "number" },
614
- toChainId: { type: "number" },
615
- sellToken: { type: "string" },
616
- buyToken: { type: "string" },
617
- sellAmount: { type: "string" },
618
- receiver: { type: "string" },
619
- deadlineMs: { type: "number" },
620
- minBuyAmount: { type: "string" },
621
- allowedSources: { type: "array", items: { type: "string" } },
622
- allowedRouters: { type: "array", items: { type: "string" } },
623
- slippageBps: { type: "number" },
624
- decimalsIn: { type: "number" },
625
- decimalsOut: { type: "number" },
626
- },
627
- },
628
- },
629
- {
630
- name: "best_swap_route",
631
- description:
632
- "Compare swap routes across every available aggregator and rank by NET output " +
633
- "(after gas and fees), not headline quote. Returns the winner plus all " +
634
- "runners-up so the ranking can be checked rather than trusted.",
635
- inputSchema: {
636
- type: "object",
637
- properties: {
638
- chainId: { type: "number", description: "EVM chain id, e.g. 8453 for Base" },
639
- tokenIn: { type: "string", description: "sell token address" },
640
- tokenOut: { type: "string", description: "buy token address" },
641
- amountIn: { type: "string", description: "raw units of tokenIn (wei-scale)" },
642
- taker: { type: "string", description: "address used for quoting only; nothing is signed" },
643
- decimalsIn: { type: "number" },
644
- decimalsOut: { type: "number" },
645
- },
646
- required: ["chainId", "tokenIn", "tokenOut", "amountIn"],
647
- },
648
- },
649
- {
650
- name: "best_bridge_route",
651
- description:
652
- "Compare cross-chain bridge routes and rank by NET output. Also reports each " +
653
- "route's expected duration, which is NOT folded into the score -- a route that " +
654
- "saves $2 but takes 30 minutes is a trade-off for the caller to make.",
655
- inputSchema: {
656
- type: "object",
657
- properties: {
658
- fromChainId: { type: "number" },
659
- toChainId: { type: "number" },
660
- tokenIn: { type: "string", description: "token on the origin chain" },
661
- tokenOut: { type: "string", description: "token on the destination chain" },
662
- amountIn: { type: "string", description: "raw units of tokenIn" },
663
- taker: { type: "string", description: "address used for quoting only" },
664
- decimalsOut: { type: "number" },
665
- },
666
- required: ["fromChainId", "toChainId", "tokenIn", "tokenOut", "amountIn"],
667
- },
668
- },
669
- {
670
- name: "prepare_best_route",
671
- description:
672
- "Compare routes, then build the SIGNABLE artifact for the winner. Returns an " +
673
- "unsigned transaction (LI.FI/ParaSwap/0x) or EIP-712 typed data for an " +
674
- "off-chain order (CoW) -- the artifactKind field says which, and they require " +
675
- "different wallet actions. Re-quotes before preparing and reports drift " +
676
- "against the comparison. Never signs or broadcasts.",
677
- inputSchema: {
678
- type: "object",
679
- properties: {
680
- chainId: { type: "number" },
681
- tokenIn: { type: "string" },
682
- tokenOut: { type: "string" },
683
- amountIn: { type: "string", description: "raw units of tokenIn" },
684
- taker: {
685
- type: "string",
686
- description:
687
- "the REAL wallet that will sign. Placeholder/burn addresses are rejected: " +
688
- "quoting is anonymous, preparing is not.",
689
- },
690
- decimalsIn: { type: "number" },
691
- decimalsOut: { type: "number" },
692
- source: {
693
- type: "string",
694
- description: "force a specific source instead of the winner (flagged in the result)",
695
- },
696
- driftToleranceBps: { type: "number", description: "default 100" },
697
- },
698
- required: ["chainId", "tokenIn", "tokenOut", "amountIn", "taker"],
699
- },
700
- },
701
- {
702
- name: "prepare_best_bridge_route",
703
- description:
704
- "Compare cross-chain bridge routes, then build the signable transaction " +
705
- "sequence for the winner. Returns a LIST of unsigned transactions -- some " +
706
- "routes need an approval and a deposit signed in order, and signing only the " +
707
- "first leaves funds approved but not bridged. Reports the destination chain " +
708
- "and expected credit time. Bridging is not atomic. Never signs or broadcasts.",
709
- inputSchema: {
710
- type: "object",
711
- properties: {
712
- fromChainId: { type: "number" },
713
- toChainId: { type: "number" },
714
- tokenIn: { type: "string", description: "token on the origin chain" },
715
- tokenOut: { type: "string", description: "token on the destination chain" },
716
- amountIn: { type: "string", description: "raw units of tokenIn" },
717
- taker: { type: "string", description: "the REAL wallet that will sign; placeholders rejected" },
718
- source: { type: "string", description: "force a source instead of the winner" },
719
- driftToleranceBps: { type: "number", description: "default 100" },
720
- },
721
- required: ["fromChainId", "toChainId", "tokenIn", "tokenOut", "amountIn", "taker"],
722
- },
723
- },
724
- {
725
- name: "equity_venues",
726
- description:
727
- "Inventory of on-chain equities venues (HIP-3 builder DEXes, Arcus perps/spot on " +
728
- "Robinhood 4663, RH Uniswap prepare tier, Solana xStocks, TON ston.fi) with tiers " +
729
- "and a liveness snapshot. Offline fixtures by default. Read-only / prepare-only.",
730
- inputSchema: { type: "object", properties: {} },
731
- },
732
- {
733
- name: "equity_quote",
734
- description:
735
- "Cross-chain best-execution comparison for a tokenized equity ticker (NVDA, SPY, " +
736
- "TSLA, ...). Ranks HIP-3, Arcus, RH Uniswap, Solana xStocks, and TON. Returns " +
737
- "winner + runners-up + bestPreparable (only rh_uniswap is preparable in v1). " +
738
- "rankedOn is usually gross because fees/gas are unmeasured - say so. Never signs.",
739
- inputSchema: {
740
- type: "object",
741
- required: ["ticker"],
742
- properties: {
743
- ticker: { type: "string", description: "equity ticker, e.g. NVDA, SPY, TSLA" },
744
- sizeUsd: { type: "string", description: "optional notional USD size for impact model" },
745
- horizonHours: {
746
- type: "number",
747
- description: "optional holding horizon; enables funding-adjusted spot-vs-perp ranking",
748
- },
749
- },
750
- },
751
- },
752
- {
753
- name: "equity_prepare",
754
- description:
755
- "Prepare an UNSIGNED Robinhood-chain Uniswap artifact for a tokenized equity. " +
756
- "Only the prepare-tier venue (rh_uniswap / chain 4663). Requires the real wallet " +
757
- "as recipient. requiresWalletSignature=true, backendSigner=false. Never signs or broadcasts.",
758
- inputSchema: {
759
- type: "object",
760
- required: ["ticker", "recipient"],
761
- properties: {
762
- ticker: { type: "string" },
763
- recipient: {
764
- type: "string",
765
- description: "the REAL 0x wallet that will sign; placeholders rejected",
766
- },
767
- sizeUsd: { type: "string", description: "optional notional USD size" },
768
- },
769
- },
770
- },
771
- {
772
- name: "twap_simulate",
773
- description:
774
- "Simulate a TWAP (time-weighted average price) DCA order. Splits a large " +
775
- "order into equal-sized chunks over a configurable window, quotes every chunk " +
776
- "at current prices, and returns the schedule + estimated average price. " +
777
- "Read-only. Never signs or broadcasts. Use before committing to a TWAP.",
778
- inputSchema: {
779
- type: "object",
780
- required: ["chainId", "tokenIn", "tokenOut", "amount", "taker"],
781
- properties: {
782
- chainId: { type: "number" },
783
- tokenIn: { type: "string" },
784
- tokenOut: { type: "string" },
785
- amount: { type: "string", description: "raw base units of tokenIn" },
786
- taker: { type: "string", description: "the REAL wallet that will sign" },
787
- splits: { type: "number", description: "number of chunks (default 10, max 100)" },
788
- windowHours: { type: "number", description: "total window in hours (default 6)" },
789
- slippageBps: { type: "number", description: "slippage cap in bps (default 100)" },
790
- },
791
- },
792
- },
793
- {
794
- name: "bridge_aggregator_scan",
795
- description:
796
- "Scan ALL cross-chain bridge routes: deBridge DLN + LI.FI/Relay + ChangeNOW. " +
797
- "Ranks every route by net output, checks for existing token approvals that " +
798
- "should be revoked before bridging, and returns the winner + runners-up. " +
799
- "Read-only. Never signs or broadcasts. ChangeNOW requires ticker symbols.",
800
- inputSchema: {
801
- type: "object",
802
- required: ["fromChainId", "toChainId", "tokenIn", "tokenOut", "amount", "taker"],
803
- properties: {
804
- fromChainId: { type: "number" },
805
- toChainId: { type: "number" },
806
- tokenIn: { type: "string" },
807
- tokenOut: { type: "string" },
808
- amount: { type: "string", description: "raw base units of tokenIn" },
809
- taker: { type: "string" },
810
- fromSymbol: { type: "string", description: "ticker for ChangeNOW (e.g. ETH, USDC)" },
811
- toSymbol: { type: "string", description: "ticker for ChangeNOW" },
812
- fromDecimals: { type: "number", description: "default 18" },
813
- toDecimals: { type: "number", description: "default 18" },
814
- },
815
- },
816
- },
817
- {
818
- name: "perps_markets",
819
- description:
820
- "Scan perps markets across dYdX (standalone chain), Drift (Solana), and Vertex " +
821
- "(Arbitrum). Returns ticker, oracle price, funding rate, open interest, and " +
822
- "24h volume. Read-only. Never signs.",
823
- inputSchema: {
824
- type: "object",
825
- properties: {
826
- venue: { type: "string", description: "dydx, drift, or vertex (default: all)" },
827
- },
828
- },
829
- },
830
- {
831
- name: "dex_quote",
832
- description:
833
- "Quote a swap across PancakeSwap (BSC+), SushiSwap (30+ chains), or Raydium " +
834
- "(Solana via Jupiter). Specify the DEX and chain. Read-only.",
835
- inputSchema: {
836
- type: "object",
837
- required: ["dex", "chainId", "tokenIn", "tokenOut", "amountIn"],
838
- properties: {
839
- dex: { type: "string", description: "pancakeswap, sushiswap, or raydium" },
840
- chainId: { type: "number" },
841
- tokenIn: { type: "string" },
842
- tokenOut: { type: "string" },
843
- amountIn: { type: "string", description: "raw base units" },
844
- },
845
- },
846
- },
847
- {
848
- name: "options_markets",
849
- description:
850
- "Scan on-chain options markets (calls/puts). Currently Aevo. " +
851
- "Returns instruments, mark prices, funding, open interest. Read-only.",
852
- inputSchema: { type: "object", properties: {} },
853
- },
854
- {
855
- name: "lending_markets",
856
- description:
857
- "Scan lending protocol markets across Compound ($2B+ TVL). " +
858
- "Returns supply/borrow APYs, total supply, collateral factors. Read-only.",
859
- inputSchema: { type: "object", properties: {} },
860
- },
861
- {
862
- name: "yield_vaults",
863
- description:
864
- "Scan yield aggregator vaults across Yearn + Convex. " +
865
- "Returns vault APYs, TVLs, boosted status. Read-only.",
866
- inputSchema: { type: "object", properties: {} },
867
- },
868
- ];
869
-
870
- // Named tool -> { provider, op, argMap(args) }
871
- //
872
- // A default address for read tools (rpc_balance, lifi fromAddress) is read from env
873
- // and is entirely optional. When unset, those tools require an explicit address --
874
- // which is the correct default for a public tool: silently substituting SOMEONE'S
875
- // wallet would both leak whose it is and quote routes against the wrong balances.
876
- const DEFAULT_ADDRESS = String(
877
- process.env.ORACLE_DEFAULT_ADDRESS || process.env.MAD_OPERATOR_ADDRESS || "",
878
- ).trim();
879
- const ROUTES = {
880
- llama_protocols: () => ({ provider: "defillama", op: "protocols", args: {} }),
881
- llama_prices: (a) => ({ provider: "defillama", op: "prices", args: { coins: a.coins } }),
882
- dex_search: (a) => ({ provider: "dexscreener", op: "search", args: { q: a.q } }),
883
- dex_token: (a) => ({ provider: "dexscreener", op: "token", args: { address: a.address } }),
884
- lifi_quote: (a) => ({
885
- provider: "lifi",
886
- op: "quote",
887
- args: {
888
- fromChain: a.fromChain,
889
- toChain: a.toChain,
890
- fromToken: a.fromToken,
891
- toToken: a.toToken,
892
- fromAmount: a.fromAmount,
893
- fromAddress: a.fromAddress || DEFAULT_ADDRESS || undefined,
894
- },
895
- }),
896
- portfolio_balance: (a) => ({
897
- provider: "portfolio",
898
- op: "balances",
899
- args: {
900
- addresses: a.addresses,
901
- evmChainIds: a.evmChainIds,
902
- includeTokens: a.includeTokens,
903
- includeCollectibles: a.includeCollectibles,
904
- includePrices: a.includePrices,
905
- },
906
- }),
907
- portfolio_snapshot: (a) => ({ provider: "portfolio", op: "snapshot", args: a }),
908
- portfolio_history: (a) => ({ provider: "portfolio", op: "history", args: a }),
909
- portfolio_value_graph: (a) => ({ provider: "portfolio", op: "valueGraph", args: a }),
910
- nft_inventory: (a) => ({ provider: "nft-portfolio", op: "inventory", args: a }),
911
- nft_gallery: (a) => ({ provider: "nft-portfolio", op: "gallery", args: a }),
912
- nft_pnl: (a) => ({ provider: "nft-portfolio", op: "pnl", args: a }),
913
- nft_prepare_list: (a) => ({ provider: "nft-portfolio", op: "prepareList", args: a }),
914
- rpc_balance: (a) => {
915
- const addr = a.address || DEFAULT_ADDRESS;
916
- if (!addr) throw new Error("address required (set ORACLE_DEFAULT_ADDRESS to supply a default)");
917
- return { provider: "evm-rpc", op: "getBalance", args: { chainId: a.chainId, address: addr } };
918
- },
919
- rpc_block: (a) => ({ provider: "evm-rpc", op: "blockNumber", args: { chainId: a.chainId } }),
920
- solana_balance: (a) => ({ provider: "solana-rpc", op: "getBalance", args: { address: a.address, commitment: a.commitment } }),
921
- solana_token_accounts: (a) => ({ provider: "solana-rpc", op: "tokenAccounts", args: { owner: a.owner, mint: a.mint, commitment: a.commitment } }),
922
- solana_simulate: (a) => ({ provider: "solana-rpc", op: "simulate", args: { transaction: a.transaction, sigVerify: a.sigVerify, replaceRecentBlockhash: a.replaceRecentBlockhash } }),
923
- jupiter_venues: (a) => ({ provider: "jupiter", op: "venues", args: { verify: a.verify, rpc: a.rpc } }),
924
- jupiter_quote: (a) => ({ provider: "jupiter", op: "quote", args: { inputMint: a.inputMint, outputMint: a.outputMint, amount: a.amount, slippageBps: a.slippageBps } }),
925
- jupiter_prepare: (a) => ({ provider: "jupiter", op: "prepare", args: { userPublicKey: a.userPublicKey, quoteResponse: a.quoteResponse, inputMint: a.inputMint, outputMint: a.outputMint, amount: a.amount, slippageBps: a.slippageBps } }),
926
- btc_health: () => ({ provider: "bitcoin-esplora", op: "health", args: {} }),
927
- btc_fees: () => ({ provider: "bitcoin-esplora", op: "fees", args: {} }),
928
- btc_balance: (a) => ({ provider: "bitcoin-esplora", op: "address", args: { address: a.address } }),
929
- btc_utxos: (a) => ({ provider: "bitcoin-esplora", op: "utxos", args: { address: a.address } }),
930
- btc_tx: (a) => ({ provider: "bitcoin-esplora", op: "tx", args: { txid: a.txid } }),
931
- btc_meta_health: () => ({ provider: "bitcoin-meta", op: "health", args: {} }),
932
- btc_rune_balance: (a) => ({ provider: "bitcoin-meta", op: "runeBalances", args: { address: a.address } }),
933
- btc_inscriptions: (a) => ({
934
- provider: "bitcoin-meta",
935
- op: "inscriptions",
936
- args: { address: a.address, limit: a.limit },
937
- }),
938
- btc_inscription_info: (a) => ({
939
- provider: "bitcoin-meta",
940
- op: "inscriptionInfo",
941
- args: { inscriptionId: a.inscriptionId },
942
- }),
943
- btc_inscription_children: (a) => ({
944
- provider: "bitcoin-meta",
945
- op: "inscriptionChildren",
946
- args: { inscriptionId: a.inscriptionId, page: a.page },
947
- }),
948
- btc_ord_block_info: (a) => ({
949
- provider: "bitcoin-meta",
950
- op: "ordBlockInfo",
951
- args: { height: a.height },
952
- }),
953
- satflow_health: () => ({ provider: "satflow", op: "health", args: {} }),
954
- satflow_floors: (a) => ({
955
- provider: "satflow",
956
- op: "collectionFloors",
957
- args: { type: a.type, ids: a.ids },
958
- }),
959
- satflow_wallet: (a) => ({
960
- provider: "satflow",
961
- op: "walletContents",
962
- args: { address: a.address, type: a.type, limit: a.limit },
963
- }),
964
- satflow_item: (a) => ({
965
- provider: "satflow",
966
- op: "item",
967
- args: { inscriptionId: a.inscriptionId || a.id },
968
- }),
969
- satflow_floor_listings: (a) => ({
970
- provider: "satflow",
971
- op: "floorListings",
972
- args: { collectionIds: a.collectionIds || a.ids, limit: a.limit },
973
- }),
974
- };
975
-
976
- function send(message) {
977
- process.stdout.write(`${JSON.stringify(message)}\n`);
978
- }
979
-
980
- function error(id, code, message) {
981
- send({ jsonrpc: "2.0", id, error: { code, message } });
982
- }
983
-
984
- async function httpJson(url, { method = "GET", body } = {}) {
985
- const res = await fetch(url, {
986
- method,
987
- headers: { "content-type": "application/json" },
988
- body: body ? JSON.stringify(body) : undefined,
989
- });
990
- const data = await res.json().catch(() => ({}));
991
- if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
992
- return data;
993
- }
994
-
995
- async function deskCall(provider, op, args = {}) {
996
- return httpJson(`${DATA_URL}/data/call`, {
997
- method: "POST",
998
- body: { provider, op, args },
999
- });
1000
- }
1001
-
1002
- async function callTool(name, args = {}) {
1003
- if (name === "rfq_quote") {
1004
- const { normalizeRfqIntent } = await import("../src/rfq/intent.mjs");
1005
- const { requestRfqQuotes } = await import("../src/rfq/sources.mjs");
1006
- const intent = normalizeRfqIntent({ ...args, sources: args.sources ?? args.allowedSources });
1007
- return requestRfqQuotes(intent, { decimalsIn: args.decimalsIn, decimalsOut: args.decimalsOut });
1008
- }
1009
- // Routing runs IN-PROCESS rather than through the desk HTTP server. The router
1010
- // fans out to several aggregators itself, so proxying it through /data/call would
1011
- // add a hop and a second timeout budget for no benefit -- and it means routing
1012
- // works without a desk server running at all.
1013
- if (name === "best_swap_route" || name === "best_bridge_route") {
1014
- const { bestSwapRoute, bestBridgeRoute } = await import("../src/router/index.mjs");
1015
- return name === "best_swap_route" ? bestSwapRoute(args) : bestBridgeRoute(args);
1016
- }
1017
- if (name === "prepare_best_route") {
1018
- const { prepareBestRoute } = await import("../src/router/prepare-route.mjs");
1019
- return prepareBestRoute(args);
1020
- }
1021
- if (name === "prepare_best_bridge_route") {
1022
- const { prepareBestBridgeRoute } = await import("../src/router/prepare-bridge.mjs");
1023
- return prepareBestBridgeRoute(args);
1024
- }
1025
- // TWAP (time-weighted average price) DCA simulation.
1026
- if (name === "twap_simulate") {
1027
- const { simulateTwap } = await import("../src/data/providers/twap.mjs");
1028
- return simulateTwap(args);
1029
- }
1030
- // Bridge aggregator: deBridge + Squid + Stargate + THORChain + LI.FI + ChangeNOW + revoke.
1031
- if (name === "bridge_aggregator_scan") {
1032
- const { scanBridgeRoutes } = await import("../src/data/providers/bridge-aggregator.mjs");
1033
- return scanBridgeRoutes(args);
1034
- }
1035
- // Perps markets: dYdX, Drift, Vertex.
1036
- if (name === "perps_markets") {
1037
- const venue = String(args.venue || "all").toLowerCase();
1038
- const results = {};
1039
- if (venue === "all" || venue === "dydx") {
1040
- const { dydxMarkets } = await import("../src/data/providers/dydx.mjs");
1041
- results.dydx = await dydxMarkets();
1042
- }
1043
- if (venue === "all" || venue === "drift") {
1044
- const { driftMarkets } = await import("../src/data/providers/drift.mjs");
1045
- results.drift = await driftMarkets();
1046
- }
1047
- if (venue === "all" || venue === "vertex") {
1048
- const { vertexMarkets } = await import("../src/data/providers/vertex.mjs");
1049
- results.vertex = await vertexMarkets();
1050
- }
1051
- return results;
1052
- }
1053
- // DEX quotes: PancakeSwap, SushiSwap, Raydium.
1054
- if (name === "dex_quote") {
1055
- const dex = String(args.dex || "").toLowerCase();
1056
- if (dex === "pancakeswap") {
1057
- const { pancakeQuote } = await import("../src/data/providers/pancakeswap.mjs");
1058
- return pancakeQuote(args);
1059
- }
1060
- if (dex === "sushiswap") {
1061
- const { sushiQuote } = await import("../src/data/providers/sushiswap.mjs");
1062
- return sushiQuote(args);
1063
- }
1064
- if (dex === "raydium") {
1065
- const { raydiumQuote } = await import("../src/data/providers/raydium.mjs");
1066
- return raydiumQuote(args);
1067
- }
1068
- return { error: `unknown dex: ${dex} — use pancakeswap, sushiswap, or raydium` };
1069
- }
1070
- // Options markets.
1071
- if (name === "options_markets") {
1072
- const { aevoMarkets } = await import("../src/data/providers/aevo.mjs");
1073
- return { aevo: await aevoMarkets() };
1074
- }
1075
- // Lending markets.
1076
- if (name === "lending_markets") {
1077
- const { compoundMarkets } = await import("../src/data/providers/compound.mjs");
1078
- return { compound: await compoundMarkets() };
1079
- }
1080
- // Yield vaults.
1081
- if (name === "yield_vaults") {
1082
- const [{ yearnVaults }, { convexPools }] = await Promise.all([
1083
- import("../src/data/providers/yearn.mjs"),
1084
- import("../src/data/providers/convex.mjs"),
1085
- ]);
1086
- return { yearn: await yearnVaults(), convex: await convexPools() };
1087
- }
1088
- // On-chain equities best-ex (HIP-3 / Arcus / RH / Solana / TON). In-process,
1089
- // fixtures-backed offline, prepare-only. No desk hop required.
1090
- if (name === "equity_venues") {
1091
- const { equityVenues, toJsonSafe } = await import("../src/equities/index.mjs");
1092
- return toJsonSafe(equityVenues());
1093
- }
1094
- if (name === "equity_quote") {
1095
- const { bestEquityRoute, toJsonSafe } = await import("../src/equities/index.mjs");
1096
- return toJsonSafe(
1097
- bestEquityRoute({
1098
- ticker: args.ticker,
1099
- sizeUsd: args.sizeUsd,
1100
- horizonHours: args.horizonHours,
1101
- }),
1102
- );
1103
- }
1104
- if (name === "equity_prepare") {
1105
- const { prepareEquityRoute, toJsonSafe } = await import("../src/equities/index.mjs");
1106
- return toJsonSafe(
1107
- prepareEquityRoute({
1108
- ticker: args.ticker,
1109
- recipient: args.recipient || args.taker,
1110
- sizeUsd: args.sizeUsd,
1111
- }),
1112
- );
1113
- }
1114
- // Smart-wallet / token scanner surface.
1115
- //
1116
- // The scanner engine already covered 11 chains and every capability below, but no
1117
- // MCP tool exposed it -- so an agent could scan nothing on EVM while the code sat
1118
- // there working. Same class of gap as a route source with no preparer: the
1119
- // capability existed, the handle did not.
1120
- //
1121
- // In-process for the same reason routing is: no desk server required.
1122
- // Read-only. scoreRisk and sellSimulation inspect; they never sign.
1123
- if (name === "scanner_coverage") {
1124
- const s = await import("../src/scanner/index.mjs");
1125
- s.registerBuiltinScanners?.();
1126
- return s.scannerCoverage();
1127
- }
1128
- if (name === "scan_token") {
1129
- const s = await import("../src/scanner/index.mjs");
1130
- s.registerBuiltinScanners?.();
1131
- const sc = s.getScanner(Number(args.chainId));
1132
- if (!sc) throw new Error(`no scanner registered for chainId ${args.chainId}`);
1133
- const token = await sc.resolveToken(args.token);
1134
- const pools = sc.supports?.("resolvePools") ? await sc.resolvePools(args.token).catch(() => null) : null;
1135
- const risk = sc.supports?.("scoreRisk") ? await sc.scoreRisk({ token: args.token }).catch(() => null) : null;
1136
- return { chainId: Number(args.chainId), token, pools, risk };
1137
- }
1138
- if (name === "wallet_balances") {
1139
- const s = await import("../src/scanner/index.mjs");
1140
- s.registerBuiltinScanners?.();
1141
- const sc = s.getScanner(Number(args.chainId));
1142
- if (!sc) throw new Error(`no scanner registered for chainId ${args.chainId}`);
1143
- const native = await sc.nativeBalance(args.address);
1144
- const token = args.token ? await sc.tokenBalance(args.address, args.token).catch(() => null) : null;
1145
- return { chainId: Number(args.chainId), address: args.address, native, token };
1146
- }
1147
- if (name === "address_book_remember") {
1148
- return rememberAddress({
1149
- address: args.address, label: args.label, who: args.who,
1150
- role: args.role, chainIds: args.chainIds, notes: args.notes, source: "oracle-data-mcp",
1151
- });
1152
- }
1153
- if (name === "address_book_list") return listAddresses({ q: args.q, role: args.role, who: args.who });
1154
- if (name === "address_book_lookup") return lookupAddress(args.address);
1155
- if (name === "address_book_forget") return forgetAddress(args.address, args.label || null);
1156
- if (name === "data_catalog") return httpJson(`${DATA_URL}/data/catalog`);
1157
- if (name === "data_health") return httpJson(`${DATA_URL}/data/health`);
1158
- if (name === "data_call") {
1159
- if (!args.provider || !args.op) throw new Error("provider and op are required");
1160
- return deskCall(args.provider, args.op, args.args || {});
1161
- }
1162
- const route = ROUTES[name];
1163
- if (route) {
1164
- const { provider, op, args: mapped } = route(args);
1165
- return deskCall(provider, op, mapped);
1166
- }
1167
- throw new Error(`Unknown tool: ${name}`);
1168
- }
1169
-
1170
- async function handle(request) {
1171
- const { id, method, params } = request;
1172
- if (method === "initialize") {
1173
- send({
1174
- jsonrpc: "2.0",
1175
- id,
1176
- result: {
1177
- protocolVersion: params?.protocolVersion || "2024-11-05",
1178
- capabilities: { tools: {} },
1179
- serverInfo: { name: "oracle-data-mcp", version: "0.1.0" },
1180
- },
1181
- });
1182
- return;
1183
- }
1184
- if (method === "notifications/initialized") return;
1185
- if (method === "tools/list") {
1186
- send({ jsonrpc: "2.0", id, result: { tools } });
1187
- return;
1188
- }
1189
- if (method === "tools/call") {
1190
- try {
1191
- const result = await callTool(params?.name, params?.arguments || {});
1192
- if (result?.dataBase64 && /^image\/(?:svg\+xml|png|jpeg|webp)$/.test(String(result.mimeType || ""))) {
1193
- const { dataBase64, ...metadata } = result;
1194
- send({
1195
- jsonrpc: "2.0",
1196
- id,
1197
- result: {
1198
- content: [
1199
- { type: "image", data: dataBase64, mimeType: result.mimeType },
1200
- { type: "text", text: JSON.stringify(metadata, null, 2) },
1201
- ],
1202
- },
1203
- });
1204
- } else {
1205
- send({ jsonrpc: "2.0", id, result: { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] } });
1206
- }
1207
- } catch (err) {
1208
- send({ jsonrpc: "2.0", id, result: { isError: true, content: [{ type: "text", text: err.message }] } });
1209
- }
1210
- return;
1211
- }
1212
- if (id !== undefined) error(id, -32601, `Method not found: ${method}`);
1213
- }
1214
-
1215
- let buffer = "";
1216
-
1217
- function startStdioLoop() {
1218
- process.stdin.setEncoding("utf8");
1219
- process.stdin.on("data", (chunk) => {
1220
- buffer += chunk;
1221
- let index;
1222
- while ((index = buffer.indexOf("\n")) >= 0) {
1223
- const line = buffer.slice(0, index).trim();
1224
- buffer = buffer.slice(index + 1);
1225
- if (!line) continue;
1226
- try {
1227
- void handle(JSON.parse(line));
1228
- } catch (err) {
1229
- error(null, -32700, err.message);
1230
- }
1231
- }
1232
- });
1233
- }
1234
-
1235
- // npm bin wrappers are symlinks. Comparing import.meta.url to argv[1] as strings
1236
- // fails for `npx oracle-data-mcp` / node_modules/.bin/oracle-data-mcp and the
1237
- // process exits without ever starting the stdio loop (Hermes sees Connection closed).
1238
- function isMainModule() {
1239
- const entry = process.argv[1];
1240
- if (!entry) return false;
1241
- try {
1242
- return fs.realpathSync(entry) === fs.realpathSync(fileURLToPath(import.meta.url));
1243
- } catch {
1244
- return false;
1245
- }
1246
- }
1247
-
1248
- if (isMainModule()) {
1249
- startStdioLoop();
1250
- }
1251
-
1252
- export { tools, callTool, handle };