MCP-Coinglass

MCP-Coinglass

Provides futures market analytics (Open Interest, Liquidations, Long/Short Ratio, Funding Rates) via the CoinGlass API v4, enabling natural language queries for crypto derivatives data.

Category
访问服务器

README

MCP-Coinglass

This project implements a Model Context Protocol (MCP) server for the CoinGlass API (v4). It lets MCP-compatible clients (AI assistants, IDE extensions, or custom apps) access futures market analytics such as Open Interest, Liquidations, Long/Short Ratio, and Funding Rates.

Features (MCP Tools)

The server exposes the following tools that MCP clients can call:

  • COINGLASS_OPEN_INTEREST: Open interest exchange list for a symbol; optional history

    • Parameters: symbol (string), exchange? (string), includeHistory? (boolean), period? ("1h" | "4h" | "12h" | "24h")
  • COINGLASS_LIQUIDATIONS_PAIR: Historical pair liquidations (v4 /api/futures/liquidation/history)

    • Parameters: exchange (string), symbol (string), interval? ("1m"|"3m"|"5m"|"15m"|"30m"|"1h"|"4h"|"6h"|"8h"|"12h"|"1d"|"1w"), limit?, start_time?, end_time?, prettyFormat? (default: true)
  • COINGLASS_LIQUIDATIONS_COIN: Aggregated coin liquidations (v4 /api/futures/liquidation/aggregated-history)

    • Parameters: exchange_list (string), symbol (string), interval? (same as above), limit?, start_time?, end_time?, prettyFormat? (default: true)
  • COINGLASS_LONG_SHORT_RATIO: Global account long/short ratio snapshot

    • Parameters: symbol (string), exchange? (string), period? ("1h" | "4h" | "12h" | "24h"), prettyFormat? (boolean, default: true)
  • COINGLASS_FUNDING_RATE: Current funding rate across exchanges

    • Parameters: symbol (string), exchange? (string), prettyFormat? (boolean, default: true)
  • COINGLASS_HYPERLIQUID_WHALE_ALERT: Real-time Hyperliquid whale alerts (>$1M)

  • Parameters: prettyFormat? (boolean, default: true)

  • COINGLASS_HYPERLIQUID_WHALE_POSITION: Real-time Hyperliquid whale positions (>$1M)

  • Parameters: prettyFormat? (boolean, default: true)

Tool call responses always return a success code even in case of api errors. In case of error tool response includes the raw api response.

