# MCP Server

The [Arcadia MCP Server](https://github.com/arcadia-finance/mcp-server) enables AI agents to interact with the Arcadia Protocol through the [Model Context Protocol](https://modelcontextprotocol.io/). It supports reading protocol data and building unsigned transactions for LP management, borrowing, deposits, and more.

Supported networks: **Base** (8453) and **Unichain** (130).

## Setup

### Remote (recommended)

No installation required. Point your MCP client to the hosted server:

```
https://mcp.arcadia.finance/mcp
```

**Claude Code:**

```bash
claude mcp add arcadia-finance --transport http https://mcp.arcadia.finance/mcp
```

**Claude Desktop / Cursor / Windsurf:**

```json
{
  "mcpServers": {
    "arcadia-finance": {
      "url": "https://mcp.arcadia.finance/mcp"
    }
  }
}
```

### Local (via npx)

Running locally allows you to provide your own RPC endpoints and use the dev signing tool.

**Claude Code:**

```bash
claude mcp add arcadia-finance -- npx -y @arcadia-finance/mcp-server
```

**Claude Desktop / Cursor / Windsurf:**

```json
{
  "mcpServers": {
    "arcadia-finance": {
      "command": "npx",
      "args": ["-y", "@arcadia-finance/mcp-server"],
      "env": {
        "RPC_URL_BASE": "https://base-mainnet.g.alchemy.com/v2/<your-key>"
      }
    }
  }
}
```

### Environment Variables

| Variable           | Required | Description                                            |
| ------------------ | -------- | ------------------------------------------------------ |
| `RPC_URL_BASE`     | No       | Base RPC endpoint (falls back to public RPC)           |
| `RPC_URL_UNICHAIN` | No       | Unichain RPC endpoint (falls back to public RPC)       |
| `PK`               | No       | Private key for the `dev.send` tool (development only) |

## Available Tools

### Read Tools

| Tool                           | Description                                                       |
| ------------------------------ | ----------------------------------------------------------------- |
| `read_account_info`            | Health factor, collateral, debt, positions, liquidation price     |
| `read_account_history`         | Historical account value tracking                                 |
| `read_account_pnl`             | Yield and P\&L data                                               |
| `read_assets`                  | Supported collateral with addresses, types, decimals, USD pricing |
| `read_wallet_balances`         | ERC20 and ETH balances for any address                            |
| `read_wallet_allowance`        | Check token approvals before deposits                             |
| `read_points`                  | Wallet points balance or leaderboard                              |
| `read_pools`                   | TVL, APY, utilization, liquidity, historical APY trends           |
| `read_strategy_list`           | LP strategies with APY, underlying assets, pool info              |
| `read_strategy_recommendation` | Rebalancing suggestions for an account                            |
| `read_guides`                  | Documentation on automation, strategy selection, templates        |

### Write Tools

All write tools return unsigned transactions (`{ to, data, value, chainId }`). They do not sign or broadcast.

| Tool                             | Description                                     |
| -------------------------------- | ----------------------------------------------- |
| `write_wallet_approve`           | Grant token spending permissions                |
| `write_account_create`           | Deploy a new Arcadia account                    |
| `write_account_deposit`          | Deposit assets into an account                  |
| `write_account_withdraw`         | Withdraw assets from an account                 |
| `write_account_borrow`           | Borrow from a lending pool                      |
| `write_account_repay`            | Repay debt                                      |
| `write_account_add_liquidity`    | Flash-action: deposit + swap + mint LP position |
| `write_account_remove_liquidity` | Remove liquidity from a position                |
| `write_account_close`            | Atomically burn position + swap + repay         |
| `write_account_swap`             | Token swap within an account                    |
| `write_account_deleverage`       | Sell collateral to repay debt atomically        |
| `write_account_stake`            | Stake LP positions for rewards                  |
| `write_asset_manager_set`        | Enable an asset manager on an account           |
| `write_asset_manager_configure`  | Configure rebalancing/compounding parameters    |

### Development Tools

| Tool       | Description                                                                                          |
| ---------- | ---------------------------------------------------------------------------------------------------- |
| `dev.send` | Sign and broadcast a transaction using a local private key (requires `PK` env var, development only) |

## Transaction Signing

The MCP server returns unsigned transactions only. To execute them in production, pass the transaction object to your signing infrastructure:

* **MPC wallets**: Fireblocks, Dfns, Turnkey
* **Smart accounts**: Safe, Biconomy
* **Embedded wallets**: Privy, Dynamic
* **Client-side**: viem or ethers

```typescript
const hash = await walletClient.sendTransaction(tx);
```

For local development and testing, use the `dev.send` tool with the `PK` environment variable.

## Skills

The MCP server repository includes [skills](https://github.com/arcadia-finance/mcp-server/tree/main/skills) for Claude Code that provide domain knowledge about Arcadia workflows, concentrated liquidity management, asset manager patterns, and more. Install them by symlinking into your skills directory:

```bash
ln -s /path/to/mcp-server/skills/<skill-name> ~/.claude/skills/<skill-name>
```

Once installed, Claude Code can reference these skills when helping you interact with the protocol.
