快速开始
3 分钟完成安装、配置和第一次交易。
第一步 — 安装
bash
npm install -g toobit-trade-mcp toobit-trade-cli验证安装:
bash
toobit market ticker --symbol BTCUSDTTIP
行情数据可立即使用,无需 API Key。
第二步 — 添加 Toobit API 凭证
创建配置文件 ~/.toobit/config.toml:
toml
# ~/.toobit/config.toml
default_profile = "live"
[profiles.live]
api_key = "your-api-key"
secret_key = "your-secret-key"
# 子账户配置(可选)
# [profiles.sub]
# api_key = "sub-account-api-key"
# secret_key = "sub-account-secret-key"获取 API Key: 登录 toobit.com → 设置 → API 密钥 → 创建新 API Key
WARNING
切勿将您的 API Key 或 Secret Key 粘贴到 AI 对话框中。所有凭证应仅保存在本地配置文件中。建议使用子账户的 API Key 并仅开启所需的最小权限。
第三步 — 连接 AI 客户端
以 Cursor 为例,在项目根目录创建 .cursor/mcp.json:
json
{
"mcpServers": {
"toobit-trade": {
"command": "toobit-trade-mcp",
"args": ["--modules", "all"]
}
}
}支持的 AI 客户端
| 客户端 | 配置方式 |
|---|---|
| Cursor | .cursor/mcp.json |
| Claude Desktop | claude_desktop_config.json |
| VS Code (Copilot) | .vscode/mcp.json |
| Windsurf | ~/.codeium/windsurf/mcp_config.json |
| Claude Code | claude-code mcp add |
自动配置
也可以使用命令自动完成配置:
bash
toobit-trade-mcp setup --client <client>| 客户端 | <client> 值 |
|---|---|
| Claude Desktop | claude-desktop |
| Claude Code | claude-code |
| Cursor | cursor |
| VS Code | vscode |
| Windsurf | windsurf |
第四步 — 试用
打开您的 AI 客户端,输入自然语言:
# 查询行情
BTC 现在的价格是多少?
# 查看账户
查看我的现货账户余额
# 合约操作
帮我查一下 ETH 合约的资金费率
# 深度分析
查看 BTC 的盘口深度,分析买卖压力或使用 CLI 直接操作:
bash
# 行情数据(无需 API Key)
toobit market ticker --symbol BTCUSDT
toobit market candles --symbol BTCUSDT --interval 1h --limit 10
# 现货交易
toobit spot place --symbol BTCUSDT --side BUY --type MARKET --quantity 0.001
# 合约交易(需使用合约格式:BTC-SWAP-USDT)
toobit futures place --symbol BTC-SWAP-USDT --side BUY_OPEN --orderType MARKET --quantity 1 --leverage 10
# 账户
toobit account balance