@arcadia-finance/mcp-server 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +249 -248
- package/README.md +12 -2
- package/dist/clients/chain.js +3 -3
- package/dist/config/cache-hints.js +10 -0
- package/dist/index.js +2 -1
- package/dist/prompts/workflows.js +4 -2
- package/dist/tools/dev/send.js +2 -7
- package/dist/tools/output-schemas.js +2 -0
- package/dist/tools/read/asset-managers.js +3 -8
- package/dist/tools/read/assets.js +1 -1
- package/dist/tools/read/strategy.js +9 -5
- package/dist/tools/read/wallet.js +1 -1
- package/dist/tools/write/account/add-liquidity.js +123 -4
- package/llms-full.txt +3 -3
- package/package.json +18 -17
- package/server.json +9 -2
- package/skills/clamm-liquidity/SKILL.md +22 -21
- package/skills/clamm-liquidity/selection.md +4 -4
- package/skills/openclaw/SKILL.md +4 -2
- package/skills/openclaw/arcadia.sh +1 -1
package/README.md
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@arcadia-finance/mcp-server)
|
|
5
5
|
[](LICENSE.md)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
|
-
[](https://modelcontextprotocol.io/)
|
|
8
8
|
[](https://smithery.ai/servers/arcadia-finance/mcp-server)
|
|
9
9
|
[](https://lobehub.com/mcp/arcadia-finance-mcp-server)
|
|
10
10
|
[](https://glama.ai/mcp/servers/arcadia-finance/mcp-server)
|
|
11
|
+
[](https://mcptry.com/servers/io.github.arcadia-finance/mcp-server)
|
|
11
12
|
|
|
12
13
|
MCP server for [Arcadia Finance](https://arcadia.finance), a platform for concentrated liquidity on Uniswap and Aero 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
14
|
|
|
@@ -243,7 +244,8 @@ Pull requests for documentation fixes are welcome from agents and humans alike.
|
|
|
243
244
|
- **PulseMCP:** [pulsemcp.com](https://www.pulsemcp.com/servers/arcadia-finance)
|
|
244
245
|
- **MCP Market:** [mcpmarket.com](https://mcpmarket.com/server/arcadia-finance)
|
|
245
246
|
- **Glama:** [glama.ai](https://glama.ai/mcp/servers/arcadia-finance/mcp-server)
|
|
246
|
-
- **
|
|
247
|
+
- **mcp.so:** [mcp.so](https://mcp.so/server/arcadia-finance/mcp-server)
|
|
248
|
+
- **awesome-mcp-servers:** [github.com/punkpeye/awesome-mcp-servers](https://github.com/punkpeye/awesome-mcp-servers)
|
|
247
249
|
|
|
248
250
|
## Development
|
|
249
251
|
|
|
@@ -254,3 +256,11 @@ yarn test # Run tests
|
|
|
254
256
|
yarn lint # Lint with ESLint
|
|
255
257
|
yarn format # Check formatting with Prettier
|
|
256
258
|
```
|
|
259
|
+
|
|
260
|
+
## Privacy
|
|
261
|
+
|
|
262
|
+
When `POSTHOG_KEY` is set on an HTTP deployment, the server records one analytics event per tool call in PostHog (EU ingestion host by default): the tool name, its arguments (which can include public wallet and account addresses), whether the call failed, the duration, and the client name and version. Events carry no person profile. Running the server locally over stdio sends no analytics, and neither does an HTTP deployment without `POSTHOG_KEY`. Tool calls never carry private keys. The development-only `dev_send` tool signs with a `PK` set in the server's own environment; the hosted server has none. Questions: legal@arcadia.finance.
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
Copyright (C) 2026 Pragma Labs. Licensed under the [GNU Affero General Public License v3.0](LICENSE.md).
|
package/dist/clients/chain.js
CHANGED
|
@@ -14,8 +14,8 @@ const unichain = defineChain({
|
|
|
14
14
|
multicall3: { address: "0xcA11bde05977b3631167028862bE2a173976CA11" },
|
|
15
15
|
},
|
|
16
16
|
});
|
|
17
|
-
//
|
|
18
|
-
//
|
|
17
|
+
// multicall3 sits at the canonical address (3808 bytes on chain) and is declared with no
|
|
18
|
+
// blockCreated, so no historical gating applies.
|
|
19
19
|
const robinhood = defineChain({
|
|
20
20
|
id: 4663,
|
|
21
21
|
name: "Robinhood",
|
|
@@ -27,7 +27,7 @@ const robinhood = defineChain({
|
|
|
27
27
|
multicall3: { address: "0xcA11bde05977b3631167028862bE2a173976CA11" },
|
|
28
28
|
},
|
|
29
29
|
});
|
|
30
|
-
const viemChains = {
|
|
30
|
+
export const viemChains = {
|
|
31
31
|
8453: base,
|
|
32
32
|
10: optimism,
|
|
33
33
|
130: unichain,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const FIVE_MINUTES_MS = 5 * 60 * 1000;
|
|
2
|
+
const staticPublic = { ttlMs: FIVE_MINUTES_MS, cacheScope: "public" };
|
|
3
|
+
export const CACHE_HINTS = {
|
|
4
|
+
"server/discover": staticPublic,
|
|
5
|
+
"tools/list": staticPublic,
|
|
6
|
+
"prompts/list": staticPublic,
|
|
7
|
+
"resources/list": staticPublic,
|
|
8
|
+
"resources/templates/list": staticPublic,
|
|
9
|
+
"resources/read": staticPublic,
|
|
10
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ catch {
|
|
|
11
11
|
import { createRequire } from "module";
|
|
12
12
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
13
13
|
import { ArcadiaApiClient } from "./clients/api.js";
|
|
14
|
+
import { CACHE_HINTS } from "./config/cache-hints.js";
|
|
14
15
|
import { getChainConfigs } from "./config/chains.js";
|
|
15
16
|
import { registerAllTools } from "./tools/index.js";
|
|
16
17
|
import { registerAllResources } from "./resources/index.js";
|
|
@@ -28,7 +29,7 @@ function buildServer() {
|
|
|
28
29
|
name: "arcadia-finance",
|
|
29
30
|
version: pkg.version,
|
|
30
31
|
description: "Arcadia Finance. Manage concentrated liquidity positions on Uniswap and Aero with automated rebalancing, compounding, yield optimization, and leverage. Base, Optimism, Unichain and Robinhood.",
|
|
31
|
-
});
|
|
32
|
+
}, { cacheHints: CACHE_HINTS });
|
|
32
33
|
const target = analytics
|
|
33
34
|
? withAnalytics(server, server, analytics, {
|
|
34
35
|
transport: transportMode,
|
|
@@ -48,8 +48,8 @@ export function registerWorkflowPrompts(server) {
|
|
|
48
48
|
`Find the best yield strategy on Arcadia (chain ${chain_id ?? "8453"})${deposit_token ? ` for depositing ${deposit_token}` : ""}.`,
|
|
49
49
|
"",
|
|
50
50
|
"Steps:",
|
|
51
|
-
"1. Call read_strategy_list(featured_only: true) to see top LP strategies with fee APY",
|
|
52
|
-
"2. Call read_strategy_info(strategy_id: <id>) for promising ones to see APY per range width",
|
|
51
|
+
"1. Call read_strategy_list(featured_only: true) to see top LP strategies with fee APY over the last 24 hours at the featured range width",
|
|
52
|
+
"2. Call read_strategy_info(strategy_id: <id>) for promising ones to see APY per range width over the last 24 hours",
|
|
53
53
|
"3. Call read_pool_list to check borrow APY for leveraged strategies",
|
|
54
54
|
"4. Evaluate: net_APY = fee_APY - (leverage - 1) * borrow_APY > 0?",
|
|
55
55
|
"",
|
|
@@ -60,6 +60,8 @@ export function registerWorkflowPrompts(server) {
|
|
|
60
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
|
+
"",
|
|
64
|
+
"When the user wants to open a position, call write_account_add_liquidity. If it returns price_checks warnings (pool price off market, or a token with no price) it returns no transaction: show every warning to the user and call again with the returned accept_price_checks list only after the user explicitly confirms they accept them. Never set accept_price_checks on the first call or without that confirmation. When rebuilding after a revert, pass only the list the user already confirmed; if the rebuild returns new warnings, show them and get a new confirmation before passing their list.",
|
|
63
65
|
].join("\n"),
|
|
64
66
|
},
|
|
65
67
|
},
|
package/dist/tools/dev/send.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { createWalletClient, createPublicClient, http } from "viem";
|
|
3
3
|
import { privateKeyToAccount } from "viem/accounts";
|
|
4
|
-
import {
|
|
4
|
+
import { viemChains } from "../../clients/chain.js";
|
|
5
5
|
import { CHAIN_ID_DESCRIPTION } from "../../config/chains.js";
|
|
6
6
|
import { DevSendOutput } from "../output-schemas.js";
|
|
7
7
|
import { validateAddress, validateHexCalldata, parseWeiDecimalString, } from "../../utils/validation.js";
|
|
8
|
-
const VIEM_CHAINS = {
|
|
9
|
-
8453: base,
|
|
10
|
-
130: unichain,
|
|
11
|
-
10: optimism,
|
|
12
|
-
};
|
|
13
8
|
export function registerSendTool(server, chains) {
|
|
14
9
|
server.registerTool("dev_send", {
|
|
15
10
|
annotations: {
|
|
@@ -44,7 +39,7 @@ export function registerSendTool(server, chains) {
|
|
|
44
39
|
const validTo = validateAddress(params.to, "to");
|
|
45
40
|
const calldata = validateHexCalldata(params.data, "data");
|
|
46
41
|
const valueWei = parseWeiDecimalString(params.value, "value");
|
|
47
|
-
const chain =
|
|
42
|
+
const chain = viemChains[params.chain_id];
|
|
48
43
|
const chainConfig = chains[params.chain_id];
|
|
49
44
|
if (!chainConfig) {
|
|
50
45
|
return {
|
|
@@ -16,6 +16,8 @@ export const BatchedTransactionOutput = z.object({
|
|
|
16
16
|
tenderly_sim_url: z.string().optional(),
|
|
17
17
|
tenderly_sim_status: z.enum(["success", "failure", "unavailable"]).optional(),
|
|
18
18
|
expected_value_change: z.string().optional(),
|
|
19
|
+
expected_value_change_unavailable: z.string().optional(),
|
|
20
|
+
price_checks: z.array(z.object({ pool: z.string(), status: z.string() }).loose()).optional(),
|
|
19
21
|
before: z.object({ total_account_value: z.string(), used_margin: z.string() }).loose().optional(),
|
|
20
22
|
after: z.object({ total_account_value: z.string(), used_margin: z.string() }).loose().optional(),
|
|
21
23
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { CHAIN_ID_DESCRIPTION } from "../../config/chains.js";
|
|
2
3
|
import { validateAddress, validateChainId } from "../../utils/validation.js";
|
|
3
4
|
import { AutomationsStateOutput, IntentsListOutput } from "../output-schemas.js";
|
|
4
5
|
const INTENT_CATALOG = [
|
|
@@ -70,10 +71,7 @@ export function registerAssetManagerTools(server, api) {
|
|
|
70
71
|
.int()
|
|
71
72
|
.optional()
|
|
72
73
|
.describe("LP position (NFT) id to scope availability to. Requires account_address."),
|
|
73
|
-
chain_id: z
|
|
74
|
-
.number()
|
|
75
|
-
.default(8453)
|
|
76
|
-
.describe("Chain id: 8453 Base, 130 Unichain, 10 Optimism"),
|
|
74
|
+
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
77
75
|
}),
|
|
78
76
|
}, async (params) => {
|
|
79
77
|
try {
|
|
@@ -149,10 +147,7 @@ export function registerAssetManagerTools(server, api) {
|
|
|
149
147
|
outputSchema: AutomationsStateOutput,
|
|
150
148
|
inputSchema: z.object({
|
|
151
149
|
account_address: z.string().describe("Arcadia account address"),
|
|
152
|
-
chain_id: z
|
|
153
|
-
.number()
|
|
154
|
-
.default(8453)
|
|
155
|
-
.describe("Chain id: 8453 Base, 130 Unichain, 10 Optimism"),
|
|
150
|
+
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
156
151
|
}),
|
|
157
152
|
}, async (params) => {
|
|
158
153
|
try {
|
|
@@ -60,7 +60,7 @@ export function registerAssetTools(server, api) {
|
|
|
60
60
|
idempotentHint: true,
|
|
61
61
|
openWorldHint: true,
|
|
62
62
|
},
|
|
63
|
-
description: "Get USD prices for one or more asset addresses. Pass a single address or comma-separated addresses. Returns a price map keyed by address.",
|
|
63
|
+
description: "Get USD prices for one or more asset addresses on one chain. Pass a single address or comma-separated addresses. Returns a price map keyed by address. Unknown or unpriced addresses return 0, not an error. Prices are scoped to chain_id (default 8453, Base), so pass the chain the addresses live on. Read-only. To find asset addresses, use read_asset_list.",
|
|
64
64
|
inputSchema: z.object({
|
|
65
65
|
asset_addresses: z
|
|
66
66
|
.string()
|
|
@@ -11,7 +11,7 @@ export function registerStrategyTools(server, api) {
|
|
|
11
11
|
idempotentHint: true,
|
|
12
12
|
openWorldHint: true,
|
|
13
13
|
},
|
|
14
|
-
description: "Get Arcadia LP strategies. Use featured_only=true for curated top strategies (recommended first call).
|
|
14
|
+
description: "Get Arcadia LP strategies. Use featured_only=true for curated top strategies (recommended first call); their apy is measured over the last 24 hours at the featured range width, and is 0.0 when that measurement fails. Otherwise returns a paginated list where strategy_apy_7d is the 7-day average APY at each strategy's default range. Increase limit or use offset for pagination. All APY values are decimal fractions (1.0 = 100%, 0.05 = 5%). For APY per range width over the last 24 hours, use read_strategy_info.",
|
|
15
15
|
inputSchema: z.object({
|
|
16
16
|
featured_only: z
|
|
17
17
|
.boolean()
|
|
@@ -62,10 +62,14 @@ export function registerStrategyTools(server, api) {
|
|
|
62
62
|
const all = await api.getStrategies(chain_id);
|
|
63
63
|
const list = Array.isArray(all) ? all : all.data;
|
|
64
64
|
if (Array.isArray(list)) {
|
|
65
|
-
|
|
65
|
+
const visible = list.filter((s) => {
|
|
66
|
+
const priceStatus = s.details?.price_status;
|
|
67
|
+
return priceStatus !== "off_market" && priceStatus !== "unpriced";
|
|
68
|
+
});
|
|
69
|
+
total = visible.length;
|
|
66
70
|
const effectiveOffset = offset ?? 0;
|
|
67
71
|
const effectiveLimit = limit ?? 25;
|
|
68
|
-
const page =
|
|
72
|
+
const page = visible.slice(effectiveOffset, effectiveOffset + effectiveLimit);
|
|
69
73
|
strategies = page.map((s) => ({
|
|
70
74
|
strategy_id: s.strategy_id,
|
|
71
75
|
name: s.strategy_name,
|
|
@@ -114,7 +118,7 @@ export function registerStrategyTools(server, api) {
|
|
|
114
118
|
idempotentHint: true,
|
|
115
119
|
openWorldHint: true,
|
|
116
120
|
},
|
|
117
|
-
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%).",
|
|
121
|
+
description: "Get full detail for a specific concentrated-liquidity LP strategy by ID: includes APY per range width over the last 24 hours, each range anchored on the current price (narrower range = higher APY but more rebalancing cost/risk), the 7-day average APY at the default range in the yield field, pool info, and configuration. For basic (constant-product) pools, use strategy_apy_7d from read_strategy_list. Use read_strategy_list to discover strategy IDs. All APY values are decimal fractions (1.0 = 100%, 0.05 = 5%).",
|
|
118
122
|
inputSchema: z.object({
|
|
119
123
|
strategy_id: z.number().describe("Strategy ID"),
|
|
120
124
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
@@ -148,7 +152,7 @@ export function registerStrategyTools(server, api) {
|
|
|
148
152
|
idempotentHint: true,
|
|
149
153
|
openWorldHint: true,
|
|
150
154
|
},
|
|
151
|
-
description: "Get a rebalancing recommendation for an Arcadia account: suggests asset changes to optimize yield.
|
|
155
|
+
description: "Get a rebalancing recommendation for an Arcadia account: suggests asset changes to optimize yield. current_apy and proposed_apy are measured over the last 24 hours where possible (the account's positions at their own ranges, the proposal at its ranges), not the 7-day average of 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.",
|
|
152
156
|
inputSchema: z.object({
|
|
153
157
|
account_address: z.string().describe("Arcadia account address"),
|
|
154
158
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
@@ -195,7 +195,7 @@ export function registerWalletTools(server, chains, api) {
|
|
|
195
195
|
idempotentHint: true,
|
|
196
196
|
openWorldHint: true,
|
|
197
197
|
},
|
|
198
|
-
description: "Get Arcadia points balance for
|
|
198
|
+
description: "Get the Arcadia points balance for one wallet address. Returns points and wallet_address. A wallet with no points returns points 0 and wallet_address 'unknown', not an error. Read-only, no authentication. For the ranked list of wallets, use read_point_leaderboard.",
|
|
199
199
|
inputSchema: z.object({
|
|
200
200
|
wallet_address: z.string().describe("Wallet address to get points for"),
|
|
201
201
|
}),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { ArcadiaApiError } from "../../../clients/api.js";
|
|
2
3
|
import { CHAIN_ID_DESCRIPTION } from "../../../config/chains.js";
|
|
3
4
|
import { getPublicClient } from "../../../clients/chain.js";
|
|
4
5
|
import { readAccountMetadata } from "./metadata.js";
|
|
@@ -6,6 +7,91 @@ import { formatBatchedResponse, isSimulationFailed } from "./format-response.js"
|
|
|
6
7
|
import { TOKENS } from "../../../config/addresses.js";
|
|
7
8
|
import { validateAddress, validateChainId } from "../../../utils/validation.js";
|
|
8
9
|
import { BatchedTransactionOutput } from "../../output-schemas.js";
|
|
10
|
+
function formatUsd(value) {
|
|
11
|
+
const digits = Math.abs(value) >= 1 ? { maximumFractionDigits: 2 } : { maximumSignificantDigits: 4 };
|
|
12
|
+
return `${value.toLocaleString("en-US", digits)} USD`;
|
|
13
|
+
}
|
|
14
|
+
function refusalMessage(err) {
|
|
15
|
+
if (!(err instanceof ArcadiaApiError) || err.status !== 400)
|
|
16
|
+
return undefined;
|
|
17
|
+
const body = err.body;
|
|
18
|
+
if (body === null || typeof body !== "object")
|
|
19
|
+
return undefined;
|
|
20
|
+
const message = body.message;
|
|
21
|
+
return typeof message === "string" ? message : undefined;
|
|
22
|
+
}
|
|
23
|
+
function describePriceCheck(check, tokenSymbols) {
|
|
24
|
+
const name = (addr) => tokenSymbols.get(addr.toLowerCase()) ?? addr;
|
|
25
|
+
if (check.status === "off_market") {
|
|
26
|
+
if (typeof check.deviation_bps !== "number") {
|
|
27
|
+
throw new Error(`Malformed price check for pool ${check.pool}: off_market without deviation_bps.`);
|
|
28
|
+
}
|
|
29
|
+
const pct = Math.abs(check.deviation_bps) / 100;
|
|
30
|
+
return `Pool ${check.pool} (${name(check.token0)}/${name(check.token1)}): pool price is ${pct}% off market.`;
|
|
31
|
+
}
|
|
32
|
+
if (!check.unpriced_token_name) {
|
|
33
|
+
throw new Error(`Malformed price check for pool ${check.pool}: unpriced without unpriced_token_name.`);
|
|
34
|
+
}
|
|
35
|
+
const parts = [
|
|
36
|
+
`Pool ${check.pool} (${name(check.token0)}/${name(check.token1)}): no price information for ${check.unpriced_token_name}, so the pool price cannot be verified.`,
|
|
37
|
+
];
|
|
38
|
+
if (check.implied_usd_price != null) {
|
|
39
|
+
parts.push(`The pool implies a price of ${formatUsd(check.implied_usd_price)}.`);
|
|
40
|
+
}
|
|
41
|
+
if (check.swap_spend_usd != null) {
|
|
42
|
+
parts.push(`The position swaps about ${formatUsd(check.swap_spend_usd)} at that price.`);
|
|
43
|
+
}
|
|
44
|
+
return parts.join(" ");
|
|
45
|
+
}
|
|
46
|
+
const PriceCheckAcknowledgement = z.discriminatedUnion("status", [
|
|
47
|
+
z.object({
|
|
48
|
+
pool: z.string(),
|
|
49
|
+
status: z.literal("off_market"),
|
|
50
|
+
deviation_bps: z.number(),
|
|
51
|
+
unpriced_token: z.null(),
|
|
52
|
+
}),
|
|
53
|
+
z.object({
|
|
54
|
+
pool: z.string(),
|
|
55
|
+
status: z.literal("unpriced"),
|
|
56
|
+
deviation_bps: z.null(),
|
|
57
|
+
unpriced_token: z.string(),
|
|
58
|
+
}),
|
|
59
|
+
]);
|
|
60
|
+
function acknowledgementFor(check) {
|
|
61
|
+
if (check.status === "off_market") {
|
|
62
|
+
if (typeof check.deviation_bps !== "number") {
|
|
63
|
+
throw new Error(`Malformed price check for pool ${check.pool}: off_market without deviation_bps.`);
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
pool: check.pool,
|
|
67
|
+
status: "off_market",
|
|
68
|
+
deviation_bps: check.deviation_bps,
|
|
69
|
+
unpriced_token: null,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (!check.unpriced_token) {
|
|
73
|
+
throw new Error(`Malformed price check for pool ${check.pool}: unpriced without unpriced_token.`);
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
pool: check.pool,
|
|
77
|
+
status: "unpriced",
|
|
78
|
+
deviation_bps: null,
|
|
79
|
+
unpriced_token: check.unpriced_token,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function isCovered(flagged, accepted) {
|
|
83
|
+
return accepted.some((a) => {
|
|
84
|
+
if (a.pool.toLowerCase() !== flagged.pool.toLowerCase())
|
|
85
|
+
return false;
|
|
86
|
+
if (a.status === "off_market" && flagged.status === "off_market") {
|
|
87
|
+
return Math.abs(flagged.deviation_bps) <= Math.abs(a.deviation_bps);
|
|
88
|
+
}
|
|
89
|
+
if (a.status === "unpriced" && flagged.status === "unpriced") {
|
|
90
|
+
return a.unpriced_token.toLowerCase() === flagged.unpriced_token.toLowerCase();
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
9
95
|
function formatTokenAmount(value, decimals, maxFrac = 8) {
|
|
10
96
|
const str = value.toString().padStart(decimals + 1, "0");
|
|
11
97
|
const whole = str.slice(0, -decimals);
|
|
@@ -22,7 +108,7 @@ export function registerAddLiquidityTool(server, api, chains) {
|
|
|
22
108
|
openWorldHint: true,
|
|
23
109
|
},
|
|
24
110
|
outputSchema: BatchedTransactionOutput,
|
|
25
|
-
description: "Multi-step flash-action: atomically combines [deposit from wallet] + [use account collateral] + [swap to optimal ratio] + [mint LP] + [borrow if leveraged] in ONE transaction. Do NOT call write_account_deposit separately. Capital sources: wallet tokens (deposits array), existing account collateral (use_account_assets=true), or both. Check allowances first (read_wallet_allowances), then approve if needed (write_wallet_approve). Supports depositing multiple tokens and minting multiple LP positions in one tx. Works with both margin accounts (can leverage) and spot accounts (no leverage). For workflows, call read_guides('strategies'). The returned calldata is time-sensitive: sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation. expected_value_change is in raw units of the account's numeraire token (6 decimals for USDC, 18 for WETH). Negative = cost to open, positive = value gained. Compare before.total_account_value and after.total_account_value for the full picture.",
|
|
111
|
+
description: "Multi-step flash-action: atomically combines [deposit from wallet] + [use account collateral] + [swap to optimal ratio] + [mint LP] + [borrow if leveraged] in ONE transaction. Do NOT call write_account_deposit separately. Capital sources: wallet tokens (deposits array), existing account collateral (use_account_assets=true), or both. Check allowances first (read_wallet_allowances), then approve if needed (write_wallet_approve). Supports depositing multiple tokens and minting multiple LP positions in one tx. Works with both margin accounts (can leverage) and spot accounts (no leverage). For workflows, call read_guides('strategies'). The returned calldata is time-sensitive: sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up), passing only the accept_price_checks the user already confirmed. Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation. expected_value_change is in raw units of the account's numeraire token (6 decimals for USDC, 18 for WETH). Negative = cost to open, positive = value gained. Compare before.total_account_value and after.total_account_value for the full picture. If a pool's price is off market or one of its tokens has no price, the tool returns the price warnings, an accept_price_checks list and NO transaction. Show the warnings to the user and call again with that accept_price_checks list only after the user explicitly confirms they accept them. If a later call returns new warnings, even on a rebuild, show them and get a new confirmation before passing their list. The acknowledgement never bypasses a backend refusal.",
|
|
26
112
|
inputSchema: z.object({
|
|
27
113
|
account_address: z.string().describe("Arcadia account address"),
|
|
28
114
|
wallet_address: z.string().describe("Wallet address of the account owner"),
|
|
@@ -63,9 +149,13 @@ export function registerAddLiquidityTool(server, api, chains) {
|
|
|
63
149
|
.default(0)
|
|
64
150
|
.describe("0 = no borrow, 2 = 2x leverage. Margin accounts only."),
|
|
65
151
|
slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
|
|
152
|
+
accept_price_checks: z
|
|
153
|
+
.array(PriceCheckAcknowledgement)
|
|
154
|
+
.optional()
|
|
155
|
+
.describe("The accept_price_checks list returned with the price warnings of a previous call, passed unchanged and only after the user has explicitly confirmed those warnings. Never set it on the first call."),
|
|
66
156
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
67
157
|
}),
|
|
68
|
-
}, async ({ account_address, wallet_address, positions, deposits: walletDeposits, use_account_assets, leverage, slippage, chain_id, }) => {
|
|
158
|
+
}, async ({ account_address, wallet_address, positions, deposits: walletDeposits, use_account_assets, leverage, slippage, accept_price_checks, chain_id, }) => {
|
|
69
159
|
try {
|
|
70
160
|
const validChainId = validateChainId(chain_id);
|
|
71
161
|
const validAccount = validateAddress(account_address, "account_address");
|
|
@@ -295,9 +385,15 @@ export function registerAddLiquidityTool(server, api, chains) {
|
|
|
295
385
|
version,
|
|
296
386
|
action_type: "portfolio.advanced",
|
|
297
387
|
slippage: slippage ?? 100,
|
|
388
|
+
price_checks_supported: true,
|
|
298
389
|
};
|
|
299
390
|
const result = await api.getBundleCalldata(body);
|
|
300
391
|
const res = result;
|
|
392
|
+
const priceChecks = (res.price_checks ?? []);
|
|
393
|
+
const flagged = priceChecks.filter((c) => c.status !== "ok");
|
|
394
|
+
const warnings = flagged.map((c) => describePriceCheck(c, tokenSymbols));
|
|
395
|
+
const acknowledgements = flagged.map(acknowledgementFor);
|
|
396
|
+
const warningText = warnings.length > 0 ? `\nPrice warnings:\n${warnings.join("\n")}` : "";
|
|
301
397
|
// Surface simulation failure — do NOT return calldata
|
|
302
398
|
if (isSimulationFailed(res.tenderly_sim_status)) {
|
|
303
399
|
const simUrl = res.tenderly_sim_url
|
|
@@ -310,13 +406,36 @@ export function registerAddLiquidityTool(server, api, chains) {
|
|
|
310
406
|
content: [
|
|
311
407
|
{
|
|
312
408
|
type: "text",
|
|
313
|
-
text: `Error: Transaction simulation FAILED
|
|
409
|
+
text: `Error: Transaction simulation FAILED. Do NOT broadcast.${simError}\nCommon causes: insufficient wallet balance, missing token approval, or deposit below minimum margin.${simUrl}${warningText}`,
|
|
410
|
+
},
|
|
411
|
+
],
|
|
412
|
+
isError: true,
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
const uncovered = acknowledgements.filter((a) => !isCovered(a, accept_price_checks ?? []));
|
|
416
|
+
if (uncovered.length > 0) {
|
|
417
|
+
const changed = accept_price_checks
|
|
418
|
+
? " The price checks changed since the user confirmed them."
|
|
419
|
+
: "";
|
|
420
|
+
return {
|
|
421
|
+
content: [
|
|
422
|
+
{
|
|
423
|
+
type: "text",
|
|
424
|
+
text: `Error: Price warnings, no transaction returned.${changed} Show these warnings to the user. Call again with accept_price_checks set to the list below only after the user explicitly confirms they accept them.${warningText}\naccept_price_checks: ${JSON.stringify(acknowledgements)}`,
|
|
314
425
|
},
|
|
315
426
|
],
|
|
316
427
|
isError: true,
|
|
317
428
|
};
|
|
318
429
|
}
|
|
319
430
|
const response = formatBatchedResponse(res, chain_id, "Add liquidity to LP position");
|
|
431
|
+
if (priceChecks.length > 0)
|
|
432
|
+
response.price_checks = priceChecks;
|
|
433
|
+
if (priceChecks.some((c) => c.status === "unpriced") &&
|
|
434
|
+
res.expected_change_status === false &&
|
|
435
|
+
res.expected_value_change == null) {
|
|
436
|
+
response.expected_value_change_unavailable =
|
|
437
|
+
"No price information for a token, so the value change cannot be computed.";
|
|
438
|
+
}
|
|
320
439
|
return {
|
|
321
440
|
content: [
|
|
322
441
|
{
|
|
@@ -332,7 +451,7 @@ export function registerAddLiquidityTool(server, api, chains) {
|
|
|
332
451
|
content: [
|
|
333
452
|
{
|
|
334
453
|
type: "text",
|
|
335
|
-
text: `Error: ${err instanceof Error ? err.message : String(err)}`,
|
|
454
|
+
text: `Error: ${refusalMessage(err) ?? (err instanceof Error ? err.message : String(err))}`,
|
|
336
455
|
},
|
|
337
456
|
],
|
|
338
457
|
isError: true,
|
package/llms-full.txt
CHANGED
|
@@ -80,7 +80,7 @@ Parameters:
|
|
|
80
80
|
|
|
81
81
|
### read_wallet_points
|
|
82
82
|
|
|
83
|
-
Get Arcadia points balance for
|
|
83
|
+
Get the Arcadia points balance for one wallet address. Returns points and wallet_address. A wallet with no points returns points 0 and wallet_address 'unknown', not an error. Read-only, no authentication. For the ranked list of wallets, use read_point_leaderboard.
|
|
84
84
|
|
|
85
85
|
Parameters:
|
|
86
86
|
- `wallet_address` (string, required): Wallet address to get points for
|
|
@@ -95,7 +95,7 @@ Parameters:
|
|
|
95
95
|
|
|
96
96
|
### read_asset_prices
|
|
97
97
|
|
|
98
|
-
Get USD prices for one or more asset addresses.
|
|
98
|
+
Get USD prices for one or more asset addresses on one chain. Pass a single address or comma-separated addresses. Returns a price map keyed by address. Unknown or unpriced addresses return 0, not an error. Prices are scoped to chain_id (default 8453, Base), so pass the chain the addresses live on. Read-only. To find asset addresses, use read_asset_list.
|
|
99
99
|
|
|
100
100
|
Parameters:
|
|
101
101
|
- `asset_addresses` (string, required): Single address or comma-separated addresses
|
|
@@ -127,7 +127,7 @@ Parameters:
|
|
|
127
127
|
|
|
128
128
|
### read_strategy_list
|
|
129
129
|
|
|
130
|
-
Get Arcadia LP strategies
|
|
130
|
+
Get Arcadia LP strategies: the 7-day average APY at each strategy's default range, or for featured strategies the last 24 hours at the featured range width.
|
|
131
131
|
|
|
132
132
|
Parameters:
|
|
133
133
|
- `featured_only` (boolean, default: false): Return only featured/curated strategies
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcadia-finance/mcp-server",
|
|
3
3
|
"mcpName": "io.github.arcadia-finance/mcp-server",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"description": "MCP server for Arcadia Finance. Deploy concentrated liquidity on Uniswap/Aero, Aerodrome and Velodrome with automated rebalancing, compounding, yield optimization, and leverage, or single-sided liquidity into lending pools. Base, Optimism, Unichain and Robinhood.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "AGPL-3.0",
|
|
@@ -67,27 +67,28 @@
|
|
|
67
67
|
"access": "public"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@modelcontextprotocol/node": "^2.1.
|
|
71
|
-
"@modelcontextprotocol/server": "^2.
|
|
72
|
-
"express": "^5.
|
|
73
|
-
"express-rate-limit": "^8.3
|
|
74
|
-
"posthog-node": "5.
|
|
75
|
-
"viem": "^2.
|
|
70
|
+
"@modelcontextprotocol/node": "^2.1.2",
|
|
71
|
+
"@modelcontextprotocol/server": "^2.4.0",
|
|
72
|
+
"express": "^5.3.0",
|
|
73
|
+
"express-rate-limit": "^8.7.3",
|
|
74
|
+
"posthog-node": "5.63.2",
|
|
75
|
+
"viem": "^2.57.17",
|
|
76
76
|
"zod": "^4.2.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@eslint/js": "^
|
|
80
|
-
"@modelcontextprotocol/client": "^2.
|
|
79
|
+
"@eslint/js": "^10",
|
|
80
|
+
"@modelcontextprotocol/client": "^2.4.0",
|
|
81
81
|
"@types/express": "^5.0.6",
|
|
82
82
|
"@types/node": "^22.0.0",
|
|
83
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
84
|
-
"@typescript-eslint/parser": "^8.
|
|
85
|
-
"eslint": "^
|
|
86
|
-
"eslint-config-prettier": "^10.
|
|
83
|
+
"@typescript-eslint/eslint-plugin": "^8.72.1",
|
|
84
|
+
"@typescript-eslint/parser": "^8.72.1",
|
|
85
|
+
"eslint": "^10",
|
|
86
|
+
"eslint-config-prettier": "^10.1.8",
|
|
87
87
|
"prettier": "^3.0.0",
|
|
88
|
-
"tsx": "^4.
|
|
89
|
-
"typescript": "
|
|
90
|
-
"typescript-eslint": "^8.
|
|
91
|
-
"
|
|
88
|
+
"tsx": "^4.23.15",
|
|
89
|
+
"typescript": "~6.0.3",
|
|
90
|
+
"typescript-eslint": "^8.72.1",
|
|
91
|
+
"vite": "^8.3.6",
|
|
92
|
+
"vitest": "^5.1.0"
|
|
92
93
|
}
|
|
93
94
|
}
|
package/server.json
CHANGED
|
@@ -3,8 +3,15 @@
|
|
|
3
3
|
"name": "io.github.arcadia-finance/mcp-server",
|
|
4
4
|
"title": "Arcadia Finance",
|
|
5
5
|
"description": "Concentrated liquidity on Uniswap/Aero (rebalance, compound, leverage) or single-sided lending.",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.7.0",
|
|
7
7
|
"websiteUrl": "https://arcadia.finance",
|
|
8
|
+
"icons": [
|
|
9
|
+
{
|
|
10
|
+
"src": "https://arcadia.finance/arcadia_logo_green_bg_2.svg",
|
|
11
|
+
"mimeType": "image/svg+xml",
|
|
12
|
+
"sizes": ["any"]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
8
15
|
"repository": {
|
|
9
16
|
"url": "https://github.com/arcadia-finance/mcp-server",
|
|
10
17
|
"source": "github"
|
|
@@ -13,7 +20,7 @@
|
|
|
13
20
|
{
|
|
14
21
|
"registryType": "npm",
|
|
15
22
|
"identifier": "@arcadia-finance/mcp-server",
|
|
16
|
-
"version": "0.
|
|
23
|
+
"version": "0.7.0",
|
|
17
24
|
"transport": {
|
|
18
25
|
"type": "stdio"
|
|
19
26
|
},
|
|
@@ -14,6 +14,7 @@ Arcadia is a platform for managing concentrated liquidity positions with automat
|
|
|
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
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. `write_account_add_liquidity` also validates deposits against per-asset minimum amounts from strategy risk factors.
|
|
17
|
+
- **Price warnings**: if `write_account_add_liquidity` finds a pool price off market or a token with no price, it returns the warnings, an `accept_price_checks` list and no transaction. Show the warnings to the user and call again with that list only after the user explicitly confirms. Never set `accept_price_checks` on the first call. New warnings on a rebuild need a new confirmation. The acknowledgement never bypasses a backend refusal.
|
|
17
18
|
- **`asset_id`** is always an integer (NFT token ID for LP positions, 0 for ERC20 tokens).
|
|
18
19
|
- **Wrapping ETH** — ETH must be wrapped to WETH before depositing. Call WETH's `deposit()` function (payable) with the ETH amount. No MCP tool for this, use your wallet.
|
|
19
20
|
|
|
@@ -51,27 +52,27 @@ Arcadia's flash-action tools can batch multiple DeFi operations into a single at
|
|
|
51
52
|
|
|
52
53
|
### Read Tools
|
|
53
54
|
|
|
54
|
-
| Tool | When to use
|
|
55
|
-
| ------------------------------ |
|
|
56
|
-
| `read_account_info` | Account overview + liquidation price. Pass `account_address` for detail (returns positions with `asset_address`/`asset_id`/`dex_protocol`, collateral, debt).
|
|
57
|
-
| `read_account_history` | Historical account value over time. Optional `days` param (default 14).
|
|
58
|
-
| `read_account_pnl` | PnL and yield earned: use to check if a strategy is still profitable.
|
|
59
|
-
| `read_asset_list` | List supported collateral assets (symbol, address, decimals). Use `search` to filter by symbol substring.
|
|
60
|
-
| `read_asset_prices` | USD prices for one or more assets by address. Pass `asset_addresses` (single or comma-separated).
|
|
61
|
-
| `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.
|
|
62
|
-
| `read_wallet_allowances` | Check ERC20 token allowances for a spender. Use before `write_wallet_approve` to avoid redundant approvals: skip if the current allowance is already sufficient.
|
|
63
|
-
| `read_wallet_accounts` | List all Arcadia accounts owned by a wallet address.
|
|
64
|
-
| `read_wallet_points` | Points earned by a wallet address.
|
|
65
|
-
| `read_pool_list` | Lending pool TVL, APY, utilization, liquidity. Pass `pool_address` for detail + APY history (optional `days`, default 14).
|
|
66
|
-
| `read_pool_info` | Detail + APY history for a specific lending pool. Pass `pool_address`.
|
|
67
|
-
| `read_strategy_list` | 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). **
|
|
68
|
-
| `read_strategy_info` | Detail for a
|
|
69
|
-
| `read_point_leaderboard` | Points leaderboard. No `chain_id` needed: points are cross-chain.
|
|
70
|
-
| `read_strategy_recommendation` | Rebalancing recommendation for an account. Uses
|
|
71
|
-
| `read_asset_manager_intents` | List the automation intents and their params. Pass `account_address` for live per-account availability plus the rule blocking anything unavailable.
|
|
72
|
-
| `read_asset_manager_current` | What is enabled on an account now: decoded per-manager config, the intents it maps to, Merkl claim state, and superseded managers to clear.
|
|
73
|
-
| `read_account_aero_upgrade` | Aero upgrade check: what a wallet's accounts (or one account) still have to move to Aero, with status and counts and no calldata. Empty accounts and failed_accounts lists mean nothing to do.
|
|
74
|
-
| `read_guides` | Reference guides: `automation` (AM setup), `selection` (pool evaluation), `strategies` (step-by-step templates).
|
|
55
|
+
| Tool | When to use |
|
|
56
|
+
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
57
|
+
| `read_account_info` | Account overview + liquidation price. Pass `account_address` for detail (returns positions with `asset_address`/`asset_id`/`dex_protocol`, collateral, debt). |
|
|
58
|
+
| `read_account_history` | Historical account value over time. Optional `days` param (default 14). |
|
|
59
|
+
| `read_account_pnl` | PnL and yield earned: use to check if a strategy is still profitable. |
|
|
60
|
+
| `read_asset_list` | List supported collateral assets (symbol, address, decimals). Use `search` to filter by symbol substring. |
|
|
61
|
+
| `read_asset_prices` | USD prices for one or more assets by address. Pass `asset_addresses` (single or comma-separated). |
|
|
62
|
+
| `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. |
|
|
63
|
+
| `read_wallet_allowances` | Check ERC20 token allowances for a spender. Use before `write_wallet_approve` to avoid redundant approvals: skip if the current allowance is already sufficient. |
|
|
64
|
+
| `read_wallet_accounts` | List all Arcadia accounts owned by a wallet address. |
|
|
65
|
+
| `read_wallet_points` | Points earned by a wallet address. |
|
|
66
|
+
| `read_pool_list` | Lending pool TVL, APY, utilization, liquidity. Pass `pool_address` for detail + APY history (optional `days`, default 14). |
|
|
67
|
+
| `read_pool_info` | Detail + APY history for a specific lending pool. Pass `pool_address`. |
|
|
68
|
+
| `read_strategy_list` | 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). **Call `read_strategy_info` to see 24h APY per range width** (very_narrow → very_wide): narrower range = higher APY but more rebalancing cost/risk. Use `featured_only: true` for curated top strategies. |
|
|
69
|
+
| `read_strategy_info` | Detail for a concentrated-liquidity strategy by `strategy_id`: APY per range width over the last 24 hours, and the 7-day average at the default range in `yield`. For basic pools, use the 7d APY from `read_strategy_list`. |
|
|
70
|
+
| `read_point_leaderboard` | Points leaderboard. No `chain_id` needed: points are cross-chain. |
|
|
71
|
+
| `read_strategy_recommendation` | Rebalancing recommendation for an account. Uses 24h APY where possible (not the 7d average of `read_strategy_list`), so numbers may differ. |
|
|
72
|
+
| `read_asset_manager_intents` | List the automation intents and their params. Pass `account_address` for live per-account availability plus the rule blocking anything unavailable. |
|
|
73
|
+
| `read_asset_manager_current` | What is enabled on an account now: decoded per-manager config, the intents it maps to, Merkl claim state, and superseded managers to clear. |
|
|
74
|
+
| `read_account_aero_upgrade` | Aero upgrade check: what a wallet's accounts (or one account) still have to move to Aero, with status and counts and no calldata. Empty accounts and failed_accounts lists mean nothing to do. |
|
|
75
|
+
| `read_guides` | Reference guides: `automation` (AM setup), `selection` (pool evaluation), `strategies` (step-by-step templates). |
|
|
75
76
|
|
|
76
77
|
### Preferred Write Tools (atomic/multi-step — use these first)
|
|
77
78
|
|