> For the complete documentation index, see [llms.txt](https://docs.tydro.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tydro.com/developers/agent-mcp-new.md).

# Agent MCP (New)

### Background

Use Tydro's MCP with any AI agent to query live rates, check positions, and execute onchain actions like supply, borrow, repay, and withdraw.

### Installation

```
npm install
npm run build
```

### Configuration

```
# Required: network (mainnet only for now)
export TYDRO_NETWORK=mainnet

# Optional: only needed for write operations (supply/borrow/repay/withdraw)
export PRIVATE_KEY=0x...
```

### Usage with Claude Desktop

```
{
  "mcpServers": {
    "tydro": {
      "command": "node",
      "args": ["/path/to/tydro-mcp/build/index.js"],
      "env": {
        "TYDRO_NETWORK": "mainnet",
        "PRIVATE_KEY": "0x..."
      }
    }
  }
}
```

### Tools

#### `get_reserve_data`

Get supply/borrow APYs, liquidity, and utilization for any reserve.

```
{ "asset": "WETH" }
{ "asset": "kBTC" }
{ "asset": "USDT0" }
```

#### `get_user_account`

Get overall health factor, collateral, debt, and borrow capacity.

```
{ "address": "0x..." }
```

#### `get_user_reserve`

Get a user's position for a specific asset (supplied, borrowed, collateral status).

```
{ "asset": "USDT0", "address": "0x..." }
```

#### `supply`

Deposit assets to earn interest. Auto-approves if needed.

```
{ "asset": "USDT0", "amount": "1000" }
{ "asset": "WETH",  "amount": "0.5"  }
```

#### `borrow`

Borrow against collateral. Variable rate only (stable rate deprecated in Aave V3).

```
{ "asset": "USDT0", "amount": "500" }
```

#### `repay`

Repay borrowed assets. Use `"max"` to repay full debt including accrued interest.

```
{ "asset": "USDT0", "amount": "500"  }
{ "asset": "WETH",  "amount": "max"  }
```

#### `withdraw`

Withdraw supplied assets. Use `"max"` to withdraw full aToken balance.

```
{ "asset": "USDT0", "amount": "max" }
```

### Notes

* **Read-only tools** (`get_reserve_data`, `get_user_account`, `get_user_reserve`) work without `PRIVATE_KEY`
* **Write tools** (`supply`, `borrow`, `repay`, `withdraw`) require `PRIVATE_KEY`
* Approvals are checked before sending — no redundant approval transactions
* Max repay/withdraw uses `type(uint256).max` — Aave caps at actual balance/debt
* Health factor warnings trigger below 1.5 (liquidation threshold is 1.0)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.tydro.com/developers/agent-mcp-new.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
