Graph Lending MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/PaulieB14/graph-lending-mcp.git
cd graph-lending-mcp
npm install
npx tsc
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "GRAPH_API_KEY=${GRAPH_API_KEY}" graph-lending -- node "<FULL_PATH_TO_GRAPH_LENDING_MCP>/dist/index.js"

Replace <FULL_PATH_TO_GRAPH_LENDING_MCP>/dist/index.js with the actual folder you prepared in step 1.

Required:GRAPH_API_KEY
README.md

Unified AI-friendly tools over Messari's standardized lending subgraphs

graph-lending-mcp

MCP server that exposes unified AI-friendly tools over Messari's standardized lending subgraphs on The Graph.

One natural-language query → fan out across 40+ lending protocols on multiple chains → get back structured, comparable data.

Features

  • 19 MCP tools covering protocols, markets, rates, positions, events, snapshots, and cross-protocol analytics
  • 40+ lending protocols across Ethereum, Polygon, Arbitrum, Avalanche, BSC, Optimism, Base, and more
  • Cross-protocol comparison — compare TVL, revenue, users across any set of protocols in one call
  • Graceful failure handling — dead subgraphs don't crash queries; failures are reported alongside successes
  • Schema-version aware — automatically selects compatible queries for v1.x, v2.x, and v3.x subgraphs

Tools

Tool Description
list_protocols List all registered protocols with live TVL data
get_protocol Detailed protocol stats (TVL, revenue, users, pool counts)
get_markets List markets for a protocol, sorted by any field
get_market Detailed single market data including rates, caps, and positions
get_interest_rates Interest rates across all markets, with optional side/type filters
get_account Account overview with position counts and activity
get_positions Open positions for an address, with optional side filter
get_deposits Recent deposit events, filterable by market and account
get_borrows Recent borrow events
get_repays Recent repay events
get_withdrawals Recent withdrawal events
get_liquidations Recent liquidation events with profit data
get_flashloans Recent flashloan events
get_daily_financials Daily financial snapshots (TVL, volume, revenue)
get_market_snapshots Daily market-level snapshots with rates and activity
get_usage_metrics Daily user activity and transaction counts
compare_protocols Side-by-side comparison of multiple protocols
top_markets_by_tvl Top markets across all protocols, optionally filtered by network
query_subgraph Raw GraphQL escape hatch for any registered subgraph

Setup

Prerequisites

Install & Build

git clone https://github.com/PaulieB14/graph-lending-mcp.git
cd graph-lending-mcp
npm install
npx tsc

Configure in Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "graph-lending": {
      "command": "node",
      "args": ["/path/to/graph-lending-mcp/dist/index.js"],
      "env": {
        "GRAPH_API_KEY": "your-api-key-here"
      }
    }
  }
}

Architecture

src/
├── index.ts          # MCP server entry — registers all 19 tools
├── registry.ts       # Protocol → subgraph ID mapping (see SUBGRAPHS.md)
├── client.ts         # GraphQL fetch with retry, timeout, fan-out
├── queries.ts        # All GraphQL query constants
└── tools/
    ├── protocol.ts   # list_protocols, get_protocol
    ├── markets.ts    # get_markets, get_market
    ├── rates.ts      # get_interest_rates
    ├── positions.ts  # get_account, get_positions
    ├── events.ts     # deposits, borrows, repays, withdrawals, liquidations, flashloans
    ├── snapshots.ts  # daily_financials, market_snapshots, usage_metrics
    └── cross.ts      # compare_protocols, top_markets_by_tvl

All queries use Messari's standardized lending schema — same entities and fields across every protocol.

Subgraph Registry

See SUBGRAPHS.md for the full list of registered subgraphs with their status, network, schema version, and notes.

License

MIT

Tools (19)

list_protocolsList all registered protocols with live TVL data
get_protocolDetailed protocol stats (TVL, revenue, users, pool counts)
get_marketsList markets for a protocol, sorted by any field
get_marketDetailed single market data including rates, caps, and positions
get_interest_ratesInterest rates across all markets, with optional side/type filters
get_accountAccount overview with position counts and activity
get_positionsOpen positions for an address, with optional side filter
get_depositsRecent deposit events, filterable by market and account
get_borrowsRecent borrow events
get_repaysRecent repay events
get_withdrawalsRecent withdrawal events
get_liquidationsRecent liquidation events with profit data
get_flashloansRecent flashloan events
get_daily_financialsDaily financial snapshots (TVL, volume, revenue)
get_market_snapshotsDaily market-level snapshots with rates and activity
get_usage_metricsDaily user activity and transaction counts
compare_protocolsSide-by-side comparison of multiple protocols
top_markets_by_tvlTop markets across all protocols, optionally filtered by network
query_subgraphRaw GraphQL escape hatch for any registered subgraph

Environment Variables

GRAPH_API_KEYrequiredAPI key from The Graph Studio

Configuration

claude_desktop_config.json
{"mcpServers": {"graph-lending": {"command": "node", "args": ["/path/to/graph-lending-mcp/dist/index.js"], "env": {"GRAPH_API_KEY": "your-api-key-here"}}}}

Try it

Compare the TVL and revenue of Aave and Compound across all chains.
What are the top 5 lending markets by TVL on the Arbitrum network?
Get the current interest rates for USDC markets across all supported protocols.
Show me the recent liquidation events for a specific wallet address.
Provide a daily financial snapshot for the last week for the MakerDAO protocol.

Frequently Asked Questions

What are the key features of Graph Lending?

Access to 19 MCP tools for protocol, market, and position analytics. Support for 40+ lending protocols across multiple EVM chains. Cross-protocol comparison of TVL, revenue, and user metrics. Automatic schema-version awareness for v1.x, v2.x, and v3.x subgraphs. Graceful failure handling for dead or unresponsive subgraphs.

What can I use Graph Lending for?

Performing cross-chain DeFi research and protocol benchmarking. Monitoring personal or institutional lending positions across multiple platforms. Analyzing market-level interest rate trends for yield optimization. Auditing recent protocol activity like liquidations and flashloans.

How do I install Graph Lending?

Install Graph Lending by running: git clone https://github.com/PaulieB14/graph-lending-mcp.git && cd graph-lending-mcp && npm install && npx tsc

What MCP clients work with Graph Lending?

Graph Lending works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Graph Lending docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare