@arcadia-finance/mcp-server 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -7
- package/dist/index.js +17 -7
- package/dist/utils/tool-naming.js +91 -0
- package/llms.txt +79 -0
- package/package.json +12 -3
- package/server.json +7 -8
package/README.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@arcadia-finance/mcp-server)
|
|
4
4
|
[](https://www.npmjs.com/package/@arcadia-finance/mcp-server)
|
|
5
|
-
[](https://smithery.ai/server/@arcadia-finance/mcp-server)
|
|
6
5
|
[](LICENSE.md)
|
|
7
6
|
[](https://www.typescriptlang.org/)
|
|
8
7
|
[](https://modelcontextprotocol.io/)
|
|
8
|
+
[](https://smithery.ai/servers/arcadia-finance/mcp-server)
|
|
9
9
|
[](https://lobehub.com/mcp/arcadia-finance-mcp-server)
|
|
10
|
-
[](https://glama.ai/mcp/servers/arcadia-finance/arcadia-finance-mcp-server)
|
|
11
11
|
|
|
12
12
|
MCP server for [Arcadia Finance](https://arcadia.finance), a platform to manage Uniswap and Aerodrome concentrated liquidity positions with built-in leverage, automated rebalancing, and yield optimization. Read protocol data and build unsigned transactions for LP management, borrowing, deposits, and more.
|
|
13
13
|
|
|
@@ -222,11 +222,14 @@ Pull requests for documentation fixes are welcome from agents and humans alike.
|
|
|
222
222
|
## Where to Find Us
|
|
223
223
|
|
|
224
224
|
- **npm:** [@arcadia-finance/mcp-server](https://www.npmjs.com/package/@arcadia-finance/mcp-server)
|
|
225
|
-
- **
|
|
226
|
-
- **
|
|
227
|
-
- **MCP
|
|
228
|
-
- **
|
|
229
|
-
- **
|
|
225
|
+
- **MCP Registry:** [registry.modelcontextprotocol.io](https://registry.modelcontextprotocol.io/?q=arcadia)
|
|
226
|
+
- **Smithery:** [smithery.ai](https://smithery.ai/servers/arcadia-finance/mcp-server)
|
|
227
|
+
- **MCP Servers:** [mcpservers.org](https://mcpservers.org/en/servers/arcadia-finance/mcp-server)
|
|
228
|
+
- **LobeHub:** [lobehub.com](https://lobehub.com/mcp/arcadia-finance-mcp-server)
|
|
229
|
+
- **PulseMCP:** [pulsemcp.com](https://www.pulsemcp.com/servers/arcadia-finance)
|
|
230
|
+
- **MCP Market:** [mcpmarket.com](https://mcpmarket.com/server/arcadia-finance)
|
|
231
|
+
- **Glama:** [glama.ai](https://glama.ai/mcp/servers/arcadia-finance/arcadia-finance-mcp-server)
|
|
232
|
+
- **awesome-mcp-servers:** [github.com/TensorBlock/awesome-mcp-servers](https://github.com/TensorBlock/awesome-mcp-servers)
|
|
230
233
|
|
|
231
234
|
## Development
|
|
232
235
|
|
package/dist/index.js
CHANGED
|
@@ -15,19 +15,21 @@ import { getChainConfigs } from "./config/chains.js";
|
|
|
15
15
|
import { registerAllTools } from "./tools/index.js";
|
|
16
16
|
import { registerAllResources } from "./resources/index.js";
|
|
17
17
|
import { registerAllPrompts } from "./prompts/index.js";
|
|
18
|
+
import { wrapServerForHttp, convertToolNames } from "./utils/tool-naming.js";
|
|
18
19
|
const require = createRequire(import.meta.url);
|
|
19
20
|
const pkg = require("../package.json");
|
|
20
21
|
const apiClient = new ArcadiaApiClient();
|
|
21
22
|
const chainConfigs = getChainConfigs();
|
|
22
|
-
function createServer() {
|
|
23
|
+
function createServer(options) {
|
|
23
24
|
const server = new McpServer({
|
|
24
25
|
name: "arcadia-finance",
|
|
25
26
|
version: pkg.version,
|
|
26
27
|
description: "Arcadia Finance. Manage concentrated liquidity positions with leverage, automated rebalancing, and yield optimization on Base and Unichain.",
|
|
27
28
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const registrationTarget = options?.httpMode ? wrapServerForHttp(server) : server;
|
|
30
|
+
registerAllTools(registrationTarget, apiClient, chainConfigs);
|
|
31
|
+
registerAllResources(registrationTarget);
|
|
32
|
+
registerAllPrompts(registrationTarget);
|
|
31
33
|
return server;
|
|
32
34
|
}
|
|
33
35
|
const transportMode = process.env.TRANSPORT ?? "stdio";
|
|
@@ -58,12 +60,12 @@ if (transportMode === "http") {
|
|
|
58
60
|
return;
|
|
59
61
|
res.status(204).end();
|
|
60
62
|
});
|
|
61
|
-
const rateLimit =
|
|
63
|
+
const { default: rateLimit, ipKeyGenerator } = await import("express-rate-limit");
|
|
62
64
|
const rpm = parseInt(process.env.RATE_LIMIT_RPM ?? "60", 10);
|
|
63
65
|
app.use("/mcp", rateLimit({
|
|
64
66
|
windowMs: 60_000,
|
|
65
67
|
max: rpm,
|
|
66
|
-
keyGenerator: (req) => req.headers["mcp-session-id"] || req.ip || "unknown",
|
|
68
|
+
keyGenerator: (req) => req.headers["mcp-session-id"] || ipKeyGenerator(req.ip ?? "") || "unknown",
|
|
67
69
|
standardHeaders: true,
|
|
68
70
|
legacyHeaders: false,
|
|
69
71
|
}));
|
|
@@ -85,7 +87,7 @@ if (transportMode === "http") {
|
|
|
85
87
|
}, SESSION_TTL_MS);
|
|
86
88
|
}
|
|
87
89
|
async function createSession() {
|
|
88
|
-
const server = createServer();
|
|
90
|
+
const server = createServer({ httpMode: true });
|
|
89
91
|
const transport = new StreamableHTTPServerTransport({
|
|
90
92
|
sessionIdGenerator: () => crypto.randomUUID(),
|
|
91
93
|
onsessioninitialized: (sessionId) => {
|
|
@@ -119,6 +121,14 @@ if (transportMode === "http") {
|
|
|
119
121
|
app.get("/health", (_req, res) => {
|
|
120
122
|
res.send("ok");
|
|
121
123
|
});
|
|
124
|
+
app.get("/.well-known/llms.txt", async (_req, res) => {
|
|
125
|
+
const { readFile } = await import("fs/promises");
|
|
126
|
+
const { fileURLToPath } = await import("url");
|
|
127
|
+
const { dirname, join } = await import("path");
|
|
128
|
+
const dir = dirname(fileURLToPath(import.meta.url));
|
|
129
|
+
const content = await readFile(join(dir, "..", "llms.txt"), "utf-8");
|
|
130
|
+
res.type("text/plain").send(convertToolNames(content));
|
|
131
|
+
});
|
|
122
132
|
app.post("/mcp", async (req, res) => {
|
|
123
133
|
if (!validateOrigin(req, res))
|
|
124
134
|
return;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const TOOL_NAME_RE = /\b(read|write|dev)\.[a-z_]+(?:\.[a-z_]+)*/g;
|
|
2
|
+
export function convertToolNames(text) {
|
|
3
|
+
return text.replace(TOOL_NAME_RE, (match) => match.replace(/\./g, "_"));
|
|
4
|
+
}
|
|
5
|
+
function deepConvertToolNames(value) {
|
|
6
|
+
if (typeof value === "string")
|
|
7
|
+
return convertToolNames(value);
|
|
8
|
+
if (Array.isArray(value))
|
|
9
|
+
return value.map(deepConvertToolNames);
|
|
10
|
+
if (value !== null && typeof value === "object") {
|
|
11
|
+
const result = {};
|
|
12
|
+
for (const [k, v] of Object.entries(value)) {
|
|
13
|
+
result[k] = deepConvertToolNames(v);
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
return value;
|
|
18
|
+
}
|
|
19
|
+
export function wrapServerForHttp(server) {
|
|
20
|
+
return new Proxy(server, {
|
|
21
|
+
get(target, prop, receiver) {
|
|
22
|
+
if (prop === "registerTool") {
|
|
23
|
+
return (name, config, cb) => {
|
|
24
|
+
const newName = convertToolNames(name);
|
|
25
|
+
const newConfig = { ...config };
|
|
26
|
+
if (typeof newConfig.description === "string") {
|
|
27
|
+
newConfig.description = convertToolNames(newConfig.description);
|
|
28
|
+
}
|
|
29
|
+
const wrappedCb = async (...args) => {
|
|
30
|
+
const result = (await cb(...args));
|
|
31
|
+
const content = result.content;
|
|
32
|
+
const structuredContent = result.structuredContent;
|
|
33
|
+
return {
|
|
34
|
+
...result,
|
|
35
|
+
...(content && {
|
|
36
|
+
content: content.map((c) => ({
|
|
37
|
+
...c,
|
|
38
|
+
...(typeof c.text === "string" && { text: convertToolNames(c.text) }),
|
|
39
|
+
})),
|
|
40
|
+
}),
|
|
41
|
+
...(structuredContent !== undefined && {
|
|
42
|
+
structuredContent: deepConvertToolNames(structuredContent),
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
return target.registerTool(newName, newConfig, wrappedCb);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (prop === "registerResource") {
|
|
50
|
+
return (name, uriOrTemplate, config, readCallback) => {
|
|
51
|
+
const wrappedCallback = async (...args) => {
|
|
52
|
+
const result = (await readCallback(...args));
|
|
53
|
+
const contents = result.contents;
|
|
54
|
+
return {
|
|
55
|
+
...result,
|
|
56
|
+
...(contents && {
|
|
57
|
+
contents: contents.map((c) => ({
|
|
58
|
+
...c,
|
|
59
|
+
...(typeof c.text === "string" && { text: convertToolNames(c.text) }),
|
|
60
|
+
})),
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
return target.registerResource(name, uriOrTemplate, config, wrappedCallback);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
if (prop === "registerPrompt") {
|
|
68
|
+
return (name, config, cb) => {
|
|
69
|
+
const wrappedCb = async (...args) => {
|
|
70
|
+
const result = (await cb(...args));
|
|
71
|
+
const messages = result.messages;
|
|
72
|
+
return {
|
|
73
|
+
...result,
|
|
74
|
+
...(messages && {
|
|
75
|
+
messages: messages.map((m) => {
|
|
76
|
+
const content = m.content;
|
|
77
|
+
if (content && typeof content.text === "string") {
|
|
78
|
+
return { ...m, content: { ...content, text: convertToolNames(content.text) } };
|
|
79
|
+
}
|
|
80
|
+
return m;
|
|
81
|
+
}),
|
|
82
|
+
}),
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
return target.registerPrompt(name, config, wrappedCb);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return Reflect.get(target, prop, receiver);
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
package/llms.txt
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Arcadia Finance MCP Server
|
|
2
|
+
|
|
3
|
+
> MCP server for Arcadia Finance, a DeFi protocol for managing concentrated liquidity positions (Uniswap v3/v4, Aerodrome/Slipstream) with leverage, automated rebalancing, and yield optimization. Supported chains: Base (8453), Unichain (130).
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Arcadia lets users open leveraged LP positions, borrow against collateral, and automate position management (rebalancing, compounding, yield claiming). This MCP server exposes the full protocol as 38 tools:
|
|
8
|
+
|
|
9
|
+
- **Account management**: health factor, collateral, debt, positions, PnL, history
|
|
10
|
+
- **Wallet**: ERC20 balances, allowances, owned accounts, points
|
|
11
|
+
- **Lending pools**: TVL, APY, utilization, available liquidity, rate history
|
|
12
|
+
- **LP strategies**: concentrated liquidity strategies with APY per range width, recommendations
|
|
13
|
+
- **Transaction building**: unsigned calldata for deposits, borrows, swaps, LP minting/closing, staking
|
|
14
|
+
- **Automation**: configure asset managers (rebalancer, compounder, yield claimer, CowSwap, Merkl)
|
|
15
|
+
|
|
16
|
+
All write tools return unsigned transactions (`{ to, data, value, chainId }`). Signing is the client's responsibility.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
npx -y @arcadia-finance/mcp-server
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or connect to the remote server: `https://mcp.arcadia.finance/mcp`
|
|
25
|
+
|
|
26
|
+
## Tools (38 total)
|
|
27
|
+
|
|
28
|
+
### Read (17)
|
|
29
|
+
|
|
30
|
+
- read.account.info: account overview with health factor, collateral, debt, positions, liquidation price, automation status
|
|
31
|
+
- read.account.history: historical account value over time
|
|
32
|
+
- read.account.pnl: PnL and yield data for an account
|
|
33
|
+
- read.wallet.accounts: list all Arcadia accounts owned by a wallet
|
|
34
|
+
- read.wallet.balances: ERC20 and native ETH balances for a wallet
|
|
35
|
+
- read.wallet.allowances: check ERC20 token allowances for a spender
|
|
36
|
+
- read.wallet.points: Arcadia points balance for a wallet
|
|
37
|
+
- read.asset.list: supported collateral assets with addresses, types, decimals
|
|
38
|
+
- read.asset.prices: USD prices for asset addresses
|
|
39
|
+
- read.pool.list: all lending pools with TVL, APY, utilization, liquidity
|
|
40
|
+
- read.pool.info: single pool detail with APY history
|
|
41
|
+
- read.point_leaderboard: paginated points leaderboard
|
|
42
|
+
- read.strategy.list: LP strategies with APY, underlyings, pool info
|
|
43
|
+
- read.strategy.info: full detail for a specific LP strategy
|
|
44
|
+
- read.strategy.recommendation: rebalancing recommendation for an account
|
|
45
|
+
- read.guides: reference guides for automation, strategies, addresses
|
|
46
|
+
- read.asset_manager.intents: available automation intents with params and supported chains
|
|
47
|
+
|
|
48
|
+
### Write (20)
|
|
49
|
+
|
|
50
|
+
- write.wallet.approve: approve ERC20/ERC721 for spending
|
|
51
|
+
- write.account.create: create a new Arcadia account
|
|
52
|
+
- write.account.deposit: deposit assets into an account
|
|
53
|
+
- write.account.withdraw: withdraw assets from an account
|
|
54
|
+
- write.account.borrow: borrow from a lending pool
|
|
55
|
+
- write.account.repay: repay debt from wallet tokens
|
|
56
|
+
- write.account.add_liquidity: flash-action that deposits, swaps, mints LP, and optionally leverages atomically
|
|
57
|
+
- write.account.remove_liquidity: partially decrease LP position liquidity
|
|
58
|
+
- write.account.swap: swap assets within an account
|
|
59
|
+
- write.account.deleverage: repay debt by selling collateral
|
|
60
|
+
- write.account.close: atomic close that burns LP, swaps, and repays in one tx
|
|
61
|
+
- write.account.stake: stake, unstake, or claim LP rewards
|
|
62
|
+
- write.account.set_asset_managers: build setAssetManagers tx from encoded intent args
|
|
63
|
+
- write.asset_manager.rebalancer: encode rebalancer automation args
|
|
64
|
+
- write.asset_manager.compounder: encode standalone compounder args
|
|
65
|
+
- write.asset_manager.compounder_staked: encode compounder + CowSwap for staked positions
|
|
66
|
+
- write.asset_manager.yield_claimer: encode yield claimer args
|
|
67
|
+
- write.asset_manager.yield_claimer_cowswap: encode yield claimer + CowSwap args
|
|
68
|
+
- write.asset_manager.cow_swapper: encode direct CowSwap mode args
|
|
69
|
+
- write.asset_manager.merkl_operator: encode Merkl reward claimer args
|
|
70
|
+
|
|
71
|
+
### Dev (1)
|
|
72
|
+
|
|
73
|
+
- dev.send: sign and broadcast using local private key (dev only)
|
|
74
|
+
|
|
75
|
+
## Links
|
|
76
|
+
|
|
77
|
+
- Website: https://arcadia.finance
|
|
78
|
+
- Docs: https://docs.arcadia.finance
|
|
79
|
+
- npm: https://www.npmjs.com/package/@arcadia-finance/mcp-server
|
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.3.
|
|
4
|
+
"version": "0.3.2",
|
|
5
5
|
"description": "MCP server for Arcadia Finance. Manage concentrated liquidity positions with leverage, automated rebalancing, and yield optimization on Base and Unichain.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "AGPL-3.0",
|
|
@@ -13,21 +13,30 @@
|
|
|
13
13
|
"homepage": "https://arcadia.finance",
|
|
14
14
|
"keywords": [
|
|
15
15
|
"mcp",
|
|
16
|
+
"mcp-server",
|
|
17
|
+
"ai-agent",
|
|
16
18
|
"arcadia",
|
|
17
19
|
"defi",
|
|
18
20
|
"lending",
|
|
21
|
+
"concentrated-liquidity",
|
|
19
22
|
"clamm",
|
|
20
23
|
"liquidity",
|
|
21
24
|
"uniswap",
|
|
22
25
|
"aerodrome",
|
|
26
|
+
"slipstream",
|
|
23
27
|
"base",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
28
|
+
"unichain",
|
|
29
|
+
"ethereum",
|
|
30
|
+
"leverage",
|
|
31
|
+
"yield-farming",
|
|
32
|
+
"rebalancing",
|
|
33
|
+
"onchain"
|
|
26
34
|
],
|
|
27
35
|
"files": [
|
|
28
36
|
"dist",
|
|
29
37
|
"skills",
|
|
30
38
|
"server.json",
|
|
39
|
+
"llms.txt",
|
|
31
40
|
"README.md",
|
|
32
41
|
"LICENSE.md"
|
|
33
42
|
],
|
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.3.
|
|
6
|
+
"version": "0.3.2",
|
|
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.3.
|
|
16
|
+
"version": "0.3.2",
|
|
17
17
|
"transport": {
|
|
18
18
|
"type": "stdio"
|
|
19
19
|
},
|
|
@@ -61,13 +61,12 @@
|
|
|
61
61
|
"isSecret": false
|
|
62
62
|
}
|
|
63
63
|
]
|
|
64
|
-
}
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"remotes": [
|
|
65
67
|
{
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"transport": {
|
|
69
|
-
"type": "streamablehttp"
|
|
70
|
-
}
|
|
68
|
+
"type": "streamable-http",
|
|
69
|
+
"url": "https://mcp.arcadia.finance/mcp"
|
|
71
70
|
}
|
|
72
71
|
]
|
|
73
72
|
}
|