@arcadia-finance/mcp-server 0.1.3 → 0.1.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 (38) hide show
  1. package/LICENSE.md +631 -68
  2. package/README.md +20 -2
  3. package/dist/clients/api.js +1 -1
  4. package/dist/config/addresses.js +78 -39
  5. package/dist/config/chains.js +2 -8
  6. package/dist/index.js +126 -9
  7. package/dist/prompts/index.js +4 -0
  8. package/dist/prompts/workflows.js +98 -0
  9. package/dist/resources/guides.js +38 -0
  10. package/dist/resources/index.js +4 -0
  11. package/dist/tools/advanced/add-liquidity.js +42 -19
  12. package/dist/tools/advanced/close-position.js +18 -11
  13. package/dist/tools/advanced/position-actions.js +11 -4
  14. package/dist/tools/advanced/remove-liquidity.js +11 -4
  15. package/dist/tools/advanced/repay-with-collateral.js +10 -4
  16. package/dist/tools/advanced/swap.js +12 -4
  17. package/dist/tools/read/accounts.js +41 -52
  18. package/dist/tools/read/allowances.js +13 -7
  19. package/dist/tools/read/assets.js +8 -4
  20. package/dist/tools/read/balances.js +12 -6
  21. package/dist/tools/read/guides.js +10 -18
  22. package/dist/tools/read/points.js +34 -6
  23. package/dist/tools/read/pools.js +29 -7
  24. package/dist/tools/read/protocol.js +28 -10
  25. package/dist/tools/write/approve.js +14 -7
  26. package/dist/tools/write/borrow.js +14 -11
  27. package/dist/tools/write/configure-asset-manager.js +46 -40
  28. package/dist/tools/write/create-account.js +17 -8
  29. package/dist/tools/write/deposit.js +15 -8
  30. package/dist/tools/write/repay.js +14 -7
  31. package/dist/tools/write/set-asset-manager.js +13 -6
  32. package/dist/tools/write/sign-and-send.js +8 -4
  33. package/dist/tools/write/withdraw.js +15 -8
  34. package/dist/utils/validation.js +1 -1
  35. package/package.json +4 -2
  36. package/server.json +9 -2
  37. package/skills/clamm-liquidity/automation.md +22 -24
  38. package/skills/clamm-liquidity/strategies.md +2 -0
@@ -3,8 +3,16 @@ import { encodeFunctionData } from "viem";
3
3
  import { accountAbi, getAccountAbi } from "../../abis/index.js";
4
4
  import { getPublicClient } from "../../clients/chain.js";
5
5
  import { appendDataSuffix } from "../../utils/attribution.js";
