crypto-mcp
Fetches Binance spot candlestick (K-line) data for USDT trading pairs, providing tools to retrieve historical and recent klines, synchronize incremental data, and list available symbols.
Caches Binance K-line data locally in DuckDB, automatically pruning old data based on rolling retention windows, and provides read-only status of stored symbols, intervals, and coverage.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@crypto-mcpGet BTCUSDT 1h klines for the past week"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Crypto MCP
下载 OKX / Binance K 线 并缓存到 DuckDB,通过 HTTP streamable MCP 暴露给国内 agent 远程调用。默认走 OKX USDT 永续(超短线合约价);也可拉 OKX 现货(含代币化美股)和 Binance 现货。
服务设计为部署在海外服务器(直连交易所);国内客户端把 MCP 地址指向它即可。数据按短线定位:短周期只保留滚动窗口,不全量存储。
本次 schema 含
exchange+market,与旧库不兼容。首次升级请删除data/crypto/klines.db后按需重新拉取。
MCP 工具
工具 | 参数 | 说明 |
|
| 拉取 [start, end](UTC,end 默认当前时间)K 线,写入缓存并剪枝,按时间升序返回,最多 |
|
| 增量同步:缓存里已有该对就只拉缺口;否则拉最近 |
|
| USDT 交易对(内存缓存 1 小时)。 |
|
| 只读缓存:每个 (exchange, market, symbol, interval) 的条数与首末时间 |
symbol:如BTCUSDT、BTC-USDT、BTC-USDT-SWAP、XTSLAUSDT(OKX 代币化美股现货)、TSLAUSDT(OKX 美股永续)。大小写不敏感。interval:1m 3m 5m 15m 30m 1h 2h 4h 6h 8h 12h 1d 3d 1w 1M。OKX 不支持8h;日线及以上用 UTC 开盘(1Dutc等)。exchange:okx|binance。market:spot|swap(Binance 仅 spot)。
Related MCP server: dex-kline-mcp
本地运行
uv sync
uv run crypto-mcp端点:http://127.0.0.1:8770/mcp/full
海外部署
# 服务器上
uv sync
cp .env.example .env
# 编辑 .env:
# CRYPTO_MCP_HOST=0.0.0.0
# CRYPTO_MCP_ALLOW_REMOTE=true
# (可选)CRYPTO_MCP_HTTP_PROXY=http://127.0.0.1:7890
uv run crypto-mcp国内客户端(opencode 等)配置示例:
{
"mcp": {
"crypto": {
"type": "remote",
"url": "http://<海外服务器IP>:8770/mcp/full"
}
}
}保留窗口(短线优先)
interval | 保留 |
1m / 3m | 2 天 |
5m / 15m | 3 天 |
30m | 7 天 |
1h | 14 天 |
2h | 30 天 |
4h / 6h | 45 天 |
8h / 12h | 60 天 |
1d | 730 天 |
3d | 1095 天 |
1w | 1825 天 |
1M | 3650 天 |
每次写库后自动按窗口剪枝(DELETE open_time < now - 窗口),保证短线数据不会无限膨胀。
开发检查
uv run pytest
uv run ruff check .安全提醒
v0.1 无鉴权。绑定 0.0.0.0 时必须显式设置 CRYPTO_MCP_ALLOW_REMOTE=true;只暴露在可信网络,或前面挂带鉴权的反向代理(如 nginx + basic auth)。
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted on-chain data for AI agents: DEX trades, OHLCV, top traders, fund tracing, address labels.
Durable background job execution, async task scheduling, and state persistence for AI agents.
Self-hostable index of AI financial agents — tokenized stocks + crypto, memory, LLM gateway.
52 paid x402 API endpoints for AI agents — crypto, data, DeFi, market intelligence.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that exposes Binance cryptocurrency exchange data to LLMs, allowing agents to access real-time prices, order books, and historical market data without requiring API keys.20MIT
- AlicenseAqualityDmaintenanceAn MCP server that streams K-line (candlestick) data from decentralized exchanges (DEXs) to power your AI agents and workflows.14MIT
- 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.9 npmApache 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