# 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), **Unichain** (130), and **Optimism** (10).

## 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)       |
| `RPC_URL_OPTIMISM` | No       | Optimism 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.arcadia.finance/developers/integrations/mcp-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