Prerequisites

  • Node.js v20+ (CI uses Node 22)
  • pnpm (https://pnpm.io/installation)

Installation

There are a few ways to run mcp-coinglass:

  1. Using pnpm dlx (recommended for most MCP client setups)

Run the published package directly without a global install. See the MCP client config example below.

  1. Global installation from npm (via pnpm)
pnpm add -g mcp-coinglass
  1. Building from source (development)
pnpm install
pnpm run build
pnpm run start
  1. For testing and development purposes use mcp inspector
# in the project root run,
pnpm run build
npx @modelcontextprotocol/inspector node dist/index.js

Configuration (Environment Variables)

This server requires a CoinGlass API key. All CoinGlass v4 endpoints require the CG-API-KEY header. Generate your API key from your account dashboard and supply it via environment variables. References:

  • Authentication docs: https://docs.coinglass.com/reference/authentication
  • Account/API key dashboard: https://www.coinglass.com/account

Create a .env file (or configure env in your MCP client) with:

COINGLASS_API_KEY=your_api_key_here

An .env.sample file is included as a reference; copy it to .env and fill in your key.

NOTE: All the available tools require an upgraded coinglass api plan to work

Running the Server with an MCP Client

MCP clients (assistants, IDE extensions) run this server as a background process. Configure your client with a server entry similar to the following.

Using pnpm dlx:

{
  "mcpServers": {
    "coinglass-mcp-server": {
      "command": "pnpm",
      "args": ["dlx", "mcp-coinglass"],
      "env": {
        "COINGLASS_API_KEY": "your_api_key_here"
      }
    }
  }
}

If globally installed (pnpm add -g mcp-coinglass):

{
  "mcpServers": {
    "coinglass-mcp-server": {
      "command": "mcp-coinglass",
      "args": [],
      "env": {
        "COINGLASS_API_KEY": "your_api_key_here"
      }
    }
  }
}

Example Tool Invocations

MCP clients pass JSON parameters to tools. Examples:

{ "tool": "COINGLASS_OPEN_INTEREST", "params": { "symbol": "BTC", "includeHistory": true, "period": "24h" } }
{ "tool": "COINGLASS_LIQUIDATIONS", "params": { "symbol": "BTCUSDT", "timeframe": "4h" } }
{ "tool": "COINGLASS_LIQUIDATIONS_PAIR", "params": { "exchange": "Binance", "symbol": "BTCUSDT", "interval": "4h" } }
{ "tool": "COINGLASS_LIQUIDATIONS_COIN", "params": { "exchange_list": "Binance,OKX,Bybit", "symbol": "BTC", "interval": "1d" } }
{ "tool": "COINGLASS_LONG_SHORT_RATIO", "params": { "symbol": "ETH", "period": "1h" } }
{ "tool": "COINGLASS_FUNDING_RATE", "params": { "symbol": "SOL" } }
{ "tool": "COINGLASS_HYPERLIQUID_WHALE_ALERT", "params": {} }
{ "tool": "COINGLASS_HYPERLIQUID_WHALE_POSITION", "params": {} }

Default Human-Readable Output Examples (prettyFormat=true)

These are the default formatted outputs. Set prettyFormat to false to receive raw API-shaped responses.

Funding Rate

Funding Rate for BTCUSDT:
Average: 0.0100% | Next Funding: 2024-08-06T08:00:00.000Z
Exchanges: 12

{
  "averageRate": 0.0001,
  "nextFundingTime": 1722960000000,
  "exchanges": [
    { "exchange": "Binance", "rate": -0.0000335, "predictedRate": -0.00002, "nextFundingTime": 1722960000000 }
    // ...
  ]
}

Open Interest

Open Interest for BTCUSDT:
Total OI (All): $123456789
24h Change: 2.34%

{
  "exchangeList": [ /* ... */ ],
  "history": { /* optional when includeHistory=true */ }
}

Liquidations (Pair)

Liquidations (Pair) for BTCUSDT [48 points]:
Latest: Long $1.23M | Short $2.34M
Totals: Long $56.78M | Short $67.89M

{
  "latest": { /* latest data point */ },
  "totals": { "long": 56780000, "short": 67890000 },
  "points": [ /* ... */ ]
}

Liquidations (Coin Aggregated)

Liquidations (Coin Aggregated) for BTC [48 points]:
Latest: Long $1.23M | Short $2.34M
Totals: Long $56.78M | Short $67.89M

{
  "latest": { /* latest data point */ },
  "totals": { "long": 56780000, "short": 67890000 },
  "points": [ /* ... */ ]
}

Global Long/Short Account Ratio

Long/Short Ratio for BTCUSDT:
Long: 73.24% | Short: 26.76% | Ratio: 2.74

{
  "latest": { /* latest data point */ },
  "points": [ /* ... */ ]
}

Hyperliquid Whale Alert

Hyperliquid Whale Alerts: 8 events
Top 5 by position value:

{
  "top": [
    { "user": "0xabc...", "symbol": "BTC", "positionValueUsd": 2936421.48, "positionAction": 2, "createTime": 1745219477000 }
    // ...
  ],
  "events": [ /* ... */ ]
}

Hyperliquid Whale Position

Hyperliquid Whale Positions: 6 positions (top 5 by value)

{
  "top": [
    { "user": "0xdef...", "symbol": "ETH", "positionSize": -44727.13, "positionValueUsd": 73589542.55, "leverage": 25, "unrealizedPnl": 27033236.42, "marginMode": "cross", "updateTime": 1745219966000 }
    // ...
  ],
  "positions": [ /* ... */ ]
}

Scripts

  • pnpm run build: Compile TypeScript to dist/ and make output executable
  • pnpm run start: Run the built server over stdio (for MCP)
  • pnpm run lint: Lint via Biome
  • pnpm run format: Format via Biome

Endpoint References (v4)

This server calls these REST endpoints:

  • Open Interest Exchange List: GET /api/futures/open-interest/exchange-list
  • Open Interest History (OHLC): GET /api/futures/open-interest/history
  • Liquidations History: GET /api/futures/liquidation/history
  • Global Long/Short Account Ratio History: GET /api/futures/global-long-short-account-ratio/history
  • Funding Rate Exchange List: GET /api/futures/funding-rate/exchange-list

Refer to the official docs for authentication and rate limits:

  • https://docs.coinglass.com/reference/authentication

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选