Binance MCP Server
Binance MCP Server
基于 Model Context Protocol 的 Binance U 本位期货 MCP 服务器,为 AI 助手提供 61 个 MCP 工具,覆盖行情数据、技术指标、风险分析与期货交易。
构建于 MCP server v2 SDK 与币安官方 SDK(@binance/derivatives-trading-usds-futures)之上,全部数值经交易所精度规则自动规整,含两级行情缓存、-1007 超时幂等恢复与时钟偏差检测。
快速开始
零配置体验(仅分析,不交易)
npx @iuk-ink/binance-mcp-server无需 API Key,默认连接测试网,即可使用行情、指标与风险分析工具。
配置 MCP Client
{
"mcpServers": {
"binance": {
"command": "npx",
"args": ["-y", "@iuk-ink/binance-mcp-server"],
"env": {
"BINANCE_TESTNET": "true"
}
}
}
}如需交易功能,补充 BINANCE_API_KEY 与 BINANCE_API_SECRET。
环境变量
变量 | 必填 | 默认值 | 说明 |
| 否 |
| 测试网(虚拟金) / 主网 |
| 否 |
| demo 交易环境(与主网凭证共用) |
| 否 | — | 自定义 REST 端点(优先级最高) |
| 否 | — | 不填则交易工具不注册 |
| 否 | — | 同上 |
| 否 | — | HTTP/HTTPS 代理地址 |
| 否 |
| 请求超时(毫秒) |
| 否 |
| 网络重试次数 |
| 否 |
| 重试退避基数(毫秒) |
| 否 |
| 签名时间窗(毫秒) |
| 否 | 全部 | 工具域过滤,逗号分隔: |
| 否 |
| MCP 服务名 |
| 否 |
| 传输模式: |
| 否 |
| HTTP 模式监听地址(非本机绑定时强制要求令牌) |
| 否 |
| HTTP 模式监听端口 |
| 否 | — | HTTP 模式 Bearer 令牌;非本机绑定时必填 |
| 否 | 自动推导 | HTTP 模式 Host 白名单(逗号分隔);通配绑定时必填 |
| 否 |
| debug / info / warn / error |
Related MCP server: Binance MCP Server
远程 / HTTP 接入
默认 stdio 适合本地单客户端(进程被客户端直接启动)。需要远程部署 / 多客户端共享时启用 Streamable HTTP。
涉及两层独立配置,请务必区分:
服务端(运行 MCP 进程的机器):用环境变量配置监听地址与认证
客户端(AI 助手 / IDE 等连入方):用 JSON 配置指定连接地址与令牌
第 1 步:服务端启动(环境变量)
# 仅本机访问(默认,无需令牌)
MCP_TRANSPORT=http
MCP_HTTP_PORT=3100
npx @iuk-ink/binance-mcp-server
# 对外暴露(必须配令牌认证,否则拒绝启动)
MCP_TRANSPORT=http
MCP_HTTP_HOST=0.0.0.0
MCP_HTTP_PORT=3100
MCP_HTTP_TOKEN=your-long-secret
MCP_HTTP_ALLOWED_HOSTS=your-domain.com
npx @iuk-ink/binance-mcp-server启动后验证服务已就绪:
curl http://127.0.0.1:3100/health # 期望 {"ok":true,"uptime":<秒>}第 2 步:客户端配置(JSON)
支持 Streamable HTTP 的 MCP 客户端,按「服务端是否设了令牌」二选一:
// 无令牌(仅本机,服务端未设 MCP_HTTP_TOKEN)
{
"mcpServers": {
"binance": { "type": "http", "url": "http://127.0.0.1:3100/mcp" }
}
}
// 有令牌(对外暴露,需在 headers 中回传 Bearer 令牌)
{
"mcpServers": {
"binance": {
"type": "http",
"url": "http://your-server:3100/mcp",
"headers": { "Authorization": "Bearer your-long-secret" }
}
}
}常见误区:服务端的
MCP_HTTP_*环境变量作用域仅限服务端进程。客户端无法通过 JSON 配置这些变量来配置服务器——JSON 只管「连到哪 + 带什么认证头」。
安全须知(交易服务器暴露 = 任何能连接的客户端都可用你的凭证交易)
默认仅监听
127.0.0.1(本机),无需令牌绑定非本机地址时必须设置
MCP_HTTP_TOKEN(Bearer 认证),否则拒绝启动通配绑定(
0.0.0.0)时必须设置MCP_HTTP_ALLOWED_HOSTS(Host 白名单,DNS rebinding 防护)公网部署强烈建议:令牌 + 反向代理 TLS(nginx / Caddy),且令牌应足够长且随机
行情缓存跨请求共享(常驻进程),等价于多客户端复用一个服务实例,注意同一服务实例上的所有客户端共享同一组币安凭证与风控额度
工具清单(61 个,主网)
测试网下 57 个(4 个情绪端点仅主网可用,不注册)。
市场数据(18)
工具 | 说明 |
| 最新成交价 |
| 最优买卖报价+量(比 orderbook 轻量得多) |
| 订单簿多档深度(5/10/20/50/100/500/1000) |
| K 线历史数据 |
| 24h 涨跌幅 / 最高 / 最低 / 成交量 |
| 标记价(= 清算参考价,含资金费率) |
| 未平仓合约量(OI) |
| 当前资金费率与上下限 |
| 历史资金费率 |
| 永续 / 当季 / 次季连续合约 K 线(基差分析) |
| 交易规则 / 精度 / 最小下单量 |
| 一站式快照:行情 + 指标 + 资金费率 + 盘口,单次调用 |
| 连通性测试 / 服务器时钟校准 |
| OI 历史统计(仅主网) |
| 全账户多空比(仅主网) |
| 主动买卖量比(仅主网) |
| 大户持仓多空比(仅主网) |
技术指标(19)
直连设计:一步完成「拉取 K 线 → 计算指标」,无需先调 market_klines。
类别 | 工具 |
趋势 |
|
动量 |
|
波动 |
|
组合信号 |
|
批量 |
|
风险分析(3)
工具 | 说明 |
| Sharpe + Sortino + 年化收益 / 波动(按 K 线周期自动推断年化系数) |
| 最大回撤(含峰谷价位与位置) |
| VaR / CVaR(置信度 0.5~0.99 可调) |
期货交易(21,需 API Key)
分类 | 工具 |
账户 |
|
订单 |
|
查询 |
|
配置 |
|
下单自动完成:价格 / 数量精度向下规整(tickSize / stepSize)、最小名义价值校验、-1007 撮合超时后以幂等订单号查证成交状态再决定是否重试。
特性亮点
market_overview一站式快照(单次调用聚合行情 / 指标 / 资金 / 盘口)多协议接入:本地 stdio 直启,或 Streamable HTTP 远程部署 / 多客户端共享
MCP_TOOL_DOMAINS工具域过滤、BINANCE_USE_DEMO/BINANCE_BASE_URL环境切换两级缓存(exchangeInfo 5min + K 线 3s,飞行中去重)
-1007撮合超时幂等恢复、时钟偏差启动检测下单精度自动规整 + 最小名义价值前置校验
参数校验全面对齐官方约束(clientOrderId 字符集、GTD 上界、追踪止损回撤率 0.1~10 等)
AI 使用指南(Skill)
仓库内置 skills/binance-trader/SKILL.md——为 AI 助手编写的使用手册,涵盖工具选择决策、跨工具工作流、交易安全纪律与错误恢复剧本。支持 Skill 机制的客户端(Claude Code / Trae 等)可直接挂载,让 AI 从"能用工具"升级为"用好工具"。
本地开发
git clone https://github.com/iuk-ink/binance-mcp-server
cd binance-mcp-server
npm install命令
命令 | 用途 |
| tsx 直接启动,开发时使用 |
| TypeScript 类型检查 |
| node:test 运行全部 196 个测试(无网络依赖) |
| 编译到 |
| 运行编译产物 |
License
MIT
Maintenance
Related MCP Servers
- AlicenseAqualityFmaintenanceA Model Context Protocol server implementation that enables AI assistants to interact with the Paradex perpetual futures trading platform, allowing for retrieving market data, managing trading accounts, placing orders, and monitoring positions.169MIT
- 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
- FlicenseNot gradedqualityDmaintenanceEnables automated cryptocurrency trading on Binance and provides integration for monitoring Base network operations. It allows users to execute trades, fetch market data, and calculate technical indicators like RSI and MACD through the Model Context Protocol.
- FlicenseNot gradedqualityDmaintenanceProvides real-time investment news, technical analysis via TA-Lib, and Binance trading capabilities including order management and market data retrieval. It enables AI assistants to perform financial market research and execute trades through the Model Context Protocol.
Related MCP Connectors
Binance Futures market intelligence: funding, OI, order book, klines, cross-exchange comparison.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Crypto perps data for AI agents: funding rates, open interest, liquidations, order book, CVD.
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/iuk-ink/binance-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server