@oracle-agent/oracle 0.11.0 → 0.13.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 (487) hide show
  1. package/LICENSE +115 -201
  2. package/README.md +13 -516
  3. package/bin/oracle.mjs +19 -27
  4. package/package.json +15 -98
  5. package/CONTRIBUTING.md +0 -98
  6. package/SECURITY.md +0 -89
  7. package/SETUP.md +0 -381
  8. package/artifacts/inscription/oracle-was-here-preview.png +0 -0
  9. package/artifacts/inscription/oracle-was-here.svg +0 -1
  10. package/artifacts/specialist-packs/oracle-full-crypto.json +0 -295
  11. package/bin/desk-server.mjs +0 -440
  12. package/bin/oracle-data-mcp.mjs +0 -1019
  13. package/bin/oracle-init.mjs +0 -496
  14. package/bin/oracle-public-server.mjs +0 -36
  15. package/bin/oracle-route.mjs +0 -254
  16. package/bin/oracle-scan.mjs +0 -192
  17. package/bin/oracle-upgrade.mjs +0 -42
  18. package/docs/adding-a-chain.md +0 -229
  19. package/docs/architecture.md +0 -138
  20. package/docs/cli.md +0 -47
  21. package/docs/connectors.md +0 -13
  22. package/docs/oracle-pack-standard.md +0 -29
  23. package/docs/profiles.md +0 -151
  24. package/docs/public-surface.md +0 -133
  25. package/examples/add-a-chain.mjs +0 -65
  26. package/examples/oracle-pack-template.mjs +0 -38
  27. package/examples/research-a-token.mjs +0 -70
  28. package/plugins/oracle-owner-gate/__init__.py +0 -227
  29. package/plugins/oracle-owner-gate/plugin.yaml +0 -9
  30. package/profiles/_template/SOUL.md +0 -54
  31. package/profiles/_template/profile.json +0 -22
  32. package/profiles/bitcoin-agent/SOUL.md +0 -31
  33. package/profiles/bitcoin-agent/profile.json +0 -32
  34. package/profiles/hyperliquid-agent/SOUL.md +0 -34
  35. package/profiles/hyperliquid-agent/profile.json +0 -37
  36. package/profiles/oracle/SOUL.md +0 -107
  37. package/profiles/oracle/profile.json +0 -39
  38. package/profiles/polymarket-agent/SOUL.md +0 -35
  39. package/profiles/polymarket-agent/profile.json +0 -34
  40. package/profiles/profile.schema.json +0 -90
  41. package/profiles/protocol-builder/SOUL.md +0 -57
  42. package/profiles/protocol-builder/profile.json +0 -39
  43. package/profiles/robinhood-agent/SOUL.md +0 -53
  44. package/profiles/robinhood-agent/profile.json +0 -40
  45. package/profiles/solana-agent/SOUL.md +0 -37
  46. package/profiles/solana-agent/profile.json +0 -37
  47. package/profiles/stable-agent/SOUL.md +0 -43
  48. package/profiles/stable-agent/profile.json +0 -37
  49. package/protocols/templates/safe-erc20/SECURITY.md +0 -16
  50. package/protocols/templates/safe-erc20/foundry.toml +0 -12
  51. package/protocols/templates/safe-erc20/remappings.txt +0 -2
  52. package/protocols/templates/safe-erc20/src/SafeERC20.sol +0 -53
  53. package/protocols/templates/safe-erc20/test/SafeERC20.t.sol +0 -72
  54. package/public/agent-connect/app.js +0 -84
  55. package/public/agent-connect/index.html +0 -83
  56. package/public/agent-connect/styles.css +0 -70
  57. package/public/index.html +0 -12
  58. package/public/oracle-console/app.js +0 -272
  59. package/public/oracle-console/bitcoin-wallets.js +0 -206
  60. package/public/oracle-console/index.html +0 -91
  61. package/public/oracle-console/styles.css +0 -239
  62. package/public/oracle-splash/assets/cli-chain-hyperliquid.jpg +0 -0
  63. package/public/oracle-splash/assets/hero/orb.avif +0 -0
  64. package/public/oracle-splash/assets/hero/orb.webm +0 -0
  65. package/public/oracle-splash/assets/llms/claude.svg +0 -1
  66. package/public/oracle-splash/assets/llms/codex-icon.svg +0 -1
  67. package/public/oracle-splash/assets/llms/codex.svg +0 -1
  68. package/public/oracle-splash/assets/llms/cursor-icon.svg +0 -12
  69. package/public/oracle-splash/assets/llms/cursor.svg +0 -17
  70. package/public/oracle-splash/assets/llms/deepseek.svg +0 -1
  71. package/public/oracle-splash/assets/llms/gemini-icon.svg +0 -1
  72. package/public/oracle-splash/assets/llms/gemini.svg +0 -1
  73. package/public/oracle-splash/assets/llms/grok.svg +0 -8
  74. package/public/oracle-splash/assets/llms/hermes.png +0 -0
  75. package/public/oracle-splash/assets/llms/kimi-icon.svg +0 -1
  76. package/public/oracle-splash/assets/llms/kimi.svg +0 -1
  77. package/public/oracle-splash/assets/llms/manus.svg +0 -18
  78. package/public/oracle-splash/assets/llms/openclaw.svg +0 -22
  79. package/public/oracle-splash/assets/llms/perplexity.svg +0 -1
  80. package/public/oracle-splash/assets/llms/qwen.svg +0 -1
  81. package/public/oracle-splash/assets/llms/windsurf.svg +0 -1
  82. package/public/oracle-splash/assets/protocols/abcdex.png +0 -0
  83. package/public/oracle-splash/assets/protocols/across.png +0 -0
  84. package/public/oracle-splash/assets/protocols/aerodrome.png +0 -0
  85. package/public/oracle-splash/assets/protocols/balancer.png +0 -0
  86. package/public/oracle-splash/assets/protocols/cowswap.png +0 -0
  87. package/public/oracle-splash/assets/protocols/curve.png +0 -0
  88. package/public/oracle-splash/assets/protocols/dreamcash.png +0 -0
  89. package/public/oracle-splash/assets/protocols/felix.png +0 -0
  90. package/public/oracle-splash/assets/protocols/gmx.png +0 -0
  91. package/public/oracle-splash/assets/protocols/hyena.png +0 -0
  92. package/public/oracle-splash/assets/protocols/hyperbeat.png +0 -0
  93. package/public/oracle-splash/assets/protocols/hyperliquid.png +0 -0
  94. package/public/oracle-splash/assets/protocols/hyperswap.png +0 -0
  95. package/public/oracle-splash/assets/protocols/jupiter.png +0 -0
  96. package/public/oracle-splash/assets/protocols/kinetiq.png +0 -0
  97. package/public/oracle-splash/assets/protocols/lfj.png +0 -0
  98. package/public/oracle-splash/assets/protocols/lifi.png +0 -0
  99. package/public/oracle-splash/assets/protocols/magic-eden.png +0 -0
  100. package/public/oracle-splash/assets/protocols/morpho.png +0 -0
  101. package/public/oracle-splash/assets/protocols/odos.png +0 -0
  102. package/public/oracle-splash/assets/protocols/oneinch.png +0 -0
  103. package/public/oracle-splash/assets/protocols/opensea.png +0 -0
  104. package/public/oracle-splash/assets/protocols/pancakeswap.png +0 -0
  105. package/public/oracle-splash/assets/protocols/paragon.png +0 -0
  106. package/public/oracle-splash/assets/protocols/paraswap.png +0 -0
  107. package/public/oracle-splash/assets/protocols/pendle.png +0 -0
  108. package/public/oracle-splash/assets/protocols/polymarket.png +0 -0
  109. package/public/oracle-splash/assets/protocols/quickswap.png +0 -0
  110. package/public/oracle-splash/assets/protocols/relay.png +0 -0
  111. package/public/oracle-splash/assets/protocols/stargate.png +0 -0
  112. package/public/oracle-splash/assets/protocols/tradexyz.png +0 -0
  113. package/public/oracle-splash/assets/protocols/uniswap.png +0 -0
  114. package/public/oracle-splash/assets/protocols/velodrome.png +0 -0
  115. package/public/oracle-splash/assets/protocols/ventuals.png +0 -0
  116. package/public/oracle-splash/assets/wordmarks/across-icon.webp +0 -0
  117. package/public/oracle-splash/assets/wordmarks/across.svg +0 -4
  118. package/public/oracle-splash/assets/wordmarks/aerodrome.svg +0 -23
  119. package/public/oracle-splash/assets/wordmarks/balancer.svg +0 -3
  120. package/public/oracle-splash/assets/wordmarks/cowswap.svg +0 -1
  121. package/public/oracle-splash/assets/wordmarks/curve.png +0 -0
  122. package/public/oracle-splash/assets/wordmarks/gmx.svg +0 -13
  123. package/public/oracle-splash/assets/wordmarks/hop-icon.webp +0 -0
  124. package/public/oracle-splash/assets/wordmarks/hyena.svg +0 -7
  125. package/public/oracle-splash/assets/wordmarks/hyperliquid.svg +0 -21
  126. package/public/oracle-splash/assets/wordmarks/hyperswap.svg +0 -13
  127. package/public/oracle-splash/assets/wordmarks/jupiter.svg +0 -35
  128. package/public/oracle-splash/assets/wordmarks/kinetiq.svg +0 -1
  129. package/public/oracle-splash/assets/wordmarks/lfj.webp +0 -0
  130. package/public/oracle-splash/assets/wordmarks/lifi.png +0 -0
  131. package/public/oracle-splash/assets/wordmarks/magic-eden.svg +0 -1
  132. package/public/oracle-splash/assets/wordmarks/markets.svg +0 -1
  133. package/public/oracle-splash/assets/wordmarks/morpho.svg +0 -1
  134. package/public/oracle-splash/assets/wordmarks/odos.svg +0 -3
  135. package/public/oracle-splash/assets/wordmarks/oneinch-icon.webp +0 -0
  136. package/public/oracle-splash/assets/wordmarks/oneinch.svg +0 -6
  137. package/public/oracle-splash/assets/wordmarks/opensea-icon.svg +0 -17
  138. package/public/oracle-splash/assets/wordmarks/opensea.svg +0 -1
  139. package/public/oracle-splash/assets/wordmarks/outcome.svg +0 -16
  140. package/public/oracle-splash/assets/wordmarks/pancakeswap.svg +0 -18
  141. package/public/oracle-splash/assets/wordmarks/paragon.svg +0 -9
  142. package/public/oracle-splash/assets/wordmarks/paraswap.svg +0 -16
  143. package/public/oracle-splash/assets/wordmarks/pendle.png +0 -0
  144. package/public/oracle-splash/assets/wordmarks/polymarket.png +0 -0
  145. package/public/oracle-splash/assets/wordmarks/quickswap.png +0 -0
  146. package/public/oracle-splash/assets/wordmarks/relay.svg +0 -8
  147. package/public/oracle-splash/assets/wordmarks/satflow-icon.png +0 -0
  148. package/public/oracle-splash/assets/wordmarks/stargate-icon.webp +0 -0
  149. package/public/oracle-splash/assets/wordmarks/stargate.svg +0 -15
  150. package/public/oracle-splash/assets/wordmarks/uniswap.svg +0 -18
  151. package/public/oracle-splash/assets/wordmarks/velodrome.svg +0 -84
  152. package/public/oracle-splash/assets/wordmarks/xyz.svg +0 -12
  153. package/public/oracle-splash/assets/wordmarks/zerox-icon.webp +0 -0
  154. package/public/oracle-splash/brand/aave.webp +0 -0
  155. package/public/oracle-splash/brand/aavev2.webp +0 -0
  156. package/public/oracle-splash/brand/aborean.webp +0 -0
  157. package/public/oracle-splash/brand/across.webp +0 -0
  158. package/public/oracle-splash/brand/aerodrome.webp +0 -0
  159. package/public/oracle-splash/brand/afi.webp +0 -0
  160. package/public/oracle-splash/brand/arcus.webp +0 -0
  161. package/public/oracle-splash/brand/aster.webp +0 -0
  162. package/public/oracle-splash/brand/avant.webp +0 -0
  163. package/public/oracle-splash/brand/balancer.webp +0 -0
  164. package/public/oracle-splash/brand/beefy.webp +0 -0
  165. package/public/oracle-splash/brand/benqi.webp +0 -0
  166. package/public/oracle-splash/brand/bestinslot.ico +0 -0
  167. package/public/oracle-splash/brand/bitfi.webp +0 -0
  168. package/public/oracle-splash/brand/bonkswap.webp +0 -0
  169. package/public/oracle-splash/brand/bouncebit.webp +0 -0
  170. package/public/oracle-splash/brand/camelot.webp +0 -0
  171. package/public/oracle-splash/brand/compound.webp +0 -0
  172. package/public/oracle-splash/brand/concrete.webp +0 -0
  173. package/public/oracle-splash/brand/cow.webp +0 -0
  174. package/public/oracle-splash/brand/curve.webp +0 -0
  175. package/public/oracle-splash/brand/derive.webp +0 -0
  176. package/public/oracle-splash/brand/dolomite.webp +0 -0
  177. package/public/oracle-splash/brand/eigenlayer.webp +0 -0
  178. package/public/oracle-splash/brand/ekubo.webp +0 -0
  179. package/public/oracle-splash/brand/ethena.webp +0 -0
  180. package/public/oracle-splash/brand/etherfi.webp +0 -0
  181. package/public/oracle-splash/brand/etherfiborrow.webp +0 -0
  182. package/public/oracle-splash/brand/felix.webp +0 -0
  183. package/public/oracle-splash/brand/fluid.webp +0 -0
  184. package/public/oracle-splash/brand/fluxbeam.webp +0 -0
  185. package/public/oracle-splash/brand/folks.webp +0 -0
  186. package/public/oracle-splash/brand/fortyacres.webp +0 -0
  187. package/public/oracle-splash/brand/gainsnetwork.webp +0 -0
  188. package/public/oracle-splash/brand/gassss.webp +0 -0
  189. package/public/oracle-splash/brand/gmx.webp +0 -0
  190. package/public/oracle-splash/brand/harmonix.webp +0 -0
  191. package/public/oracle-splash/brand/hlorderbook.webp +0 -0
  192. package/public/oracle-splash/brand/hlp.webp +0 -0
  193. package/public/oracle-splash/brand/hop.webp +0 -0
  194. package/public/oracle-splash/brand/hyperbeat.webp +0 -0
  195. package/public/oracle-splash/brand/hyperlend.webp +0 -0
  196. package/public/oracle-splash/brand/hyperliquid.webp +0 -0
  197. package/public/oracle-splash/brand/hyperliquidhpl.webp +0 -0
  198. package/public/oracle-splash/brand/hyperliquidspot.webp +0 -0
  199. package/public/oracle-splash/brand/hyperswap.webp +0 -0
  200. package/public/oracle-splash/brand/hypha.webp +0 -0
  201. package/public/oracle-splash/brand/joedex.webp +0 -0
  202. package/public/oracle-splash/brand/jupiter.webp +0 -0
  203. package/public/oracle-splash/brand/kelp.webp +0 -0
  204. package/public/oracle-splash/brand/kinetiq.webp +0 -0
  205. package/public/oracle-splash/brand/kmhype.webp +0 -0
  206. package/public/oracle-splash/brand/kona.webp +0 -0
  207. package/public/oracle-splash/brand/konalend.webp +0 -0
  208. package/public/oracle-splash/brand/lfj.webp +0 -0
  209. package/public/oracle-splash/brand/lido.webp +0 -0
  210. package/public/oracle-splash/brand/lifi.webp +0 -0
  211. package/public/oracle-splash/brand/lighter.webp +0 -0
  212. package/public/oracle-splash/brand/lista.webp +0 -0
  213. package/public/oracle-splash/brand/loopedhype.webp +0 -0
  214. package/public/oracle-splash/brand/lorenzo.webp +0 -0
  215. package/public/oracle-splash/brand/magic-eden.webp +0 -0
  216. package/public/oracle-splash/brand/magiceden.webp +0 -0
  217. package/public/oracle-splash/brand/mempool.png +0 -0
  218. package/public/oracle-splash/brand/meteora.webp +0 -0
  219. package/public/oracle-splash/brand/morpho.webp +0 -0
  220. package/public/oracle-splash/brand/myriad.webp +0 -0
  221. package/public/oracle-splash/brand/noxa.webp +0 -0
  222. package/public/oracle-splash/brand/odos.webp +0 -0
  223. package/public/oracle-splash/brand/oneinch.webp +0 -0
  224. package/public/oracle-splash/brand/openbook.webp +0 -0
  225. package/public/oracle-splash/brand/opensea.webp +0 -0
  226. package/public/oracle-splash/brand/orca.webp +0 -0
  227. package/public/oracle-splash/brand/ordinals.png +0 -0
  228. package/public/oracle-splash/brand/ostium.webp +0 -0
  229. package/public/oracle-splash/brand/pancakeswap.webp +0 -0
  230. package/public/oracle-splash/brand/pendle.webp +0 -0
  231. package/public/oracle-splash/brand/perena.webp +0 -0
  232. package/public/oracle-splash/brand/pharaoh.webp +0 -0
  233. package/public/oracle-splash/brand/phoenix.webp +0 -0
  234. package/public/oracle-splash/brand/polymarket.webp +0 -0
  235. package/public/oracle-splash/brand/polynomial.webp +0 -0
  236. package/public/oracle-splash/brand/projectx.webp +0 -0
  237. package/public/oracle-splash/brand/pumpfun.webp +0 -0
  238. package/public/oracle-splash/brand/quickswap.webp +0 -0
  239. package/public/oracle-splash/brand/rain.webp +0 -0
  240. package/public/oracle-splash/brand/raydium.webp +0 -0
  241. package/public/oracle-splash/brand/relay.webp +0 -0
  242. package/public/oracle-splash/brand/rocketpool.webp +0 -0
  243. package/public/oracle-splash/brand/saber.webp +0 -0
  244. package/public/oracle-splash/brand/sakuraswap.webp +0 -0
  245. package/public/oracle-splash/brand/sanctum.webp +0 -0
  246. package/public/oracle-splash/brand/satflow.png +0 -0
  247. package/public/oracle-splash/brand/sierra.webp +0 -0
  248. package/public/oracle-splash/brand/sky.webp +0 -0
  249. package/public/oracle-splash/brand/solv.webp +0 -0
  250. package/public/oracle-splash/brand/spark.webp +0 -0
  251. package/public/oracle-splash/brand/sparksavings.webp +0 -0
  252. package/public/oracle-splash/brand/sphere.webp +0 -0
  253. package/public/oracle-splash/brand/ssv.webp +0 -0
  254. package/public/oracle-splash/brand/stabble.webp +0 -0
  255. package/public/oracle-splash/brand/stableswap.webp +0 -0
  256. package/public/oracle-splash/brand/stakewise.webp +0 -0
  257. package/public/oracle-splash/brand/stargate.webp +0 -0
  258. package/public/oracle-splash/brand/sthype.webp +0 -0
  259. package/public/oracle-splash/brand/sushiswap.webp +0 -0
  260. package/public/oracle-splash/brand/unisat.png +0 -0
  261. package/public/oracle-splash/brand/uniswap.webp +0 -0
  262. package/public/oracle-splash/brand/uniswapv2.webp +0 -0
  263. package/public/oracle-splash/brand/uniswapv4.webp +0 -0
  264. package/public/oracle-splash/brand/unit.webp +0 -0
  265. package/public/oracle-splash/brand/velodrome.webp +0 -0
  266. package/public/oracle-splash/brand/velora.webp +0 -0
  267. package/public/oracle-splash/brand/venus.webp +0 -0
  268. package/public/oracle-splash/brand/wbeth.webp +0 -0
  269. package/public/oracle-splash/brand/xsy.webp +0 -0
  270. package/public/oracle-splash/brand/yieldyak.webp +0 -0
  271. package/public/oracle-splash/brand/zerobase.webp +0 -0
  272. package/public/oracle-splash/brand/zerox.webp +0 -0
  273. package/public/oracle-splash/favicon.ico +0 -0
  274. package/public/oracle-splash/favicon.svg +0 -6
  275. package/public/oracle-splash/index.html +0 -1558
  276. package/public/oracle-splash/mesh-graph.png +0 -0
  277. package/public/oracle-splash/mesh-graph.svg +0 -216
  278. package/scripts/adversarial-bench.mjs +0 -114
  279. package/scripts/build-inscription.py +0 -230
  280. package/scripts/check-doc-drift.mjs +0 -123
  281. package/scripts/check-test-count.mjs +0 -105
  282. package/scripts/e2e-hl-markets.mjs +0 -21
  283. package/scripts/e2e-hl-perps.mjs +0 -48
  284. package/scripts/e2e-hypercore-staking.mjs +0 -128
  285. package/scripts/e2e-solana-bitcoin.mjs +0 -183
  286. package/scripts/protocol-template-gate.mjs +0 -15
  287. package/scripts/public-api-scan.mjs +0 -23
  288. package/scripts/secret-scan.mjs +0 -181
  289. package/scripts/verify-v3-venues.mjs +0 -192
  290. package/skills/balance/SKILL.md +0 -176
  291. package/skills/oracle-action-semantics/SKILL.md +0 -40
  292. package/skills/oracle-best-execution/SKILL.md +0 -127
  293. package/skills/oracle-bitcoin/SKILL.md +0 -53
  294. package/skills/oracle-chain-graphs-telegram-cards/SKILL.md +0 -59
  295. package/skills/oracle-chat/SKILL.md +0 -61
  296. package/skills/oracle-chat/chain.SKILL.md +0 -31
  297. package/skills/oracle-chat/setup.SKILL.md +0 -37
  298. package/skills/oracle-circuit-breaker/SKILL.md +0 -51
  299. package/skills/oracle-contract-research/SKILL.md +0 -55
  300. package/skills/oracle-desk/SKILL.md +0 -58
  301. package/skills/oracle-dex-launch/SKILL.md +0 -38
  302. package/skills/oracle-grants/SKILL.md +0 -69
  303. package/skills/oracle-hypercore-staking/SKILL.md +0 -57
  304. package/skills/oracle-hyperliquid/SKILL.md +0 -56
  305. package/skills/oracle-meme-token-sniper/SKILL.md +0 -73
  306. package/skills/oracle-multichain-nft-launch/SKILL.md +0 -338
  307. package/skills/oracle-multichain-token-launch/SKILL.md +0 -300
  308. package/skills/oracle-nft-gacha-launch/SKILL.md +0 -48
  309. package/skills/oracle-nft-mint-gas-war/SKILL.md +0 -63
  310. package/skills/oracle-polymarket/SKILL.md +0 -60
  311. package/skills/oracle-protocol-builder/SKILL.md +0 -59
  312. package/skills/oracle-protocol-security/SKILL.md +0 -60
  313. package/skills/oracle-public-product/SKILL.md +0 -44
  314. package/skills/oracle-receipts/SKILL.md +0 -52
  315. package/skills/oracle-rfq-tokenized-assets/SKILL.md +0 -69
  316. package/skills/oracle-smart-wallet-scanner/SKILL.md +0 -49
  317. package/skills/oracle-solana/SKILL.md +0 -65
  318. package/skills/oracle-solana-nft/SKILL.md +0 -54
  319. package/skills/oracle-token-research/SKILL.md +0 -67
  320. package/skins/oracle.yaml +0 -56
  321. package/src/action-receipts.mjs +0 -265
  322. package/src/action-semantics.mjs +0 -62
  323. package/src/address-book.mjs +0 -208
  324. package/src/agent-auth.mjs +0 -206
  325. package/src/approval-guard.mjs +0 -282
  326. package/src/attestation-secret.mjs +0 -88
  327. package/src/audit-log.mjs +0 -196
  328. package/src/auth/oauth.mjs +0 -672
  329. package/src/auto-slippage.mjs +0 -378
  330. package/src/capability-posture.mjs +0 -125
  331. package/src/chains.mjs +0 -62
  332. package/src/cli/chain-catalog.mjs +0 -215
  333. package/src/cli/chain-state.mjs +0 -74
  334. package/src/cli/commands/auth.mjs +0 -193
  335. package/src/cli/commands/bootstrap.mjs +0 -87
  336. package/src/cli/commands/chain.mjs +0 -143
  337. package/src/cli/commands/chat.mjs +0 -434
  338. package/src/cli/commands/credential.mjs +0 -9
  339. package/src/cli/commands/data-mcp.mjs +0 -18
  340. package/src/cli/commands/data.mjs +0 -75
  341. package/src/cli/commands/doctor.mjs +0 -136
  342. package/src/cli/commands/help.mjs +0 -7
  343. package/src/cli/commands/init.mjs +0 -27
  344. package/src/cli/commands/mcp.mjs +0 -142
  345. package/src/cli/commands/model.mjs +0 -99
  346. package/src/cli/commands/prepare.mjs +0 -12
  347. package/src/cli/commands/public.mjs +0 -20
  348. package/src/cli/commands/route.mjs +0 -12
  349. package/src/cli/commands/runner.mjs +0 -9
  350. package/src/cli/commands/scan.mjs +0 -12
  351. package/src/cli/commands/setup.mjs +0 -275
  352. package/src/cli/commands/sign.mjs +0 -21
  353. package/src/cli/commands/signer.mjs +0 -9
  354. package/src/cli/commands/upgrade.mjs +0 -12
  355. package/src/cli/commands/vault.mjs +0 -9
  356. package/src/cli/commands/version.mjs +0 -22
  357. package/src/cli/first-run.mjs +0 -23
  358. package/src/cli/kernel.mjs +0 -239
  359. package/src/cli/mcp-targets/chatgpt.mjs +0 -51
  360. package/src/cli/mcp-targets/claude-code.mjs +0 -39
  361. package/src/cli/mcp-targets/claude-desktop.mjs +0 -24
  362. package/src/cli/mcp-targets/codex.mjs +0 -41
  363. package/src/cli/mcp-targets/shared.mjs +0 -61
  364. package/src/cli/messaging-platforms.mjs +0 -209
  365. package/src/cli/model-config.mjs +0 -70
  366. package/src/cli/operator-dispatch.mjs +0 -258
  367. package/src/cli/oracle-harness.py +0 -415
  368. package/src/cli/paths.mjs +0 -83
  369. package/src/cli/runtime.mjs +0 -351
  370. package/src/cli/setup-state.mjs +0 -168
  371. package/src/cli/spawn-child.mjs +0 -43
  372. package/src/data/catalog.mjs +0 -585
  373. package/src/data/desk-data.mjs +0 -695
  374. package/src/data/http.mjs +0 -253
  375. package/src/data/provider-endpoint.mjs +0 -94
  376. package/src/data/providers/aerodrome.mjs +0 -245
  377. package/src/data/providers/balancer.mjs +0 -209
  378. package/src/data/providers/bitcoin-esplora.mjs +0 -216
  379. package/src/data/providers/bitcoin-meta.mjs +0 -378
  380. package/src/data/providers/blockscout.mjs +0 -14
  381. package/src/data/providers/bridges.mjs +0 -242
  382. package/src/data/providers/cowswap.mjs +0 -415
  383. package/src/data/providers/curve.mjs +0 -201
  384. package/src/data/providers/defillama.mjs +0 -88
  385. package/src/data/providers/dexscreener.mjs +0 -43
  386. package/src/data/providers/evm-rpc.mjs +0 -225
  387. package/src/data/providers/geckoterminal.mjs +0 -34
  388. package/src/data/providers/gmx.mjs +0 -496
  389. package/src/data/providers/hl-assets.mjs +0 -165
  390. package/src/data/providers/hl-info.mjs +0 -108
  391. package/src/data/providers/hl-markets.mjs +0 -210
  392. package/src/data/providers/hl-outcome.mjs +0 -61
  393. package/src/data/providers/hl-perps.mjs +0 -387
  394. package/src/data/providers/hl-staking.mjs +0 -353
  395. package/src/data/providers/hl-ws.mjs +0 -119
  396. package/src/data/providers/hyperevm-dex.mjs +0 -49
  397. package/src/data/providers/jupiter-venues.mjs +0 -119
  398. package/src/data/providers/jupiter.mjs +0 -315
  399. package/src/data/providers/lifi.mjs +0 -151
  400. package/src/data/providers/magiceden-sol.mjs +0 -406
  401. package/src/data/providers/morpho.mjs +0 -177
  402. package/src/data/providers/nft-gallery.mjs +0 -163
  403. package/src/data/providers/nft-portfolio.mjs +0 -494
  404. package/src/data/providers/odos.mjs +0 -156
  405. package/src/data/providers/oneinch.mjs +0 -174
  406. package/src/data/providers/opensea-multichain.mjs +0 -136
  407. package/src/data/providers/opensea-nft.mjs +0 -371
  408. package/src/data/providers/paraswap.mjs +0 -118
  409. package/src/data/providers/pendle.mjs +0 -188
  410. package/src/data/providers/poly-clob.mjs +0 -283
  411. package/src/data/providers/poly-public.mjs +0 -96
  412. package/src/data/providers/poly-ws.mjs +0 -103
  413. package/src/data/providers/portfolio-history.mjs +0 -394
  414. package/src/data/providers/portfolio.mjs +0 -594
  415. package/src/data/providers/rfq.mjs +0 -15
  416. package/src/data/providers/rh-agent.mjs +0 -59
  417. package/src/data/providers/satflow.mjs +0 -341
  418. package/src/data/providers/signed-material-guard.mjs +0 -108
  419. package/src/data/providers/solana-rpc.mjs +0 -197
  420. package/src/data/providers/uniswap-v3.mjs +0 -349
  421. package/src/data/providers/uniswap-v4.mjs +0 -414
  422. package/src/data/providers/zerox.mjs +0 -167
  423. package/src/data/public-api-scan.mjs +0 -61
  424. package/src/data/quote-placeholder.mjs +0 -31
  425. package/src/exact-integer.mjs +0 -72
  426. package/src/exec-policy.mjs +0 -455
  427. package/src/flags.mjs +0 -15
  428. package/src/fresh-window.mjs +0 -76
  429. package/src/gmx-attestation.mjs +0 -176
  430. package/src/index.mjs +0 -100
  431. package/src/nft-gas-war-guard.mjs +0 -139
  432. package/src/onboarding/agent-keys.mjs +0 -161
  433. package/src/onboarding/harness-configs.mjs +0 -102
  434. package/src/onboarding/index.mjs +0 -18
  435. package/src/onboarding/tiers.mjs +0 -139
  436. package/src/oracle-env.mjs +0 -47
  437. package/src/portfolio-risk.mjs +0 -170
  438. package/src/prepare-envelope.mjs +0 -204
  439. package/src/profile-upgrade.mjs +0 -277
  440. package/src/protocol-execution.mjs +0 -84
  441. package/src/protocol-templates/gate.mjs +0 -179
  442. package/src/protocol-templates/prepare-deploy.mjs +0 -81
  443. package/src/public-api/buzz-integration.mjs +0 -256
  444. package/src/public-api/connect-agent.mjs +0 -416
  445. package/src/public-api/grants.mjs +0 -142
  446. package/src/public-api/http.mjs +0 -389
  447. package/src/public-control/aa-adapter.mjs +0 -402
  448. package/src/public-control/build-registry.mjs +0 -227
  449. package/src/public-control/bundler-client.mjs +0 -357
  450. package/src/public-control/grant-indexer.mjs +0 -296
  451. package/src/public-control/policy-render.mjs +0 -69
  452. package/src/public-control/policy-schema.mjs +0 -318
  453. package/src/public-control/runtime-config.mjs +0 -275
  454. package/src/public-control/session-key-model.mjs +0 -374
  455. package/src/public-control/session-orchestrator.mjs +0 -412
  456. package/src/rfq/intent.mjs +0 -180
  457. package/src/rfq/sources.mjs +0 -181
  458. package/src/route-attestation.mjs +0 -132
  459. package/src/router/best-execution.mjs +0 -326
  460. package/src/router/index.mjs +0 -226
  461. package/src/router/prepare-bridge.mjs +0 -289
  462. package/src/router/prepare-route.mjs +0 -398
  463. package/src/router/proposal.mjs +0 -311
  464. package/src/router/risk-classifier.mjs +0 -119
  465. package/src/router/route-sources.mjs +0 -364
  466. package/src/scanner/chains.config.mjs +0 -430
  467. package/src/scanner/contract.mjs +0 -270
  468. package/src/scanner/evm-scanner.mjs +0 -394
  469. package/src/scanner/index.mjs +0 -9
  470. package/src/scanner/v2-venue.mjs +0 -335
  471. package/src/scanner/v3-venue.mjs +0 -290
  472. package/src/scopes.mjs +0 -44
  473. package/src/sell-simulation.mjs +0 -167
  474. package/src/signals/engine.mjs +0 -146
  475. package/src/signals/index.mjs +0 -1
  476. package/src/token-transfer-guard.mjs +0 -188
  477. package/src/tui/app.mjs +0 -438
  478. package/src/tui/backend.mjs +0 -145
  479. package/src/tui/format.mjs +0 -272
  480. package/src/tui/gateway-client.mjs +0 -177
  481. package/src/tui/input.mjs +0 -501
  482. package/src/tui/renderer.mjs +0 -443
  483. package/src/tui/standalone-client.mjs +0 -666
  484. package/src/tui/theme.mjs +0 -81
  485. package/src/vault-attestation.mjs +0 -146
  486. package/src/venues.mjs +0 -206
  487. package/src/watch-preferences.mjs +0 -85
