@oracle-agent/oracle 0.1.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.
- package/CONTRIBUTING.md +98 -0
- package/LICENSE +202 -0
- package/README.md +384 -0
- package/SECURITY.md +89 -0
- package/SETUP.md +235 -0
- package/artifacts/inscription/oracle-was-here-preview.png +0 -0
- package/artifacts/inscription/oracle-was-here.svg +1 -0
- package/artifacts/specialist-packs/oracle-full-crypto.json +273 -0
- package/bin/desk-server.mjs +438 -0
- package/bin/oracle-data-mcp.mjs +603 -0
- package/bin/oracle-init.mjs +423 -0
- package/bin/oracle-public-server.mjs +36 -0
- package/bin/oracle-route.mjs +254 -0
- package/bin/oracle-scan.mjs +192 -0
- package/docs/adding-a-chain.md +229 -0
- package/docs/architecture.md +135 -0
- package/docs/profiles.md +132 -0
- package/examples/add-a-chain.mjs +65 -0
- package/examples/research-a-token.mjs +70 -0
- package/package.json +90 -0
- package/profiles/_template/SOUL.md +47 -0
- package/profiles/_template/profile.json +22 -0
- package/profiles/bitcoin-agent/SOUL.md +31 -0
- package/profiles/bitcoin-agent/profile.json +32 -0
- package/profiles/hyperliquid-agent/SOUL.md +34 -0
- package/profiles/hyperliquid-agent/profile.json +37 -0
- package/profiles/oracle/SOUL.md +65 -0
- package/profiles/oracle/profile.json +35 -0
- package/profiles/polymarket-agent/SOUL.md +35 -0
- package/profiles/polymarket-agent/profile.json +34 -0
- package/profiles/profile.schema.json +90 -0
- package/profiles/protocol-builder/SOUL.md +50 -0
- package/profiles/protocol-builder/profile.json +37 -0
- package/profiles/robinhood-agent/SOUL.md +45 -0
- package/profiles/robinhood-agent/profile.json +39 -0
- package/profiles/solana-agent/SOUL.md +37 -0
- package/profiles/solana-agent/profile.json +37 -0
- package/profiles/stable-agent/SOUL.md +43 -0
- package/profiles/stable-agent/profile.json +37 -0
- package/public/oracle-console/app.js +272 -0
- package/public/oracle-console/bitcoin-wallets.js +206 -0
- package/public/oracle-console/index.html +91 -0
- package/public/oracle-console/styles.css +239 -0
- package/public/oracle-splash/index.html +931 -0
- package/scripts/build-inscription.py +230 -0
- package/scripts/check-test-count.mjs +105 -0
- package/scripts/e2e-hl-markets.mjs +21 -0
- package/scripts/e2e-hl-perps.mjs +48 -0
- package/scripts/e2e-hypercore-staking.mjs +128 -0
- package/scripts/e2e-solana-bitcoin.mjs +183 -0
- package/scripts/public-api-scan.mjs +23 -0
- package/scripts/secret-scan.mjs +181 -0
- package/scripts/verify-v3-venues.mjs +192 -0
- package/skills/oracle-best-execution/SKILL.md +127 -0
- package/skills/oracle-bitcoin/SKILL.md +53 -0
- package/skills/oracle-chain-graphs-telegram-cards/SKILL.md +59 -0
- package/skills/oracle-circuit-breaker/SKILL.md +51 -0
- package/skills/oracle-contract-research/SKILL.md +55 -0
- package/skills/oracle-desk/SKILL.md +58 -0
- package/skills/oracle-dex-launch/SKILL.md +38 -0
- package/skills/oracle-grants/SKILL.md +69 -0
- package/skills/oracle-hypercore-staking/SKILL.md +57 -0
- package/skills/oracle-hyperliquid/SKILL.md +56 -0
- package/skills/oracle-meme-token-sniper/SKILL.md +73 -0
- package/skills/oracle-nft-gacha-launch/SKILL.md +48 -0
- package/skills/oracle-nft-mint-gas-war/SKILL.md +63 -0
- package/skills/oracle-polymarket/SKILL.md +60 -0
- package/skills/oracle-protocol-builder/SKILL.md +38 -0
- package/skills/oracle-protocol-security/SKILL.md +60 -0
- package/skills/oracle-public-product/SKILL.md +44 -0
- package/skills/oracle-receipts/SKILL.md +52 -0
- package/skills/oracle-rfq-tokenized-assets/SKILL.md +69 -0
- package/skills/oracle-smart-wallet-scanner/SKILL.md +49 -0
- package/skills/oracle-solana/SKILL.md +65 -0
- package/skills/oracle-solana-nft/SKILL.md +54 -0
- package/skills/oracle-token-research/SKILL.md +67 -0
- package/src/agent-auth.mjs +191 -0
- package/src/approval-guard.mjs +282 -0
- package/src/attestation-secret.mjs +88 -0
- package/src/audit-log.mjs +196 -0
- package/src/auto-slippage.mjs +378 -0
- package/src/capability-posture.mjs +125 -0
- package/src/chains.mjs +62 -0
- package/src/data/catalog.mjs +495 -0
- package/src/data/desk-data.mjs +623 -0
- package/src/data/http.mjs +200 -0
- package/src/data/provider-endpoint.mjs +94 -0
- package/src/data/providers/aerodrome.mjs +244 -0
- package/src/data/providers/balancer.mjs +208 -0
- package/src/data/providers/bitcoin-esplora.mjs +230 -0
- package/src/data/providers/bitcoin-meta.mjs +378 -0
- package/src/data/providers/blockscout.mjs +14 -0
- package/src/data/providers/bridges.mjs +241 -0
- package/src/data/providers/cowswap.mjs +501 -0
- package/src/data/providers/curve.mjs +200 -0
- package/src/data/providers/defillama.mjs +88 -0
- package/src/data/providers/dexscreener.mjs +43 -0
- package/src/data/providers/evm-rpc.mjs +203 -0
- package/src/data/providers/geckoterminal.mjs +34 -0
- package/src/data/providers/gmx.mjs +495 -0
- package/src/data/providers/hl-info.mjs +102 -0
- package/src/data/providers/hl-markets.mjs +210 -0
- package/src/data/providers/hl-perps.mjs +382 -0
- package/src/data/providers/hl-staking.mjs +352 -0
- package/src/data/providers/hl-ws.mjs +119 -0
- package/src/data/providers/hyperevm-dex.mjs +49 -0
- package/src/data/providers/jupiter.mjs +182 -0
- package/src/data/providers/lifi.mjs +150 -0
- package/src/data/providers/magiceden-sol.mjs +355 -0
- package/src/data/providers/morpho.mjs +173 -0
- package/src/data/providers/odos.mjs +155 -0
- package/src/data/providers/oneinch.mjs +173 -0
- package/src/data/providers/opensea-multichain.mjs +136 -0
- package/src/data/providers/opensea-nft.mjs +99 -0
- package/src/data/providers/paraswap.mjs +117 -0
- package/src/data/providers/pendle.mjs +187 -0
- package/src/data/providers/poly-public.mjs +96 -0
- package/src/data/providers/poly-ws.mjs +103 -0
- package/src/data/providers/rh-agent.mjs +59 -0
- package/src/data/providers/satflow.mjs +336 -0
- package/src/data/providers/solana-rpc.mjs +186 -0
- package/src/data/providers/uniswap-v3.mjs +303 -0
- package/src/data/providers/zerox.mjs +166 -0
- package/src/data/public-api-scan.mjs +61 -0
- package/src/data/quote-placeholder.mjs +31 -0
- package/src/exact-integer.mjs +72 -0
- package/src/exec-policy.mjs +444 -0
- package/src/flags.mjs +15 -0
- package/src/fresh-window.mjs +76 -0
- package/src/gmx-attestation.mjs +175 -0
- package/src/index.mjs +50 -0
- package/src/nft-gas-war-guard.mjs +139 -0
- package/src/onboarding/agent-keys.mjs +157 -0
- package/src/onboarding/index.mjs +18 -0
- package/src/onboarding/tiers.mjs +139 -0
- package/src/oracle-env.mjs +38 -0
- package/src/protocol-execution.mjs +84 -0
- package/src/public-api/buzz-integration.mjs +256 -0
- package/src/public-api/connect-agent.mjs +397 -0
- package/src/public-api/grants.mjs +142 -0
- package/src/public-api/http.mjs +374 -0
- package/src/public-control/aa-adapter.mjs +402 -0
- package/src/public-control/build-registry.mjs +227 -0
- package/src/public-control/bundler-client.mjs +372 -0
- package/src/public-control/grant-indexer.mjs +296 -0
- package/src/public-control/policy-render.mjs +69 -0
- package/src/public-control/policy-schema.mjs +318 -0
- package/src/public-control/runtime-config.mjs +265 -0
- package/src/public-control/session-key-model.mjs +374 -0
- package/src/public-control/session-orchestrator.mjs +412 -0
- package/src/route-attestation.mjs +132 -0
- package/src/router/best-execution.mjs +221 -0
- package/src/router/index.mjs +185 -0
- package/src/router/prepare-bridge.mjs +288 -0
- package/src/router/prepare-route.mjs +341 -0
- package/src/router/proposal.mjs +311 -0
- package/src/router/risk-classifier.mjs +119 -0
- package/src/router/route-sources.mjs +292 -0
- package/src/scanner/chains.config.mjs +381 -0
- package/src/scanner/contract.mjs +270 -0
- package/src/scanner/evm-scanner.mjs +394 -0
- package/src/scanner/index.mjs +9 -0
- package/src/scanner/v2-venue.mjs +335 -0
- package/src/scanner/v3-venue.mjs +290 -0
- package/src/scopes.mjs +44 -0
- package/src/sell-simulation.mjs +167 -0
- package/src/token-transfer-guard.mjs +188 -0
- package/src/vault-attestation.mjs +145 -0
- package/src/venues.mjs +206 -0
|
@@ -0,0 +1,603 @@
|
|
|
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. No key, no signing, no broadcast. Routes to the Oracle
|
|
6
|
+
// data server read plane (/data/call), which is unauthenticated on loopback.
|
|
7
|
+
// This is the "scan all public APIs" surface: DeFiLlama protocol TVL, DexScreener
|
|
8
|
+
// token/search, LI.FI + Uniswap quotes, multi-chain RPC balances/blocks.
|
|
9
|
+
//
|
|
10
|
+
// Mirrors the Oracle exec MCP stdio JSON-RPC shape.
|
|
11
|
+
|
|
12
|
+
import process from "node:process";
|
|
13
|
+
import { env } from "../src/oracle-env.mjs";
|
|
14
|
+
|
|
15
|
+
const DATA_URL = (env("ORACLE_DATA_URL", "MAD_DESK_URL", "http://127.0.0.1:8787")).replace(/\/$/, "");
|
|
16
|
+
|
|
17
|
+
const tools = [
|
|
18
|
+
{
|
|
19
|
+
name: "data_catalog",
|
|
20
|
+
description:
|
|
21
|
+
"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.",
|
|
22
|
+
inputSchema: { type: "object", properties: {} },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "data_health",
|
|
26
|
+
description:
|
|
27
|
+
"Health of every read-plane provider (which public APIs are up / configured). Read-only.",
|
|
28
|
+
inputSchema: { type: "object", properties: {} },
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "data_call",
|
|
32
|
+
description:
|
|
33
|
+
"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.",
|
|
34
|
+
inputSchema: {
|
|
35
|
+
type: "object",
|
|
36
|
+
required: ["provider", "op"],
|
|
37
|
+
properties: {
|
|
38
|
+
provider: { type: "string", description: "provider id, e.g. defillama, dexscreener, lifi, evm-rpc" },
|
|
39
|
+
op: { type: "string", description: "op name for that provider, e.g. protocols, search, quote" },
|
|
40
|
+
args: { type: "object", description: "op arguments (free-form)" },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "llama_protocols",
|
|
46
|
+
description:
|
|
47
|
+
"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.",
|
|
48
|
+
inputSchema: { type: "object", properties: {} },
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "llama_prices",
|
|
52
|
+
description:
|
|
53
|
+
"DeFiLlama current prices for coins keyed 'chain:address' or 'coingecko:id' (comma-joined or array). Read-only.",
|
|
54
|
+
inputSchema: {
|
|
55
|
+
type: "object",
|
|
56
|
+
required: ["coins"],
|
|
57
|
+
properties: {
|
|
58
|
+
coins: { type: "string", description: "comma-joined coin keys, e.g. 'ethereum:0x...,coingecko:bitcoin'" },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "dex_search",
|
|
64
|
+
description:
|
|
65
|
+
"DexScreener search across all chains by symbol/name/address. Returns matching pairs with price, liquidity, volume, chain. Read-only.",
|
|
66
|
+
inputSchema: {
|
|
67
|
+
type: "object",
|
|
68
|
+
required: ["q"],
|
|
69
|
+
properties: { q: { type: "string", description: "query: symbol, name, or token address" } },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "dex_token",
|
|
74
|
+
description:
|
|
75
|
+
"DexScreener pairs for a specific token address (any chain). Price, liquidity, volume, pair addresses. Read-only.",
|
|
76
|
+
inputSchema: {
|
|
77
|
+
type: "object",
|
|
78
|
+
required: ["address"],
|
|
79
|
+
properties: { address: { type: "string" } },
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "lifi_quote",
|
|
84
|
+
description:
|
|
85
|
+
"LI.FI cross-chain / DEX aggregator quote (no key). Best route + expected out for a swap or bridge. Read-only.",
|
|
86
|
+
inputSchema: {
|
|
87
|
+
type: "object",
|
|
88
|
+
required: ["fromChain", "toChain", "fromToken", "toToken", "fromAmount"],
|
|
89
|
+
properties: {
|
|
90
|
+
fromChain: { type: "number" },
|
|
91
|
+
toChain: { type: "number" },
|
|
92
|
+
fromToken: { type: "string" },
|
|
93
|
+
toToken: { type: "string" },
|
|
94
|
+
fromAmount: { type: "string", description: "raw integer amount (wei-scale)" },
|
|
95
|
+
fromAddress: { type: "string", description: "optional; defaults to operator wallet" },
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: "rpc_balance",
|
|
101
|
+
description:
|
|
102
|
+
"Native token balance of an address on a chain via public RPC. Read-only. Omit address to read the operator wallet.",
|
|
103
|
+
inputSchema: {
|
|
104
|
+
type: "object",
|
|
105
|
+
required: ["chainId"],
|
|
106
|
+
properties: {
|
|
107
|
+
chainId: { type: "number" },
|
|
108
|
+
address: { type: "string" },
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "rpc_block",
|
|
114
|
+
description: "Latest block number on a chain via public RPC. Read-only.",
|
|
115
|
+
inputSchema: {
|
|
116
|
+
type: "object",
|
|
117
|
+
required: ["chainId"],
|
|
118
|
+
properties: { chainId: { type: "number" } },
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "solana_balance",
|
|
123
|
+
description: "Solana mainnet SOL balance for a base58 public key. Read-only; no signing or broadcast.",
|
|
124
|
+
inputSchema: {
|
|
125
|
+
type: "object",
|
|
126
|
+
required: ["address"],
|
|
127
|
+
properties: { address: { type: "string" }, commitment: { type: "string" } },
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "solana_token_accounts",
|
|
132
|
+
description: "Solana SPL token accounts for an owner, optionally filtered by mint. Read-only.",
|
|
133
|
+
inputSchema: {
|
|
134
|
+
type: "object",
|
|
135
|
+
required: ["owner"],
|
|
136
|
+
properties: { owner: { type: "string" }, mint: { type: "string" }, commitment: { type: "string" } },
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "solana_simulate",
|
|
141
|
+
description: "Simulate a base64 Solana transaction through RPC. Read-only; never signs or broadcasts.",
|
|
142
|
+
inputSchema: {
|
|
143
|
+
type: "object",
|
|
144
|
+
required: ["transaction"],
|
|
145
|
+
properties: { transaction: { type: "string" }, sigVerify: { type: "boolean" }, replaceRecentBlockhash: { type: "boolean" } },
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "jupiter_quote",
|
|
150
|
+
description: "Jupiter Solana Swap API quote with a hard <=100 bps slippage cap. Read-only.",
|
|
151
|
+
inputSchema: {
|
|
152
|
+
type: "object",
|
|
153
|
+
required: ["inputMint", "outputMint", "amount"],
|
|
154
|
+
properties: { inputMint: { type: "string" }, outputMint: { type: "string" }, amount: { type: "string" }, slippageBps: { type: "number" } },
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "jupiter_prepare",
|
|
159
|
+
description: "Prepare an unsigned Jupiter swap transaction for the user's Solana wallet to sign. No local signer, no broadcast.",
|
|
160
|
+
inputSchema: {
|
|
161
|
+
type: "object",
|
|
162
|
+
required: ["userPublicKey"],
|
|
163
|
+
properties: { userPublicKey: { type: "string" }, quoteResponse: { type: "object" }, inputMint: { type: "string" }, outputMint: { type: "string" }, amount: { type: "string" }, slippageBps: { type: "number" } },
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "btc_health",
|
|
168
|
+
description: "Bitcoin L1 Esplora health + tip height (mempool.space by default). No Core RPC, no keys. Read-only.",
|
|
169
|
+
inputSchema: { type: "object", properties: {} },
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "btc_fees",
|
|
173
|
+
description: "Recommended Bitcoin fee rates (sats/vB). Read-only.",
|
|
174
|
+
inputSchema: { type: "object", properties: {} },
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "btc_balance",
|
|
178
|
+
description: "Bitcoin address balance in sats via Esplora. Read-only.",
|
|
179
|
+
inputSchema: {
|
|
180
|
+
type: "object",
|
|
181
|
+
required: ["address"],
|
|
182
|
+
properties: { address: { type: "string", description: "bc1…/1…/3… address" } },
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: "btc_utxos",
|
|
187
|
+
description: "UTXOs for a Bitcoin address via Esplora. Read-only.",
|
|
188
|
+
inputSchema: {
|
|
189
|
+
type: "object",
|
|
190
|
+
required: ["address"],
|
|
191
|
+
properties: { address: { type: "string" } },
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "btc_tx",
|
|
196
|
+
description: "Lookup a Bitcoin transaction by txid via Esplora. Read-only.",
|
|
197
|
+
inputSchema: {
|
|
198
|
+
type: "object",
|
|
199
|
+
required: ["txid"],
|
|
200
|
+
properties: { txid: { type: "string" } },
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "btc_meta_health",
|
|
205
|
+
description:
|
|
206
|
+
"Ordinals/runes indexer health. Reports whether BTC_META_API_URL / vendor API keys are configured. Read-only.",
|
|
207
|
+
inputSchema: { type: "object", properties: {} },
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "btc_rune_balance",
|
|
211
|
+
description:
|
|
212
|
+
"Rune balances for a Bitcoin address (requires configured indexer + optional API key). Read-only.",
|
|
213
|
+
inputSchema: {
|
|
214
|
+
type: "object",
|
|
215
|
+
required: ["address"],
|
|
216
|
+
properties: { address: { type: "string" } },
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
name: "btc_inscriptions",
|
|
221
|
+
description:
|
|
222
|
+
"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.",
|
|
223
|
+
inputSchema: {
|
|
224
|
+
type: "object",
|
|
225
|
+
required: ["address"],
|
|
226
|
+
properties: { address: { type: "string" }, limit: { type: "number" } },
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: "btc_inscription_info",
|
|
231
|
+
description:
|
|
232
|
+
"Inscription metadata by inscription id (content type/length, height, sat, fee). KEYLESS via ordinals.com recursive. Read-only.",
|
|
233
|
+
inputSchema: {
|
|
234
|
+
type: "object",
|
|
235
|
+
required: ["inscriptionId"],
|
|
236
|
+
properties: {
|
|
237
|
+
inscriptionId: { type: "string", description: "<64-hex-txid>i<index>" },
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: "btc_inscription_children",
|
|
243
|
+
description:
|
|
244
|
+
"Child inscriptions of a parent (collections). KEYLESS via ordinals.com recursive. Read-only.",
|
|
245
|
+
inputSchema: {
|
|
246
|
+
type: "object",
|
|
247
|
+
required: ["inscriptionId"],
|
|
248
|
+
properties: {
|
|
249
|
+
inscriptionId: { type: "string", description: "<64-hex-txid>i<index>" },
|
|
250
|
+
page: { type: "number" },
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: "btc_ord_block_info",
|
|
256
|
+
description:
|
|
257
|
+
"Ord node block info / indexer tip. KEYLESS. Use to confirm the ordinals indexer is at the same tip as Esplora before trusting metaprotocol reads.",
|
|
258
|
+
inputSchema: {
|
|
259
|
+
type: "object",
|
|
260
|
+
properties: { height: { type: "number", description: "omit for current tip" } },
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
name: "satflow_health",
|
|
265
|
+
description:
|
|
266
|
+
"Satflow marketplace health (primary BTC ordinals/runes market after Magic Eden BTC sunset). Needs SATFLOW_API_KEY. Read-only.",
|
|
267
|
+
inputSchema: { type: "object", properties: {} },
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: "satflow_floors",
|
|
271
|
+
description: "Satflow collection floor prices. type=ordinals|runes. Read-only.",
|
|
272
|
+
inputSchema: {
|
|
273
|
+
type: "object",
|
|
274
|
+
properties: {
|
|
275
|
+
type: { type: "string", description: "ordinals or runes" },
|
|
276
|
+
ids: { type: "string", description: "optional comma-separated collection ids" },
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
name: "satflow_wallet",
|
|
282
|
+
description: "Satflow wallet contents (ordinals/runes) for an address. Read-only.",
|
|
283
|
+
inputSchema: {
|
|
284
|
+
type: "object",
|
|
285
|
+
required: ["address"],
|
|
286
|
+
properties: { address: { type: "string" }, type: { type: "string" }, limit: { type: "number" } },
|
|
287
|
+
},
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: "satflow_item",
|
|
291
|
+
description: "Satflow item detail for an inscription id (listing + bids + meta). Read-only.",
|
|
292
|
+
inputSchema: {
|
|
293
|
+
type: "object",
|
|
294
|
+
required: ["inscriptionId"],
|
|
295
|
+
properties: { inscriptionId: { type: "string" } },
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: "satflow_floor_listings",
|
|
300
|
+
description: "Satflow floor listings for collection id(s). Read-only.",
|
|
301
|
+
inputSchema: {
|
|
302
|
+
type: "object",
|
|
303
|
+
required: ["collectionIds"],
|
|
304
|
+
properties: { collectionIds: { type: "string" }, limit: { type: "number" } },
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
name: "best_swap_route",
|
|
309
|
+
description:
|
|
310
|
+
"Compare swap routes across every available aggregator and rank by NET output " +
|
|
311
|
+
"(after gas and fees), not headline quote. Returns the winner plus all " +
|
|
312
|
+
"runners-up so the ranking can be checked rather than trusted.",
|
|
313
|
+
inputSchema: {
|
|
314
|
+
type: "object",
|
|
315
|
+
properties: {
|
|
316
|
+
chainId: { type: "number", description: "EVM chain id, e.g. 8453 for Base" },
|
|
317
|
+
tokenIn: { type: "string", description: "sell token address" },
|
|
318
|
+
tokenOut: { type: "string", description: "buy token address" },
|
|
319
|
+
amountIn: { type: "string", description: "raw units of tokenIn (wei-scale)" },
|
|
320
|
+
taker: { type: "string", description: "address used for quoting only; nothing is signed" },
|
|
321
|
+
decimalsIn: { type: "number" },
|
|
322
|
+
decimalsOut: { type: "number" },
|
|
323
|
+
},
|
|
324
|
+
required: ["chainId", "tokenIn", "tokenOut", "amountIn"],
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
name: "best_bridge_route",
|
|
329
|
+
description:
|
|
330
|
+
"Compare cross-chain bridge routes and rank by NET output. Also reports each " +
|
|
331
|
+
"route's expected duration, which is NOT folded into the score -- a route that " +
|
|
332
|
+
"saves $2 but takes 30 minutes is a trade-off for the caller to make.",
|
|
333
|
+
inputSchema: {
|
|
334
|
+
type: "object",
|
|
335
|
+
properties: {
|
|
336
|
+
fromChainId: { type: "number" },
|
|
337
|
+
toChainId: { type: "number" },
|
|
338
|
+
tokenIn: { type: "string", description: "token on the origin chain" },
|
|
339
|
+
tokenOut: { type: "string", description: "token on the destination chain" },
|
|
340
|
+
amountIn: { type: "string", description: "raw units of tokenIn" },
|
|
341
|
+
taker: { type: "string", description: "address used for quoting only" },
|
|
342
|
+
decimalsOut: { type: "number" },
|
|
343
|
+
},
|
|
344
|
+
required: ["fromChainId", "toChainId", "tokenIn", "tokenOut", "amountIn"],
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
name: "prepare_best_route",
|
|
349
|
+
description:
|
|
350
|
+
"Compare routes, then build the SIGNABLE artifact for the winner. Returns an " +
|
|
351
|
+
"unsigned transaction (LI.FI/ParaSwap/0x) or EIP-712 typed data for an " +
|
|
352
|
+
"off-chain order (CoW) -- the artifactKind field says which, and they require " +
|
|
353
|
+
"different wallet actions. Re-quotes before preparing and reports drift " +
|
|
354
|
+
"against the comparison. Never signs or broadcasts.",
|
|
355
|
+
inputSchema: {
|
|
356
|
+
type: "object",
|
|
357
|
+
properties: {
|
|
358
|
+
chainId: { type: "number" },
|
|
359
|
+
tokenIn: { type: "string" },
|
|
360
|
+
tokenOut: { type: "string" },
|
|
361
|
+
amountIn: { type: "string", description: "raw units of tokenIn" },
|
|
362
|
+
taker: {
|
|
363
|
+
type: "string",
|
|
364
|
+
description:
|
|
365
|
+
"the REAL wallet that will sign. Placeholder/burn addresses are rejected: " +
|
|
366
|
+
"quoting is anonymous, preparing is not.",
|
|
367
|
+
},
|
|
368
|
+
decimalsIn: { type: "number" },
|
|
369
|
+
decimalsOut: { type: "number" },
|
|
370
|
+
source: {
|
|
371
|
+
type: "string",
|
|
372
|
+
description: "force a specific source instead of the winner (flagged in the result)",
|
|
373
|
+
},
|
|
374
|
+
driftToleranceBps: { type: "number", description: "default 100" },
|
|
375
|
+
},
|
|
376
|
+
required: ["chainId", "tokenIn", "tokenOut", "amountIn", "taker"],
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
name: "prepare_best_bridge_route",
|
|
381
|
+
description:
|
|
382
|
+
"Compare cross-chain bridge routes, then build the signable transaction " +
|
|
383
|
+
"sequence for the winner. Returns a LIST of unsigned transactions -- some " +
|
|
384
|
+
"routes need an approval and a deposit signed in order, and signing only the " +
|
|
385
|
+
"first leaves funds approved but not bridged. Reports the destination chain " +
|
|
386
|
+
"and expected credit time. Bridging is not atomic. Never signs or broadcasts.",
|
|
387
|
+
inputSchema: {
|
|
388
|
+
type: "object",
|
|
389
|
+
properties: {
|
|
390
|
+
fromChainId: { type: "number" },
|
|
391
|
+
toChainId: { type: "number" },
|
|
392
|
+
tokenIn: { type: "string", description: "token on the origin chain" },
|
|
393
|
+
tokenOut: { type: "string", description: "token on the destination chain" },
|
|
394
|
+
amountIn: { type: "string", description: "raw units of tokenIn" },
|
|
395
|
+
taker: { type: "string", description: "the REAL wallet that will sign; placeholders rejected" },
|
|
396
|
+
source: { type: "string", description: "force a source instead of the winner" },
|
|
397
|
+
driftToleranceBps: { type: "number", description: "default 100" },
|
|
398
|
+
},
|
|
399
|
+
required: ["fromChainId", "toChainId", "tokenIn", "tokenOut", "amountIn", "taker"],
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
];
|
|
403
|
+
|
|
404
|
+
// Named tool -> { provider, op, argMap(args) }
|
|
405
|
+
//
|
|
406
|
+
// A default address for read tools (rpc_balance, lifi fromAddress) is read from env
|
|
407
|
+
// and is entirely optional. When unset, those tools require an explicit address --
|
|
408
|
+
// which is the correct default for a public tool: silently substituting SOMEONE'S
|
|
409
|
+
// wallet would both leak whose it is and quote routes against the wrong balances.
|
|
410
|
+
const DEFAULT_ADDRESS = String(
|
|
411
|
+
process.env.ORACLE_DEFAULT_ADDRESS || process.env.MAD_OPERATOR_ADDRESS || "",
|
|
412
|
+
).trim();
|
|
413
|
+
const ROUTES = {
|
|
414
|
+
llama_protocols: () => ({ provider: "defillama", op: "protocols", args: {} }),
|
|
415
|
+
llama_prices: (a) => ({ provider: "defillama", op: "prices", args: { coins: a.coins } }),
|
|
416
|
+
dex_search: (a) => ({ provider: "dexscreener", op: "search", args: { q: a.q } }),
|
|
417
|
+
dex_token: (a) => ({ provider: "dexscreener", op: "token", args: { address: a.address } }),
|
|
418
|
+
lifi_quote: (a) => ({
|
|
419
|
+
provider: "lifi",
|
|
420
|
+
op: "quote",
|
|
421
|
+
args: {
|
|
422
|
+
fromChain: a.fromChain,
|
|
423
|
+
toChain: a.toChain,
|
|
424
|
+
fromToken: a.fromToken,
|
|
425
|
+
toToken: a.toToken,
|
|
426
|
+
fromAmount: a.fromAmount,
|
|
427
|
+
fromAddress: a.fromAddress || DEFAULT_ADDRESS || undefined,
|
|
428
|
+
},
|
|
429
|
+
}),
|
|
430
|
+
rpc_balance: (a) => {
|
|
431
|
+
const addr = a.address || DEFAULT_ADDRESS;
|
|
432
|
+
if (!addr) throw new Error("address required (set ORACLE_DEFAULT_ADDRESS to supply a default)");
|
|
433
|
+
return { provider: "evm-rpc", op: "getBalance", args: { chainId: a.chainId, address: addr } };
|
|
434
|
+
},
|
|
435
|
+
rpc_block: (a) => ({ provider: "evm-rpc", op: "blockNumber", args: { chainId: a.chainId } }),
|
|
436
|
+
solana_balance: (a) => ({ provider: "solana-rpc", op: "getBalance", args: { address: a.address, commitment: a.commitment } }),
|
|
437
|
+
solana_token_accounts: (a) => ({ provider: "solana-rpc", op: "tokenAccounts", args: { owner: a.owner, mint: a.mint, commitment: a.commitment } }),
|
|
438
|
+
solana_simulate: (a) => ({ provider: "solana-rpc", op: "simulate", args: { transaction: a.transaction, sigVerify: a.sigVerify, replaceRecentBlockhash: a.replaceRecentBlockhash } }),
|
|
439
|
+
jupiter_quote: (a) => ({ provider: "jupiter", op: "quote", args: { inputMint: a.inputMint, outputMint: a.outputMint, amount: a.amount, slippageBps: a.slippageBps } }),
|
|
440
|
+
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 } }),
|
|
441
|
+
btc_health: () => ({ provider: "bitcoin-esplora", op: "health", args: {} }),
|
|
442
|
+
btc_fees: () => ({ provider: "bitcoin-esplora", op: "fees", args: {} }),
|
|
443
|
+
btc_balance: (a) => ({ provider: "bitcoin-esplora", op: "address", args: { address: a.address } }),
|
|
444
|
+
btc_utxos: (a) => ({ provider: "bitcoin-esplora", op: "utxos", args: { address: a.address } }),
|
|
445
|
+
btc_tx: (a) => ({ provider: "bitcoin-esplora", op: "tx", args: { txid: a.txid } }),
|
|
446
|
+
btc_meta_health: () => ({ provider: "bitcoin-meta", op: "health", args: {} }),
|
|
447
|
+
btc_rune_balance: (a) => ({ provider: "bitcoin-meta", op: "runeBalances", args: { address: a.address } }),
|
|
448
|
+
btc_inscriptions: (a) => ({
|
|
449
|
+
provider: "bitcoin-meta",
|
|
450
|
+
op: "inscriptions",
|
|
451
|
+
args: { address: a.address, limit: a.limit },
|
|
452
|
+
}),
|
|
453
|
+
btc_inscription_info: (a) => ({
|
|
454
|
+
provider: "bitcoin-meta",
|
|
455
|
+
op: "inscriptionInfo",
|
|
456
|
+
args: { inscriptionId: a.inscriptionId },
|
|
457
|
+
}),
|
|
458
|
+
btc_inscription_children: (a) => ({
|
|
459
|
+
provider: "bitcoin-meta",
|
|
460
|
+
op: "inscriptionChildren",
|
|
461
|
+
args: { inscriptionId: a.inscriptionId, page: a.page },
|
|
462
|
+
}),
|
|
463
|
+
btc_ord_block_info: (a) => ({
|
|
464
|
+
provider: "bitcoin-meta",
|
|
465
|
+
op: "ordBlockInfo",
|
|
466
|
+
args: { height: a.height },
|
|
467
|
+
}),
|
|
468
|
+
satflow_health: () => ({ provider: "satflow", op: "health", args: {} }),
|
|
469
|
+
satflow_floors: (a) => ({
|
|
470
|
+
provider: "satflow",
|
|
471
|
+
op: "collectionFloors",
|
|
472
|
+
args: { type: a.type, ids: a.ids },
|
|
473
|
+
}),
|
|
474
|
+
satflow_wallet: (a) => ({
|
|
475
|
+
provider: "satflow",
|
|
476
|
+
op: "walletContents",
|
|
477
|
+
args: { address: a.address, type: a.type, limit: a.limit },
|
|
478
|
+
}),
|
|
479
|
+
satflow_item: (a) => ({
|
|
480
|
+
provider: "satflow",
|
|
481
|
+
op: "item",
|
|
482
|
+
args: { inscriptionId: a.inscriptionId || a.id },
|
|
483
|
+
}),
|
|
484
|
+
satflow_floor_listings: (a) => ({
|
|
485
|
+
provider: "satflow",
|
|
486
|
+
op: "floorListings",
|
|
487
|
+
args: { collectionIds: a.collectionIds || a.ids, limit: a.limit },
|
|
488
|
+
}),
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
function send(message) {
|
|
492
|
+
process.stdout.write(`${JSON.stringify(message)}\n`);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function error(id, code, message) {
|
|
496
|
+
send({ jsonrpc: "2.0", id, error: { code, message } });
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
async function httpJson(url, { method = "GET", body } = {}) {
|
|
500
|
+
const res = await fetch(url, {
|
|
501
|
+
method,
|
|
502
|
+
headers: { "content-type": "application/json" },
|
|
503
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
504
|
+
});
|
|
505
|
+
const data = await res.json().catch(() => ({}));
|
|
506
|
+
if (!res.ok) throw new Error(data.error || `HTTP ${res.status}`);
|
|
507
|
+
return data;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
async function deskCall(provider, op, args = {}) {
|
|
511
|
+
return httpJson(`${DATA_URL}/data/call`, {
|
|
512
|
+
method: "POST",
|
|
513
|
+
body: { provider, op, args },
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
async function callTool(name, args = {}) {
|
|
518
|
+
// Routing runs IN-PROCESS rather than through the desk HTTP server. The router
|
|
519
|
+
// fans out to several aggregators itself, so proxying it through /data/call would
|
|
520
|
+
// add a hop and a second timeout budget for no benefit -- and it means routing
|
|
521
|
+
// works without a desk server running at all.
|
|
522
|
+
if (name === "best_swap_route" || name === "best_bridge_route") {
|
|
523
|
+
const { bestSwapRoute, bestBridgeRoute } = await import("../src/router/index.mjs");
|
|
524
|
+
return name === "best_swap_route" ? bestSwapRoute(args) : bestBridgeRoute(args);
|
|
525
|
+
}
|
|
526
|
+
if (name === "prepare_best_route") {
|
|
527
|
+
const { prepareBestRoute } = await import("../src/router/prepare-route.mjs");
|
|
528
|
+
return prepareBestRoute(args);
|
|
529
|
+
}
|
|
530
|
+
if (name === "prepare_best_bridge_route") {
|
|
531
|
+
const { prepareBestBridgeRoute } = await import("../src/router/prepare-bridge.mjs");
|
|
532
|
+
return prepareBestBridgeRoute(args);
|
|
533
|
+
}
|
|
534
|
+
if (name === "data_catalog") return httpJson(`${DATA_URL}/data/catalog`);
|
|
535
|
+
if (name === "data_health") return httpJson(`${DATA_URL}/data/health`);
|
|
536
|
+
if (name === "data_call") {
|
|
537
|
+
if (!args.provider || !args.op) throw new Error("provider and op are required");
|
|
538
|
+
return deskCall(args.provider, args.op, args.args || {});
|
|
539
|
+
}
|
|
540
|
+
const route = ROUTES[name];
|
|
541
|
+
if (route) {
|
|
542
|
+
const { provider, op, args: mapped } = route(args);
|
|
543
|
+
return deskCall(provider, op, mapped);
|
|
544
|
+
}
|
|
545
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
async function handle(request) {
|
|
549
|
+
const { id, method, params } = request;
|
|
550
|
+
if (method === "initialize") {
|
|
551
|
+
send({
|
|
552
|
+
jsonrpc: "2.0",
|
|
553
|
+
id,
|
|
554
|
+
result: {
|
|
555
|
+
protocolVersion: params?.protocolVersion || "2024-11-05",
|
|
556
|
+
capabilities: { tools: {} },
|
|
557
|
+
serverInfo: { name: "oracle-data-mcp", version: "0.1.0" },
|
|
558
|
+
},
|
|
559
|
+
});
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
if (method === "notifications/initialized") return;
|
|
563
|
+
if (method === "tools/list") {
|
|
564
|
+
send({ jsonrpc: "2.0", id, result: { tools } });
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
if (method === "tools/call") {
|
|
568
|
+
try {
|
|
569
|
+
const result = await callTool(params?.name, params?.arguments || {});
|
|
570
|
+
send({ jsonrpc: "2.0", id, result: { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] } });
|
|
571
|
+
} catch (err) {
|
|
572
|
+
send({ jsonrpc: "2.0", id, result: { isError: true, content: [{ type: "text", text: err.message }] } });
|
|
573
|
+
}
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (id !== undefined) error(id, -32601, `Method not found: ${method}`);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
let buffer = "";
|
|
580
|
+
|
|
581
|
+
function startStdioLoop() {
|
|
582
|
+
process.stdin.setEncoding("utf8");
|
|
583
|
+
process.stdin.on("data", (chunk) => {
|
|
584
|
+
buffer += chunk;
|
|
585
|
+
let index;
|
|
586
|
+
while ((index = buffer.indexOf("\n")) >= 0) {
|
|
587
|
+
const line = buffer.slice(0, index).trim();
|
|
588
|
+
buffer = buffer.slice(index + 1);
|
|
589
|
+
if (!line) continue;
|
|
590
|
+
try {
|
|
591
|
+
void handle(JSON.parse(line));
|
|
592
|
+
} catch (err) {
|
|
593
|
+
error(null, -32700, err.message);
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
600
|
+
startStdioLoop();
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export { tools, callTool, handle };
|