@arcadia-finance/mcp-server 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/LICENSE.md +631 -68
  2. package/README.md +54 -38
  3. package/dist/clients/api.js +1 -1
  4. package/dist/index.js +15 -5
  5. package/dist/prompts/workflows.js +9 -9
  6. package/dist/tools/advanced/add-liquidity.js +14 -7
  7. package/dist/tools/advanced/close-position.js +12 -5
  8. package/dist/tools/advanced/position-actions.js +8 -1
  9. package/dist/tools/advanced/remove-liquidity.js +10 -3
  10. package/dist/tools/advanced/repay-with-collateral.js +9 -2
  11. package/dist/tools/advanced/swap.js +9 -2
  12. package/dist/tools/read/accounts.js +24 -3
  13. package/dist/tools/read/allowances.js +9 -2
  14. package/dist/tools/read/assets.js +8 -1
  15. package/dist/tools/read/balances.js +9 -2
  16. package/dist/tools/read/guides.js +8 -1
  17. package/dist/tools/read/points.js +8 -1
  18. package/dist/tools/read/pools.js +8 -1
  19. package/dist/tools/read/protocol.js +17 -3
  20. package/dist/tools/write/approve.js +9 -2
  21. package/dist/tools/write/borrow.js +10 -3
  22. package/dist/tools/write/configure-asset-manager.js +9 -2
  23. package/dist/tools/write/create-account.js +9 -2
  24. package/dist/tools/write/deposit.js +9 -2
  25. package/dist/tools/write/repay.js +9 -2
  26. package/dist/tools/write/set-asset-manager.js +9 -2
  27. package/dist/tools/write/sign-and-send.js +9 -2
  28. package/dist/tools/write/withdraw.js +10 -3
  29. package/package.json +2 -2
  30. package/server.json +9 -2
  31. package/skills/clamm-liquidity/SKILL.md +44 -44
  32. package/skills/clamm-liquidity/automation.md +7 -7
  33. package/skills/clamm-liquidity/selection.md +19 -19
  34. package/skills/clamm-liquidity/strategies.md +53 -53
@@ -1,6 +1,13 @@
1
1
  import { z } from "zod";
