Skip to content

MCP server

Connect an AI agent to Lendwise. @lendwise/mcp exposes the standardized dataset through five curated Model Context Protocol tools, so an agent can answer "I have $1,000 to place in DeFi for the next 6 months — what are the best markets?" against real yield data in about four tool calls.

Read-only by design: it compares markets, it never signs a transaction. No API key — the server holds no secrets and speaks only HTTPS to the public Lendwise API.

Install

Claude Code plugin (easiest)

Installs the hosted server plus a /lendwise:find-yield skill in two commands — no config, no API key:

bash
/plugin marketplace add lendwise-fi/lendwise-mcp
/plugin install lendwise@lendwise-fi

Hosted (Streamable HTTP)

Point any MCP client at:

https://mcp.lendwise.fi/mcp

With Claude Code:

bash
claude mcp add --transport http lendwise https://mcp.lendwise.fi/mcp

Local (stdio)

jsonc
// claude_desktop_config.json / .mcp.json
{
  "mcpServers": {
    "lendwise": {
      "command": "npx",
      "args": ["-y", "@lendwise/mcp"]
    }
  }
}

Requires Node ≥ 24.

Tools

ToolArgumentsReturns
list_market_universekind? (supply | borrow, default supply)Every asset, chain and protocol Lendwise tracks, with counts. Call this first — filter values for the other tools come from here, not from memory.
find_best_marketskind? (supply | borrow, default supply), asset?, chainId?, protocol? (aave | morpho | compound), collateral? (borrow only), minTvlUsd? (default 1000000), limit? (default 10, max 50)Current markets ranked by net APY. Supply ranks highest-first (most earned); borrow ranks lowest-first (cheapest cost). Borrow rows also carry borrowedUsd and accepted collaterals. Filtering and sorting run server-side against the latest snapshot.
get_market_detailsproductIdOne market in full: protocol metadata, accepted collaterals, and the current APY split into base / rewards / fees with individual reward items. Handles supply and borrow productIds alike.
get_market_historyproductId, kind? (supply | borrow, default supply), range? (7d | 30d | 90d | 180d, default 90d)Daily net-APY series plus mean / stddev / min / max — the stability signal a long horizon needs. For borrow it measures how much the cost moves, not the yield.
optimize_allocationamountUsd, productIds (2–20 markets), diversification? (0–100, default 80)Per-market dollar amounts, blended APY, and a projected 6-month yield, computed by the Lendwise optimizer.

The intended flow

  1. list_market_universe → the assets, chains and protocols that actually exist
  2. find_best_markets({ asset: "USDC" }) → top markets by net APY
  3. get_market_history({ productId, range: "180d" }) on the top candidates → mean/stddev separates a durable 6% from a 12% reward spike that ends next week
  4. optimize_allocation({ amountUsd: 1000, productIds: [...] }) → the split

Defaults that matter

  • find_best_markets defaults to minTvlUsd: 1000000. In a thin market a headline APY is mostly noise; the floor can be lowered deliberately, never silently.
  • Supply and borrow rank in opposite directions. Borrow net APY is a cost (base + fees − rewards), so kind: borrow ranks the cheapest market first — the reverse of supply. To narrow a borrow search by collateral, take a collateral value from the collaterals on returned borrow rows rather than guessing.
  • get_market_history returns statistics, not just a series. A snapshot cannot tell a durable yield from a reward programme that ends next week; a 180-day standard deviation can.
  • Data quality is surfaced, not hidden. Every response carries the snapshot timestamp (asOf), rows with poor slot completeness are flagged reliable: false, and markets with no usable APY are reported as missing — never defaulted to 0.

Rate limits & errors

The upstream API allows 60 GraphQL requests/min per IP and 10 optimizer requests/min per IP. A 429 is surfaced to the agent as an explicitly retryable error carrying retryAfterSeconds — clients should back off, not retry-storm.

Local development

Env varDefaultPurpose
LENDWISE_API_URLhttps://lendwise.fiPoint at a local Lendwise API instance instead of production.

Source, tests and contribution guidelines live in the lendwise-mcp repository.

Not financial advice

Informational only. APYs are variable and historical yields do not predict future returns.

Not financial advice. DeFi lending carries smart-contract and market risk.