Skip to content

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
指定 Profiletoobit-trade-mcp --profile sub --modules all
禁用日志toobit-trade-mcp --modules all --no-log

权限说明

market 模块无需 API Key,所有接口公开可用。其他模块需要 API Key 的 读取 权限;写入操作(下单、撤单等)还需额外开启 交易 权限。

交易对格式

接口类型格式示例
现货(行情、深度、K 线、订单等)无分隔符,大写BTCUSDTETHUSDT
合约(资金费率、标记价格、持仓量、多空比、合约行情、保险基金、风险限额、下单、持仓、杠杆等)合约格式,带连字符BTC-SWAP-USDTETH-SWAP-USDT

market 模块中的合约相关工具(market_get_mark_pricemarket_get_funding_ratemarket_get_open_interestmarket_get_long_short_ratiomarket_get_contract_ticker_*market_get_insurance_fundmarket_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_klinesK线(OHLCV)数据
market_get_ticker_24hr24h 价格变动统计
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返回服务器能力快照(模块可用性、鉴权状态、只读模式等)

基于 MIT 许可发布