@arcadia-finance/mcp-server 0.1.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 (59) hide show
  1. package/LICENSE.md +97 -0
  2. package/README.md +186 -0
  3. package/dist/abis/account.json +1012 -0
  4. package/dist/abis/account_v4.json +1027 -0
  5. package/dist/abis/chainlink.json +509 -0
  6. package/dist/abis/erc20.json +299 -0
  7. package/dist/abis/factory.json +938 -0
  8. package/dist/abis/gauge_helper.json +84 -0
  9. package/dist/abis/index.js +26 -0
  10. package/dist/abis/mainreg.json +1172 -0
  11. package/dist/abis/nftmanager.json +1221 -0
  12. package/dist/abis/nftmanager_v4.json +1297 -0
  13. package/dist/abis/pool.json +2136 -0
  14. package/dist/abis/slipstream_nftmanager.json +1312 -0
  15. package/dist/abis/staked_aero_am.json +1220 -0
  16. package/dist/abis/staked_slipstream_am.json +1131 -0
  17. package/dist/abis/state_viewer.json +365 -0
  18. package/dist/abis/tranche.json +1004 -0
  19. package/dist/abis/wrapped_aero_am.json +1232 -0
  20. package/dist/abis/wrapped_staked_slipstream_am.json +338 -0
  21. package/dist/clients/api.js +189 -0
  22. package/dist/clients/chain.js +30 -0
  23. package/dist/config/addresses.js +94 -0
  24. package/dist/config/chains.js +31 -0
  25. package/dist/index.js +29 -0
  26. package/dist/skills/clamm-liquidity/SKILL.md +167 -0
  27. package/dist/skills/clamm-liquidity/automation.md +138 -0
  28. package/dist/skills/clamm-liquidity/selection.md +183 -0
  29. package/dist/skills/clamm-liquidity/strategies.md +337 -0
  30. package/dist/tools/advanced/account-metadata.js +46 -0
  31. package/dist/tools/advanced/add-liquidity.js +310 -0
  32. package/dist/tools/advanced/close-position.js +208 -0
  33. package/dist/tools/advanced/format-response.js +26 -0
  34. package/dist/tools/advanced/position-actions.js +95 -0
  35. package/dist/tools/advanced/remove-liquidity.js +68 -0
  36. package/dist/tools/advanced/repay-with-collateral.js +66 -0
  37. package/dist/tools/advanced/swap.js +64 -0
  38. package/dist/tools/index.js +52 -0
  39. package/dist/tools/read/accounts.js +243 -0
  40. package/dist/tools/read/allowances.js +86 -0
  41. package/dist/tools/read/assets.js +54 -0
  42. package/dist/tools/read/balances.js +93 -0
  43. package/dist/tools/read/guides.js +59 -0
  44. package/dist/tools/read/points.js +25 -0
  45. package/dist/tools/read/pools.js +48 -0
  46. package/dist/tools/read/protocol.js +94 -0
  47. package/dist/tools/write/approve.js +99 -0
  48. package/dist/tools/write/borrow.js +87 -0
  49. package/dist/tools/write/configure-asset-manager.js +258 -0
  50. package/dist/tools/write/create-account.js +112 -0
  51. package/dist/tools/write/deposit.js +104 -0
  52. package/dist/tools/write/repay.js +56 -0
  53. package/dist/tools/write/set-asset-manager.js +65 -0
  54. package/dist/tools/write/sign-and-send.js +90 -0
  55. package/dist/tools/write/withdraw.js +114 -0
  56. package/dist/types/api.js +5 -0
  57. package/dist/utils/attribution.js +20 -0
  58. package/dist/utils/validation.js +17 -0
  59. package/package.json +67 -0
