Skip to main content
Glama
graph-lending-mcp

graph-lending-mcp

graph-lending-mcp

The Graph上のMessariの標準化されたレンディングサブグラフを介して、AIフレンドリーな統合ツールを提供するMCPサーバーです。

1つの自然言語クエリで、15チェーン上の40以上のレンディングプロトコルに展開し、構造化された比較可能なデータを取得します。

特徴

  • 19種類のMCPツール: プロトコル、市場、レート、ポジション、イベント、スナップショット、クロスプロトコル分析をカバー

  • 90種類のサブグラフデプロイメント: 15チェーン(Ethereum、Polygon、Arbitrum、Avalanche、BSC、Optimism、Base、Scroll、Fantom、Gnosis、Moonbeamなど)上の40以上のレンディングプロトコルに対応

  • クロスプロトコル比較: 1回の呼び出しで、任意のプロトコルセット間でTVL、収益、ユーザー数を比較可能

  • 正常なエラー処理: サブグラフが停止していてもクエリはクラッシュせず、成功した結果とともにエラーが報告されます

  • スキーマバージョン対応: v1.x、v2.x、v3.xのサブグラフに対して互換性のあるクエリを自動的に選択

Related MCP server: Stacks AI MCP Server

ツール

ツール

説明

list_protocols

ライブTVLデータを含む登録済みプロトコルの一覧を表示

get_protocol

プロトコルの詳細統計(TVL、収益、ユーザー数、プール数)

get_markets

任意のフィールドでソートされたプロトコルの市場一覧を表示

get_market

レート、キャップ、ポジションを含む単一市場の詳細データ

get_interest_rates

すべての市場の金利(サイド/タイプフィルターオプション付き)

get_account

ポジション数とアクティビティを含むアカウントの概要

get_positions

アドレスのオープンポジション(サイドフィルターオプション付き)

get_deposits

最近の預け入れイベント(市場およびアカウントでフィルタリング可能)

get_borrows

最近の借り入れイベント

get_repays

最近の返済イベント

get_withdrawals

最近の引き出しイベント

get_liquidations

利益データを含む最近の清算イベント

get_flashloans

最近のフラッシュローンイベント

get_daily_financials

日次財務スナップショット(TVL、ボリューム、収益)

get_market_snapshots

レートとアクティビティを含む日次市場レベルのスナップショット

get_usage_metrics

日次のユーザーアクティビティとトランザクション数

compare_protocols

複数のプロトコルの並列比較

top_markets_by_tvl

すべてのプロトコルにおけるトップ市場(ネットワークでフィルタリング可能)

query_subgraph

登録済みサブグラフ用の生のGraphQLエスケープハッチ

セットアップ

前提条件

クイックスタート (npm)

{
  "mcpServers": {
    "graph-lending": {
      "command": "npx",
      "args": ["graph-lending-mcp"],
      "env": {
        "GRAPH_API_KEY": "your-api-key-here"
      }
    }
  }
}

ソースからインストール

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

次に、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"
      }
    }
  }
}

アーキテクチャ

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

すべてのクエリはMessariの標準化されたレンディングスキーマを使用しており、すべてのプロトコルで同じエンティティとフィールドが使用されます。

サブグラフ・レジストリ

登録されている90のサブグラフデプロイメントのステータス、ネットワーク、スキーマバージョン、メモなどの全リストについては、SUBGRAPHS.mdを参照してください。

ライセンス

MIT

Available Tools

19 tools
compare_protocolsA
Read-only

Compare multiple protocols side-by-side: TVL, deposits, borrows, revenue, users, pools. Sorted by TVL. Tolerates individual endpoint failures.

Inputs: protocols (required).

get_accountA
Read-only

Account summary for a wallet address: open/closed position counts, deposit/borrow/liquidation activity, and list of current open positions.

Inputs: address (required), protocol (required), network.

get_borrowsB
Read-only

Recent borrow events. Optionally filter by market ID and/or account address.

Inputs: protocol (required), first, account, network, +1 more.

get_daily_financialsA
Read-only

Protocol-level daily snapshots: TVL, deposit/borrow/liquidation volume, and revenue breakdown (supply-side vs protocol-side). Returns last N days.

Inputs: protocol (required), days, network.

get_depositsA
Read-only

Recent deposit events. Optionally filter by market ID and/or account address.

Inputs: protocol (required), first, account, network, +1 more.

get_flashloansA
Read-only

Recent flashloan events including fee amounts. Only available for v3+ schema protocols (e.g. aave-v3, compound-v3, spark-lend).

