Graph Uniswap MCP

Graph Uniswap MCP

Provides a unified MCP interface over Uniswap V2, V3, and V4 across multiple chains via The Graph, enabling agents to query token prices, top pools, pairs, and recent swaps with clean JSON output.

Category
访问服务器

README

Graph Uniswap MCP

npm version npm downloads license node

One MCP interface over Uniswap V2, V3, and V4 across Ethereum, Arbitrum, Base, Polygon, Optimism, and BSC — powered by The Graph. Ask an agent for a price, the top pools, a pair, or recent swaps on any Uniswap deployment and get back clean JSON.

Built to be correct where naive subgraph access goes wrong:

  • 🔁 Self-healing — markets are addressed by subgraph ID, so queries always follow the publisher's latest published version. discover_markets re-resolves the best live subgraph from The Graph's network subgraph (ranked by curation signal), so new or replacement deployments surface with no code change.
  • 🧬 Schema-adaptive — Uniswap's subgraphs are not uniform (V2 pairs vs V3/V4 pools; classic ethPriceUSD/derivedETH vs newer nativePriceUSD/derivedNative). The server introspects each subgraph once and adapts every query automatically.
  • 🚫 Footgun-proofed — Uniswap subgraph TVL is unreliable (one spam-token pool can report trillions in fake liquidity). Every ranking is by volumeUSD, never TVL, and TVL is always returned with a caveat. Prices are derived on-chain and easy to sanity-check (a stablecoin reads ~$1).

Tools

Tool What it does
list_markets Every version×chain and its backing subgraph
discover_markets Re-resolve the best live subgraph from the network subgraph (self-healing)
get_token_price USD price of a token (symbol or address)
top_pools Top pools on a chain, ranked by volume
find_pool Pool(s) for a token pair, either order
pool_info Full stats for one pool/pair
recent_swaps Newest swaps, optionally scoped to a pool
raw_query Arbitrary GraphQL against the resolved subgraph

Every tool takes chain and an optional version (v2/v3/v4). Omit version and it uses the highest-volume version on that chain. Chain aliases (eth, arb, matic, bnb, …) are accepted.

Setup

npm install
npm run build

Get a free Graph gateway API key at https://thegraph.com/studio (Billing → API Keys — first 100k queries/month are free), then add the server to your MCP client:

{
  "mcpServers": {
    "graph-uniswap": {
      "command": "npx",
      "args": ["-y", "graph-uniswap-mcp"],
      "env": { "GRAPH_API_KEY": "your_key_here" }
    }
  }
}

Or run locally: GRAPH_API_KEY=... npm start.

Example calls

get_token_price  { "token": "WETH", "chain": "arbitrum" }
top_pools        { "chain": "base", "version": "v4", "first": 5 }
find_pool        { "tokenA": "WBTC", "tokenB": "USDC", "chain": "ethereum" }
recent_swaps     { "chain": "base", "version": "v4", "first": 10 }
discover_markets { "chain": "arbitrum", "version": "v3" }

Covered markets

13 markets, each backed by a canonical Uniswap-Labs subgraph addressed by subgraph ID (so it auto-follows the publisher's latest version). Query volumes are a rough popularity signal from the operator dashboard.

Version Chain What it covers ~Queries/day Subgraph ID
V4 Base PoolManager pools + hooks, swaps, fee tiers, prices — highest-volume Uniswap subgraph on the whole network 8.6M Gqm2b5J85n1bhCyDMpGbtbVn4935EvvdyHdHrx3dibyj
V4 BNB V4 pools, swaps, fee tiers, prices 1.7M EAq1nJKgjnuKH6Gj4RFjCW7LcL7E2uipbncdwV7TTWkX
V4 Ethereum V4 pools, swaps, fee tiers, prices 233K AdA6Ax3jtct69NnXfxNjWtPTe9gMtSEZx2tTQcT4VHu
V4 Arbitrum V4 pools, swaps, fee tiers, prices D1VHPU6cXXSC8eaApWCjCnPcTZQFSYCpGoDAvt4ogDWh
V4 Optimism V4 pools, swaps, fee tiers, prices 3Tn7Y1NJAr4ySKm7KFu1dwvH2WM3mHJnXzXAxQsdBDvW
V3 Ethereum Concentrated-liquidity pools, fee tiers, swaps, positions, prices 467K 5zvR82QoaXYFyDEKLZ9t6v9adgnptxYpKpSbxtgVENFV
V3 Arbitrum V3 pools, fee tiers, swaps, prices 854K FbCGRftH4a3yZugY7TnbYgPJVEv2LvMT6oF1fxPe9aJM
V3 Base V3 pools, fee tiers, swaps, prices — native-pricing schema (nativePriceUSD/derivedNative) 536K HMuAwufqZ1YCRmzL2SfHTVkzZovC9VL2UAKhjvRqKiR1
V3 Polygon V3 pools, fee tiers, swaps, prices 539K EsLGwxyeMMeJuhqWvuLmJEiDKXJ4Z6YsoJreUnyeozco
V3 Optimism V3 pools, fee tiers, swaps, prices 307K Cghf4LfVqPiFw6fp6Y5X5Ubc8UpmUhSfJL82zwiBFLaj
V3 BSC V3 pools, fee tiers, swaps, prices 1.1M 7XgdLW3bts4HktCYsu9dy8bEnuiNeZuftcuK3Aj4JXYV
V2 Ethereum Constant-product pairs, reserves, swaps, prices 2.4M GmSczqdCDZ3hJeYY9JphwsADn5rePUzUKm8EZcVuhRAm
V2 Base V2 pairs, reserves, swaps, prices 1.6M DbcUmZwXBYbNZvLuDEvcmFa4uAWwwjrdX8dVFg1AUVKa

Call list_markets for this table live, or discover_markets to re-resolve the best current subgraph from The Graph's network subgraph. (V4 is not yet deployed on Polygon.)

Reliability

Built for agents that can't babysit a hung tool call:

  • Fail-fast, never hang. Every gateway request is time-boxed by an AbortController (default 15s/attempt), so a stalled indexer returns a clean error instead of hanging your agent. Only genuinely transient failures (indexer lag, 5xx) retry.
  • Version fallback (self-healing on the data path). When you don't pin a version and the top market's indexers are down, the server transparently falls back to the next-highest-volume version on that chain and still returns real data — the response's served field tells you which version answered. A pinned version is never silently swapped.
  • Tunable via env: GRAPH_HTTP_TIMEOUT_MS (15000), GRAPH_MAX_ATTEMPTS (2), GRAPH_TOTAL_BUDGET_MS (25000).

Keyless pay-per-query (x402)

This server uses a shared GRAPH_API_KEY (free tier: 100k queries/month). If you'd rather an agent pay per query with no API key or account at all, pair it with PayQL — an MCP that runs any Graph subgraph query (including all the Uniswap subgraphs above) over x402, paying ~$0.01 in USDC per call via the gateway's …/api/x402/… path. Gasless (EIP-3009), keyless, wallet-agnostic — the payment is the auth. Use this MCP for the curated Uniswap tools, and PayQL when you want the raw, key-free pay-as-you-go path.

License

MIT © PaulieB14

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选