@arcadia-finance/mcp-server 0.3.3 → 0.3.5

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 (41) hide show
  1. package/README.md +3 -2
  2. package/dist/config/addresses.js +55 -3
  3. package/dist/config/chains.js +10 -2
  4. package/dist/index.js +1 -1
  5. package/dist/tools/dev/send.js +4 -2
  6. package/dist/tools/read/account.js +5 -4
  7. package/dist/tools/read/asset-managers.js +9 -2
  8. package/dist/tools/read/assets.js +3 -2
  9. package/dist/tools/read/pools.js +3 -2
  10. package/dist/tools/read/strategy.js +27 -5
  11. package/dist/tools/read/wallet.js +4 -3
  12. package/dist/tools/write/account/add-liquidity.js +2 -1
  13. package/dist/tools/write/account/borrow.js +2 -1
  14. package/dist/tools/write/account/close.js +2 -1
  15. package/dist/tools/write/account/create.js +2 -1
  16. package/dist/tools/write/account/deleverage.js +2 -1
  17. package/dist/tools/write/account/deposit.js +2 -1
  18. package/dist/tools/write/account/format-response.js +17 -5
  19. package/dist/tools/write/account/remove-liquidity.js +2 -1
  20. package/dist/tools/write/account/repay.js +2 -1
  21. package/dist/tools/write/account/stake.js +2 -1
  22. package/dist/tools/write/account/swap.js +2 -1
  23. package/dist/tools/write/account/withdraw.js +2 -1
  24. package/dist/tools/write/asset-managers/compounder.js +6 -4
  25. package/dist/tools/write/asset-managers/merkl-operator.js +2 -1
  26. package/dist/tools/write/asset-managers/rebalancer.js +2 -1
  27. package/dist/tools/write/asset-managers/set-asset-managers.js +2 -1
  28. package/dist/tools/write/asset-managers/shared.js +4 -0
  29. package/dist/tools/write/asset-managers/yield-claimer.js +6 -4
  30. package/dist/tools/write/wallet/approve.js +2 -1
  31. package/dist/utils/validation.js +2 -2
  32. package/llms-full.txt +35 -35
  33. package/llms.txt +2 -2
  34. package/package.json +5 -2
  35. package/server.json +9 -3
  36. package/skills/clamm-liquidity/SKILL.md +31 -4
  37. package/skills/openclaw/SKILL.md +39 -19
  38. package/skills/openclaw/arcadia.sh +101 -0
  39. package/skills/openclaw/contracts.md +20 -2
  40. package/skills/openclaw/wallet-signing.md +2 -22
  41. package/skills/openclaw/arcadia.mjs +0 -49
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  [![MCP Badge](https://lobehub.com/badge/mcp/arcadia-finance-mcp-server)](https://lobehub.com/mcp/arcadia-finance-mcp-server)
10
10
  [![arcadia-finance-mcp-server MCP server](https://glama.ai/mcp/servers/arcadia-finance/arcadia-finance-mcp-server/badges/score.svg)](https://glama.ai/mcp/servers/arcadia-finance/arcadia-finance-mcp-server)
11
11
 
12
- MCP server for [Arcadia Finance](https://arcadia.finance), a platform to manage Uniswap and Aerodrome concentrated liquidity positions with built-in leverage, automated rebalancing, and yield optimization. Read protocol data and build unsigned transactions for LP management, borrowing, deposits, and more.
12
+ MCP server for [Arcadia Finance](https://arcadia.finance), a platform to manage concentrated liquidity positions on Uniswap and Aerodrome with automated rebalancing, compounding, yield optimization, and leverage. Read protocol data and build unsigned transactions for LP management, borrowing, deposits, and more.
13
13
 
14
14
  Designed for AI agents (Claude, Cursor, etc.) to interact with Arcadia onchain.
15
15
 
@@ -138,13 +138,14 @@ yarn build
138
138
  | ------------------ | -------- | ----------------------------- | --------- | -------------------------------------------------------------- |
139
139
  | `RPC_URL_BASE` | No | Public RPC | Both | RPC URL for Base (8453). |
140
140
  | `RPC_URL_UNICHAIN` | No | Public RPC | Both | RPC URL for Unichain (130). |
141
+ | `RPC_URL_OPTIMISM` | No | Public RPC | Both | RPC URL for Optimism (10). |
141
142
  | `PK` | No | — | Both | Private key (hex) for dev-only `dev.send` tool. |
142
143
  | `TRANSPORT` | No | `stdio` | — | Transport mode: `stdio` or `http`. |
143
144
  | `PORT` | No | `3000` | HTTP | Listen port for HTTP transport. |
144
145
  | `ALLOWED_ORIGINS` | No | `https://mcp.arcadia.finance` | HTTP | Comma-separated allowed Origin headers (CORS / DNS rebinding). |
145
146
  | `RATE_LIMIT_RPM` | No | `60` | HTTP | Max requests per minute per session. |
146
147
 
147
- **Supported chains:** Base (8453), Unichain (130)
148
+ **Supported chains:** Base (8453), Unichain (130), Optimism (10)
148
149
 
149
150
  ## MCP Client Configuration
150
151
 
@@ -11,10 +11,13 @@ export const PROTOCOL = {
11
11
  uniswapV4AM: "0xb808971ea73341b0d7286B3D67F08De321f80465",
12
12
  slipstreamAM: "0xd3A7055bBcDA4F8F49e5c5dE7E83B09a33633F44",
13
13
  slipstreamV2AM: "0x3aDE1F1FdC666B1bFAd376345EA878D1c11EB73B",
14
+ slipstreamV3AM: "0xcaf4167dE878Cfb23D9912b1ff5869F2b3527189",
14
15
  wrappedAeroAM: "0x17B5826382e3a5257b829cF0546A08Bd77409270",
15
16
  stakedAeroAM: "0x9f42361B7602Df1A8Ae28Bf63E6cb1883CD44C27",
16
17
  stakedSlipstreamAM: "0x1Dc7A0f5336F52724B650E39174cfcbbEdD67bF1",
17
18
  stakedSlipstreamV2AM: "0xBed6C3E35B9B1e044b3Bc71465769EdFDC0FDD4c",
19
+ stakedSlipstreamV3AM: "0xE0F20BE5886F11CbcD2cb5bA9987Bcbbf1d8ca7b",
20
+ wrappedStakedSlipstreamV3: "0x9189BC25f8faC157B4D87b0b3c14F56bA1477d53",
18
21
  alienBaseAM: "0x79dD8b8d4abB5dEEA986DB1BF0a02E4CA42ae416",
19
22
  gaugeHelper: "0x2feb44C740eB4e64aDE33E0D44Ef30049Fb06CC5",
20
23
  clHelper: "0x1496Bd3502DE0Dd5b1D44E16623cCc5118771117",
@@ -25,6 +28,10 @@ export const POOLS = {
25
28
  LP_USDC: "0x3ec4a293Fb906DD2Cd440c20dECB250DeF141dF1",
26
29
  LP_CBBTC: "0xa37E9b4369dc20940009030BfbC2088F09645e3B",
27
30
  },
31
+ 10: {
32
+ LP_WETH: "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2",
33
+ LP_USDC: "0x3ec4a293Fb906DD2Cd440c20dECB250DeF141dF1",
34
+ },
28
35
  };
29
36
  export const TRANCHES = {
30
37
  8453: {
@@ -32,6 +39,10 @@ export const TRANCHES = {
32
39
  sr_USDC: "0xEFE32813dBA3A783059d50e5358b9e3661218daD",
33
40
  sr_CBBTC: "0x9c63A4c499B323a25D389Da759c2ac1e385eEc92",
34
41
  },
42
+ 10: {
43
+ sr_WETH: "0x393893caeB06B5C16728bb1E354b6c36942b1382",
44
+ sr_USDC: "0xEFE32813dBA3A783059d50e5358b9e3661218daD",
45
+ },
35
46
  };
36
47
  export const TOKENS = {
37
48
  8453: {
@@ -42,24 +53,35 @@ export const TOKENS = {
42
53
  AAA: { address: "0xaaa843fb2916c0B57454270418E121C626402AAa", decimals: 18 },
43
54
  stAAA: { address: "0xDeA1531d8a1505785eb517C7A28526443df223F3", decimals: 18 },
44
55
  },
56
+ 10: {
57
+ WETH: { address: "0x4200000000000000000000000000000000000006", decimals: 18 },
58
+ USDC: { address: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", decimals: 6 },
59
+ OP: { address: "0x4200000000000000000000000000000000000042", decimals: 18 },
60
+ VELO: { address: "0x9560e827aF36c94D2Ac33a39bCE1Fe78631088Db", decimals: 18 },
61
+ WBTC: { address: "0x68f180fcCe6836688e9084f035309E29Bf0A2095", decimals: 8 },
62
+ WSTETH: { address: "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb", decimals: 18 },
63
+ },
45
64
  };
46
65
  // Single source of truth — all addresses, no chain dimension
47
66
  const AM_ADDRESSES = {
48
67
  rebalancers: {
49
68
  slipstreamV1: "0x5802454749cc0c4A6F28D5001B4cD84432e2b79F",
50
69
  slipstreamV2: "0x953Ff365d0b562ceC658dc46B394E9282338d9Ea",
70
+ slipstreamV3: "0x37c6258aEe125d520B6f03fc2cb490955050D557",
51
71
  uniV3: "0xbA1D0c99c261F94b9C8b52465890Cca27dd993Bd",
52
72
  uniV4: "0x01EDaF0067a10D18c88D2876c0A85Ee0096a5Ac0",
53
73
  },
54
74
  compounders: {
55
75
  slipstreamV1: "0x467837f44A71e3eAB90AEcfC995c84DC6B3cfCF7",
56
76
  slipstreamV2: "0x35e59448C7145482E56212510cC689612AB4F61f",
77
+ slipstreamV3: "0xd42A3Ac56456bD5422835B36C35Cacb6448ddCd9",
57
78
  uniV3: "0x02e1fa043214E51eDf1F0478c6D0d3D5658a2DC3",
58
79
  uniV4: "0xAA95c9c402b195D8690eCaea2341a76e3266B189",
59
80
  },
60
81
  yieldClaimers: {
61
82
  slipstreamV1: "0x5a8278D37b7a787574b6Aa7E18d8C02D994f18Ba",
62
83
  slipstreamV2: "0xc8bF4B2c740FF665864E9494832520f18822871C",
84
+ slipstreamV3: "0x8c1Fbf38118fD5A704b6E7babcB7AF1a9A291980",
63
85
  uniV3: "0x75Ed28EA8601Ce9F5FbcAB1c2428f04A57aFaA16",
64
86
  uniV4: "0xD8aa21AB7f9B8601CB7d7A776D3AFA1602d5D8D4",
65
87
  },
@@ -67,26 +89,32 @@ const AM_ADDRESSES = {
67
89
  gasRelayer: "0xD938C8d04cF91094fecAF0A2018EAac483a40137",
68
90
  cowSwapper: "0xc928013A219EC9F18dE7B2dee6A50Ba626811854",
69
91
  };
70
- // Per-chain availability — update these when deploying to new chains
92
+ // Per-chain availability — update these when deploying to new chains.
93
+ // Slipstream V3 position manager is only live on Base; Unichain and Optimism have V1 only.
71
94
  const CHAIN_PROTOCOLS = {
72
- 8453: new Set(["slipstreamV1", "slipstreamV2", "uniV3", "uniV4"]),
95
+ 8453: new Set(["slipstreamV1", "slipstreamV2", "slipstreamV3", "uniV3", "uniV4"]),
73
96
  130: new Set(["slipstreamV1", "uniV3", "uniV4"]),
97
+ 10: new Set(["slipstreamV1", "uniV3", "uniV4"]),
74
98
  };
75
99
  const CHAIN_STANDALONE_AMS = {
76
100
  8453: new Set(["merklOperator", "gasRelayer", "cowSwapper"]),
77
101
  130: new Set(["merklOperator", "gasRelayer"]),
102
+ 10: new Set(["merklOperator", "gasRelayer"]),
78
103
  };
79
- const CHAIN_NAMES = { 8453: "Base", 130: "Unichain" };
104
+ const CHAIN_NAMES = { 8453: "Base", 130: "Unichain", 10: "Optimism" };
80
105
  // Map LP asset names → dex_protocol values
81
106
  const LP_NAME_TO_POOL_PROTOCOL = {
82
107
  UniV3: "uniV3",
83
108
  UniV4: "uniV4",
84
109
  slipstream: "slipstream",
85
110
  slipstream_v2: "slipstream_v2",
111
+ slipstream_v3: "slipstream_v3",
86
112
  "Staked Slipstream": "staked_slipstream",
87
113
  "Staked Slipstream V2": "staked_slipstream_v2",
114
+ "Staked Slipstream V3": "staked_slipstream_v3",
88
115
  "Wrapped Staked Slipstream": "staked_slipstream",
89
116
  "Wrapped Staked Slipstream V2": "staked_slipstream_v2",
117
+ "Wrapped Staked Slipstream V3": "staked_slipstream_v3",
90
118
  "Wrapped Aerodrome": "slipstream",
91
119
  "Staked Aerodrome": "staked_slipstream",
92
120
  };
@@ -97,9 +125,24 @@ export function lpNameToPoolProtocol(name) {
97
125
  export const AM_KEY_TO_POOL_PROTOCOL = {
98
126
  slipstreamV1: "slipstream",
99
127
  slipstreamV2: "slipstream_v2",
128
+ slipstreamV3: "slipstream_v3",
100
129
  uniV3: "uniV3",
101
130
  uniV4: "uniV4",
102
131
  };
132
+ // User-facing dex_protocol values available on a chain. Slipstream AMs are
133
+ // shared between plain and staked pools, so each slipstreamV* on a chain
134
+ // contributes both `slipstream_vN` and `staked_slipstream_vN`.
135
+ export function getChainDexProtocols(chainId) {
136
+ const values = [];
137
+ for (const protocol of CHAIN_PROTOCOLS[chainId]) {
138
+ const base = AM_KEY_TO_POOL_PROTOCOL[protocol];
139
+ values.push(base);
140
+ if (protocol.startsWith("slipstream")) {
141
+ values.push(base.replace(/^slipstream/, "staked_slipstream"));
142
+ }
143
+ }
144
+ return values;
145
+ }
103
146
  export function getAmProtocolAddress(chainId, category, protocol) {
104
147
  if (!CHAIN_PROTOCOLS[chainId].has(protocol)) {
105
148
  const available = [...CHAIN_PROTOCOLS[chainId]]
@@ -162,6 +205,7 @@ export const MINIMAL_STRATEGY_HOOK = "0x13beD1A58d87c0454872656c5328103aAe5eB86A
162
205
  export const STATE_VIEWERS = {
163
206
  8453: "0xA3c0c9b65baD0b08107Aa264b0f3dB444b867A71",
164
207
  130: "0x86e8631A016F9068C3f085fAF484Ee3F5fDee8f2",
208
+ 10: "0xc18a3169788F4f75A170290584ecA6395C75Ecdb",
165
209
  };
166
210
  // LP position manager address (lowercase) → dex_protocol value
167
211
  // Chain-specific: non-staked LP position manager addresses differ per chain
@@ -169,6 +213,7 @@ export const CHAIN_POSITION_MANAGERS = {
169
213
  8453: {
170
214
  "0x827922686190790b37229fd06084350e74485b72": "slipstream",
171
215
  "0xa990c6a764b73bf43cee5bb40339c3322fb9d55f": "slipstream_v2",
216
+ "0xe1f8cd9ac4e4a65f54f38a5cdafca44f6dd68b53": "slipstream_v3",
172
217
  "0x03a520b32c04bf3beef7beb72e919cf822ed34f1": "uniV3",
173
218
  "0x7c5f5a4bbd8fd63184577525326123b519429bdc": "uniV4",
174
219
  },
@@ -177,11 +222,18 @@ export const CHAIN_POSITION_MANAGERS = {
177
222
  "0x943e6e07a7e8e791dafc44083e54041d743c46e9": "uniV3",
178
223
  "0x4529a01c7a0410167c5740c487a8de60232617bf": "uniV4",
179
224
  },
225
+ 10: {
226
+ "0x416b433906b1b72fa758e166e239c43d68dc6f29": "slipstream", // Velodrome Slipstream V1
227
+ "0xc36442b4a4522e871399cd717abdd847ab11fe88": "uniV3",
228
+ "0x3c3ea4b57a46241e54610e5f022e5c45859a1017": "uniV4",
229
+ },
180
230
  };
181
231
  // Universal staked/wrapped-staked position manager addresses (same on all chains)
182
232
  export const UNIVERSAL_POSITION_MANAGERS = {
183
233
  "0x1dc7a0f5336f52724b650e39174cfcbbedd67bf1": "staked_slipstream", // StakedSlipstreamAM V1
184
234
  "0xbed6c3e35b9b1e044b3bc71465769edfdc0fdd4c": "staked_slipstream_v2", // StakedSlipstreamAM V2
235
+ "0xe0f20be5886f11cbcd2cb5ba9987bcbbf1d8ca7b": "staked_slipstream_v3", // StakedSlipstreamAM V3
185
236
  "0xd74339e0f10fce96894916b93e5cc7de89c98272": "staked_slipstream", // WrappedStakedSlipstream V1
186
237
  "0x147a2ccbaf4521ad209a2875ae0b3c496f4b25a4": "staked_slipstream_v2", // WrappedStakedSlipstream V2
238
+ "0x9189bc25f8fac157b4d87b0b3c14f56ba1477d53": "staked_slipstream_v3", // WrappedStakedSlipstream V3
187
239
  };
@@ -1,4 +1,6 @@
1
- export const SUPPORTED_CHAIN_IDS = [8453, 130];
1
+ export const SUPPORTED_CHAIN_IDS = [8453, 130, 10];
2
+ export const CHAIN_ID_DESCRIPTION = "Chain ID: 8453 (Base), 130 (Unichain), or 10 (Optimism)";
3
+ export const SUPPORTED_CHAINS_ERROR = "Supported chains: Base (8453), Unichain (130), and Optimism (10)";
2
4
  export function getChainConfigs() {
3
5
  return {
4
6
  8453: {
@@ -13,12 +15,18 @@ export function getChainConfigs() {
13
15
  rpcUrl: process.env.RPC_URL_UNICHAIN ?? "https://mainnet.unichain.org",
14
16
  stateViewer: "0x86e8631A016F9068C3f085fAF484Ee3F5fDee8f2",
15
17
  },
18
+ 10: {
19
+ name: "optimism",
20
+ chainId: 10,
21
+ rpcUrl: process.env.RPC_URL_OPTIMISM ?? "https://mainnet.optimism.io",
22
+ stateViewer: "0xc18a3169788F4f75A170290584ecA6395C75Ecdb",
23
+ },
16
24
  };
17
25
  }
18
26
  export function resolveChainId(input) {
19
27
  const id = typeof input === "string" ? parseInt(input, 10) : input;
20
28
  if (!SUPPORTED_CHAIN_IDS.includes(id)) {
21
- throw new Error(`Unsupported chain_id: ${id}. Supported chains: Base (8453) and Unichain (130).`);
29
+ throw new Error(`Unsupported chain_id: ${id}. ${SUPPORTED_CHAINS_ERROR}.`);
22
30
  }
23
31
  return id;
24
32
  }
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ function createServer(options) {
24
24
  const server = new McpServer({
25
25
  name: "arcadia-finance",
26
26
  version: pkg.version,
27
- description: "Arcadia Finance. Manage concentrated liquidity positions with leverage, automated rebalancing, and yield optimization on Base and Unichain.",
27
+ description: "Arcadia Finance. Manage concentrated liquidity positions on Uniswap and Aerodrome with automated rebalancing, compounding, yield optimization, and leverage. Base and Unichain.",
28
28
  });
29
29
  const registrationTarget = options?.httpMode ? wrapServerForHttp(server) : server;
30
30
  registerAllTools(registrationTarget, apiClient, chainConfigs);
@@ -1,12 +1,14 @@
1
1
  import { z } from "zod";
2
2
  import { createWalletClient, createPublicClient, http } from "viem";
3
3
  import { privateKeyToAccount } from "viem/accounts";
4
- import { base, unichain } from "viem/chains";
4
+ import { base, optimism, unichain } from "viem/chains";
5
+ import { CHAIN_ID_DESCRIPTION } from "../../config/chains.js";
5
6
  import { DevSendOutput } from "../output-schemas.js";
6
7
  import { validateAddress } from "../../utils/validation.js";
7
8
  const VIEM_CHAINS = {
8
9
  8453: base,
9
10
  130: unichain,
11
+ 10: optimism,
10
12
  };
11
13
  export function registerSendTool(server, chains) {
12
14
  server.registerTool("dev.send", {
@@ -23,7 +25,7 @@ export function registerSendTool(server, chains) {
23
25
  to: z.string().describe("Target contract address"),
24
26
  data: z.string().describe("Encoded calldata (hex)"),
25
27
  value: z.string().default("0").describe("Value in wei (default '0')"),
26
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
28
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
27
29
  },
28
30
  }, async (params) => {
29
31
  try {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { CHAIN_ID_DESCRIPTION } from "../../config/chains.js";
2
3
  import { accountAbi } from "../../abis/index.js";
3
4
  import { getPublicClient } from "../../clients/chain.js";
4
5
  import { getChainAmChecks, AM_KEY_TO_POOL_PROTOCOL, CHAIN_POSITION_MANAGERS, UNIVERSAL_POSITION_MANAGERS, } from "../../config/addresses.js";
@@ -61,10 +62,10 @@ export function registerAccountTools(server, api, chains) {
61
62
  idempotentHint: true,
62
63
  openWorldHint: true,
63
64
  },
64
- description: "Get full overview of an Arcadia account: health factor, collateral value, debt, deposited assets, liquidation price, and automation status. Health factor = 1 - (used_margin / liquidation_value): 1 = no debt (safest), >0 = healthy, 0 = liquidation threshold, <0 = past liquidation. Higher is safer. On Base, also returns which asset managers are enabled (rebalancer, compounder, yield_claimer, merkl_operator, cow_swapper). LP positions in assets[] include a dex_protocol field (slipstream, slipstream_v2, staked_slipstream, staked_slipstream_v2, uniV3, uniV4) — use this as the dex_protocol param for write.asset_manager.* tools. The automation object uses internal AM key names (slipstreamV1, slipstreamV2, uniV3, uniV4): map slipstreamV1 → 'slipstream'/'staked_slipstream', slipstreamV2 → 'slipstream_v2'/'staked_slipstream_v2', uniV3 → 'uniV3', uniV4 → 'uniV4'. Numeric fields without a _usd suffix are in the account's numeraire token raw units (divide by 10^decimals: 6 for USDC, 18 for WETH, 8 for cbBTC). Fields ending in _usd are in USD with 18 decimals (divide by 1e18). health_factor is unitless. Asset amounts are raw token units. To list all accounts for a wallet, use read.wallet.accounts.",
65
+ description: "Get full overview of an Arcadia account: health factor, collateral value, debt, deposited assets, liquidation price, and automation status. Health factor = 1 - (used_margin / liquidation_value): 1 = no debt (safest), >0 = healthy, 0 = liquidation threshold, <0 = past liquidation. Higher is safer. On Base, also returns which asset managers are enabled (rebalancer, compounder, yield_claimer, merkl_operator, cow_swapper). LP positions in assets[] include a dex_protocol field (slipstream, slipstream_v2, slipstream_v3, staked_slipstream, staked_slipstream_v2, staked_slipstream_v3, uniV3, uniV4) — use this as the dex_protocol param for write.asset_manager.* tools. Slipstream V3 pools are Base-only; Unichain and Optimism support Slipstream V1 (Velodrome), uniV3, uniV4 only. The automation object uses internal AM key names (slipstreamV1, slipstreamV2, slipstreamV3, uniV3, uniV4): map slipstreamV1 → 'slipstream'/'staked_slipstream', slipstreamV2 → 'slipstream_v2'/'staked_slipstream_v2', slipstreamV3 → 'slipstream_v3'/'staked_slipstream_v3', uniV3 → 'uniV3', uniV4 → 'uniV4'. Numeric fields without a _usd suffix are in the account's numeraire token raw units (divide by 10^decimals: 6 for USDC, 18 for WETH, 8 for cbBTC). Fields ending in _usd are in USD with 18 decimals (divide by 1e18). health_factor is unitless. Asset amounts are raw token units. To list all accounts for a wallet, use read.wallet.accounts.",
65
66
  inputSchema: {
66
67
  account_address: z.string().describe("Arcadia account address"),
67
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
68
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
68
69
  },
69
70
  outputSchema: AccountInfoOutput,
70
71
  }, async ({ account_address, chain_id }) => {
@@ -199,7 +200,7 @@ export function registerAccountTools(server, api, chains) {
199
200
  inputSchema: {
200
201
  account_address: z.string().describe("Arcadia account address"),
201
202
  days: z.number().default(14).describe("Number of days of history (default 14)"),
202
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
203
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
203
204
  },
204
205
  outputSchema: AccountHistoryOutput,
205
206
  }, async ({ account_address, days, chain_id }) => {
@@ -241,7 +242,7 @@ export function registerAccountTools(server, api, chains) {
241
242
  description: "Get PnL (cost basis) and yield earned for an Arcadia account. Returns lifetime totals: cost basis vs current value (negative cost_basis = net profit withdrawn), net transfers per token, total yield earned in USD and per token. cost_basis, current_value, cost_diff are in USD (human-readable). Per-token fields (net_transfers, summed_yields_earned) are in raw token units.",
242
243
  inputSchema: {
243
244
  account_address: z.string().describe("Arcadia account address"),
244
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
245
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
245
246
  },
246
247
  outputSchema: AccountPnlOutput,
247
248
  }, async ({ account_address, chain_id }) => {
@@ -1,11 +1,14 @@
1
1
  import { z } from "zod";
2
2
  import { validateChainId } from "../../utils/validation.js";
3
3
  import { IntentsListOutput } from "../output-schemas.js";
4
+ import { getChainDexProtocols } from "../../config/addresses.js";
4
5
  const POOL_PROTOCOLS = [
5
6
  "slipstream",
6
7
  "slipstream_v2",
8
+ "slipstream_v3",
7
9
  "staked_slipstream",
8
10
  "staked_slipstream_v2",
11
+ "staked_slipstream_v3",
9
12
  "uniV3",
10
13
  "uniV4",
11
14
  ];
@@ -15,7 +18,7 @@ const DEX_PROTOCOL_PARAM = {
15
18
  values: POOL_PROTOCOLS,
16
19
  hint: "LP DEX protocol of the position",
17
20
  };
18
- const ALL_CHAINS = [8453, 130];
21
+ const ALL_CHAINS = [8453, 130, 10];
19
22
  const BASE_ONLY = [8453];
20
23
  const INTENTS = [
21
24
  {
@@ -126,7 +129,11 @@ export function registerAssetManagerTools(server) {
126
129
  let filtered = INTENTS;
127
130
  if (params.chain_id !== undefined) {
128
131
  const validChainId = validateChainId(params.chain_id);
129
- filtered = INTENTS.filter((i) => i.chains.includes(validChainId));
132
+ const chainDexProtocols = getChainDexProtocols(validChainId);
133
+ filtered = INTENTS.filter((i) => i.chains.includes(validChainId)).map((intent) => ({
134
+ ...intent,
135
+ required_params: intent.required_params.map((p) => p.name === "dex_protocol" ? { ...p, values: chainDexProtocols } : p),
136
+ }));
130
137
  }
131
138
  const result = {
132
139
  automations: filtered,
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { CHAIN_ID_DESCRIPTION } from "../../config/chains.js";
2
3
  import { AssetListOutput, AssetPricesOutput } from "../output-schemas.js";
3
4
  export function registerAssetTools(server, api) {
4
5
  server.registerTool("read.asset.list", {
@@ -15,7 +16,7 @@ export function registerAssetTools(server, api) {
15
16
  .string()
16
17
  .optional()
17
18
  .describe("Filter assets by symbol (case-insensitive substring match)"),
18
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
19
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
19
20
  },
20
21
  outputSchema: AssetListOutput,
21
22
  }, async ({ search, chain_id }) => {
@@ -64,7 +65,7 @@ export function registerAssetTools(server, api) {
64
65
  asset_addresses: z
65
66
  .string()
66
67
  .describe("Single address or comma-separated addresses for price lookup"),
67
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
68
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
68
69
  },
69
70
  outputSchema: AssetPricesOutput,
70
71
  }, async ({ asset_addresses, chain_id }) => {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { CHAIN_ID_DESCRIPTION } from "../../config/chains.js";
2
3
  import { PoolListOutput, PoolDetailOutput } from "../output-schemas.js";
3
4
  export function registerPoolTools(server, api) {
4
5
  server.registerTool("read.pool.list", {
@@ -11,7 +12,7 @@ export function registerPoolTools(server, api) {
11
12
  },
12
13
  description: "List all Arcadia lending pools: TVL, utilization, available liquidity. Key fields: interest_rate = current borrow cost, lending_apy = lender yield. All rates are decimal fractions (1.0 = 100%, 0.06 = 6%). For APY history on a specific pool, use read.pool.info.",
13
14
  inputSchema: {
14
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
15
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
15
16
  },
16
17
  outputSchema: PoolListOutput,
17
18
  }, async ({ chain_id }) => {
@@ -57,7 +58,7 @@ export function registerPoolTools(server, api) {
57
58
  inputSchema: {
58
59
  pool_address: z.string().describe("Pool address"),
59
60
  days: z.number().default(14).describe("Number of days of APY history"),
60
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
61
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
61
62
  },
62
63
  outputSchema: PoolDetailOutput,
63
64
  }, async ({ pool_address, days, chain_id }) => {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { CHAIN_ID_DESCRIPTION } from "../../config/chains.js";
2
3
  import { StrategyListOutput, StrategyDetailOutput, StrategyRecommendationOutput, } from "../output-schemas.js";
3
4
  export function registerStrategyTools(server, api) {
4
5
  server.registerTool("read.strategy.list", {
@@ -17,7 +18,7 @@ export function registerStrategyTools(server, api) {
17
18
  .describe("Return only featured/curated strategies (recommended)"),
18
19
  limit: z.number().default(25).describe("Max strategies to return (default 25)"),
19
20
  offset: z.number().default(0).describe("Skip first N strategies for pagination"),
20
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
21
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
21
22
  },
22
23
  outputSchema: StrategyListOutput,
23
24
  }, async ({ featured_only, limit, offset, chain_id }) => {
@@ -26,9 +27,30 @@ export function registerStrategyTools(server, api) {
26
27
  let total;
27
28
  if (featured_only) {
28
29
  const raw = await api.getFeatured(chain_id);
29
- strategies = Array.isArray(raw) ? raw : [];
30
+ const all = Array.isArray(raw) ? raw : [];
31
+ // The /featured endpoint currently returns curated Base strategies regardless of
32
+ // chain_id. Filter by the chain baked into each strategy's url (`/farm/<chainId>/…`)
33
+ // so we never hand back strategies that belong to a different chain.
34
+ const urlChainRe = /\/farm\/(\d+)\//;
35
+ strategies = all.filter((s) => {
36
+ const url = s.url;
37
+ if (!url)
38
+ return true;
39
+ const match = url.match(urlChainRe);
40
+ if (!match)
41
+ return true;
42
+ return Number(match[1]) === chain_id;
43
+ });
30
44
  total = strategies.length;
31
- const result = { total, offset: 0, limit: total, strategies };
45
+ const result = {
46
+ total,
47
+ offset: 0,
48
+ limit: total,
49
+ strategies,
50
+ };
51
+ if (total === 0 && all.length > 0) {
52
+ result.context_note = `Featured strategies are not curated for chain ${chain_id} yet. Backend returned ${all.length} Base strategies; filtered out. Use featured_only=false to list all strategies on this chain.`;
53
+ }
32
54
  return {
33
55
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
34
56
  structuredContent: result,
@@ -92,7 +114,7 @@ export function registerStrategyTools(server, api) {
92
114
  description: "Get full detail for a specific LP strategy by ID — includes APY per range width (narrower range = higher APY but more rebalancing cost/risk), pool info, and configuration. Use read.strategy.list to discover strategy IDs. All APY values are decimal fractions (1.0 = 100%, 0.05 = 5%).",
93
115
  inputSchema: {
94
116
  strategy_id: z.number().describe("Strategy ID"),
95
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
117
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
96
118
  },
97
119
  outputSchema: StrategyDetailOutput,
98
120
  }, async ({ strategy_id, chain_id }) => {
@@ -126,7 +148,7 @@ export function registerStrategyTools(server, api) {
126
148
  description: "Get a rebalancing recommendation for an Arcadia account — suggests asset changes to optimize yield. Uses 1d APY (not 7d like read.strategy.list), so recommended strategies may differ from the list ranking. APY values are decimal fractions (0.05 = 5%). weekly_earning_difference is in USD.",
127
149
  inputSchema: {
128
150
  account_address: z.string().describe("Arcadia account address"),
129
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
151
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
130
152
  },
131
153
  outputSchema: StrategyRecommendationOutput,
132
154
  }, async ({ account_address, chain_id }) => {
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { formatUnits } from "viem";
3
+ import { CHAIN_ID_DESCRIPTION } from "../../config/chains.js";
3
4
  import { erc20Abi } from "../../abis/index.js";
4
5
  import { getPublicClient } from "../../clients/chain.js";
5
6
  import { validateAddress, validateChainId } from "../../utils/validation.js";
@@ -18,7 +19,7 @@ export function registerWalletTools(server, chains, api) {
18
19
  inputSchema: {
19
20
  wallet_address: z.string().describe("Wallet address to check balances for"),
20
21
  token_addresses: z.array(z.string()).describe("ERC20 token contract addresses to check"),
21
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
22
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
22
23
  },
23
24
  outputSchema: WalletBalancesOutput,
24
25
  }, async ({ wallet_address, token_addresses, chain_id }) => {
@@ -97,7 +98,7 @@ export function registerWalletTools(server, chains, api) {
97
98
  .string()
98
99
  .describe("Spender address to check allowance for (e.g. Arcadia account address)"),
99
100
  token_addresses: z.array(z.string()).describe("ERC20 token contract addresses to check"),
100
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
101
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
101
102
  },
102
103
  outputSchema: WalletAllowanceOutput,
103
104
  }, async ({ owner_address, spender_address, token_addresses, chain_id }) => {
@@ -161,7 +162,7 @@ export function registerWalletTools(server, chains, api) {
161
162
  description: "List all Arcadia accounts owned by a wallet address. Returns a summary of each account (address, name). Call read.account.info with a specific account_address for full details like health factor, collateral, and debt.",
162
163
  inputSchema: {
163
164
  wallet_address: z.string().describe("Wallet address to list accounts for"),
164
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
165
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
165
166
  },
166
167
  outputSchema: AccountListOutput,
167
168
  }, async ({ wallet_address, chain_id }) => {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { CHAIN_ID_DESCRIPTION } from "../../../config/chains.js";
2
3
  import { getPublicClient } from "../../../clients/chain.js";
3
4
  import { readAccountMetadata } from "./metadata.js";
4
5
  import { formatBatchedResponse } from "./format-response.js";
@@ -62,7 +63,7 @@ export function registerAddLiquidityTool(server, api, chains) {
62
63
  .default(0)
63
64
  .describe("0 = no borrow, 2 = 2x leverage. Margin accounts only."),
64
65
  slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
65
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
66
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
66
67
  },
67
68
  }, async ({ account_address, wallet_address, positions, deposits: walletDeposits, use_account_assets, leverage, slippage, chain_id, }) => {
68
69
  try {
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { encodeFunctionData } from "viem";
3
+ import { CHAIN_ID_DESCRIPTION } from "../../../config/chains.js";
3
4
  import { poolAbi } from "../../../abis/index.js";
4
5
  import { appendDataSuffix } from "../../../utils/attribution.js";
5
6
  import { validateAddress } from "../../../utils/validation.js";
@@ -22,7 +23,7 @@ export function registerBorrowTool(server, _chains, api) {
22
23
  account_address: z.string().describe("Arcadia account address used as collateral"),
23
24
  amount: z.string().describe("Amount in raw units"),
24
25
  to: z.string().describe("Address to receive borrowed tokens"),
25
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
26
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
26
27
  },
27
28
  }, async (params) => {
28
29
  try {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { CHAIN_ID_DESCRIPTION } from "../../../config/chains.js";
2
3
  import { getPublicClient } from "../../../clients/chain.js";
3
4
  import { readAccountMetadata } from "./metadata.js";
4
5
  import { formatBatchedResponse } from "./format-response.js";
@@ -50,7 +51,7 @@ The returned calldata is time-sensitive — sign and broadcast within 30 seconds
50
51
  .default(false)
51
52
  .describe("true = only burn LP positions, leave underlying tokens in account. false = full close (burn + swap + repay)."),
52
53
  slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
53
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
54
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
54
55
  },
55
56
  }, async ({ account_address, assets, receive_assets, close_lp_only, slippage, chain_id }) => {
56
57
  try {
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { encodeFunctionData, keccak256, concat, pad, toBytes, getAddress, slice } from "viem";
3
+ import { CHAIN_ID_DESCRIPTION } from "../../../config/chains.js";
3
4
  import { factoryAbi } from "../../../abis/index.js";
4
5
  import { PROTOCOL } from "../../../config/addresses.js";
5
6
  import { getPublicClient } from "../../../clients/chain.js";
@@ -49,7 +50,7 @@ export function registerCreateTool(server, chains) {
49
50
  .string()
50
51
  .optional()
51
52
  .describe("Lending pool address for V3 margin account. Ignored for V4 spot accounts (version 0 or 4)."),
52
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
53
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
53
54
  },
54
55
  }, async (params) => {
55
56
  try {
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { CHAIN_ID_DESCRIPTION } from "../../../config/chains.js";
2
3
  import { formatBatchedResponse } from "./format-response.js";
3
4
  import { validateAddress } from "../../../utils/validation.js";
4
5
  import { BatchedTransactionOutput } from "../../output-schemas.js";
@@ -20,7 +21,7 @@ export function registerDeleverageTool(server, api) {
20
21
  numeraire: z.string().describe("Debt token address"),
21
22
  creditor: z.string().describe("Lending pool address"),
22
23
  slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
23
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
24
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
24
25
  },
25
26
  }, async ({ account_address, amount_in, asset_from, numeraire, creditor, slippage, chain_id }) => {
26
27
  try {
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { encodeFunctionData } from "viem";
3
+ import { CHAIN_ID_DESCRIPTION } from "../../../config/chains.js";
3
4
  import { accountAbi, getAccountAbi } from "../../../abis/index.js";
4
5
  import { getPublicClient } from "../../../clients/chain.js";
5
6
  import { appendDataSuffix } from "../../../utils/attribution.js";
@@ -32,7 +33,7 @@ export function registerDepositTool(server, chains) {
32
33
  .number()
33
34
  .optional()
34
35
  .describe("Override account version (3 or 4). Auto-detected on-chain if omitted."),
35
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
36
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
36
37
  },
37
38
  }, async (params) => {
38
39
  try {
@@ -16,11 +16,23 @@ export function formatBatchedResponse(result, chainId, description) {
16
16
  response.tenderly_sim_status = "unavailable";
17
17
  }
18
18
  if (result.expected_value_change != null) {
19
- response.expected_value_change = result.expected_value_change;
19
+ response.expected_value_change = String(result.expected_value_change);
20
+ }
21
+ if (result.before != null) {
22
+ const b = result.before;
23
+ response.before = {
24
+ ...b,
25
+ total_account_value: String(b.total_account_value),
26
+ used_margin: String(b.used_margin),
27
+ };
28
+ }
29
+ if (result.after != null) {
30
+ const a = result.after;
31
+ response.after = {
32
+ ...a,
33
+ total_account_value: String(a.total_account_value),
34
+ used_margin: String(a.used_margin),
35
+ };
20
36
  }
21
- if (result.before != null)
22
- response.before = result.before;
23
- if (result.after != null)
24
- response.after = result.after;
25
37
  return response;
26
38
  }
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { CHAIN_ID_DESCRIPTION } from "../../../config/chains.js";
2
3
  import { formatBatchedResponse } from "./format-response.js";
3
4
  import { validateAddress } from "../../../utils/validation.js";
4
5
  import { BatchedTransactionOutput } from "../../output-schemas.js";
@@ -24,7 +25,7 @@ The returned calldata is time-sensitive — sign and broadcast within 30 seconds
24
25
  adjustment: z
25
26
  .string()
26
27
  .describe("Liquidity amount to remove (raw uint128 value as string). Must be less than total liquidity — for full removal use write.account.close."),
27
- chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
28
+ chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
28
29
  },
29
30
  }, async ({ account_address, asset_address, asset_id, adjustment, chain_id }) => {
30
31
  try {