> 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/vii.-developers/developer-overview/mcp.md). Agents can also search and read this documentation through its [MCP server](https://docs.tydro.com/~gitbook/mcp).

# MCP

Use Tydro's MCP 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.tydro.com/vii.-developers/developer-overview/mcp.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
