MCP 服务器
MCP(Model Context Protocol)是一种标准化协议,让 AI 客户端可以安全地调用外部工具。toobit-trade-mcp 实现了该协议,提供 66 个交易工具供 AI 使用。
启动选项
| 使用场景 | 命令 |
|---|---|
| 仅行情数据(无需 Key) | toobit-trade-mcp --modules market |
| 全功能 | toobit-trade-mcp --modules all |
| 只读监控 | toobit-trade-mcp --read-only |
| 仅现货 | toobit-trade-mcp --modules market,spot |
| 仅合约 | toobit-trade-mcp --modules market,futures |
| 指定 Profile | toobit-trade-mcp --profile sub --modules all |
| 禁用日志 | toobit-trade-mcp --modules all --no-log |
权限说明
market 模块无需 API Key,所有接口公开可用。其他模块需要 API Key 的 读取 权限;写入操作(下单、撤单等)还需额外开启 交易 权限。
交易对格式
| 接口类型 | 格式 | 示例 |
|---|---|---|
| 现货(行情、深度、K 线、订单等) | 无分隔符,大写 | BTCUSDT、ETHUSDT |
| 合约(资金费率、标记价格、持仓量、多空比、合约行情、保险基金、风险限额、下单、持仓、杠杆等) | 合约格式,带连字符 | BTC-SWAP-USDT、ETH-SWAP-USDT |
market 模块中的合约相关工具(market_get_mark_price、market_get_funding_rate、market_get_open_interest、market_get_long_short_ratio、market_get_contract_ticker_*、market_get_insurance_fund、market_get_risk_limits)以及所有 futures_* 工具均需使用合约格式 BTC-SWAP-USDT。
工具列表
market — 行情数据(21 个,公开接口)
| 工具 | 说明 |
|---|---|
market_get_server_time | 获取 Toobit 服务器时间 |
market_get_exchange_info | 交易规则与交易对信息 |
market_get_depth | 盘口深度 |
market_get_merged_depth | 合并盘口深度 |
market_get_trades | 最新成交记录 |
market_get_klines | K线(OHLCV)数据 |
market_get_ticker_24hr | 24h 价格变动统计 |
market_get_ticker_price | 最新价格 |
market_get_book_ticker | 最优挂单价格 |
market_get_index_klines | 指数 K 线 |
market_get_mark_price | 标记价格 |
market_get_mark_price_klines | 标记价格 K 线 |
market_get_funding_rate | 当前资金费率 |
market_get_funding_rate_history | 历史资金费率 |
market_get_open_interest | 持仓量 |
market_get_long_short_ratio | 多空比 |
market_get_contract_ticker_24hr | 合约 24h 行情 |
market_get_contract_ticker_price | 合约最新价格 |
market_get_index_price | 指数价格 |
market_get_insurance_fund | 保险基金余额 |
market_get_risk_limits | 风险限额配置 |
spot — 现货交易(10 个)
| 工具 | 说明 | 类型 |
|---|---|---|
spot_place_order | 下现货单(LIMIT / MARKET / LIMIT_MAKER) | 写入 |
spot_place_order_test | 模拟下单测试(不实际提交) | 读取 |
spot_batch_orders | 批量下单 | 写入 |
spot_cancel_order | 撤销订单 | 写入 |
spot_cancel_open_orders | 撤销全部挂单 | 写入 |
spot_cancel_order_by_ids | 按 ID 批量撤单 | 写入 |
spot_get_order | 查询单笔订单 | 读取 |
spot_get_open_orders | 查询当前挂单 | 读取 |
spot_get_trade_orders | 查询历史订单 | 读取 |
spot_get_fills | 查询成交记录 | 读取 |
futures — USDT-M 永续合约(25 个)
| 工具 | 说明 | 类型 |
|---|---|---|
futures_place_order | 开仓 / 平仓(BUY_OPEN / SELL_CLOSE 等) | 写入 |
futures_batch_orders | 批量下单 | 写入 |
futures_cancel_order | 撤销订单 | 写入 |
futures_cancel_all_orders | 撤销全部订单 | 写入 |
futures_cancel_order_by_ids | 按 ID 批量撤单 | 写入 |
futures_amend_order | 修改订单 | 写入 |
futures_get_order | 查询单笔订单 | 读取 |
futures_get_open_orders | 查询当前挂单 | 读取 |
futures_get_history_orders | 查询历史订单 | 读取 |
futures_get_positions | 查询当前持仓 | 读取 |
futures_get_history_positions | 查询历史持仓 | 读取 |
futures_set_leverage | 设置杠杆倍数 | 写入 |
futures_get_leverage | 查询杠杆设置 | 读取 |
futures_set_margin_type | 切换逐仓 / 全仓 | 写入 |
futures_adjust_margin | 调整保证金 | 写入 |
futures_set_trading_stop | 设置止盈止损 | 写入 |
futures_flash_close | 闪电平仓 | 写入 |
futures_reverse_position | 反向开仓 | 写入 |
futures_auto_add_margin | 自动追加保证金 | 写入 |
futures_get_fills | 查询成交记录 | 读取 |
futures_get_balance | 查询合约余额 | 读取 |
futures_get_balance_flow | 查询资金流水 | 读取 |
futures_get_commission_rate | 查询手续费率 | 读取 |
futures_get_today_pnl | 查询今日盈亏 | 读取 |
account — 账户管理(10 个)
| 工具 | 说明 | 类型 |
|---|---|---|
account_get_info | 查询现货账户余额 | 读取 |
account_get_balance_flow | 查询资金流水 | 读取 |
account_get_sub_accounts | 查询子账户列表 | 读取 |
account_sub_transfer | 母子账户划转 | 写入 |
account_check_api_key | 验证 API Key 信息 | 读取 |
account_withdraw | 提币 | 写入 |
account_get_deposit_address | 查询充值地址 | 读取 |
account_get_deposit_orders | 查询充值记录 | 读取 |
account_get_withdraw_orders | 查询提币记录 | 读取 |
trade_get_history | 查询本地审计日志 | 读取 |
system — 系统
| 工具 | 说明 |
|---|---|
system_get_capabilities | 返回服务器能力快照(模块可用性、鉴权状态、只读模式等) |