2
2
  export function registerProtocolTools(server, api) {
3
- server.registerTool("get_strategies", {
3
+ server.registerTool("read.strategies", {
4
+ annotations: {
5
+ title: "Get Strategies",
6
+ readOnlyHint: true,
7
+ destructiveHint: false,
8
+ idempotentHint: true,
9
+ openWorldHint: true,
10
+ },
4
11
  description: "Get Arcadia LP strategies. Use featured_only=true for curated top strategies (recommended first call). Use strategy_id for full detail on a specific strategy — includes APY per range width (narrower range = higher APY but more rebalancing cost/risk). Without filters, returns a compact summary with 7d avg APY for the strategy's default range. Increase limit or use offset for pagination. All APY values are decimal fractions (1.0 = 100%, 0.05 = 5%).",
5
12
  inputSchema: {
6
13
  strategy_id: z.number().optional().describe("Strategy ID for full detail"),
@@ -67,8 +74,15 @@ export function registerProtocolTools(server, api) {
67
74
  };
68
75
  }
69
76
  });
70
- server.registerTool("get_recommendation", {
71
- description: "Get a rebalancing recommendation for an Arcadia account — suggests asset changes to optimize yield. Uses 1d APY (not 7d like get_strategies list view), so recommended strategies may differ from the list ranking.",
77
+ server.registerTool("read.recommendation", {
78
+ annotations: {
79
+ title: "Get Recommendation",
80
+ readOnlyHint: true,
81
+ destructiveHint: false,
82
+ idempotentHint: true,
83
+ openWorldHint: true,
84
+ },
85
+ description: "Get a rebalancing recommendation for an Arcadia account — suggests asset changes to optimize yield. Uses 1d APY (not 7d like read.strategies list view), so recommended strategies may differ from the list ranking.",
72
86
  inputSchema: {
73
87
  account_address: z.string().describe("Arcadia account address"),
74
88
  chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
@@ -5,8 +5,15 @@ import { appendDataSuffix } from "../../utils/attribution.js";
5
5
  import { validateAddress } from "../../utils/validation.js";
6
6
  const MAX_UINT256 = 2n ** 256n - 1n;
7
7
  export function registerApproveTool(server, _chains) {
8
- server.registerTool("build_approve_tx", {
9
- description: "Build an unsigned approval transaction. For ERC20 tokens: generates approve(spender, amount). For ERC721/ERC1155 NFTs (e.g. LP positions): generates setApprovalForAll(operator, true). Required before build_deposit_tx or build_add_liquidity_tx (when depositing from wallet). Tip: call get_allowance first to check if approval already exists — skip this if the current allowance is sufficient.",
8
+ server.registerTool("write.approve", {
9
+ annotations: {
10
+ title: "Build Approve Transaction",
11
+ readOnlyHint: false,
12
+ destructiveHint: false,
13
+ idempotentHint: true,
14
+ openWorldHint: false,
15
+ },
16
+ description: "Build an unsigned approval transaction. For ERC20 tokens: generates approve(spender, amount). For ERC721/ERC1155 NFTs (e.g. LP positions): generates setApprovalForAll(operator, true). Required before write.deposit or advanced.add_liquidity (when depositing from wallet). Tip: call read.allowance first to check if approval already exists — skip this if the current allowance is sufficient.",
10
17
  inputSchema: {
11
18
  token_address: z.string().describe("Token contract address to approve"),
12
19
  spender_address: z
@@ -4,8 +4,15 @@ import { poolAbi } from "../../abis/index.js";
4
4
  import { appendDataSuffix } from "../../utils/attribution.js";
5
5
  import { validateAddress } from "../../utils/validation.js";
6
6
  export function registerBorrowTool(server, _chains, api) {
7
- server.registerTool("build_borrow_tx", {
8
- description: "Build an unsigned transaction to borrow from an Arcadia lending pool against account collateral. Only works with margin accounts (created with a creditor/lending pool). Spot accounts (no creditor) cannot borrow — the tool will validate this and reject. Before borrowing, verify the account has positive free margin via get_account_info: collateral_value must exceed used_margin.",
7
+ server.registerTool("write.borrow", {
8
+ annotations: {
9
+ title: "Build Borrow Transaction",
10
+ readOnlyHint: false,
11
+ destructiveHint: false,
12
+ idempotentHint: true,
13
+ openWorldHint: false,
14
+ },
15
+ description: "Build an unsigned transaction to borrow from an Arcadia lending pool against account collateral. Only works with margin accounts (created with a creditor/lending pool). Spot accounts (no creditor) cannot borrow — the tool will validate this and reject. Before borrowing, verify the account has positive free margin via read.account_info: collateral_value must exceed used_margin.",
9
16
  inputSchema: {
10
17
  pool_address: z
11
18
  .string()
@@ -28,7 +35,7 @@ export function registerBorrowTool(server, _chains, api) {
28
35
  content: [
29
36
  {
30
37
  type: "text",
31
- text: "Error: This account has no creditor (spot account) and cannot borrow. Create a margin account with a creditor (lending pool) using build_create_account_tx.",
38
+ text: "Error: This account has no creditor (spot account) and cannot borrow. Create a margin account with a creditor (lending pool) using write.create_account.",
32
39
  },
33
40
  ],
34
41
  isError: true,
@@ -116,8 +116,15 @@ function resolveAmAddress(chainId, amType, protocol) {
116
116
  return getAmProtocolAddress(chainId, AM_TYPE_TO_CATEGORY[amType], PROTOCOL_TO_AM_KEY[protocol]);
117
117
  }
118
118
  export function registerConfigureAssetManagerTool(server, _chains) {
119
- server.registerTool("build_configure_asset_manager_tx", {
120
- description: "Build an unsigned transaction to enable AND configure an asset manager on an Arcadia V3/V4 account. Unlike build_set_asset_manager_tx (which only grants permission), this also sets the initiator, fee limits, and strategy parameters in one transaction via setAssetManagers. Supports rebalancer (with trigger ratios and compound mode), compounder, yield claimer (with fee recipient), and merkl operator (with reward recipient). For cow_swapper, use build_set_asset_manager_tx instead (no callback data needed). Pass pool_protocol to auto-resolve the correct AM address (required for rebalancer/compounder/yield_claimer), or pass asset_manager_address directly. merkl_operator is protocol-agnostic and auto-resolves without pool_protocol. Returns { transaction: { to, data, value, chainId } }.",
119
+ server.registerTool("write.configure_asset_manager", {
120
+ annotations: {
121
+ title: "Build Configure Asset Manager Transaction",
122
+ readOnlyHint: false,
123
+ destructiveHint: false,
124
+ idempotentHint: true,
125
+ openWorldHint: false,
126
+ },
127
+ description: "Build an unsigned transaction to enable AND configure an asset manager on an Arcadia V3/V4 account. Unlike write.set_asset_manager (which only grants permission), this also sets the initiator, fee limits, and strategy parameters in one transaction via setAssetManagers. Supports rebalancer (with trigger ratios and compound mode), compounder, yield claimer (with fee recipient), and merkl operator (with reward recipient). For cow_swapper, use write.set_asset_manager instead (no callback data needed). Pass pool_protocol to auto-resolve the correct AM address (required for rebalancer/compounder/yield_claimer), or pass asset_manager_address directly. merkl_operator is protocol-agnostic and auto-resolves without pool_protocol. Returns { transaction: { to, data, value, chainId } }.",
121
128
  inputSchema: {
122
129
  account_address: z.string().describe("Arcadia account address (must be V3 or V4)"),
123
130
  asset_manager_address: z
@@ -25,7 +25,14 @@ export function computeAccountAddress(factoryAddress, userSalt, walletAddress, i
25
25
  return getAddress(slice(raw, 12));
26
26
  }
27
27
  export function registerCreateAccountTool(server, chains) {
28
- server.registerTool("build_create_account_tx", {
28
+ server.registerTool("write.create_account", {
29
+ annotations: {
30
+ title: "Build Create Account Transaction",
31
+ readOnlyHint: false,
32
+ destructiveHint: false,
33
+ idempotentHint: true,
34
+ openWorldHint: false,
35
+ },
29
36
  description: "Build an unsigned transaction to create a new Arcadia account via the Factory contract. account_version: 3 with creditor → V3 margin account (can borrow/leverage). account_version: 0 or 4 → V4 spot account (no borrowing, creditor is ignored, any ERC20 allowed). Returns the predicted account address (deterministic via CREATE2).",
30
37
  inputSchema: {
31
38
  salt: z.number().describe("Unique salt (uint32) for deterministic account address"),
@@ -95,7 +102,7 @@ export function registerCreateAccountTool(server, chains) {
95
102
  ...(predictedAddress && { predicted_account_address: predictedAddress }),
96
103
  next_steps: predictedAddress
97
104
  ? "The new account will be at predicted_account_address after tx confirms. You can use it immediately without waiting for indexing."
98
- : "After tx confirms, call get_account_info with wallet_address to find the new account. Note: there may be a short indexing delay.",
105
+ : "After tx confirms, call read.account_info with wallet_address to find the new account. Note: there may be a short indexing delay.",
99
106
  }, null, 2),
100
107
  },
101
108
  ],
@@ -5,8 +5,15 @@ import { getPublicClient } from "../../clients/chain.js";
5
5
  import { appendDataSuffix } from "../../utils/attribution.js";
6
6
  import { validateAddress, validateChainId } from "../../utils/validation.js";
7
7
  export function registerDepositTool(server, chains) {
8
- server.registerTool("build_deposit_tx", {
9
- description: "Build an unsigned transaction to deposit assets into an Arcadia account as collateral. Supports ERC20 tokens and ERC721 NFTs (LP positions). NOT needed before build_add_liquidity_tx — that tool deposits from wallet atomically. Ensure the account is approved first (call get_allowance to check, then build_approve_tx if needed). Account version is auto-detected on-chain (override with account_version if needed).",
8
+ server.registerTool("write.deposit", {
9
+ annotations: {
10
+ title: "Build Deposit Transaction",
11
+ readOnlyHint: false,
12
+ destructiveHint: false,
13
+ idempotentHint: true,
14
+ openWorldHint: false,
15
+ },
16
+ description: "Build an unsigned transaction to deposit assets into an Arcadia account as collateral. Supports ERC20 tokens and ERC721 NFTs (LP positions). NOT needed before advanced.add_liquidity — that tool deposits from wallet atomically. Ensure the account is approved first (call read.allowance to check, then write.approve if needed). Account version is auto-detected on-chain (override with account_version if needed).",
10
17
  inputSchema: {
11
18
  account_address: z.string().describe("Arcadia account address"),
12
19
  asset_addresses: z.array(z.string()).describe("Token contract addresses to deposit"),
@@ -4,8 +4,15 @@ import { poolAbi } from "../../abis/index.js";
4
4
  import { appendDataSuffix } from "../../utils/attribution.js";
5
5
  import { validateAddress } from "../../utils/validation.js";
6
6
  export function registerRepayTool(server, _chains) {
7
- server.registerTool("build_repay_tx", {
8
- description: "Build an unsigned transaction to repay debt to an Arcadia lending pool from your wallet. This tool does not validate whether the account has outstanding debt — check with get_account_info first. Check allowance first (get_allowance), then approve the pool if needed (build_approve_tx). To repay using account collateral instead, use build_repay_with_collateral_tx.",
7
+ server.registerTool("write.repay", {
8
+ annotations: {
9
+ title: "Build Repay Transaction",
10
+ readOnlyHint: false,
11
+ destructiveHint: false,
12
+ idempotentHint: true,
13
+ openWorldHint: false,
14
+ },
15
+ description: "Build an unsigned transaction to repay debt to an Arcadia lending pool from your wallet. This tool does not validate whether the account has outstanding debt — check with read.account_info first. Check allowance first (read.allowance), then approve the pool if needed (write.approve). To repay using account collateral instead, use advanced.repay_with_collateral.",
9
16
  inputSchema: {
10
17
  pool_address: z
11
18
  .string()
@@ -4,8 +4,15 @@ import { accountAbi } from "../../abis/index.js";
4
4
  import { appendDataSuffix } from "../../utils/attribution.js";
5
5
  import { validateAddress } from "../../utils/validation.js";
6
6
  export function registerSetAssetManagerTool(server, _chains) {
7
- server.registerTool("build_set_asset_manager_tx", {
8
- description: "Build an unsigned transaction to grant or revoke an asset manager's permission on an Arcadia V3/V4 account via setAssetManagers. This ONLY toggles the permission flag — it does NOT configure initiator, fees, or strategy parameters. For full setup (enable + configure in one tx), use build_configure_asset_manager_tx instead. For asset manager addresses, call get_guide('automation'). Returns { transaction: { to, data, value, chainId } }.",
7
+ server.registerTool("write.set_asset_manager", {
8
+ annotations: {
9
+ title: "Build Set Asset Manager Transaction",
10
+ readOnlyHint: false,
11
+ destructiveHint: false,
12
+ idempotentHint: true,
13
+ openWorldHint: false,
14
+ },
15
+ description: "Build an unsigned transaction to grant or revoke an asset manager's permission on an Arcadia V3/V4 account via setAssetManagers. This ONLY toggles the permission flag — it does NOT configure initiator, fees, or strategy parameters. For full setup (enable + configure in one tx), use write.configure_asset_manager instead. For asset manager addresses, call read.guide('automation'). Returns { transaction: { to, data, value, chainId } }.",
9
16
  inputSchema: {
10
17
  account_address: z.string().describe("Arcadia account address (V3 or V4)"),
11
18
  asset_manager_address: z
@@ -8,8 +8,15 @@ const VIEM_CHAINS = {
8
8
  130: unichain,
9
9
  };
10
10
  export function registerSignAndSendTool(server, chains) {
11
- server.registerTool("sign_and_send_tx", {
12
- description: "DEV ONLY — Sign and broadcast an unsigned transaction using a local private key (PK env var). For production, use a dedicated wallet MCP server (Fireblocks, Safe, Turnkey, etc.) instead of this tool. Takes the transaction object returned by any build_*_tx tool and submits it onchain.",
11
+ server.registerTool("dev.sign_and_send", {
12
+ annotations: {
13
+ title: "Sign and Send Transaction",
14
+ readOnlyHint: false,
15
+ destructiveHint: true,
16
+ idempotentHint: false,
17
+ openWorldHint: true,
18
+ },
19
+ description: "DEV ONLY — Sign and broadcast an unsigned transaction using a local private key (PK env var). For production, use a dedicated wallet MCP server (Fireblocks, Safe, Turnkey, etc.) instead of this tool. Takes the transaction object returned by any write.* or advanced.* tool and submits it onchain.",
13
20
  inputSchema: {
14
21
  to: z.string().describe("Target contract address"),
15
22
  data: z.string().describe("Encoded calldata (hex)"),
@@ -5,8 +5,15 @@ import { getPublicClient } from "../../clients/chain.js";
5
5
  import { appendDataSuffix } from "../../utils/attribution.js";
6
6
  import { validateAddress, validateChainId } from "../../utils/validation.js";
7
7
  export function registerWithdrawTool(server, chains) {
8
- server.registerTool("build_withdraw_tx", {
9
- description: "Build an unsigned transaction to withdraw assets from an Arcadia account to the owner's wallet. Only the account owner can withdraw. Will revert if the account has debt and withdrawal would make it undercollateralized. Does not support max_uint256 — pass exact amounts from get_account_info. Account version is auto-detected on-chain (override with account_version if needed).",
8
+ server.registerTool("write.withdraw", {
9
+ annotations: {
10
+ title: "Build Withdraw Transaction",
11
+ readOnlyHint: false,
12
+ destructiveHint: false,
13
+ idempotentHint: true,
14
+ openWorldHint: false,
15
+ },
16
+ description: "Build an unsigned transaction to withdraw assets from an Arcadia account to the owner's wallet. Only the account owner can withdraw. Will revert if the account has debt and withdrawal would make it undercollateralized. Does not support max_uint256 — pass exact amounts from read.account_info. Account version is auto-detected on-chain (override with account_version if needed).",
10
17
  inputSchema: {
11
18
  account_address: z.string().describe("Arcadia account address"),
12
19
  asset_addresses: z.array(z.string()).describe("Token contract addresses to withdraw"),
@@ -32,7 +39,7 @@ export function registerWithdrawTool(server, chains) {
32
39
  content: [
33
40
  {
34
41
  type: "text",
35
- text: 'Error: build_withdraw_tx does not support "max_uint256". Pass exact amounts from get_account_info.',
42
+ text: 'Error: write.withdraw does not support "max_uint256". Pass exact amounts from read.account_info.',
36
43
  },
37
44
  ],
38
45
  isError: true,
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@arcadia-finance/mcp-server",
3
3
  "mcpName": "io.github.arcadia-finance/mcp-server",
4
- "version": "0.1.4",
4
+ "version": "0.2.0",
5
5
  "description": "MCP server for Arcadia Finance. Manage concentrated liquidity positions with leverage, automated rebalancing, and yield optimization on Base, Optimism, and Unichain.",
6
6
  "type": "module",
7
- "license": "BUSL-1.1",
7
+ "license": "AGPL-3.0",
8
8
  "packageManager": "yarn@4.13.0",
9
9
  "repository": {
10
10
  "type": "git",
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "io.github.arcadia-finance/mcp-server",
4
4
  "title": "Arcadia Finance",
5
5
  "description": "Manage Uniswap and Aerodrome liquidity positions with automated rebalancing and leverage.",
6
- "version": "0.1.4",
6
+ "version": "0.2.0",
7
7
  "websiteUrl": "https://arcadia.finance",
8
8
  "repository": {
9
9
  "url": "https://github.com/arcadia-finance/mcp-server",
@@ -13,7 +13,7 @@
13
13
  {
14
14
  "registryType": "npm",
15
15
  "identifier": "@arcadia-finance/mcp-server",
16
- "version": "0.1.4",
16
+ "version": "0.2.0",
17
17
  "transport": {
18
18
  "type": "stdio"
19
19
  },
@@ -43,6 +43,13 @@
43
43
  "isSecret": true
44
44
  }
45
45
  ]
46
+ },
47
+ {
48
+ "registryType": "url",
49
+ "identifier": "https://mcp.arcadia.finance/mcp",
50
+ "transport": {
51
+ "type": "streamablehttp"
52
+ }
46
53
  }
47
54
  ]
48
55
  }
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: clamm-liquidity
3
3
  description: Agent guide for clAMM management on Arcadia Finance. Covers 25 MCP tools (+1 dev), automation setup (rebalancers, compounders, yield claimers, Merkl, CoW swapper), strategy selection framework, and strategy templates including delta neutral leveraged LP and protocol-owned liquidity.
4
- user-invokable: true
4
+ user-invocable: true
5
5
  ---
6
6
 
7
7
  # Arcadia Finance — clAMM Agent Guide
@@ -10,14 +10,14 @@ Arcadia is a platform for managing concentrated liquidity positions — with bui
10
10
 
11
11
  ## Key Constraints
12
12
 
13
- - **All `build_*_tx` tools return unsigned transactions** (`{ to, data, value, chainId }`) — you must sign and broadcast them. See "Transaction Signing" below.
13
+ - **All `write.*` and `advanced.*` tools return unsigned transactions** (`{ to, data, value, chainId }`) — you must sign and broadcast them. See "Transaction Signing" below.
14
14
  - **Automation strategy config** (tick range, rebalance thresholds) is not currently settable via MCP — this requires Arcadia platform access.
15
15
  - **Health factor** = `1 - (used_margin / liquidation_value)`. Higher is safer. `1` = no debt, `>0` = healthy, `0` = liquidation threshold, `<0` = past liquidation. Keep above 0.5 for leveraged positions; act immediately below 0.2.
16
- - **Minimum margin** — each lending pool enforces a fixed minimum margin denominated in the pool's numeraire (e.g. WETH for the WETH pool, USDC for the USDC pool), typically a few dollars in value. This gets **added to the debt** when computing `used_margin` (i.e. `used_margin = open_debt + minimum_margin`). It ensures liquidations remain profitable (covering gas costs) and prevents dust attacks. For small positions the fixed minimum margin dominates the used margin, pushing health factor lower than the leverage ratio alone would suggest (e.g. HF ~0.3 at 2× leverage). Increase position size for a healthier starting HF. `build_add_liquidity_tx` also validates deposits against per-asset minimum amounts from strategy risk factors.
16
+ - **Minimum margin** — each lending pool enforces a fixed minimum margin denominated in the pool's numeraire (e.g. WETH for the WETH pool, USDC for the USDC pool), typically a few dollars in value. This gets **added to the debt** when computing `used_margin` (i.e. `used_margin = open_debt + minimum_margin`). It ensures liquidations remain profitable (covering gas costs) and prevents dust attacks. For small positions the fixed minimum margin dominates the used margin, pushing health factor lower than the leverage ratio alone would suggest (e.g. HF ~0.3 at 2× leverage). Increase position size for a healthier starting HF. `advanced.add_liquidity` also validates deposits against per-asset minimum amounts from strategy risk factors.
17
17
 
18
18
  ## Transaction Signing
19
19
 
20
- Write and advanced tools (`build_*_tx`) return unsigned transaction calldata. This server does NOT sign or broadcast. After receiving a transaction object, you must:
20
+ Write and advanced tools (`write.*` / `advanced.*`) return unsigned transaction calldata. This server does NOT sign or broadcast. After receiving a transaction object, you must:
21
21
 
22
22
  1. **Sign** the transaction with the account owner's private key or wallet
23
23
  2. **Broadcast** it to the appropriate chain (Base 8453, Optimism 10, or Unichain 130)
@@ -28,7 +28,7 @@ How you sign depends on your setup:
28
28
  - **MPC wallet** (Fireblocks, Dfns, Turnkey) — pass the unsigned tx to your provider's signing API
29
29
  - **Smart account** (Safe, Biconomy) — wrap the tx as a UserOperation or Safe transaction
30
30
  - **Embedded wallet** (Privy, Dynamic) — use the provider's `sendTransaction` method
31
- - **Direct private key** (development only) — use the built-in `sign_and_send_tx` tool (set `PK` in a `.env` file or MCP client config), or viem/ethers `sendTransaction` with a local signer
31
+ - **Direct private key** (development only) — use the built-in `dev.sign_and_send` tool (set `PK` in a `.env` file or MCP client config), or viem/ethers `sendTransaction` with a local signer
32
32
 
33
33
  Example with viem:
34
34
 
@@ -49,51 +49,51 @@ Arcadia's flash-action tools can batch multiple DeFi operations into a single at
49
49
 
50
50
  ### Read Tools
51
51
 
52
- | Tool | When to use |
53
- | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
- | `get_account_info` | Account overview + liquidation price. Pass `account_address` for detail (returns positions with `asset_address`/`asset_id`, collateral, debt) or `wallet_address` to list accounts. |
55
- | `get_account_history` | Historical account value over time. Optional `days` param (default 14). |
56
- | `get_account_pnl` | PnL and yield earned — use to check if a strategy is still profitable. |
57
- | `get_assets` | Supported collateral assets with prices. Pass `asset_addresses` (single or comma-separated) for price lookup. |
58
- | `get_wallet_balances` | On-chain ERC20 balances and native ETH for a wallet. Use to pre-check if the wallet has enough tokens before depositing or adding liquidity. |
59
- | `get_allowance` | Check ERC20 token allowances for a spender. Use before `build_approve_tx` to avoid redundant approvals — skip if the current allowance is already sufficient. |
60
- | `get_lending_pools` | Pool TVL, APY, utilization, liquidity. Pass `pool_address` for detail + APY history (optional `days`, default 14). |
61
- | `get_strategies` | LP strategies with fee APY, underlyings, pool protocol. List view shows 7d avg APY for the strategy's default range (e.g. ±7.5% for volatile pairs). **Pass `strategy_id` to see APY per range width** (very_narrow → full_range) — narrower range = higher APY but more rebalancing cost/risk. Use `featured_only: true` for curated top strategies. |
62
- | `get_points` | Points for a wallet or leaderboard. No `chain_id` needed — points are cross-chain. |
63
- | `get_recommendation` | Rebalancing recommendation for an account. Uses 1d APY (not 7d like `get_strategies`), so numbers may differ. |
64
- | `get_guide` | Reference guides: `automation` (AM setup), `selection` (pool evaluation), `strategies` (step-by-step templates). |
52
+ | Tool | When to use |
53
+ | ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
54
+ | `read.account_info` | Account overview + liquidation price. Pass `account_address` for detail (returns positions with `asset_address`/`asset_id`, collateral, debt) or `wallet_address` to list accounts. |
55
+ | `read.account_history` | Historical account value over time. Optional `days` param (default 14). |
56
+ | `read.account_pnl` | PnL and yield earned — use to check if a strategy is still profitable. |
57
+ | `read.assets` | Supported collateral assets with prices. Pass `asset_addresses` (single or comma-separated) for price lookup. |
58
+ | `read.wallet_balances` | On-chain ERC20 balances and native ETH for a wallet. Use to pre-check if the wallet has enough tokens before depositing or adding liquidity. |
59
+ | `read.allowance` | Check ERC20 token allowances for a spender. Use before `write.approve` to avoid redundant approvals — skip if the current allowance is already sufficient. |
60
+ | `read.lending_pools` | Pool TVL, APY, utilization, liquidity. Pass `pool_address` for detail + APY history (optional `days`, default 14). |
61
+ | `read.strategies` | LP strategies with fee APY, underlyings, pool protocol. List view shows 7d avg APY for the strategy's default range (e.g. ±7.5% for volatile pairs). **Pass `strategy_id` to see APY per range width** (very_narrow → full_range) — narrower range = higher APY but more rebalancing cost/risk. Use `featured_only: true` for curated top strategies. |
62
+ | `read.points` | Points for a wallet or leaderboard. No `chain_id` needed — points are cross-chain. |
63
+ | `read.recommendation` | Rebalancing recommendation for an account. Uses 1d APY (not 7d like `read.strategies`), so numbers may differ. |
64
+ | `read.guide` | Reference guides: `automation` (AM setup), `selection` (pool evaluation), `strategies` (step-by-step templates). |
65
65
 
66
66
  ### Preferred Write Tools (atomic/multi-step — use these first)
67
67
 
68
68
  These tools batch multiple operations into ONE atomic transaction. Always prefer these over individual tools.
69
69
 
70
- | Tool | Batches | When to use |
71
- | ---------------------------------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
72
- | `build_add_liquidity_tx` | deposit + swap + mint LP + optional borrow | Open LP position. Do NOT call `build_deposit_tx` separately — this handles wallet transfer atomically. |
73
- | `build_close_position_tx` | burn LP + swap + repay debt (up to 3 steps) | Close/exit a position. ALWAYS try this first. Tokens stay in account — follow up with `build_withdraw_tx`. |
74
- | `build_repay_with_collateral_tx` | swap collateral + repay debt | Repay debt using account collateral (no wallet tokens needed). Preferred for health factor fixes. |
75
- | `build_configure_asset_manager_tx` | grant permission + set initiator/fees/strategy params | Enable AND configure an automation (rebalancer, compounder, yield claimer, merkl) in one transaction. |
70
+ | Tool | Batches | When to use |
71
+ | -------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
72
+ | `advanced.add_liquidity` | deposit + swap + mint LP + optional borrow | Open LP position. Do NOT call `write.deposit` separately — this handles wallet transfer atomically. |
73
+ | `advanced.close_position` | burn LP + swap + repay debt (up to 3 steps) | Close/exit a position. ALWAYS try this first. Tokens stay in account — follow up with `write.withdraw`. |
74
+ | `advanced.repay_with_collateral` | swap collateral + repay debt | Repay debt using account collateral (no wallet tokens needed). Preferred for health factor fixes. |
75
+ | `write.configure_asset_manager` | grant permission + set initiator/fees/strategy params | Enable AND configure an automation (rebalancer, compounder, yield claimer, merkl) in one transaction. |
76
76
 
77
77
  ### Individual Write Tools (use when batched tools fail or for standalone operations)
78
78
 
79
- | Tool | When to use |
80
- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
81
- | `build_approve_tx` | Approve a token for spending. **Required before `build_deposit_tx`** and before `build_add_liquidity_tx` (when depositing from wallet). Call `get_allowance` first to check if already approved. |
82
- | `build_create_account_tx` | Create a new Arcadia account (one-time setup). Use `account_version: 0` for the latest version (recommended). |
83
- | `build_deposit_tx` | Deposit ERC20 tokens as collateral. NOT needed before `build_add_liquidity_tx` — that tool handles deposits atomically. |
84
- | `build_withdraw_tx` | Withdraw assets to account owner. Account version auto-detected on-chain. Params: `asset_addresses[]`, `asset_amounts[]` (exact amounts, no max_uint256), optional `asset_ids[]` (0 for ERC20). |
85
- | `build_borrow_tx` | Borrow from a lending pool. NOT needed for leveraged LP — `build_add_liquidity_tx` handles borrowing internally. |
86
- | `build_repay_tx` | Repay debt from wallet (approve pool first). Use `amount: "max_uint256"` to repay in full. For repaying with account collateral, prefer `build_repay_with_collateral_tx`. |
87
- | `build_swap_tx` | Swap assets within account (backend handles routing). For closing positions, prefer `build_close_position_tx`. |
88
- | `build_remove_liquidity_tx` | PARTIAL liquidity decrease only (position stays open). For full LP removal/exit, use `build_close_position_tx`. |
89
- | `build_position_action_tx` | Stake, unstake, or claim rewards for an LP position. Direction auto-detected from `asset_address`. |
90
- | `build_set_asset_manager_tx` | Grant/revoke AM permission only (no configuration). Use to revoke; for full setup prefer `build_configure_asset_manager_tx`. |
79
+ | Tool | When to use |
80
+ | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
81
+ | `write.approve` | Approve a token for spending. **Required before `write.deposit`** and before `advanced.add_liquidity` (when depositing from wallet). Call `read.allowance` first to check if already approved. |
82
+ | `write.create_account` | Create a new Arcadia account (one-time setup). Use `account_version: 0` for the latest version (recommended). |
83
+ | `write.deposit` | Deposit ERC20 tokens as collateral. NOT needed before `advanced.add_liquidity` — that tool handles deposits atomically. |
84
+ | `write.withdraw` | Withdraw assets to account owner. Account version auto-detected on-chain. Params: `asset_addresses[]`, `asset_amounts[]` (exact amounts, no max_uint256), optional `asset_ids[]` (0 for ERC20). |
85
+ | `write.borrow` | Borrow from a lending pool. NOT needed for leveraged LP — `advanced.add_liquidity` handles borrowing internally. |
86
+ | `write.repay` | Repay debt from wallet (approve pool first). Use `amount: "max_uint256"` to repay in full. For repaying with account collateral, prefer `advanced.repay_with_collateral`. |
87
+ | `advanced.swap` | Swap assets within account (backend handles routing). For closing positions, prefer `advanced.close_position`. |
88
+ | `advanced.remove_liquidity` | PARTIAL liquidity decrease only (position stays open). For full LP removal/exit, use `advanced.close_position`. |
89
+ | `advanced.position_action` | Stake, unstake, or claim rewards for an LP position. Direction auto-detected from `asset_address`. |
90
+ | `write.set_asset_manager` | Grant/revoke AM permission only (no configuration). Use to revoke; for full setup prefer `write.configure_asset_manager`. |
91
91
 
92
92
  ### Dev Tools (only available when `PK` env var is set)
93
93
 
94
- | Tool | When to use |
95
- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
96
- | `sign_and_send_tx` | Sign and broadcast an unsigned transaction using a local private key. Pass the `{ to, data, value, chainId }` from any `build_*_tx` tool. **Not for production** — use a dedicated wallet MCP server (Fireblocks, Safe, Turnkey, etc.) instead. |
94
+ | Tool | When to use |
95
+ | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
96
+ | `dev.sign_and_send` | Sign and broadcast an unsigned transaction using a local private key. Pass the `{ to, data, value, chainId }` from any `write.*` or `advanced.*` tool. **Not for production** — use a dedicated wallet MCP server (Fireblocks, Safe, Turnkey, etc.) instead. |
97
97
 
98
98
  ## Token Addresses (Base 8453)
99
99
 
@@ -118,7 +118,7 @@ These tools batch multiple operations into ONE atomic transaction. Always prefer
118
118
 
119
119
  ## Lending Pool Addresses (Base 8453)
120
120
 
121
- Use as `pool_address` in `build_borrow_tx` / `build_repay_tx`, as `creditor` in `build_create_account_tx` / `build_repay_with_collateral_tx`:
121
+ Use as `pool_address` in `write.borrow` / `write.repay`, as `creditor` in `write.create_account` / `advanced.repay_with_collateral`:
122
122
 
123
123
  | Asset | Pool Address |
124
124
  | ----- | -------------------------------------------- |
@@ -128,7 +128,7 @@ Use as `pool_address` in `build_borrow_tx` / `build_repay_tx`, as `creditor` in
128
128
 
129
129
  ## Asset Manager Addresses (Base 8453)
130
130
 
131
- Use with `build_configure_asset_manager_tx` (enable + configure) or `build_set_asset_manager_tx` (grant/revoke only). Both require V3/V4 accounts.
131
+ Use with `write.configure_asset_manager` (enable + configure) or `write.set_asset_manager` (grant/revoke only). Both require V3/V4 accounts.
132
132
 
133
133
  | Type | Protocol | Address |
134
134
  | -------------- | ------------- | -------------------------------------------- |
@@ -148,7 +148,7 @@ Use with `build_configure_asset_manager_tx` (enable + configure) or `build_set_a
148
148
  | CoW Swapper | All | `0xc928013A219EC9F18dE7B2dee6A50Ba626811854` |
149
149
  | Gas Relayer | All | `0xD938C8d04cF91094fecAF0A2018EAac483a40137` |
150
150
 
151
- **Slipstream V1 vs V2:** The pool determines the version — some pools are V1, some are V2. The API currently returns `protocol: "slipstream"` without V1/V2 distinction. To identify the version, check the position manager address from `get_account_info` against the known addresses (V1: `0x8279...`, V2: `0xa990...`). Alternatively, pass `pool_protocol` directly to `build_configure_asset_manager_tx` to auto-resolve the correct AM address. Staked and wrapped staked positions use the same asset managers as their base protocol.
151
+ **Slipstream V1 vs V2:** The pool determines the version — some pools are V1, some are V2. The API currently returns `protocol: "slipstream"` without V1/V2 distinction. To identify the version, check the position manager address from `read.account_info` against the known addresses (V1: `0x8279...`, V2: `0xa990...`). Alternatively, pass `pool_protocol` directly to `write.configure_asset_manager` to auto-resolve the correct AM address. Staked and wrapped staked positions use the same asset managers as their base protocol.
152
152
 
153
153
  ## Account Versions
154
154
 
@@ -156,9 +156,9 @@ Spot vs margin is determined by whether a **creditor** (lending pool) is set at
156
156
 
157
157
  - `account_version: 3` — **margin account** (created with a `creditor`). Can borrow, leverage, and mint LP. Uses an onchain whitelist of allowed collateral tokens.
158
158
  - `account_version: 4` or `0` (latest) — **spot account** (no creditor, no borrowing). Can hold assets and mint LP with `leverage: 0`. Accepts any ERC20 (no onchain whitelist).
159
- - `account_version: 1` or `2` — legacy. Not supported by current MCP tools (`build_set_asset_manager_tx` and `build_configure_asset_manager_tx` require V3/V4).
159
+ - `account_version: 1` or `2` — legacy. Not supported by current MCP tools (`write.set_asset_manager` and `write.configure_asset_manager` require V3/V4).
160
160
  - For **leveraged LP strategies**, use `account_version: 3` with a creditor.
161
- - To check an existing account's version: call `get_account_info` — the response includes the account version.
161
+ - To check an existing account's version: call `read.account_info` — the response includes the account version.
162
162
 
163
163
  ## Reference Files
164
164
 
@@ -4,14 +4,14 @@ All automation on Arcadia uses one of two tools (both V3/V4 accounts only), then
4
4
 
5
5
  ## Which tool to use
6
6
 
7
- **To enable + configure (recommended):** Use `build_configure_asset_manager_tx`. This grants permission AND sets strategy parameters (initiator, fee limits, trigger thresholds, fee recipient, etc.) in a single transaction.
7
+ **To enable + configure (recommended):** Use `write.configure_asset_manager`. This grants permission AND sets strategy parameters (initiator, fee limits, trigger thresholds, fee recipient, etc.) in a single transaction.
8
8
 
9
- **To grant/revoke only:** Use `build_set_asset_manager_tx`. This only grants or revokes permission — no configuration. Use this to revoke an asset manager.
9
+ **To grant/revoke only:** Use `write.set_asset_manager`. This only grants or revokes permission — no configuration. Use this to revoke an asset manager.
10
10
 
11
11
  ## Configure + enable
12
12
 
13
13
  ```
14
- build_configure_asset_manager_tx(
14
+ write.configure_asset_manager(
15
15
  account_address: <account>,
16
16
  asset_manager_address: <address from table below>,
17
17
  am_type: "rebalancer" | "compounder" | "yield_claimer" | "merkl_operator",
@@ -32,7 +32,7 @@ build_configure_asset_manager_tx(
32
32
  ## Grant/revoke only
33
33
 
34
34
  ```
35
- build_set_asset_manager_tx(
35
+ write.set_asset_manager(
36
36
  account_address: <account>,
37
37
  asset_manager_address: <address from table below>,
38
38
  enabled: true, // false to revoke
@@ -40,7 +40,7 @@ build_set_asset_manager_tx(
40
40
  )
41
41
  ```
42
42
 
43
- To revoke any AM: `build_set_asset_manager_tx(..., enabled: false)` or `build_configure_asset_manager_tx` is not used for revocation — use `build_set_asset_manager_tx` with `enabled: false`.
43
+ To revoke any AM: `write.set_asset_manager(..., enabled: false)` or `write.configure_asset_manager` is not used for revocation — use `write.set_asset_manager` with `enabled: false`.
44
44
 
45
45
  ---
46
46
 
@@ -109,7 +109,7 @@ Quota is also bypassed automatically when: gas cost < pending fees ÷ 2, or posi
109
109
  | Uniswap V3 | `0x75Ed28EA8601Ce9F5FbcAB1c2428f04A57aFaA16` | All |
110
110
  | Uniswap V4 | `0xD8aa21AB7f9B8601CB7d7A776D3AFA1602d5D8D4` | All |
111
111
 
112
- **Recipient config:** Set `fee_recipient` in `build_configure_asset_manager_tx` (V3/V4 accounts). Pass your wallet address or any destination address.
112
+ **Recipient config:** Set `fee_recipient` in `write.configure_asset_manager` (V3/V4 accounts). Pass your wallet address or any destination address.
113
113
 
114
114
  ---
115
115
 
@@ -117,7 +117,7 @@ Quota is also bypassed automatically when: gas cost < pending fees ÷ 2, or posi
117
117
 
118
118
  **What it does:** Bot claims external Merkl protocol incentive rewards into the account. These are additional rewards paid by token teams on top of regular LP fees — completely separate from trading fee yield.
119
119
 
120
- **When to enable:** When the pool you LP into has active Merkl campaigns. Check by looking at the pool APY breakdown in `get_strategies` — if there's a "Merkl" or "external rewards" component, enable this.
120
+ **When to enable:** When the pool you LP into has active Merkl campaigns. Check by looking at the pool APY breakdown in `read.strategies` — if there's a "Merkl" or "external rewards" component, enable this.
121
121
 
122
122
  **Address (all chains):** `0x969F0251360b9Cf11c68f6Ce9587924c1B8b42C6`
123
123