@arcadia-finance/mcp-server 0.4.6 → 0.5.1

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/README.md CHANGED
@@ -5,9 +5,9 @@
5
5
  [![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL--3.0-blue)](LICENSE.md)
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.5-blue)](https://www.typescriptlang.org/)
7
7
  [![MCP](https://img.shields.io/badge/MCP-2025--11--25-green)](https://modelcontextprotocol.io/)
8
- [![smithery badge](https://smithery.ai/badge/@arcadia-finance/mcp-server)](https://smithery.ai/servers/arcadia-finance/mcp-server)
8
+ [![Smithery](https://img.shields.io/badge/Smithery-listed-6b46c1)](https://smithery.ai/servers/arcadia-finance/mcp-server)
9
9
  [![MCP Badge](https://lobehub.com/badge/mcp/arcadia-finance-mcp-server)](https://lobehub.com/mcp/arcadia-finance-mcp-server)
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)
10
+ [![arcadia-finance-mcp-server MCP server](https://glama.ai/mcp/servers/arcadia-finance/mcp-server/badges/score.svg)](https://glama.ai/mcp/servers/arcadia-finance/mcp-server)
11
11
 
12
12
  MCP server for [Arcadia Finance](https://arcadia.finance), a platform for concentrated liquidity on Uniswap and Aerodrome with automated rebalancing, compounding, yield optimization, and leverage, or single-sided liquidity into lending pools. Read protocol data and build unsigned transactions for LP management, borrowing, deposits, and more.
13
13
 
@@ -40,36 +40,31 @@ Designed for AI agents (Claude, Cursor, etc.) to interact with Arcadia onchain.
40
40
  | `read.strategy.info` | Full detail for a specific LP strategy: APY per range width, pool config. |
41
41
  | `read.strategy.recommendation` | Rebalancing recommendation for an account. |
42
42
  | `read.guides` | Reference guides: automation setup, strategy selection, strategy templates. |
43
- | `read.asset_manager.intents` | Available automation intents with tool names, required params, and supported chains. |
43
+ | `read.asset_manager.intents` | Automation intents and their params; add `account_address` for live per-account availability. |
44
+ | `read.asset_manager.current` | Automations enabled on an account: decoded config, mapped intents, Merkl state, superseded managers. |
44
45
 
45
46
  ### Write Tools
46
47
 
47
48
  All write tools return unsigned transactions as `{ to, data, value, chainId }`.
48
49
 
49
- | Tool | Description |
50
- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
51
- | `write.wallet.approve` | Approve an ERC20 token for spending. Required before depositing into an account. Call `read.wallet.allowances` first to check if already approved. |
52
- | `write.pool.deposit` | Lend the pool's underlying asset into an ERC-4626 tranche to earn interest. Mints tranche shares to the receiver. |
53
- | `write.pool.redeem` | Redeem tranche shares back into the underlying asset (lender exit). |
54
- | `write.account.create` | Create a new Arcadia account via Factory. |
55
- | `write.account.deposit` | Deposit ERC20 tokens into an account. |
56
- | `write.account.withdraw` | Withdraw assets from an account. |
57
- | `write.account.borrow` | Borrow from a lending pool. |
58
- | `write.account.repay` | Repay debt to a lending pool from wallet. |
59
- | `write.account.add_liquidity` | Flash-action: deposit + swap + mint LP + optional leverage, atomically. |
60
- | `write.account.remove_liquidity` | Remove/decrease LP position liquidity. |
61
- | `write.account.swap` | Swap assets within an account (backend-routed). |
62
- | `write.account.deleverage` | Repay debt by selling collateral (swap + repay in one tx). |
63
- | `write.account.close` | Atomic close: burn LP + swap + repay debt in one tx. |
64
- | `write.account.stake` | Stake, unstake, or claim rewards for LP positions. |
65
- | `write.asset_manager.rebalancer` | Encode rebalancer automation args (strategy config, triggers, compound mode). |
66
- | `write.asset_manager.compounder` | Encode standalone compounder args. |
67
- | `write.asset_manager.compounder_staked` | Encode compounder + CowSwap coupled args (sell rewards, buy target token). |
68
- | `write.asset_manager.yield_claimer` | Encode yield claimer args (claim fees to recipient). |
69
- | `write.asset_manager.yield_claimer_cowswap` | Encode yield claimer + CowSwap coupled args. |
70
- | `write.asset_manager.cow_swapper` | Encode direct CowSwap mode args (Base only). |
71
- | `write.asset_manager.merkl_operator` | Encode Merkl operator args (claim external rewards). |
72
- | `write.account.set_asset_managers` | Build unsigned setAssetManagers tx from encoded intent args. Combine multiple intents by merging arrays. |
50
+ | Tool | Description |
51
+ | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
52
+ | `write.wallet.approve` | Approve an ERC20 token for spending. Required before depositing into an account. Call `read.wallet.allowances` first to check if already approved. |
53
+ | `write.pool.deposit` | Lend the pool's underlying asset into an ERC-4626 tranche to earn interest. Mints tranche shares to the receiver. |
54
+ | `write.pool.redeem` | Redeem tranche shares back into the underlying asset (lender exit). |
55
+ | `write.account.create` | Create a new Arcadia account via Factory. |
56
+ | `write.account.deposit` | Deposit ERC20 tokens into an account. |
57
+ | `write.account.withdraw` | Withdraw assets from an account. |
58
+ | `write.account.borrow` | Borrow from a lending pool. |
59
+ | `write.account.repay` | Repay debt to a lending pool from wallet. |
60
+ | `write.account.add_liquidity` | Flash-action: deposit + swap + mint LP + optional leverage, atomically. |
61
+ | `write.account.remove_liquidity` | Remove/decrease LP position liquidity. |
62
+ | `write.account.swap` | Swap assets within an account (backend-routed). |
63
+ | `write.account.deleverage` | Repay debt by selling collateral (swap + repay in one tx). |
64
+ | `write.account.close` | Atomic close: burn LP + swap + repay debt in one tx. |
65
+ | `write.account.stake` | Stake, unstake, or claim rewards for LP positions. |
66
+ | `write.account.automations` | Configure automations from an intents array (full desired state). Returns the unsigned setAssetManagers tx. |
67
+ | `write.account.automations_delta` | Enable/disable individual automations, leaving the rest untouched. |
73
68
 
74
69
  ### Dev Tools
75
70
 
@@ -215,9 +210,9 @@ ln -s /path/to/mcp-server/skills/clamm-liquidity ~/.claude/skills/clamm-liquidit
215
210
 
216
211
  Available skills:
217
212
 
218
- | Skill | Description |
219
- | ----------------- | ------------------------------------------------------------------------------------------------------------------- |
220
- | `clamm-liquidity` | Concentrated liquidity management: concepts, asset managers (rebalancers, compounders), and step-by-step workflows. |
213
+ | Skill | Description |
214
+ | ----------------- | ------------------------------------------------------------------------------------------------- |
215
+ | `clamm-liquidity` | Concentrated liquidity management: concepts, intent-based automation, and step-by-step workflows. |
221
216
 
222
217
  ## Reporting Issues
223
218
 
@@ -241,7 +236,7 @@ Pull requests for documentation fixes are welcome from agents and humans alike.
241
236
  - **LobeHub:** [lobehub.com](https://lobehub.com/mcp/arcadia-finance-mcp-server)
242
237
  - **PulseMCP:** [pulsemcp.com](https://www.pulsemcp.com/servers/arcadia-finance)
243
238
  - **MCP Market:** [mcpmarket.com](https://mcpmarket.com/server/arcadia-finance)
244
- - **Glama:** [glama.ai](https://glama.ai/mcp/servers/arcadia-finance/arcadia-finance-mcp-server)
239
+ - **Glama:** [glama.ai](https://glama.ai/mcp/servers/arcadia-finance/mcp-server)
245
240
  - **awesome-mcp-servers:** [github.com/TensorBlock/awesome-mcp-servers](https://github.com/TensorBlock/awesome-mcp-servers)
246
241
 
247
242
  ## Development
@@ -192,4 +192,27 @@ export class ArcadiaApiClient {
192
192
  position_id: asset_id,
193
193
  });
194
194
  }
195
+ // ── Automations (intent compiler) ────────────────────────────────
196
+ // The backend owns intent resolution, compatibility validation and metadata
197
+ // encoding. These endpoints return finished setAssetManagers calldata.
198
+ async previewAutomations(account, chainId, body) {
199
+ return this.post(`/automations/${account}/preview?chain_id=${chainId}`, body);
200
+ }
201
+ async saveAutomations(account, chainId, body) {
202
+ return this.post(`/automations/${account}/save?chain_id=${chainId}`, body);
203
+ }
204
+ async applyAutomationsDelta(account, chainId, body) {
205
+ return this.post(`/automations/${account}/apply?chain_id=${chainId}`, body);
206
+ }
207
+ async getCurrentAutomations(account, chainId) {
208
+ return this.get(`/automations/${account}`, {
209
+ chain_id: chainId,
210
+ });
211
+ }
212
+ async getAvailableAutomations(account, chainId, positionId) {
213
+ const params = { chain_id: chainId };
214
+ if (positionId !== undefined)
215
+ params.position_id = positionId;
216
+ return this.get(`/automations/${account}/available`, params);
217
+ }
195
218
  }
@@ -62,209 +62,40 @@ export const TOKENS = {
62
62
  WSTETH: { address: "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb", decimals: 18 },
63
63
  },
64
64
  };
65
- // Rebalancers — V2.1.1 (current, unified rebalancer + profit taker), V2.1.0
66
- // (split architecture, still active on Base + Unichain), V2.0.1 (legacy, Base).
67
- const REBALANCERS_V2_1_1 = {
68
- slipstreamV1: "0x5802454749cc0c4A6F28D5001B4cD84432e2b79F",
69
- slipstreamV2: "0x953Ff365d0b562ceC658dc46B394E9282338d9Ea",
70
- slipstreamV3: "0x37c6258aEe125d520B6f03fc2cb490955050D557",
71
- uniV3: "0xbA1D0c99c261F94b9C8b52465890Cca27dd993Bd",
72
- uniV4: "0x01EDaF0067a10D18c88D2876c0A85Ee0096a5Ac0",
73
- };
74
- const REBALANCERS_V2_1_0 = {
75
- slipstreamV1: "0xE07A9383AF8E0B1320419dFeF205bb9bA75f3Ef2",
76
- slipstreamV2: "0xc0dBb5443689E40E4b58b627F82f468Ef1Ad7561",
77
- uniV3: "0xbb22cdbfFF5a263E85917803692db3630bF860c4",
78
- uniV4: "0x9E466179c46eB098B564cbE319bA4b3EAd6476C1",
79
- };
80
- const REBALANCERS_V2_0_1 = {
81
- slipstreamV1: "0xEfe600366e9847D405f2238cF9196E33780B3A42",
82
- uniV3: "0xD8285fC23eFF687B8b618b78d85052f1eD17236E",
83
- uniV4: "0xa8676C8c197E12a71AE82a08B02DD9e666312cF1",
84
- };
85
- const COMPOUNDERS_V2_1_1 = {
86
- slipstreamV1: "0x467837f44A71e3eAB90AEcfC995c84DC6B3cfCF7",
87
- slipstreamV2: "0x35e59448C7145482E56212510cC689612AB4F61f",
88
- slipstreamV3: "0xd42A3Ac56456bD5422835B36C35Cacb6448ddCd9",
89
- uniV3: "0x02e1fa043214E51eDf1F0478c6D0d3D5658a2DC3",
90
- uniV4: "0xAA95c9c402b195D8690eCaea2341a76e3266B189",
91
- };
92
- const COMPOUNDERS_V2_0_1 = {
93
- slipstreamV1: "0x4694c34d153EE777CC07d01AC433bcC010A20EBd",
94
- uniV3: "0x80D3548bc54710d46201D554712E8638fD51326D",
95
- uniV4: "0xCfF15E24a453aFAd454533E6D10889A84e2A68e1",
96
- };
97
- const YIELD_CLAIMERS_V2_1_1 = {
98
- slipstreamV1: "0x5a8278D37b7a787574b6Aa7E18d8C02D994f18Ba",
99
- slipstreamV2: "0xc8bF4B2c740FF665864E9494832520f18822871C",
100
- slipstreamV3: "0x8c1Fbf38118fD5A704b6E7babcB7AF1a9A291980",
101
- uniV3: "0x75Ed28EA8601Ce9F5FbcAB1c2428f04A57aFaA16",
102
- uniV4: "0xD8aa21AB7f9B8601CB7d7A776D3AFA1602d5D8D4",
103
- };
104
- const YIELD_CLAIMERS_V2_0_1 = {
105
- slipstreamV1: "0x1f75aBF8a24782053B351D9b4EA6d1236ED59105",
106
- uniV3: "0x40462e71Effd9974Fee04B6b327B701D663f753e",
107
- uniV4: "0x3BC2B398eEEE9807ff76fdb4E11526dE0Ee80cEa",
108
- };
109
- // Optimism-specific V2.1.1 overrides: slipstreamV3 was deployed at different addresses on Optimism.
110
- const REBALANCERS_V2_1_1_OPTIMISM = {
111
- ...REBALANCERS_V2_1_1,
112
- slipstreamV3: "0x33442fC10a20Aad0ddD73F6ae24500F5B370DC51",
113
- };
114
- const COMPOUNDERS_V2_1_1_OPTIMISM = {
115
- ...COMPOUNDERS_V2_1_1,
116
- slipstreamV3: "0x3e7b6997399eC402491c4A049e4CD727d3aA1738",
117
- };
118
- const YIELD_CLAIMERS_V2_1_1_OPTIMISM = {
119
- ...YIELD_CLAIMERS_V2_1_1,
120
- slipstreamV3: "0x3630bDb1Ac7cF8A435411391db75450350814F42",
121
- };
122
- // Deployed versions per chain, newest first. The first entry is treated as
123
- // the "current" version (used for new registrations). Older entries are
124
- // probed in read.account.info so users registered on older versions are
125
- // reported as active. See multichain-deploy-scripts Arcadia.sol for source.
126
- const CHAIN_AM_VERSIONS = {
127
- 8453: {
128
- rebalancers: [REBALANCERS_V2_1_1, REBALANCERS_V2_1_0, REBALANCERS_V2_0_1],
129
- compounders: [COMPOUNDERS_V2_1_1, COMPOUNDERS_V2_0_1],
130
- yieldClaimers: [YIELD_CLAIMERS_V2_1_1, YIELD_CLAIMERS_V2_0_1],
131
- },
132
- 130: {
133
- rebalancers: [REBALANCERS_V2_1_1, REBALANCERS_V2_1_0],
134
- compounders: [COMPOUNDERS_V2_1_1],
135
- yieldClaimers: [YIELD_CLAIMERS_V2_1_1],
136
- },
137
- 10: {
138
- rebalancers: [REBALANCERS_V2_1_1_OPTIMISM],
139
- compounders: [COMPOUNDERS_V2_1_1_OPTIMISM],
140
- yieldClaimers: [YIELD_CLAIMERS_V2_1_1_OPTIMISM],
141
- },
142
- };
143
- const STANDALONE_AM_ADDRESSES = {
144
- merklOperator: "0x969F0251360b9Cf11c68f6Ce9587924c1B8b42C6",
145
- gasRelayer: "0xD938C8d04cF91094fecAF0A2018EAac483a40137",
146
- cowSwapper: "0xFfC742E68D41389BE9Ef1aFD518F036064DA2Bb6",
147
- };
148
- // Per-chain availability — update these when deploying to new chains.
149
- // Slipstream V2 is Base-only. V3 is live on Base and Optimism. Unichain has V1 only.
150
- const CHAIN_PROTOCOLS = {
151
- 8453: new Set(["slipstreamV1", "slipstreamV2", "slipstreamV3", "uniV3", "uniV4"]),
152
- 130: new Set(["slipstreamV1", "uniV3", "uniV4"]),
153
- 10: new Set(["slipstreamV1", "slipstreamV3", "uniV3", "uniV4"]),
154
- };
155
- const CHAIN_STANDALONE_AMS = {
156
- 8453: new Set(["merklOperator", "gasRelayer", "cowSwapper"]),
157
- 130: new Set(["merklOperator", "gasRelayer"]),
158
- 10: new Set(["merklOperator", "gasRelayer"]),
159
- };
160
- const CHAIN_NAMES = { 8453: "Base", 130: "Unichain", 10: "Optimism" };
161
- // Map LP asset names → dex_protocol values
162
- const LP_NAME_TO_POOL_PROTOCOL = {
163
- UniV3: "uniV3",
164
- UniV4: "uniV4",
165
- slipstream: "slipstream",
65
+ // Asset-manager addresses are NOT duplicated here. The automations backend owns
66
+ // the address book (current + superseded deployments, per chain and protocol) and
67
+ // returns finished setAssetManagers calldata, so the only mapping the MCP server
68
+ // needs is between the backend's protocol vocabulary and the dex_protocol values
69
+ // the read tools report.
70
+ /** Asset-manager groups the automations reader can report on an account. */
71
+ export const AUTOMATION_GROUPS = [
72
+ "rebalancer",
73
+ "compounder",
74
+ "yield_claimer",
75
+ "cow_swapper",
76
+ "merkl_operator",
77
+ ];
78
+ // The gas relayer pulls deposited AAA to pay for rebalances beyond the free
79
+ // quota. It is registered as an asset manager but is not part of the automations
80
+ // address book (no intent configures it), so it is not in the backend's reader
81
+ // and stays here. Same address on every supported chain.
82
+ export const GAS_RELAYER = "0xD938C8d04cF91094fecAF0A2018EAac483a40137";
83
+ const BACKEND_PROTOCOL_TO_DEX_PROTOCOL = {
84
+ slipstream_v1: "slipstream",
166
85
  slipstream_v2: "slipstream_v2",
167
86
  slipstream_v3: "slipstream_v3",
168
- "Staked Slipstream": "staked_slipstream",
169
- "Staked Slipstream V2": "staked_slipstream_v2",
170
- "Staked Slipstream V3": "staked_slipstream_v3",
171
- "Wrapped Staked Slipstream": "staked_slipstream",
172
- "Wrapped Staked Slipstream V2": "staked_slipstream_v2",
173
- "Wrapped Staked Slipstream V3": "staked_slipstream_v3",
174
- "Wrapped Aerodrome": "slipstream",
175
- "Staked Aerodrome": "staked_slipstream",
176
- };
177
- export function lpNameToPoolProtocol(name) {
178
- return LP_NAME_TO_POOL_PROTOCOL[name] ?? null;
179
- }
180
- // Map internal AM keys to user-facing dex_protocol values (used in error messages and account info)
181
- export const AM_KEY_TO_POOL_PROTOCOL = {
182
- slipstreamV1: "slipstream",
183
- slipstreamV2: "slipstream_v2",
184
- slipstreamV3: "slipstream_v3",
185
- uniV3: "uniV3",
186
- uniV4: "uniV4",
187
- };
188
- // User-facing dex_protocol values available on a chain. Slipstream AMs are
189
- // shared between plain and staked pools, so each slipstreamV* on a chain
190
- // contributes both `slipstream_vN` and `staked_slipstream_vN`.
191
- export function getChainDexProtocols(chainId) {
192
- const values = [];
193
- for (const protocol of CHAIN_PROTOCOLS[chainId]) {
194
- const base = AM_KEY_TO_POOL_PROTOCOL[protocol];
195
- values.push(base);
196
- if (protocol.startsWith("slipstream")) {
197
- values.push(base.replace(/^slipstream/, "staked_slipstream"));
198
- }
199
- }
200
- return values;
201
- }
202
- export function getAmProtocolAddress(chainId, category, protocol) {
203
- if (!CHAIN_PROTOCOLS[chainId].has(protocol)) {
204
- const available = [...CHAIN_PROTOCOLS[chainId]]
205
- .map((k) => AM_KEY_TO_POOL_PROTOCOL[k])
206
- .join(", ");
207
- throw new Error(`${AM_KEY_TO_POOL_PROTOCOL[protocol]} is not available on ${CHAIN_NAMES[chainId]} (${chainId}). Available protocols: ${available}.`);
208
- }
209
- // Write tools always target the current (newest) version for that chain.
210
- const current = CHAIN_AM_VERSIONS[chainId][category][0][protocol];
211
- if (!current) {
212
- throw new Error(`No ${category} address for ${AM_KEY_TO_POOL_PROTOCOL[protocol]} on ${CHAIN_NAMES[chainId]} (${chainId}).`);
213
- }
214
- return current;
215
- }
216
- const STANDALONE_TO_USER_FACING = {
217
- merklOperator: "merkl_operator",
218
- gasRelayer: "gas_relayer",
219
- cowSwapper: "cow_swapper",
220
- };
221
- export function getStandaloneAmAddress(chainId, am) {
222
- if (!CHAIN_STANDALONE_AMS[chainId].has(am)) {
223
- const supportedChains = Object.entries(CHAIN_STANDALONE_AMS)
224
- .filter(([, ams]) => ams.has(am))
225
- .map(([id]) => `${CHAIN_NAMES[Number(id)]} (${id})`)
226
- .join(", ");
227
- throw new Error(`${STANDALONE_TO_USER_FACING[am]} is not available on ${CHAIN_NAMES[chainId]} (${chainId}). Supported chains: ${supportedChains}.`);
228
- }
229
- return STANDALONE_AM_ADDRESSES[am];
230
- }
231
- const CATEGORY_TO_GROUP = {
232
- rebalancers: "rebalancer",
233
- compounders: "compounder",
234
- yieldClaimers: "yield_claimer",
235
- };
236
- const STANDALONE_TO_GROUP = {
237
- merklOperator: "merkl_operator",
238
- gasRelayer: "gas_relayer",
239
- cowSwapper: "cow_swapper",
240
- };
241
- export function getChainAmChecks(chainId) {
242
- const protocols = CHAIN_PROTOCOLS[chainId];
243
- const standalone = CHAIN_STANDALONE_AMS[chainId];
244
- const checks = [];
245
- // Fan out across every deployed version so users registered on an older
246
- // version (e.g. V2.1.0 on Base) are still reported as active.
247
- for (const category of ["rebalancers", "compounders", "yieldClaimers"]) {
248
- for (const versionMap of CHAIN_AM_VERSIONS[chainId][category]) {
249
- for (const protocol of protocols) {
250
- const address = versionMap[protocol];
251
- if (!address)
252
- continue;
253
- checks.push({ group: CATEGORY_TO_GROUP[category], protocol, address });
254
- }
255
- }
256
- }
257
- for (const am of standalone) {
258
- checks.push({
259
- group: STANDALONE_TO_GROUP[am],
260
- protocol: null,
261
- address: STANDALONE_AM_ADDRESSES[am],
262
- });
263
- }
264
- return checks;
87
+ slipstream_v3_op: "slipstream_v3",
88
+ uniswap_v3: "uniV3",
89
+ uniswap_v4: "uniV4",
90
+ };
91
+ /**
92
+ * Backend protocol name to the dex_protocol value the read tools use.
93
+ * Returns null for an unrecognised name so callers can surface it rather than
94
+ * silently reporting a wrong protocol.
95
+ */
96
+ export function backendProtocolToDexProtocol(protocol) {
97
+ return BACKEND_PROTOCOL_TO_DEX_PROTOCOL[protocol] ?? null;
265
98
  }
266
- // Minimal strategy hook — required for rebalancer onSetAssetManager callback
267
- export const MINIMAL_STRATEGY_HOOK = "0x13beD1A58d87c0454872656c5328103aAe5eB86A";
268
99
  // Chain-specific addresses
269
100
  export const STATE_VIEWERS = {
270
101
  8453: "0xA3c0c9b65baD0b08107Aa264b0f3dB444b867A71",
@@ -288,11 +119,14 @@ export const CHAIN_POSITION_MANAGERS = {
288
119
  },
289
120
  10: {
290
121
  "0x416b433906b1b72fa758e166e239c43d68dc6f29": "slipstream", // Velodrome Slipstream V1
122
+ "0xf7f8ccce99ca2896ec75d3a399d152db96808399": "slipstream_v3",
291
123
  "0xc36442b4a4522e871399cd717abdd847ab11fe88": "uniV3",
292
124
  "0x3c3ea4b57a46241e54610e5f022e5c45859a1017": "uniV4",
293
125
  },
294
126
  };
295
- // Universal staked/wrapped-staked position manager addresses (same on all chains)
127
+ // Staked / wrapped-staked position managers. V1 and V2 are deployed at the same
128
+ // address on every chain; the V3 pair was deployed at different addresses on
129
+ // Optimism, so those are chain-scoped and take precedence over the shared table.
296
130
  export const UNIVERSAL_POSITION_MANAGERS = {
297
131
  "0x1dc7a0f5336f52724b650e39174cfcbbedd67bf1": "staked_slipstream", // StakedSlipstreamAM V1
298
132
  "0xbed6c3e35b9b1e044b3bc71465769edfdc0fdd4c": "staked_slipstream_v2", // StakedSlipstreamAM V2
@@ -301,3 +135,17 @@ export const UNIVERSAL_POSITION_MANAGERS = {
301
135
  "0x147a2ccbaf4521ad209a2875ae0b3c496f4b25a4": "staked_slipstream_v2", // WrappedStakedSlipstream V2
302
136
  "0x9189bc25f8fac157b4d87b0b3c14f56ba1477d53": "staked_slipstream_v3", // WrappedStakedSlipstream V3
303
137
  };
138
+ export const CHAIN_STAKED_POSITION_MANAGERS = {
139
+ 10: {
140
+ "0xf6a87d944204bb5fdb9cf5534c03c46895f78ecd": "staked_slipstream_v3", // StakedSlipstreamAM V3 (OP)
141
+ "0xc4d3d804ed64c1f78097799208d46b1db4252749": "staked_slipstream_v3", // WrappedStakedSlipstream V3 (OP)
142
+ },
143
+ };
144
+ /** dex_protocol for an LP position manager address on a chain, or null if unknown. */
145
+ export function positionManagerToDexProtocol(chainId, address) {
146
+ const key = address.toLowerCase();
147
+ return (CHAIN_STAKED_POSITION_MANAGERS[chainId]?.[key] ??
148
+ UNIVERSAL_POSITION_MANAGERS[key] ??
149
+ CHAIN_POSITION_MANAGERS[chainId]?.[key] ??
150
+ null);
151
+ }
@@ -57,7 +57,7 @@ export function registerWorkflowPrompts(server) {
57
57
  "- Pair type (volatile/stable, correlated, stable/stable)",
58
58
  "- Recommended range width given volatility",
59
59
  "- Leverage sizing (target health factor >= 0.5 at entry)",
60
- "- Automation combo (rebalancer + compounder/yield claimer + merkl if applicable)",
60
+ "- Automation combo (rebalance + compound_fees/claim_rewards + claim_merkl if applicable)",
61
61
  "",
62
62
  "Recommend the top 1-3 strategies with reasoning.",
63
63
  ].join("\n"),
@@ -66,7 +66,7 @@ export function registerWorkflowPrompts(server) {
66
66
  ],
67
67
  }));
68
68
  server.registerPrompt("setup-automation", {
69
- description: "Enable rebalancer, compounder, yield claimer, and/or merkl operator for an Arcadia account.",
69
+ description: "Configure automations (compounding, claiming, rebalancing, Merkl) for an Arcadia account.",
70
70
  argsSchema: {
71
71
  account_address: z.string().describe("Arcadia account address"),
72
72
  chain_id: z.string().optional().describe("Chain ID (default: 8453 Base)"),
@@ -81,18 +81,20 @@ export function registerWorkflowPrompts(server) {
81
81
  `Set up automation for Arcadia account ${account_address} on chain ${chain_id ?? "8453"}.`,
82
82
  "",
83
83
  "Steps:",
84
- "1. Call read.account.info to check current positions and which asset managers are already enabled",
85
- "2. Identify the LP protocol (Slipstream V1/V2/V3 or Uniswap V3/V4) from the position",
86
- "3. Call read.asset_manager.intents to see available automations",
87
- "4. For each automation to enable, call the matching write.asset_manager.* tool:",
88
- " - Rebalancer: write.asset_manager.rebalancer (set dex_protocol, trigger ratios, compound_leftovers)",
89
- " - Compounder: write.asset_manager.compounder or write.asset_manager.compounder_staked (with CowSwap)",
90
- " - Yield Claimer: write.asset_manager.yield_claimer or write.asset_manager.yield_claimer_cowswap",
91
- " - Merkl Operator: write.asset_manager.merkl_operator (set reward_recipient)",
92
- " - CowSwap Direct: write.asset_manager.cow_swapper (Base only)",
93
- "5. Merge arrays from multiple intent calls if combining, then call write.account.set_asset_managers",
84
+ "1. Call read.account.info to see the account's positions and note the LP position id",
85
+ "2. Call read.asset_manager.current to see what is already enabled, including any superseded managers to clear",
86
+ "3. Call read.asset_manager.intents with the account address to see which intents are available and why any are blocked",
87
+ "4. Ask which automations the user wants, then build one intents array covering all of them:",
88
+ " - compound_fees: reinvest fees and rewards into the LP",
89
+ " - claim_rewards: claim yield out, optionally converted to one token via CowSwap",
90
+ " - add_to_lp: fold idle pool-token balances back into the LP",
91
+ " - rebalance: reposition when out of range (or take_profit / POL strategy)",
92
+ " - claim_merkl: auto-claim Merkl incentive rewards",
93
+ "5. Call write.account.automations with the account, the LP position_id and that intents array",
94
94
  "",
95
- "Ask which automations to enable and walk through each one.",
95
+ "The intents array is the complete desired state, so include every automation the user wants kept, not just the new ones.",
96
+ "If a compatibility rule rejects the combination, read errors[].reason, adjust and retry.",
97
+ "To change one automation without restating the rest, use write.account.automations_delta.",
96
98
  ].join("\n"),
97
99
  },
98
100
  },
@@ -8,7 +8,7 @@ const GUIDES = {
8
8
  },
9
9
  automation: {
10
10
  file: "automation.md",
11
- description: "Rebalancer, compounder, yield claimer, merkl operator, CoW swapper setup and addresses",
11
+ description: "Intent-based automation setup: compound fees, claim rewards, add to LP, rebalance, claim Merkl",
12
12
  },
13
13
  strategies: {
14
14
  file: "strategies.md",
@@ -14,12 +14,7 @@ import { registerRepayTool } from "./write/account/repay.js";
14
14
  import { registerApproveTool } from "./write/wallet/approve.js";
15
15
  import { registerPoolDepositTool } from "./write/pool/deposit.js";
16
16
  import { registerPoolRedeemTool } from "./write/pool/redeem.js";
17
- import { registerRebalancerTool } from "./write/asset-managers/rebalancer.js";
18
- import { registerCompounderTools } from "./write/asset-managers/compounder.js";
19
- import { registerYieldClaimerTools } from "./write/asset-managers/yield-claimer.js";
20
- import { registerCowSwapperTool } from "./write/asset-managers/cow-swapper.js";
21
- import { registerMerklOperatorTool } from "./write/asset-managers/merkl-operator.js";
22
- import { registerSetAssetManagersTool } from "./write/asset-managers/set-asset-managers.js";
17
+ import { registerAutomationsTools } from "./write/asset-managers/automations.js";
23
18
  import { registerSendTool } from "./dev/send.js";
24
19
  import { registerAddLiquidityTool } from "./write/account/add-liquidity.js";
25
20
  import { registerRemoveLiquidityTool } from "./write/account/remove-liquidity.js";
@@ -36,7 +31,7 @@ export function registerAllTools(server, api, chains) {
36
31
  registerPointsTools(server, api);
37
32
  registerGuideTools(server);
38
33
  registerWalletTools(server, chains, api);
39
- registerAssetManagerTools(server);
34
+ registerAssetManagerTools(server, api);
40
35
  // Write tools — account
41
36
  registerCreateTool(server, chains);
42
37
  registerDepositTool(server, chains);
@@ -54,13 +49,8 @@ export function registerAllTools(server, api, chains) {
54
49
  // Write tools — pool (lending tranches, ERC-4626)
55
50
  registerPoolDepositTool(server, chains);
56
51
  registerPoolRedeemTool(server, chains);
57
- // Write tools — asset managers
58
- registerRebalancerTool(server, chains);
59
- registerCompounderTools(server, chains);
60
- registerYieldClaimerTools(server, chains);
61
- registerCowSwapperTool(server, chains);
62
- registerMerklOperatorTool(server, chains);
63
- registerSetAssetManagersTool(server, chains);
52
+ // Write tools: asset managers (intent-based, compiled by the backend)
53
+ registerAutomationsTools(server, api);
64
54
  // Dev tools
65
55
  registerSendTool(server, chains);
66
56
  }
@@ -25,12 +25,47 @@ export const BatchedTransactionOutput = z.object({
25
25
  .passthrough()
26
26
  .optional(),
27
27
  });
28
- export const IntentOutput = z.object({
29
- description: z.string().optional(),
30
- asset_managers: z.array(z.string()),
31
- statuses: z.array(z.boolean()),
32
- datas: z.array(z.string()),
33
- strategy_name: z.string().optional(),
28
+ const ResolvedManager = z.object({
29
+ manager: z.string(),
30
+ address: z.string(),
31
+ enabled: z.boolean(),
32
+ strategy: z.string().nullish(),
33
+ serving_intents: z.array(z.string()),
34
+ });
35
+ const DiffEntry = z.object({
36
+ manager: z.string(),
37
+ address: z.string(),
38
+ enabled: z.boolean(),
39
+ });
40
+ export const AutomationsPlanOutput = z.object({
41
+ description: z.string(),
42
+ valid: z.boolean(),
43
+ errors: z.array(z.object({ rule: z.string(), severity: z.string(), reason: z.string() })),
44
+ warnings: z.array(z.string()),
45
+ human_summary: z.array(z.string()),
46
+ plan: z.array(ResolvedManager),
47
+ diff: z
48
+ .object({
49
+ added: z.array(DiffEntry),
50
+ removed: z.array(DiffEntry),
51
+ updated: z.array(DiffEntry),
52
+ })
53
+ .optional(),
54
+ transaction: Transaction.optional(),
55
+ simulation_url: z.string().optional(),
56
+ tenderly_sim_status: z.enum(["success", "failure", "unavailable"]).optional(),
57
+ no_changes_needed: z.boolean().optional(),
58
+ preview_only: z.boolean().optional(),
59
+ });
60
+ export const AutomationsStateOutput = z.object({
61
+ account: z.string(),
62
+ chain_id: z.number(),
63
+ read_ok: z.boolean(),
64
+ inferred_intents: z.array(z.string()),
65
+ enabled: z.array(z.record(z.unknown())),
66
+ deprecated: z.array(z.record(z.unknown())),
67
+ merkl: z.record(z.unknown()).nullish(),
68
+ warnings: z.array(z.string()),
34
69
  });
35
70
  export const WalletBalancesOutput = z.object({
36
71
  native: z.object({
@@ -125,6 +160,7 @@ export const GuideOutput = z.object({
125
160
  });
126
161
  export const IntentsListOutput = z.object({
127
162
  automations: z.array(z.record(z.unknown())),
163
+ availability_error: z.string().optional(),
128
164
  shared_params: z.array(z.string()),
129
165
  usage: z.string(),
130
166
  });