TypeScriptADK-TS

MCP Fraxlend

Interact with the Fraxlend lending platform

Usage with ADK TypeScript

import {McpFraxlend} from "@iqai/adk";

const toolset = McpFraxlend({
  env: {
    WALLET_PRIVATE_KEY: process.env.WALLET_PRIVATE_KEY,
  },
})

const tools = await toolset.getTools()
import {McpToolset} from "@iqai/adk";

const toolset = new McpToolset({
  name: "Fraxlend MCP Client",
  description: "Client for Fraxlend lending operations",
  transport: {
    mode: "stdio",
    command: "pnpm",
    args: ["dlx", "@iqai/mcp-fraxlend"],
    env: {
      WALLET_PRIVATE_KEY: process.env.WALLET_PRIVATE_KEY,
      PATH: process.env.PATH || "",
    },
  },
})

const tools = await toolset.getTools()
{
  "mcpServers": {
    "fraxlend-server": {
      "command": "pnpm",
      "args": ["dlx", "@iqai/mcp-fraxlend"],
      "env": {
        "WALLET_PRIVATE_KEY": "your_wallet_private_key_here"
      }
    }
  }
}

Features

  • Interact with the Fraxlend lending platform
  • Fetch statistics for a specific Fraxlend pair
  • Lend assets to a specific Fraxlend pair
  • Borrow assets from a specific Fraxlend pair
  • Add collateral to a specific Fraxlend pair
  • Remove collateral from a specific Fraxlend pair
  • Repay borrowed assets to a specific Fraxlend pair
  • Withdraw lent assets from a specific Fraxlend pair
  • Get the pair address for a specific Fraxlend pair

Available Tools

FRAXLEND_ADD_COLLATERAL
pairAddress:stringamount:string

Description

Add collateral to a FraxLend position

FRAXLEND_GET_POSITIONS
address:string

Description

Get your positions in FraxLend pools

FRAXLEND_BORROW
pairAddress:stringreceiver:stringcollateralAmount:stringborrowAmount:string

Description

Borrow assets from a FraxLend pool

FRAXLEND_GET_STATS

No parameters

Description

Get lending statistics from FraxLend pools

FRAXLEND_LEND
pairAddress:stringamount:string

Description

Lend assets to a FraxLend pool

FRAXLEND_GET_PAIR_ADDRESS
assetSymbol:stringcollateralSymbol:stringsortByApr:string

Description

Get FraxLend pair addresses and pool information

FRAXLEND_REMOVE_COLLATERAL
pairAddress:stringamount:string

Description

Remove collateral from a FraxLend position

FRAXLEND_REPAY
pairAddress:stringamount:string

Description

Repay borrowed assets to a FraxLend pool

FRAXLEND_WITHDRAW
pairAddress:stringamount:string

Description

Withdraw assets from a FraxLend pool

Environment Variables

Security

The private key is used for signing transactions for lending, borrowing, etc. Handle with care.

  • WALLET_PRIVATE_KEY: Required for LEND, BORROW, ADD_COLLATERAL, REMOVE_COLLATERAL, REPAY, WITHDRAW

Usage Examples

  • "Show my current FraxLend positions"
  • "I want to lend 100 FRAX to the FRAX-ETH pool at 0x123...abc"
  • "Borrow 1000 FRAX using 2 ETH as collateral from the pool at 0x123...abc"
  • "What's the pair address for FRAX-ETH pool with the highest APR?"

Response Format

Actions return structured responses, including:

āœ” Transaction status & hash (for lending/borrowing) šŸ”— āœ” Formatted asset amounts šŸ’² āœ” Error messages when applicable ⚠ āœ” Lending market details šŸ“ˆ

Error Handling

The plugin handles various error scenarios:

🚨 Invalid market addresses šŸ’ø Insufficient collateral or liquidity šŸ”„ Transaction failures 🌐 Network issues šŸ›‘ Input validation errors