@oracle-agent/oracle 0.11.0 → 0.12.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 (308) hide show
  1. package/LICENSE +115 -201
  2. package/README.md +66 -84
  3. package/SECURITY.md +37 -12
  4. package/SETUP.md +207 -272
  5. package/dist/action-receipts.mjs +1 -0
  6. package/dist/action-semantics.mjs +1 -0
  7. package/dist/address-book.mjs +2 -0
  8. package/dist/bin/desk-server.mjs +14 -0
  9. package/dist/bin/oracle-data-mcp.mjs +8 -0
  10. package/dist/bin/oracle-init.mjs +24 -0
  11. package/dist/bin/oracle-public-server.mjs +5 -0
  12. package/dist/bin/oracle-route.mjs +22 -0
  13. package/dist/bin/oracle-scan.mjs +18 -0
  14. package/dist/bin/oracle-upgrade.mjs +21 -0
  15. package/dist/bin/oracle.mjs +68 -0
  16. package/dist/chains.mjs +1 -0
  17. package/dist/cli/commands/auth.mjs +16 -0
  18. package/dist/cli/commands/bootstrap.mjs +18 -0
  19. package/dist/cli/commands/chain.mjs +21 -0
  20. package/dist/cli/commands/chat.mjs +35 -0
  21. package/dist/cli/commands/credential.mjs +1 -0
  22. package/dist/cli/commands/data-mcp.mjs +2 -0
  23. package/dist/cli/commands/data.mjs +12 -0
  24. package/dist/cli/commands/doctor.mjs +5 -0
  25. package/dist/cli/commands/gate.mjs +13 -0
  26. package/dist/cli/commands/help.mjs +1 -0
  27. package/dist/cli/commands/init.mjs +3 -0
  28. package/dist/cli/commands/mcp.mjs +33 -0
  29. package/dist/cli/commands/model.mjs +44 -0
  30. package/dist/cli/commands/prepare.mjs +2 -0
  31. package/dist/cli/commands/public.mjs +3 -0
  32. package/dist/cli/commands/route.mjs +2 -0
  33. package/dist/cli/commands/runner.mjs +1 -0
  34. package/dist/cli/commands/scan.mjs +2 -0
  35. package/dist/cli/commands/setup.mjs +34 -0
  36. package/dist/cli/commands/sign.mjs +4 -0
  37. package/dist/cli/commands/signer.mjs +1 -0
  38. package/dist/cli/commands/upgrade.mjs +2 -0
  39. package/dist/cli/commands/vault.mjs +1 -0
  40. package/dist/cli/commands/version.mjs +2 -0
  41. package/dist/data/desk-data.mjs +12 -0
  42. package/dist/index.mjs +17 -0
  43. package/dist/nft-gas-war-guard.mjs +1 -0
  44. package/dist/onboarding/harness-configs.mjs +4 -0
  45. package/dist/portfolio-risk.mjs +1 -0
  46. package/dist/prepare-envelope.mjs +1 -0
  47. package/dist/public-control/policy-schema.mjs +1 -0
  48. package/dist/router/index.mjs +2 -0
  49. package/dist/scanner/index.mjs +4 -0
  50. package/dist/signals/index.mjs +1 -0
  51. package/dist/watch-preferences.mjs +1 -0
  52. package/package.json +27 -65
  53. package/public/oracle-splash/index.html +11 -1
  54. package/CONTRIBUTING.md +0 -98
  55. package/bin/desk-server.mjs +0 -440
  56. package/bin/oracle-data-mcp.mjs +0 -1019
  57. package/bin/oracle-init.mjs +0 -496
  58. package/bin/oracle-public-server.mjs +0 -36
  59. package/bin/oracle-route.mjs +0 -254
  60. package/bin/oracle-scan.mjs +0 -192
  61. package/bin/oracle-upgrade.mjs +0 -42
  62. package/bin/oracle.mjs +0 -33
  63. package/docs/adding-a-chain.md +0 -229
  64. package/docs/architecture.md +0 -138
  65. package/docs/cli.md +0 -47
  66. package/docs/connectors.md +0 -13
  67. package/docs/oracle-pack-standard.md +0 -29
  68. package/docs/profiles.md +0 -151
  69. package/docs/public-surface.md +0 -133
  70. package/examples/add-a-chain.mjs +0 -65
  71. package/examples/oracle-pack-template.mjs +0 -38
  72. package/examples/research-a-token.mjs +0 -70
  73. package/plugins/oracle-owner-gate/__init__.py +0 -227
  74. package/plugins/oracle-owner-gate/plugin.yaml +0 -9
  75. package/profiles/_template/SOUL.md +0 -54
  76. package/profiles/_template/profile.json +0 -22
  77. package/profiles/bitcoin-agent/SOUL.md +0 -31
  78. package/profiles/bitcoin-agent/profile.json +0 -32
  79. package/profiles/hyperliquid-agent/SOUL.md +0 -34
  80. package/profiles/hyperliquid-agent/profile.json +0 -37
  81. package/profiles/oracle/SOUL.md +0 -107
  82. package/profiles/oracle/profile.json +0 -39
  83. package/profiles/polymarket-agent/SOUL.md +0 -35
  84. package/profiles/polymarket-agent/profile.json +0 -34
  85. package/profiles/profile.schema.json +0 -90
  86. package/profiles/protocol-builder/SOUL.md +0 -57
  87. package/profiles/protocol-builder/profile.json +0 -39
  88. package/profiles/robinhood-agent/SOUL.md +0 -53
  89. package/profiles/robinhood-agent/profile.json +0 -40
  90. package/profiles/solana-agent/SOUL.md +0 -37
  91. package/profiles/solana-agent/profile.json +0 -37
  92. package/profiles/stable-agent/SOUL.md +0 -43
  93. package/profiles/stable-agent/profile.json +0 -37
  94. package/protocols/templates/safe-erc20/SECURITY.md +0 -16
  95. package/protocols/templates/safe-erc20/foundry.toml +0 -12
  96. package/protocols/templates/safe-erc20/remappings.txt +0 -2
  97. package/protocols/templates/safe-erc20/src/SafeERC20.sol +0 -53
  98. package/protocols/templates/safe-erc20/test/SafeERC20.t.sol +0 -72
  99. package/scripts/adversarial-bench.mjs +0 -114
  100. package/scripts/build-inscription.py +0 -230
  101. package/scripts/check-doc-drift.mjs +0 -123
  102. package/scripts/check-test-count.mjs +0 -105
  103. package/scripts/e2e-hl-markets.mjs +0 -21
  104. package/scripts/e2e-hl-perps.mjs +0 -48
  105. package/scripts/e2e-hypercore-staking.mjs +0 -128
  106. package/scripts/e2e-solana-bitcoin.mjs +0 -183
  107. package/scripts/protocol-template-gate.mjs +0 -15
  108. package/scripts/public-api-scan.mjs +0 -23
  109. package/scripts/secret-scan.mjs +0 -181
  110. package/scripts/verify-v3-venues.mjs +0 -192
  111. package/skills/balance/SKILL.md +0 -176
  112. package/skills/oracle-action-semantics/SKILL.md +0 -40
  113. package/skills/oracle-best-execution/SKILL.md +0 -127
  114. package/skills/oracle-bitcoin/SKILL.md +0 -53
  115. package/skills/oracle-chain-graphs-telegram-cards/SKILL.md +0 -59
  116. package/skills/oracle-chat/SKILL.md +0 -61
  117. package/skills/oracle-chat/chain.SKILL.md +0 -31
  118. package/skills/oracle-chat/setup.SKILL.md +0 -37
  119. package/skills/oracle-circuit-breaker/SKILL.md +0 -51
  120. package/skills/oracle-contract-research/SKILL.md +0 -55
  121. package/skills/oracle-desk/SKILL.md +0 -58
  122. package/skills/oracle-dex-launch/SKILL.md +0 -38
  123. package/skills/oracle-grants/SKILL.md +0 -69
  124. package/skills/oracle-hypercore-staking/SKILL.md +0 -57
  125. package/skills/oracle-hyperliquid/SKILL.md +0 -56
  126. package/skills/oracle-meme-token-sniper/SKILL.md +0 -73
  127. package/skills/oracle-multichain-nft-launch/SKILL.md +0 -338
  128. package/skills/oracle-multichain-token-launch/SKILL.md +0 -300
  129. package/skills/oracle-nft-gacha-launch/SKILL.md +0 -48
  130. package/skills/oracle-nft-mint-gas-war/SKILL.md +0 -63
  131. package/skills/oracle-polymarket/SKILL.md +0 -60
  132. package/skills/oracle-protocol-builder/SKILL.md +0 -59
  133. package/skills/oracle-protocol-security/SKILL.md +0 -60
  134. package/skills/oracle-public-product/SKILL.md +0 -44
  135. package/skills/oracle-receipts/SKILL.md +0 -52
  136. package/skills/oracle-rfq-tokenized-assets/SKILL.md +0 -69
  137. package/skills/oracle-smart-wallet-scanner/SKILL.md +0 -49
  138. package/skills/oracle-solana/SKILL.md +0 -65
  139. package/skills/oracle-solana-nft/SKILL.md +0 -54
  140. package/skills/oracle-token-research/SKILL.md +0 -67
  141. package/skins/oracle.yaml +0 -56
  142. package/src/action-receipts.mjs +0 -265
  143. package/src/action-semantics.mjs +0 -62
  144. package/src/address-book.mjs +0 -208
  145. package/src/agent-auth.mjs +0 -206
  146. package/src/approval-guard.mjs +0 -282
  147. package/src/attestation-secret.mjs +0 -88
  148. package/src/audit-log.mjs +0 -196
  149. package/src/auth/oauth.mjs +0 -672
  150. package/src/auto-slippage.mjs +0 -378
  151. package/src/capability-posture.mjs +0 -125
  152. package/src/chains.mjs +0 -62
  153. package/src/cli/chain-catalog.mjs +0 -215
  154. package/src/cli/chain-state.mjs +0 -74
  155. package/src/cli/commands/auth.mjs +0 -193
  156. package/src/cli/commands/bootstrap.mjs +0 -87
  157. package/src/cli/commands/chain.mjs +0 -143
  158. package/src/cli/commands/chat.mjs +0 -434
  159. package/src/cli/commands/credential.mjs +0 -9
  160. package/src/cli/commands/data-mcp.mjs +0 -18
  161. package/src/cli/commands/data.mjs +0 -75
  162. package/src/cli/commands/doctor.mjs +0 -136
  163. package/src/cli/commands/help.mjs +0 -7
  164. package/src/cli/commands/init.mjs +0 -27
  165. package/src/cli/commands/mcp.mjs +0 -142
  166. package/src/cli/commands/model.mjs +0 -99
  167. package/src/cli/commands/prepare.mjs +0 -12
  168. package/src/cli/commands/public.mjs +0 -20
  169. package/src/cli/commands/route.mjs +0 -12
  170. package/src/cli/commands/runner.mjs +0 -9
  171. package/src/cli/commands/scan.mjs +0 -12
  172. package/src/cli/commands/setup.mjs +0 -275
  173. package/src/cli/commands/sign.mjs +0 -21
  174. package/src/cli/commands/signer.mjs +0 -9
  175. package/src/cli/commands/upgrade.mjs +0 -12
  176. package/src/cli/commands/vault.mjs +0 -9
  177. package/src/cli/commands/version.mjs +0 -22
  178. package/src/cli/first-run.mjs +0 -23
  179. package/src/cli/kernel.mjs +0 -239
  180. package/src/cli/mcp-targets/chatgpt.mjs +0 -51
  181. package/src/cli/mcp-targets/claude-code.mjs +0 -39
  182. package/src/cli/mcp-targets/claude-desktop.mjs +0 -24
  183. package/src/cli/mcp-targets/codex.mjs +0 -41
  184. package/src/cli/mcp-targets/shared.mjs +0 -61
  185. package/src/cli/messaging-platforms.mjs +0 -209
  186. package/src/cli/model-config.mjs +0 -70
  187. package/src/cli/operator-dispatch.mjs +0 -258
  188. package/src/cli/oracle-harness.py +0 -415
  189. package/src/cli/paths.mjs +0 -83
  190. package/src/cli/runtime.mjs +0 -351
  191. package/src/cli/setup-state.mjs +0 -168
  192. package/src/cli/spawn-child.mjs +0 -43
  193. package/src/data/catalog.mjs +0 -585
  194. package/src/data/desk-data.mjs +0 -695
  195. package/src/data/http.mjs +0 -253
  196. package/src/data/provider-endpoint.mjs +0 -94
  197. package/src/data/providers/aerodrome.mjs +0 -245
  198. package/src/data/providers/balancer.mjs +0 -209
  199. package/src/data/providers/bitcoin-esplora.mjs +0 -216
  200. package/src/data/providers/bitcoin-meta.mjs +0 -378
  201. package/src/data/providers/blockscout.mjs +0 -14
  202. package/src/data/providers/bridges.mjs +0 -242
  203. package/src/data/providers/cowswap.mjs +0 -415
  204. package/src/data/providers/curve.mjs +0 -201
  205. package/src/data/providers/defillama.mjs +0 -88
  206. package/src/data/providers/dexscreener.mjs +0 -43
  207. package/src/data/providers/evm-rpc.mjs +0 -225
  208. package/src/data/providers/geckoterminal.mjs +0 -34
  209. package/src/data/providers/gmx.mjs +0 -496
  210. package/src/data/providers/hl-assets.mjs +0 -165
  211. package/src/data/providers/hl-info.mjs +0 -108
  212. package/src/data/providers/hl-markets.mjs +0 -210
  213. package/src/data/providers/hl-outcome.mjs +0 -61
  214. package/src/data/providers/hl-perps.mjs +0 -387
  215. package/src/data/providers/hl-staking.mjs +0 -353
  216. package/src/data/providers/hl-ws.mjs +0 -119
  217. package/src/data/providers/hyperevm-dex.mjs +0 -49
  218. package/src/data/providers/jupiter-venues.mjs +0 -119
  219. package/src/data/providers/jupiter.mjs +0 -315
  220. package/src/data/providers/lifi.mjs +0 -151
  221. package/src/data/providers/magiceden-sol.mjs +0 -406
  222. package/src/data/providers/morpho.mjs +0 -177
  223. package/src/data/providers/nft-gallery.mjs +0 -163
  224. package/src/data/providers/nft-portfolio.mjs +0 -494
  225. package/src/data/providers/odos.mjs +0 -156
  226. package/src/data/providers/oneinch.mjs +0 -174
  227. package/src/data/providers/opensea-multichain.mjs +0 -136
  228. package/src/data/providers/opensea-nft.mjs +0 -371
  229. package/src/data/providers/paraswap.mjs +0 -118
  230. package/src/data/providers/pendle.mjs +0 -188
  231. package/src/data/providers/poly-clob.mjs +0 -283
  232. package/src/data/providers/poly-public.mjs +0 -96
  233. package/src/data/providers/poly-ws.mjs +0 -103
  234. package/src/data/providers/portfolio-history.mjs +0 -394
  235. package/src/data/providers/portfolio.mjs +0 -594
  236. package/src/data/providers/rfq.mjs +0 -15
  237. package/src/data/providers/rh-agent.mjs +0 -59
  238. package/src/data/providers/satflow.mjs +0 -341
  239. package/src/data/providers/signed-material-guard.mjs +0 -108
  240. package/src/data/providers/solana-rpc.mjs +0 -197
  241. package/src/data/providers/uniswap-v3.mjs +0 -349
  242. package/src/data/providers/uniswap-v4.mjs +0 -414
  243. package/src/data/providers/zerox.mjs +0 -167
  244. package/src/data/public-api-scan.mjs +0 -61
  245. package/src/data/quote-placeholder.mjs +0 -31
  246. package/src/exact-integer.mjs +0 -72
  247. package/src/exec-policy.mjs +0 -455
  248. package/src/flags.mjs +0 -15
  249. package/src/fresh-window.mjs +0 -76
  250. package/src/gmx-attestation.mjs +0 -176
  251. package/src/index.mjs +0 -100
  252. package/src/nft-gas-war-guard.mjs +0 -139
  253. package/src/onboarding/agent-keys.mjs +0 -161
  254. package/src/onboarding/harness-configs.mjs +0 -102
  255. package/src/onboarding/index.mjs +0 -18
  256. package/src/onboarding/tiers.mjs +0 -139
  257. package/src/oracle-env.mjs +0 -47
  258. package/src/portfolio-risk.mjs +0 -170
  259. package/src/prepare-envelope.mjs +0 -204
  260. package/src/profile-upgrade.mjs +0 -277
  261. package/src/protocol-execution.mjs +0 -84
  262. package/src/protocol-templates/gate.mjs +0 -179
  263. package/src/protocol-templates/prepare-deploy.mjs +0 -81
  264. package/src/public-api/buzz-integration.mjs +0 -256
  265. package/src/public-api/connect-agent.mjs +0 -416
  266. package/src/public-api/grants.mjs +0 -142
  267. package/src/public-api/http.mjs +0 -389
  268. package/src/public-control/aa-adapter.mjs +0 -402
  269. package/src/public-control/build-registry.mjs +0 -227
  270. package/src/public-control/bundler-client.mjs +0 -357
  271. package/src/public-control/grant-indexer.mjs +0 -296
  272. package/src/public-control/policy-render.mjs +0 -69
  273. package/src/public-control/policy-schema.mjs +0 -318
  274. package/src/public-control/runtime-config.mjs +0 -275
  275. package/src/public-control/session-key-model.mjs +0 -374
  276. package/src/public-control/session-orchestrator.mjs +0 -412
  277. package/src/rfq/intent.mjs +0 -180
  278. package/src/rfq/sources.mjs +0 -181
  279. package/src/route-attestation.mjs +0 -132
  280. package/src/router/best-execution.mjs +0 -326
  281. package/src/router/index.mjs +0 -226
  282. package/src/router/prepare-bridge.mjs +0 -289
  283. package/src/router/prepare-route.mjs +0 -398
  284. package/src/router/proposal.mjs +0 -311
  285. package/src/router/risk-classifier.mjs +0 -119
  286. package/src/router/route-sources.mjs +0 -364
  287. package/src/scanner/chains.config.mjs +0 -430
  288. package/src/scanner/contract.mjs +0 -270
  289. package/src/scanner/evm-scanner.mjs +0 -394
  290. package/src/scanner/index.mjs +0 -9
  291. package/src/scanner/v2-venue.mjs +0 -335
  292. package/src/scanner/v3-venue.mjs +0 -290
  293. package/src/scopes.mjs +0 -44
  294. package/src/sell-simulation.mjs +0 -167
  295. package/src/signals/engine.mjs +0 -146
  296. package/src/signals/index.mjs +0 -1
  297. package/src/token-transfer-guard.mjs +0 -188
  298. package/src/tui/app.mjs +0 -438
  299. package/src/tui/backend.mjs +0 -145
  300. package/src/tui/format.mjs +0 -272
  301. package/src/tui/gateway-client.mjs +0 -177
  302. package/src/tui/input.mjs +0 -501
  303. package/src/tui/renderer.mjs +0 -443
  304. package/src/tui/standalone-client.mjs +0 -666
  305. package/src/tui/theme.mjs +0 -81
  306. package/src/vault-attestation.mjs +0 -146
  307. package/src/venues.mjs +0 -206
  308. 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 };