Inputs: protocol (required), first, network.

get_interest_ratesA
Read-only

Current supply and borrow APRs across all markets in a protocol. Optionally filter by side (LENDER/BORROWER) or rate type (VARIABLE/STABLE/FIXED).

Inputs: protocol (required), side, type, network.

get_liquidationsA
Read-only

Recent liquidation events with liquidator, liquidatee, collateral asset, and profit amounts. Optionally filter by market.

Inputs: protocol (required), first, network, market_id.

get_marketA
Read-only

Deep-dive on a single market by its on-chain contract address. Returns balances, cumulative stats, position counts, risk parameters, rates, and rewards. Get market IDs from get_markets first.

Inputs: protocol (required), market_id (required), network.

get_marketsA
Read-only

List markets (lending pools) for a protocol, ordered by TVL or borrows. Returns token, rates, caps, LTV thresholds, and reward info.

Inputs: protocol (required), first, network, order_by.

get_market_snapshotsA
Read-only

Daily snapshots for a specific market: token price, TVL, volume, revenue, rates history, and active user counts.

Inputs: protocol (required), market_id (required), days, network.

get_positionsA
Read-only

Open positions for a wallet address with balances, market prices, and activity counts. Optionally filter by side.

Inputs: address (required), protocol (required), side, first, +1 more.

get_protocolA
Read-only

Detailed stats for a single lending protocol: TVL, deposits, borrows, revenue, user counts, transaction counts, pool counts, position counts.

Inputs: protocol (required), network.

get_repaysA
Read-only

Recent repay events. Optionally filter by market ID and/or account address.

Inputs: protocol (required), first, account, network, +1 more.

get_usage_metricsB
Read-only

Daily active user counts and transaction activity breakdown (deposits, borrows, repays, liquidations) for a protocol.

Inputs: protocol (required), days, network.

get_withdrawalsA
Read-only

Recent withdrawal events. Optionally filter by market ID and/or account address.

Inputs: protocol (required), first, account, network, +1 more.

list_protocolsA
Read-only

List all supported lending protocols with live TVL, deposit/borrow totals, pool counts, and user counts. Fans out to all registered subgraph endpoints. Optionally filter by network or schema version.

Inputs: network, schema_version.

query_subgraphA
Read-only

Execute a raw GraphQL query against any registered lending subgraph. Use for custom filters, uncommon fields, or exploratory queries. All subgraphs use the Messari standardized lending schema with entities: lendingProtocols, markets, accounts, positions, deposits, borrows, repays, withdraws, liquidates, flashloans, financialsDailySnapshots, marketDailySnapshots, usageMetricsDailySnapshots.

Inputs: query (required), protocol (required), network, variables.

top_markets_by_tvlA
Read-only

Global top N markets by TVL across ALL registered lending protocols. Fans out to every endpoint. Optionally filter by network.

Inputs: first, network.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4/5.0

    Scored across 19 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose, targeting specific entities (protocols, markets, events, accounts) or actions (list, get, compare, query). There is no ambiguity; even similar-sounding tools like get_market and get_markets are differentiated by singular vs plural and depth of data.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern using snake_case (e.g., get_markets, list_protocols, query_subgraph). Minor deviations like compare_protocols and top_markets_by_tvl still adhere to the same pattern, ensuring predictability.

    Tool Count4/5

    19 tools is on the higher end but appropriate for the comprehensive scope of lending protocol data. Each tool covers a specific aspect (protocols, markets, events, analytics) without redundancy, justifying the count.

    Completeness5/5

    The tool set provides full coverage for a read-only lending data API: protocol listing and details, market analysis, event history (deposits, borrows, etc.), account positions, aggregated financials, usage metrics, interest rates, comparisons, and raw GraphQL access. No obvious gaps for the intended domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      F
      maintenance
      Official MCP server that turns The Graph’s Token API into a plug-and-play web3 data tool. Exposes ERC-20 & NFT metadata, balances, transfers, top-holder stats, prices, and more, allowing LLMs to run SQL queries on structured and indexed blockchain data.
      2
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      A comprehensive MCP server providing unified access to over 144 tools for lending, trading, and staking across six major DeFi protocols on the Stacks Bitcoin Layer 2. It enables AI agents to perform complex blockchain operations and interact with the DeFi ecosystem using natural language commands.
      3
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      An MCP server that enables querying Polymarket prediction market data through The Graph subgraphs. It provides tools for accessing market stats, trader P\&L, user positions, and orderbook activity using AI agents.
      35
      101 npm
      4
      MIT