@@ -1,1019 +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
-
726
- // Named tool -> { provider, op, argMap(args) }
727
- //
728
- // A default address for read tools (rpc_balance, lifi fromAddress) is read from env
729
- // and is entirely optional. When unset, those tools require an explicit address --
730
- // which is the correct default for a public tool: silently substituting SOMEONE'S
731
- // wallet would both leak whose it is and quote routes against the wrong balances.
732
- const DEFAULT_ADDRESS = String(
733
- process.env.ORACLE_DEFAULT_ADDRESS || process.env.MAD_OPERATOR_ADDRESS || "",
734
- ).trim();
735
- const ROUTES = {
736
- llama_protocols: () => ({ provider: "defillama", op: "protocols", args: {} }),
737
- llama_prices: (a) => ({ provider: "defillama", op: "prices", args: { coins: a.coins } }),
738
- dex_search: (a) => ({ provider: "dexscreener", op: "search", args: { q: a.q } }),
739
- dex_token: (a) => ({ provider: "dexscreener", op: "token", args: { address: a.address } }),
740
- lifi_quote: (a) => ({
741
- provider: "lifi",
742
- op: "quote",
743
- args: {
744
- fromChain: a.fromChain,
745
- toChain: a.toChain,
746
- fromToken: a.fromToken,
747
- toToken: a.toToken,
748
- fromAmount: a.fromAmount,
749
- fromAddress: a.fromAddress || DEFAULT_ADDRESS || undefined,
750
- },
751
- }),
752
- portfolio_balance: (a) => ({
753
- provider: "portfolio",
754
- op: "balances",
755
- args: {
756
- addresses: a.addresses,
757
- evmChainIds: a.evmChainIds,
758
- includeTokens: a.includeTokens,
759
- includeCollectibles: a.includeCollectibles,
760
- includePrices: a.includePrices,
761
- },
762
- }),
763
- portfolio_snapshot: (a) => ({ provider: "portfolio", op: "snapshot", args: a }),
764
- portfolio_history: (a) => ({ provider: "portfolio", op: "history", args: a }),
765
- portfolio_value_graph: (a) => ({ provider: "portfolio", op: "valueGraph", args: a }),
766
- nft_inventory: (a) => ({ provider: "nft-portfolio", op: "inventory", args: a }),
767
- nft_gallery: (a) => ({ provider: "nft-portfolio", op: "gallery", args: a }),
768
- nft_pnl: (a) => ({ provider: "nft-portfolio", op: "pnl", args: a }),
769
- nft_prepare_list: (a) => ({ provider: "nft-portfolio", op: "prepareList", args: a }),
770
- rpc_balance: (a) => {
771
- const addr = a.address || DEFAULT_ADDRESS;
772
- if (!addr) throw new Error("address required (set ORACLE_DEFAULT_ADDRESS to supply a default)");
773
- return { provider: "evm-rpc", op: "getBalance", args: { chainId: a.chainId, address: addr } };
774
- },
775
- rpc_block: (a) => ({ provider: "evm-rpc", op: "blockNumber", args: { chainId: a.chainId } }),
776
- solana_balance: (a) => ({ provider: "solana-rpc", op: "getBalance", args: { address: a.address, commitment: a.commitment } }),
777
- solana_token_accounts: (a) => ({ provider: "solana-rpc", op: "tokenAccounts", args: { owner: a.owner, mint: a.mint, commitment: a.commitment } }),
778
- solana_simulate: (a) => ({ provider: "solana-rpc", op: "simulate", args: { transaction: a.transaction, sigVerify: a.sigVerify, replaceRecentBlockhash: a.replaceRecentBlockhash } }),
779
- jupiter_venues: (a) => ({ provider: "jupiter", op: "venues", args: { verify: a.verify, rpc: a.rpc } }),
780
- jupiter_quote: (a) => ({ provider: "jupiter", op: "quote", args: { inputMint: a.inputMint, outputMint: a.outputMint, amount: a.amount, slippageBps: a.slippageBps } }),
781
- 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 } }),
782
- btc_health: () => ({ provider: "bitcoin-esplora", op: "health", args: {} }),
783
- btc_fees: () => ({ provider: "bitcoin-esplora", op: "fees", args: {} }),
784
- btc_balance: (a) => ({ provider: "bitcoin-esplora", op: "address", args: { address: a.address } }),
785
- btc_utxos: (a) => ({ provider: "bitcoin-esplora", op: "utxos", args: { address: a.address } }),
786
- btc_tx: (a) => ({ provider: "bitcoin-esplora", op: "tx", args: { txid: a.txid } }),
787
- btc_meta_health: () => ({ provider: "bitcoin-meta", op: "health", args: {} }),
788
- btc_rune_balance: (a) => ({ provider: "bitcoin-meta", op: "runeBalances", args: { address: a.address } }),
789
- btc_inscriptions: (a) => ({
790
- provider: "bitcoin-meta",
791
- op: "inscriptions",
792
- args: { address: a.address, limit: a.limit },
793
- }),
794
- btc_inscription_info: (a) => ({
795
- provider: "bitcoin-meta",
796
- op: "inscriptionInfo",
797
- args: { inscriptionId: a.inscriptionId },
798
- }),
799
- btc_inscription_children: (a) => ({
800
- provider: "bitcoin-meta",
801
- op: "inscriptionChildren",
802
- args: { inscriptionId: a.inscriptionId, page: a.page },
803
- }),
804
- btc_ord_block_info: (a) => ({
805
- provider: "bitcoin-meta",
806
- op: "ordBlockInfo",
807
- args: { height: a.height },
808
- }),
809
- satflow_health: () => ({ provider: "satflow", op: "health", args: {} }),
810
- satflow_floors: (a) => ({
811
- provider: "satflow",
812
- op: "collectionFloors",
813
- args: { type: a.type, ids: a.ids },
814
- }),
815
- satflow_wallet: (a) => ({
816
- provider: "satflow",
817
- op: "walletContents",
818
- args: { address: a.address, type: a.type, limit: a.limit },
819
- }),
820
- satflow_item: (a) => ({
821
- provider: "satflow",
822
- op: "item",
823
- args: { inscriptionId: a.inscriptionId || a.id },
824
- }),
825
- satflow_floor_listings: (a) => ({
826
- provider: "satflow",
827
- op: "floorListings",
828
- args: { collectionIds: a.collectionIds || a.ids, limit: a.limit },
829
- }),
830
- };
831
-
832
- function send(message) {
833
- process.stdout.write(`${JSON.stringify(message)}\n`);
834
- }
835
-
836
- function error(id, code, message) {
837
- send({ jsonrpc: "2.0", id, error: { code, message } });
838
- }
839
-
840
- async function httpJson(url, { method = "GET", body } = {}) {
841
- const res = await fetch(url, {
842
- method,
843
- headers: { "content-type": "application/json" },
844
- body: body ? JSON.stringify(body) : undefined,
845
- });
846
- const data = await res.json().catch(() => ({}));
847
- if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
848
- return data;
849
- }
850
-
851
- async function deskCall(provider, op, args = {}) {
852
- return httpJson(`${DATA_URL}/data/call`, {
853
- method: "POST",
854
- body: { provider, op, args },
855
- });
856
- }
857
-
858
- async function callTool(name, args = {}) {
859
- if (name === "rfq_quote") {
860
- const { normalizeRfqIntent } = await import("../src/rfq/intent.mjs");
861
- const { requestRfqQuotes } = await import("../src/rfq/sources.mjs");
862
- const intent = normalizeRfqIntent({ ...args, sources: args.sources ?? args.allowedSources });
863
- return requestRfqQuotes(intent, { decimalsIn: args.decimalsIn, decimalsOut: args.decimalsOut });
864
- }
865
- // Routing runs IN-PROCESS rather than through the desk HTTP server. The router
866
- // fans out to several aggregators itself, so proxying it through /data/call would
867
- // add a hop and a second timeout budget for no benefit -- and it means routing
868
- // works without a desk server running at all.
869
- if (name === "best_swap_route" || name === "best_bridge_route") {
870
- const { bestSwapRoute, bestBridgeRoute } = await import("../src/router/index.mjs");
871
- return name === "best_swap_route" ? bestSwapRoute(args) : bestBridgeRoute(args);
872
- }
873
- if (name === "prepare_best_route") {
874
- const { prepareBestRoute } = await import("../src/router/prepare-route.mjs");
875
- return prepareBestRoute(args);
876
- }
877
- if (name === "prepare_best_bridge_route") {
878
- const { prepareBestBridgeRoute } = await import("../src/router/prepare-bridge.mjs");
879
- return prepareBestBridgeRoute(args);
880
- }
881
- // Smart-wallet / token scanner surface.
882
- //
883
- // The scanner engine already covered 11 chains and every capability below, but no
884
- // MCP tool exposed it -- so an agent could scan nothing on EVM while the code sat
885
- // there working. Same class of gap as a route source with no preparer: the
886
- // capability existed, the handle did not.
887
- //
888
- // In-process for the same reason routing is: no desk server required.
889
- // Read-only. scoreRisk and sellSimulation inspect; they never sign.
890
- if (name === "scanner_coverage") {
891
- const s = await import("../src/scanner/index.mjs");
892
- s.registerBuiltinScanners?.();
893
- return s.scannerCoverage();
894
- }
895
- if (name === "scan_token") {
896
- const s = await import("../src/scanner/index.mjs");
897
- s.registerBuiltinScanners?.();
898
- const sc = s.getScanner(Number(args.chainId));
899
- if (!sc) throw new Error(`no scanner registered for chainId ${args.chainId}`);
900
- const token = await sc.resolveToken(args.token);
901
- const pools = sc.supports?.("resolvePools") ? await sc.resolvePools(args.token).catch(() => null) : null;
902
- const risk = sc.supports?.("scoreRisk") ? await sc.scoreRisk({ token: args.token }).catch(() => null) : null;
903
- return { chainId: Number(args.chainId), token, pools, risk };
904
- }
905
- if (name === "wallet_balances") {
906
- const s = await import("../src/scanner/index.mjs");
907
- s.registerBuiltinScanners?.();
908
- const sc = s.getScanner(Number(args.chainId));
909
- if (!sc) throw new Error(`no scanner registered for chainId ${args.chainId}`);
910
- const native = await sc.nativeBalance(args.address);
911
- const token = args.token ? await sc.tokenBalance(args.address, args.token).catch(() => null) : null;
912
- return { chainId: Number(args.chainId), address: args.address, native, token };
913
- }
914
- if (name === "address_book_remember") {
915
- return rememberAddress({
916
- address: args.address, label: args.label, who: args.who,
917
- role: args.role, chainIds: args.chainIds, notes: args.notes, source: "oracle-data-mcp",
918
- });
919
- }
920
- if (name === "address_book_list") return listAddresses({ q: args.q, role: args.role, who: args.who });
921
- if (name === "address_book_lookup") return lookupAddress(args.address);
922
- if (name === "address_book_forget") return forgetAddress(args.address, args.label || null);
923
- if (name === "data_catalog") return httpJson(`${DATA_URL}/data/catalog`);
924
- if (name === "data_health") return httpJson(`${DATA_URL}/data/health`);
925
- if (name === "data_call") {
926
- if (!args.provider || !args.op) throw new Error("provider and op are required");
927
- return deskCall(args.provider, args.op, args.args || {});
928
- }
929
- const route = ROUTES[name];
930
- if (route) {
931
- const { provider, op, args: mapped } = route(args);
932
- return deskCall(provider, op, mapped);
933
- }
934
- throw new Error(`Unknown tool: ${name}`);
935
- }
936
-
937
- async function handle(request) {
938
- const { id, method, params } = request;
939
- if (method === "initialize") {
940
- send({
941
- jsonrpc: "2.0",
942
- id,
943
- result: {
944
- protocolVersion: params?.protocolVersion || "2024-11-05",
945
- capabilities: { tools: {} },
946
- serverInfo: { name: "oracle-data-mcp", version: "0.1.0" },
947
- },
948
- });
949
- return;
950
- }
951
- if (method === "notifications/initialized") return;
952
- if (method === "tools/list") {
953
- send({ jsonrpc: "2.0", id, result: { tools } });
954
- return;
955
- }
956
- if (method === "tools/call") {
957
- try {
958
- const result = await callTool(params?.name, params?.arguments || {});
959
- if (result?.dataBase64 && /^image\/(?:svg\+xml|png|jpeg|webp)$/.test(String(result.mimeType || ""))) {
960
- const { dataBase64, ...metadata } = result;
961
- send({
962
- jsonrpc: "2.0",
963
- id,
964
- result: {
965
- content: [
966
- { type: "image", data: dataBase64, mimeType: result.mimeType },
967
- { type: "text", text: JSON.stringify(metadata, null, 2) },
968
- ],
969
- },
970
- });
971
- } else {
972
- send({ jsonrpc: "2.0", id, result: { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] } });
973
- }
974
- } catch (err) {
975
- send({ jsonrpc: "2.0", id, result: { isError: true, content: [{ type: "text", text: err.message }] } });
976
- }
977
- return;
978
- }
979
- if (id !== undefined) error(id, -32601, `Method not found: ${method}`);
980
- }
981
-
982
- let buffer = "";
983
-
984
- function startStdioLoop() {
985
- process.stdin.setEncoding("utf8");
986
- process.stdin.on("data", (chunk) => {
987
- buffer += chunk;
988
- let index;
989
- while ((index = buffer.indexOf("\n")) >= 0) {
990
- const line = buffer.slice(0, index).trim();
991
- buffer = buffer.slice(index + 1);
992
- if (!line) continue;
993
- try {
994
- void handle(JSON.parse(line));
995
- } catch (err) {
996
- error(null, -32700, err.message);
997
- }
998
- }
999
- });
1000
- }
1001
-
1002
- // npm bin wrappers are symlinks. Comparing import.meta.url to argv[1] as strings
1003
- // fails for `npx oracle-data-mcp` / node_modules/.bin/oracle-data-mcp and the
1004
- // process exits without ever starting the stdio loop (Hermes sees Connection closed).
1005
- function isMainModule() {
1006
- const entry = process.argv[1];
1007
- if (!entry) return false;
1008
- try {
1009
- return fs.realpathSync(entry) === fs.realpathSync(fileURLToPath(import.meta.url));
1010
- } catch {
1011
- return false;
1012
- }
1013
- }
1014
-
1015
- if (isMainModule()) {
1016
- startStdioLoop();
1017
- }
1018
-
1019
- export { tools, callTool, handle };