exchange-data-mcp
exchange-data-mcp
面向加密货币交易所的只读市场数据 MCP 服务器,仅使用公开端点,无需 API 密钥和账户。将 Binance、KuCoin 和 Coinbase 的数据标准化为一种形态,并为 LLM 上下文进行序列化。
既可以作为面向 agent 客户端的 MCP 服务器运行,也可以作为零依赖的普通 Python 库使用。
为什么存在
与市场打交道的 agent 需要订单簿、成交记录和 K 线,而现有方案交给模型的是交易所的原始 JSON。原始负载往往包含模型不会读的多余无用内容,而这个方案不会;此外,它还统一了不同交易所的信息。这个包先对各类方言做一次归一化,然后就能更轻松地序列化。
Related MCP server: Binance Cryptocurrency MCP
值得注意的地方:
交易对方言。KuCoin 和 Coinbase 上的 BTC-USDT、Binance 上的 BTCUSDT 被聚合为一种规范形式(BASE-QUOTE)。
时间戳单位因交易所和端点而异。Binance 是毫秒,KuCoin 的统计和订单簿是毫秒,KuCoin 的成交历史是纳秒,KuCoin 和 Coinbase 的 K 线是秒,Coinbase 的 ticker 是 ISO 字符串。所有数据模型输出的时间戳均为自 epoch 起的毫秒数。
Coinbase 的 K 线行是 [time, low, high, open, close, volume],最新的在前。这是文档记载的列顺序。KuCoin 的 K 线则使用 [time, open, close, high, low, ...]。可以通过带测试的位置映射来处理,或让解析器反转 K 线。
速率限制按 IP 计算,而 agent 工具会突发唤醒。缓存为每个端点保存 TTL,并将并发的未命中合并为一次请求(single-flight),因此五个工具在同一秒读取同一个订单簿时,只花费一次 HTTP 调用。失败不会被缓存;当带头请求抛错时,等待中的调用者会立即重试。
点差运算全程使用 Decimal。
精简的序列化器在短键名下保留精确的十进制字符串。在记录的 fixture 上实测:24 小时 ticker 从原始封装的 605 字节降到 207 字节(34%)。对于已经非常紧凑的订单簿快照,体积大致持平;真正的收益是三个交易所共用一种 schema。
用法
作为库使用(零依赖):
from exchange_data_mcp import MarketDataService
from exchange_data_mcp.transport import urllib_fetcher
svc = MarketDataService(urllib_fetcher())
svc.ticker("kucoin", "BTC-USDT")
svc.compare("BTC-USDT") # same pair on every venue, executable spread from top of book作为 MCP 服务器:
pip install -e ".[mcp]"
python -m exchange_data_mcp.server暴露的工具:get_ticker, get_orderbook, get_recent_trades, get_candles, compare_price。
错误分类如下:可重试类(携带 retry_after 的 RateLimited、ExchangeUnavailable)、修正输入类(SymbolNotFound、UnsupportedRequest),或交易所行为变化类(BadResponse)。
测试
37 个测试,完全离线,基于记录的 fixture 运行:
python3 -m unittest discover -s tests -t .状态
用于作品集展示。REST 加 TTL 缓存。同一工程中面向实时 10 ms 流式处理的部分,请参阅 kucoin-fast-stream。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to access real-time Binance cryptocurrency market data including prices, order books, candlestick charts, trading history, and 24-hour statistics through natural language queries.11Apache 2.0
- AlicenseDqualityDmaintenanceEnables AI agents to access real-time Binance cryptocurrency market data including prices, order books, candlestick charts, trading history, and 24-hour statistics through natural language queries.12Apache 2.0
- AlicenseAqualityCmaintenanceProvides live cryptocurrency market data from over 100 exchanges, enabling AI agents to fetch prices, order books, funding rates, and more for trading analysis and arbitrage opportunities.131MIT

PredMCPofficial
AlicenseNot gradedqualityBmaintenanceSafe, read-only market data for AI trading agents, offering 44 tools to query prediction markets, perpetuals, and cross-venue signals without the ability to execute trades.MIT
Related MCP Connectors
Pre-computed market data that improves agent reasoning, reduces token usage, and replaces pipelines.
52 paid x402 API endpoints for AI agents — crypto, data, DeFi, market intelligence.
Agent-native crypto market-data over MCP+REST: order flow, whales, liquidations, calibrated scores
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/nullpointer-hq/exchange-data-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server