Crypto MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Crypto MCP Server 🚀
2025 年 7 月 · MCP 协议发布之初的首批实践之一
在 Model Context Protocol 刚公开时就投入开发的早期 MCP Server,国内较早的 MCP 探索项目之一。
一套完整的加密货币市场数据 MCP 服务端 + 客户端工具链。提供实时行情、K 线、资金费率、市场深度、行业新闻和深度搜索能力,可直接被任何 MCP 兼容的 Agent 作为工具调用。
背景
2025 年 7 月,Anthropic 开源了 MCP(Model Context Protocol)协议。当时市面上几乎没有现成的 MCP Server 实现,文档和工具链都不完善。这个项目就是在那个阶段开始的——从零搭建 MCP Server 框架、实现 stdio 传输、注册工具、编写客户端库,算是国内最早一批把 MCP 跑起来的尝试。
项目结构保留了早期的探索痕迹:有专门的 MCP Client 库(mcp_client.py),有 LLM 编排层,也有后来追加的 WebUI 管理后台。不是最优雅的代码,但每一行都是当时真实踩坑的记录。
Related MCP server: Crypto Market Data MCP Server
功能一览
功能 | 说明 |
实时行情 | 单币种 / 批量查询最新价格(数据源:Binance) |
K 线数据 | 多时间周期历史 K 线,含开/高/低/收/成交量 |
资金费率 | 永续合约资金费率历史 |
市场深度 | 订单簿买卖盘数据(Asks / Bids) |
行业新闻 | 整合 Odaily 快讯 + NewsAPI 多源搜索 |
深度搜索 | Tavily 搜索 + LLM 结构化总结 |
天气查询 | 模块化扩展示例 |
WebUI 后台 | FastAPI 可视化管理界面 |
多 Server 编排 | 同时注册多个 MCP Server,统一通过 LLM 调度 |
重试退避 | 内置指数退避 + 随机抖动,应对 API 限流 |
系统架构
Agent / 用户
│ stdio (MCP 协议)
▼
┌───────────────────────┐ ┌──────────────────┐
│ MCP Client 库 │◄──────►│ FastAPI WebUI │
│ (mcp_client.py) │ │ (可视化管理) │
└──────────┬────────────┘ └──────────────────┘
│ stdio
▼
┌───────────────────────┐
│ MCP Server 层 │
│ FastMCP / @mcp.tool │
├───────────────────────┤
│ crypto_mcp_server │ 行情 / K 线 / 资金费率 / 深度
│ deepsearch_server │ 深度搜索 + LLM 总结
│ weather_server │ 模块化扩展示例
└───────────────────────┘
│
▼
┌───────────────────────┐
│ LLM 编排层 │ Moonshot / OpenRouter
│ (重试退避) │ exponential backoff
└───────────────────────┘项目结构
crypto_mcp_server.py # 行情 MCP Server(核心)
deepsearch_mcp_server.py # 深度搜索 MCP Server
weather_mcp_server.py # 天气 MCP Server(示例)
mcp_client.py # MCP Client 库(LLM 编排 + 重试退避)
webui_fastapi.py # FastAPI WebUI 后台
static/ # WebUI 前端资源
templates/ # WebUI 页面模板
config.json # LLM 参数配置
mcp.json # MCP Server 启动配置
.env.example # 环境变量模板
requirements.txt # Python 依赖快速开始
1. 安装
git clone https://github.com/Ibook000/crypto_mcp_server.git
cd crypto_mcp_server
pip install -r requirements.txt2. 配置密钥
cp .env.example .env编辑 .env 填入你的密钥:
变量 | 用途 | 获取地址 |
| Odaily / NewsAPI 行业新闻搜索 | |
| deepsearch 深度搜索 | |
| deepsearch LLM 总结 | |
| Client LLM 编排(Moonshot 兼容) | |
| 天气模块 |
⚠️
.env已加入.gitignore,不会提交到仓库。代码统一通过os.environ.get()读取。
3. 启动 MCP Server
python crypto_mcp_server.py # 加密货币行情
python deepsearch_mcp_server.py # 深度搜索
python weather_mcp_server.py # 天气每个 Server 以 stdio 方式运行,可被任意 MCP 兼容的 Agent(Claude Code、Cursor、Codex 等)调用。
4. 通过 Client 调用
from mcp_client import MCPClient
import asyncio
client = MCPClient()
async def main():
for name in client.mcp_servers:
await client.connect_to_server(name)
result = await client.process_query("BTC 现在的价格是多少?")
print(result)
asyncio.run(main())5. 启动 WebUI
python webui_fastapi.py
# 打开 http://localhost:8000MCP 工具一览
crypto_mcp_server.py
工具 | 说明 |
| 查询单个币种价格 |
| 批量查询多个币种价格 |
| 查询 K 线数据(1m–1M,最多 1000 条) |
| 查询永续合约资金费率 |
| 查询市场深度(订单簿) |
| 查询行业快讯(Odaily) |
| 搜索新闻(NewsAPI) |
deepsearch_mcp_server.py
工具 | 说明 |
| 执行深度搜索,返回结构化结果 |
| 深度搜索 + LLM 总结为 MD 报告 |
WebUI 截图
WebUI 管理后台基于 FastAPI 构建,支持多 Server 连接监控和对话式查询。


技术要点
MCP 协议:基于
stdio传输,使用FastMCP+@mcp.tool()注册工具异步 I/O:
httpx+asyncio,单币种和批量请求都支持重试退避:Client 内置指数退避 + 随机抖动,应对 API 限流
容错设计:所有数据获取函数返回结构化错误,格式化函数有边界校验
模块化扩展:新增数据源只需实现
fetch_xxx+format_xxx+@mcp.tool()三步
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Real-time crypto market data, funding rates, arbitrage and trading tools from 60+ exchanges.
Provide real-time cryptocurrency price data and market analysis.
Real-time crypto prices from Binance, Coinbase, Kraken, OKX, and Bybit
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides real-time cryptocurrency market data from Binance API, including price queries, 24h statistics, K-line data, market trend analysis, and order book depth information for trading analysis.1MIT
- 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.132MIT
- FlicenseNot gradedqualityDmaintenanceProvides real-time cryptocurrency data, technical analysis, and market information from Binance and CoinGecko APIs, enabling price queries, K-line analysis, and alpha token tracking.-
- FlicenseNot gradedqualityDmaintenanceEnables fetching live crypto market data from Binance, Bybit, and Hyperliquid via MCP tools, including klines, orderbook, funding rates, technical indicators, and market breadth for real-time analysis by LLMs.-