6
+ import { validateAddress, validateChainId } from "../../utils/validation.js";
6
7
  export function registerWithdrawTool(server, chains) {
7
8
  server.registerTool("build_withdraw_tx", {
9
+ annotations: {
10
+ title: "Build Withdraw Transaction",
11
+ readOnlyHint: false,
12
+ destructiveHint: false,
13
+ idempotentHint: true,
14
+ openWorldHint: false,
15
+ },
8
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 get_account_info. Account version is auto-detected on-chain (override with account_version if needed).",
9
17
  inputSchema: {
10
18
  account_address: z.string().describe("Arcadia account address"),
@@ -22,10 +30,7 @@ export function registerWithdrawTool(server, chains) {
22
30
  .number()
23
31
  .optional()
24
32
  .describe("Override account version (3 or 4). Auto-detected on-chain if omitted."),
25
- chain_id: z
26
- .number()
27
- .default(8453)
28
- .describe("Chain ID: 8453 (Base), 10 (Optimism), or 130 (Unichain)"),
33
+ chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
29
34
  },
30
35
  }, async (params) => {
31
36
  try {
@@ -51,11 +56,13 @@ export function registerWithdrawTool(server, chains) {
51
56
  isError: true,
52
57
  };
53
58
  }
59
+ const validChainId = validateChainId(params.chain_id);
60
+ const validAccount = validateAddress(params.account_address, "account_address");
54
61
  let version = params.account_version ?? 0;
55
62
  if (!version) {
56
- const client = getPublicClient(params.chain_id, chains);
63
+ const client = getPublicClient(validChainId, chains);
57
64
  version = Number(await client.readContract({
58
- address: params.account_address,
65
+ address: validAccount,
59
66
  abi: accountAbi,
60
67
  functionName: "ACCOUNT_VERSION",
61
68
  }));
@@ -82,10 +89,10 @@ export function registerWithdrawTool(server, chains) {
82
89
  text: JSON.stringify({
83
90
  description: `Withdraw assets from Arcadia account (V${version})`,
84
91
  transaction: {
85
- to: params.account_address,
92
+ to: validAccount,
86
93
  data,
87
94
  value: "0",
88
- chainId: params.chain_id,
95
+ chainId: validChainId,
89
96
  },
90
97
  }, null, 2),
91
98
  },
@@ -10,7 +10,7 @@ export function validateAddress(address, label = "address") {
10
10
  }
11
11
  export function validateChainId(chainId) {
12
12
  if (!SUPPORTED_CHAIN_IDS.includes(chainId)) {
13
- throw new Error(`Unsupported chain_id: ${chainId}. Arcadia is deployed on Base (8453), Optimism (10), and Unichain (130).`);
13
+ throw new Error(`Unsupported chain_id: ${chainId}. Supported chains: Base (8453) and Unichain (130).`);
14
14
  }
15
15
  return chainId;
16
16
  }
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.3",
4
+ "version": "0.1.5",
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",
@@ -53,11 +53,13 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@modelcontextprotocol/sdk": "^1.12.0",
56
+ "express": "^5.2.1",
56
57
  "viem": "^2.0.0",
57
58
  "zod": "^3.23.0"
58
59
  },
59
60
  "devDependencies": {
60
61
  "@eslint/js": "^9.0.0",
62
+ "@types/express": "^5.0.6",
61
63
  "@types/node": "^22.0.0",
62
64
  "@typescript-eslint/eslint-plugin": "^8.0.0",
63
65
  "@typescript-eslint/parser": "^8.0.0",
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.3",
6
+ "version": "0.1.5",
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.3",
16
+ "version": "0.1.5",
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
  }
@@ -48,14 +48,14 @@ To revoke any AM: `build_set_asset_manager_tx(..., enabled: false)` or `build_co
48
48
 
49
49
  **What it does:** When the LP position goes out of range, Arcadia's bot repositions it to a new range centered on the current price. As part of every rebalance, the old position is burned and all pending fees and staking rewards are claimed — these are automatically compounded into the new position. The rebalancer therefore also acts as a compounder at every rebalance event.
50
50
 
51
- **Which address:** Match to your LP protocol (Base):
51
+ **Which address:** Match to your LP protocol. The tool returns an error if a manager isn't available on the requested chain.
52
52
 
53
- | Protocol | Address |
54
- | ----------------------- | -------------------------------------------- |
55
- | Aerodrome Slipstream V1 | `0x5802454749cc0c4A6F28D5001B4cD84432e2b79F` |
56
- | Aerodrome Slipstream V2 | `0x953Ff365d0b562ceC658dc46B394E9282338d9Ea` |
57
- | Uniswap V3 | `0xbA1D0c99c261F94b9C8b52465890Cca27dd993Bd` |
58
- | Uniswap V4 | `0x01EDaF0067a10D18c88D2876c0A85Ee0096a5Ac0` |
53
+ | Protocol | Address | Chains |
54
+ | ----------------------- | -------------------------------------------- | --------- |
55
+ | Aerodrome Slipstream V1 | `0x5802454749cc0c4A6F28D5001B4cD84432e2b79F` | All |
56
+ | Aerodrome Slipstream V2 | `0x953Ff365d0b562ceC658dc46B394E9282338d9Ea` | Base only |
57
+ | Uniswap V3 | `0xbA1D0c99c261F94b9C8b52465890Cca27dd993Bd` | All |
58
+ | Uniswap V4 | `0x01EDaF0067a10D18c88D2876c0A85Ee0096a5Ac0` | All |
59
59
 
60
60
  **Free rebalance quota (per owner across all accounts):**
61
61
 
@@ -83,14 +83,14 @@ Quota is also bypassed automatically when: gas cost < pending fees ÷ 2, or posi
83
83
 
84
84
  **What it does:** Bot claims accumulated LP fees and reinvests them back into the position (compound interest instead of cash flow).
85
85
 
86
- **Which address (Base):**
86
+ **Which address:**
87
87
 
88
- | Protocol | Address |
89
- | ----------------------- | -------------------------------------------- |
90
- | Aerodrome Slipstream V1 | `0x467837f44A71e3eAB90AEcfC995c84DC6B3cfCF7` |
91
- | Aerodrome Slipstream V2 | `0x35e59448C7145482E56212510cC689612AB4F61f` |
92
- | Uniswap V3 | `0x02e1fa043214E51eDf1F0478c6D0d3D5658a2DC3` |
93
- | Uniswap V4 | `0xAA95c9c402b195D8690eCaea2341a76e3266B189` |
88
+ | Protocol | Address | Chains |
89
+ | ----------------------- | -------------------------------------------- | --------- |
90
+ | Aerodrome Slipstream V1 | `0x467837f44A71e3eAB90AEcfC995c84DC6B3cfCF7` | All |
91
+ | Aerodrome Slipstream V2 | `0x35e59448C7145482E56212510cC689612AB4F61f` | Base only |
92
+ | Uniswap V3 | `0x02e1fa043214E51eDf1F0478c6D0d3D5658a2DC3` | All |
93
+ | Uniswap V4 | `0xAA95c9c402b195D8690eCaea2341a76e3266B189` | All |
94
94
 
95
95
  **When to add a compounder on top of a rebalancer:** The rebalancer compounds fees at rebalance time. Adding a compounder also compounds fees between rebalances — more frequent compounding, higher effective APY.
96
96
 
@@ -100,14 +100,14 @@ Quota is also bypassed automatically when: gas cost < pending fees ÷ 2, or posi
100
100
 
101
101
  **What it does:** Bot periodically claims pending fees/emissions and sends them to a designated recipient (owner wallet, another account, or any address).
102
102
 
103
- **Which address (Base):**
103
+ **Which address:**
104
104
 
105
- | Protocol | Address |
106
- | ----------------------- | -------------------------------------------- |
107
- | Aerodrome Slipstream V1 | `0x5a8278D37b7a787574b6Aa7E18d8C02D994f18Ba` |
108
- | Aerodrome Slipstream V2 | `0xc8bF4B2c740FF665864E9494832520f18822871C` |
109
- | Uniswap V3 | `0x75Ed28EA8601Ce9F5FbcAB1c2428f04A57aFaA16` |
110
- | Uniswap V4 | `0xD8aa21AB7f9B8601CB7d7A776D3AFA1602d5D8D4` |
105
+ | Protocol | Address | Chains |
106
+ | ----------------------- | -------------------------------------------- | --------- |
107
+ | Aerodrome Slipstream V1 | `0x5a8278D37b7a787574b6Aa7E18d8C02D994f18Ba` | All |
108
+ | Aerodrome Slipstream V2 | `0xc8bF4B2c740FF665864E9494832520f18822871C` | Base only |
109
+ | Uniswap V3 | `0x75Ed28EA8601Ce9F5FbcAB1c2428f04A57aFaA16` | All |
110
+ | Uniswap V4 | `0xD8aa21AB7f9B8601CB7d7A776D3AFA1602d5D8D4` | All |
111
111
 
112
112
  **Recipient config:** Set `fee_recipient` in `build_configure_asset_manager_tx` (V3/V4 accounts). Pass your wallet address or any destination address.
113
113
 
@@ -119,8 +119,6 @@ Quota is also bypassed automatically when: gas cost < pending fees ÷ 2, or posi
119
119
 
120
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.
121
121
 
122
- **Address:**
123
-
124
122
  **Address (all chains):** `0x969F0251360b9Cf11c68f6Ce9587924c1B8b42C6`
125
123
 
126
124
  **Always combine with rebalancer** when both are relevant — no conflict, extra free yield.
@@ -131,7 +129,7 @@ Quota is also bypassed automatically when: gas cost < pending fees ÷ 2, or posi
131
129
 
132
130
  **What it does:** Bot places CoW Protocol batch auction swap orders to sell tokens accumulated in the account (e.g., claimed AERO emissions → USDC). Uses MEV-protected execution via CoW's batch auction mechanism.
133
131
 
134
- **Address (Base):** `0xc928013A219EC9F18dE7B2dee6A50Ba626811854`
132
+ **Address (Base only):** `0xc928013A219EC9F18dE7B2dee6A50Ba626811854`
135
133
 
136
134
  **Config:** Which tokens to sell and what to buy is configured in the Arcadia platform — not settable via MCP.
137
135
 
@@ -52,6 +52,8 @@ Close: disable rebalancer → unstake → atomic close (burn LP + swap + repay
52
52
 
53
53
  ### Step-by-step
54
54
 
55
+ > Addresses below are Base mainnet examples. Always verify current addresses via `get_lending_pools` and `get_assets` before executing.
56
+
55
57
  ```
56
58
  // 1. FIND A POOL
57
59
  get_strategies(chain_id: 8453)