package/LICENSE.md ADDED
@@ -0,0 +1,97 @@
1
+ Business Source License 1.1
2
+
3
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
5
+
6
+ ---
7
+
8
+ Parameters
9
+
10
+ Licensor: Pragma Labs
11
+
12
+ Licensed Work: Pragma Labs - Arcadia MCP Server. The Licensed Work is (c) 2026 Pragma Labs
13
+
14
+ Additional Use Grant: Any uses listed and defined at this [LICENSE](./LICENSE.md) or at [core-license-grants.pragmalabs.dev](https://core-license-grants.pragmalabs.dev)
15
+
16
+ Change Date: The earlier of 2028-03-04 or a date specified at [core-license-date.pragmalabs.dev](https://core-license-date.pragmalabs.dev)
17
+
18
+ Change License: GNU Affero General Public License v3.0 or later
19
+
20
+ ---
21
+
22
+ Terms
23
+
24
+ The Licensor hereby grants you the right to copy, modify, create derivative
25
+ works, redistribute, and make non-production use of the Licensed Work. The
26
+ Licensor may make an Additional Use Grant, above, permitting limited
27
+ production use.
28
+
29
+ Effective on the Change Date, or the fourth anniversary of the first publicly
30
+ available distribution of a specific version of the Licensed Work under this
31
+ License, whichever comes first, the Licensor hereby grants you rights under
32
+ the terms of the Change License, and the rights granted in the paragraph
33
+ above terminate.
34
+
35
+ If your use of the Licensed Work does not comply with the requirements
36
+ currently in effect as described in this License, you must purchase a
37
+ commercial license from the Licensor, its affiliated entities, or authorized
38
+ resellers, or you must refrain from using the Licensed Work.
39
+
40
+ All copies of the original and modified Licensed Work, and derivative works
41
+ of the Licensed Work, are subject to this License. This License applies
42
+ separately for each version of the Licensed Work and the Change Date may vary
43
+ for each version of the Licensed Work released by Licensor.
44
+
45
+ You must conspicuously display this License on each original or modified copy
46
+ of the Licensed Work. If you receive the Licensed Work in original or
47
+ modified form from a third party, the terms and conditions set forth in this
48
+ License apply to your use of that work.
49
+
50
+ Any use of the Licensed Work in violation of this License will automatically
51
+ terminate your rights under this License for the current and all other
52
+ versions of the Licensed Work.
53
+
54
+ This License does not grant you any right in any trademark or logo of
55
+ Licensor or its affiliates (provided that you may use a trademark or logo of
56
+ Licensor as expressly required by this License).
57
+
58
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
59
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
60
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
61
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
62
+ TITLE.
63
+
64
+ MariaDB hereby grants you permission to use this License’s text to license
65
+ your works, and to refer to it using the trademark "Business Source License",
66
+ as long as you comply with the Covenants of Licensor below.
67
+
68
+ ---
69
+
70
+ Covenants of Licensor
71
+
72
+ In consideration of the right to use this License’s text and the "Business
73
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
74
+ other recipients of the licensed work to be provided by Licensor:
75
+
76
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
77
+ or a license that is compatible with GPL Version 2.0 or a later version,
78
+ where "compatible" means that software provided under the Change License can
79
+ be included in a program with software provided under GPL Version 2.0 or a
80
+ later version. Licensor may specify additional Change Licenses without
81
+ limitation.
82
+
83
+ 2. To either: (a) specify an additional grant of rights to use that does not
84
+ impose any additional restriction on the right granted in this License, as
85
+ the Additional Use Grant; or (b) insert the text "None".
86
+
87
+ 3. To specify a Change Date.
88
+
89
+ 4. Not to modify this License in any other way.
90
+
91
+ ---
92
+
93
+ Notice
94
+
95
+ The Business Source License (this document, or the "License") is not an Open
96
+ Source license. However, the Licensed Work will eventually be made available
97
+ under an Open Source License, as stated in this License.
package/README.md ADDED
@@ -0,0 +1,186 @@
1
+ # Arcadia Finance MCP Server
2
+
3
+ MCP server for [Arcadia Finance](https://arcadia.finance), a platform to manage 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.
4
+
5
+ Designed for AI agents (Claude, Cursor, etc.) to interact with Arcadia onchain.
6
+
7
+ ## Tools
8
+
9
+ ### Read Tools
10
+
11
+ | Tool | Description |
12
+ | --------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
13
+ | `get_account_info` | Account overview: health factor, collateral, debt, positions, liquidation price. Pass `account_address` or `wallet_address`. |
14
+ | `get_account_history` | Historical account value over time. |
15
+ | `get_account_pnl` | PnL and yield data for an account. |
16
+ | `get_assets` | Supported collateral assets with addresses, types, decimals. Optional USD price lookup. |
17
+ | `get_wallet_balances` | On-chain ERC20 balances and native ETH for a wallet address. |
18
+ | `get_allowance` | Check ERC20 token allowances for a spender. Use before `build_approve_tx` to avoid redundant approvals. |
19
+ | `get_points` | Points balance for a wallet, or leaderboard. |
20
+ | `get_lending_pools` | Pool data: TVL, APY, utilization, liquidity. Optional single-pool detail with APY history. |
21
+ | `get_strategies` | LP strategies with APY, underlyings, pool info. Optional detail or featured filter. |
22
+ | `get_recommendation` | Rebalancing recommendation for an account. |
23
+ | `get_guide` | Reference guides: automation setup, strategy selection, strategy templates. |
24
+
25
+ ### Write Tools
26
+
27
+ Direct calldata encoding via viem. Each returns `{ to, data, value, chainId }`.
28
+
29
+ | Tool | Description |
30
+ | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
31
+ | `build_approve_tx` | Approve an ERC20 token for spending. Required before depositing into an account. Call `get_allowance` first to check if already approved. |
32
+ | `build_create_account_tx` | Create a new Arcadia account via Factory. |
33
+ | `build_deposit_tx` | Deposit ERC20 tokens into an account. |
34
+ | `build_withdraw_tx` | Withdraw assets from an account. |
35
+ | `build_borrow_tx` | Borrow from a lending pool. |
36
+ | `build_repay_tx` | Repay debt to a lending pool. |
37
+ | `build_set_asset_manager_tx` | Grant or revoke an asset manager contract's permission on a V3/V4 account. For full setup with config, use `build_configure_asset_manager_tx`. |
38
+ | `build_configure_asset_manager_tx` | Enable AND configure an asset manager in one tx for V3/V4 accounts: sets initiator, fee limits, and strategy parameters (trigger thresholds, compound mode, recipients). |
39
+
40
+ ### Dev Tools
41
+
42
+ Always registered but requires `PK` env var to function.
43
+
44
+ | Tool | Description |
45
+ | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
46
+ | `sign_and_send_tx` | Sign and broadcast an unsigned transaction using a local private key (`PK` env var). Not for production — use a dedicated wallet MCP server instead. |
47
+
48
+ ### Advanced Tools
49
+
50
+ Proxied via backend API. Handles swap routing, Tenderly simulation, optimal ratios.
51
+
52
+ | Tool | Description |
53
+ | -------------------------------- | ----------------------------------------------------------------------- |
54
+ | `build_add_liquidity_tx` | Flash-action: deposit + swap + mint LP + optional leverage, atomically. |
55
+ | `build_remove_liquidity_tx` | Remove/decrease LP position liquidity. |
56
+ | `build_swap_tx` | Swap assets within an account (backend-routed). |
57
+ | `build_repay_with_collateral_tx` | Repay debt by selling collateral (swap + repay in one tx). |
58
+ | `build_close_position_tx` | Atomic close: burn LP + swap + repay debt in one tx. |
59
+ | `build_position_action_tx` | Stake, unstake, or claim rewards for LP positions. |
60
+
61
+ ## Transaction Signing
62
+
63
+ All write and advanced tools return **unsigned transactions** as `{ to, data, value, chainId }`. This server does NOT sign or broadcast — your agent or application is responsible for that.
64
+
65
+ ### Options
66
+
67
+ **Wallet infrastructure (recommended for production):**
68
+ Use your existing wallet setup — MPC wallets (Fireblocks, Dfns, Turnkey), smart accounts (Safe, Biconomy), or embedded wallets (Privy, Dynamic). Pass the unsigned tx object to your provider's signing method.
69
+
70
+ **viem/ethers in your agent:**
71
+
72
+ ```typescript
73
+ import { createWalletClient, http } from "viem";
74
+ import { privateKeyToAccount } from "viem/accounts";
75
+ import { base } from "viem/chains";
76
+
77
+ const account = privateKeyToAccount("0x...");
78
+ const client = createWalletClient({ account, chain: base, transport: http() });
79
+
80
+ // tx = result from any build_*_tx tool
81
+ const hash = await client.sendTransaction(tx);
82
+ ```
83
+
84
+ **Built-in `sign_and_send_tx` tool (development only):**
85
+ The server includes a dev-only signing tool that reads a private key from the `PK` environment variable. Set `PK` via a `.env` file or your MCP client config:
86
+
87
+ ```bash
88
+ # .env in the server directory (never commit — already gitignored)
89
+ PK=0xYourPrivateKeyHex
90
+ RPC_URL_BASE=https://base-mainnet.g.alchemy.com/v2/your-key
91
+ ```
92
+
93
+ The server loads `.env` automatically on startup. Works with any MCP client (Claude Desktop, Claude Code, VSCode, Cursor). MCP client `env` block settings take precedence if both are set.
94
+
95
+ Not for production — use a dedicated wallet MCP server (Fireblocks, Turnkey, Safe) instead.
96
+
97
+ ## Setup
98
+
99
+ **Prerequisites:** Node.js >= 22
100
+
101
+ ```bash
102
+ yarn install
103
+ yarn build
104
+ ```
105
+
106
+ **Environment variables:**
107
+
108
+ | Variable | Required | Description |
109
+ | ------------------ | -------- | ---------------------------------------------------------------- |
110
+ | `RPC_URL_BASE` | No | RPC URL for Base (8453). Falls back to public RPC if not set. |
111
+ | `RPC_URL_OPTIMISM` | No | RPC URL for Optimism (10). Falls back to public RPC if not set. |
112
+ | `RPC_URL_UNICHAIN` | No | RPC URL for Unichain (130). Falls back to public RPC if not set. |
113
+ | `PK` | No | Private key (hex) for dev-only `sign_and_send_tx` tool. |
114
+
115
+ **Supported chains:** Base (8453), Optimism (10), Unichain (130)
116
+
117
+ ## MCP Client Configuration
118
+
119
+ **Via npx** (recommended):
120
+
121
+ ```json
122
+ {
123
+ "mcpServers": {
124
+ "arcadia-finance": {
125
+ "command": "npx",
126
+ "args": ["-y", "@arcadia-finance/mcp-server"],
127
+ "env": {
128
+ "RPC_URL_BASE": "https://base-mainnet.g.alchemy.com/v2/your-key"
129
+ }
130
+ }
131
+ }
132
+ }
133
+ ```
134
+
135
+ **From source** (local development):
136
+
137
+ ```json
138
+ {
139
+ "mcpServers": {
140
+ "arcadia-finance": {
141
+ "command": "node",
142
+ "args": ["/absolute/path/to/mcp-server/dist/index.js"],
143
+ "env": {
144
+ "RPC_URL_BASE": "https://base-mainnet.g.alchemy.com/v2/your-key"
145
+ }
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ ## Skills
152
+
153
+ The `skills/` directory contains Claude Code skills that teach AI agents how to use this MCP server effectively. To install a skill, symlink it into your Claude skills directory:
154
+
155
+ ```bash
156
+ ln -s /path/to/mcp-server/skills/clamm-liquidity ~/.claude/skills/clamm-liquidity
157
+ ```
158
+
159
+ Available skills:
160
+
161
+ | Skill | Description |
162
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------- |
163
+ | `clamm-liquidity` | Concentrated liquidity management: concepts, asset managers (rebalancers, compounders), and step-by-step workflows. |
164
+
165
+ ## Reporting Issues
166
+
167
+ Found a bug, missing feature, or unclear documentation while using this server?
168
+ Open an issue: https://github.com/arcadia-finance/mcp-server/issues
169
+
170
+ **For AI agents:** If you hit a gap during task execution, open an issue with:
171
+
172
+ - Tool name and parameters you used
173
+ - What you expected vs what happened
174
+ - The strategy or goal you were trying to execute
175
+
176
+ Pull requests for documentation fixes are welcome from agents and humans alike. All PRs require human review before merging.
177
+
178
+ ## Development
179
+
180
+ ```bash
181
+ yarn dev # Run with tsx (hot reload)
182
+ yarn build # Compile TypeScript
183
+ yarn test # Run tests
184
+ yarn lint # Lint with ESLint
185
+ yarn format # Check formatting with Prettier
186
+ ```