Skip to main content
Glama
PaulieB14

graph-lending-mcp

graph-lending-mcp

一个 MCP 服务器,通过 The GraphMessari 标准化的借贷子图 提供统一的 AI 友好型工具。

一个自然语言查询 → 分发至 15 条链上的 40 多个借贷协议 → 返回结构化、可比较的数据。

功能特性

  • 19 个 MCP 工具:涵盖协议、市场、利率、头寸、事件、快照及跨协议分析

  • 90 个子图部署:覆盖 15 条链(以太坊、Polygon、Arbitrum、Avalanche、BSC、Optimism、Base、Scroll、Fantom、Gnosis、Moonbeam 等)上的 40 多个借贷协议

  • 跨协议比较 — 在一次调用中比较任意协议集的 TVL、收入和用户数

  • 优雅的故障处理 — 失效的子图不会导致查询崩溃;故障会与成功结果一并报告

  • 模式版本感知 — 自动为 v1.x、v2.x 和 v3.x 子图选择兼容的查询

Related MCP server: graph-polymarket-mcp

工具

工具

描述

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

所有协议中 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 的 标准化借贷模式 —— 每个协议的实体和字段均保持一致。

子图注册表

请参阅 SUBGRAPHS.md 获取 90 个已注册子图部署的完整列表,包括其状态、网络、模式版本和备注。

许可证

MIT

Install Server
A
security – no known vulnerabilities
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/PaulieB14/graph-lending-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server