dogabot dogabot

General

API 密钥与 MCP 集成

在 Pro 或 Institutional 套餐上创建带范围的 API 密钥,用于脚本、交易台工具以及面向 AI 代理的 dogabot MCP。

apimcpproinstitutionalintegrationautomation

Pro 与 Institutional 订阅用户可创建 API 密钥,以编程方式访问 dogabot — 脚本、内部工具,以及面向 AI 代理的 MCP(Cursor、Claude Desktop、Claude Code)。

产品概览:dogabot.com/zh/mcp-server。完整工具目录:docs.dogabot.com/mcp。

谁可以使用 MCP 和 API 密钥

免费账户无法启用 OAuth MCP,也无法创建 API 密钥。

步骤 1:创建密钥

  1. 登录 dogabot。
  2. 从 Settings 打开 MCP & API,或在 ⌘K 中搜索 MCP & API。这不是 凭据 — 那是交易所密钥。
  3. 输入名称(例如 风控台、Cursor MCP)。
  4. 选择 Scopes — 默认勾选全部读取范围;取消勾选此密钥不应访问的项。仅在套餐允许时添加写入范围。
  5. 可选添加 IP 白名单 — 每行一个公网 IP 或 CIDR(家庭、办公室或 VPN 出口)。留空则允许任意 IP。请勿使用 127.0.0.1。
  6. 点击 Create key。
  7. 立即复制密钥 — 以 dbk_live_ 开头,且只显示一次。

之后可在密钥行(网络图标)编辑 IP 白名单,无需轮换密钥。

将密钥存入环境变量或密钥管理器。切勿提交到 git。

步骤 2:调用 REST API

export DOGABOT_API_KEY=dbk_live_...
curl -H "Authorization: Bearer $DOGABOT_API_KEY" https://api.dogabot.com/api/v1/me

你可以列出自动化、订单、回测结果等。写入权限与速率限制取决于套餐;机构交易台应与客户经理协调写入与 webhook。写入请求务必发送 Idempotency-Key 请求头。

一键客户端

在 MCP & API 启用 OAuth MCP 后,打开客户端的安装界面(仍需在客户端确认,并完成 dogabot OAuth / Needs login):

通过智能体安装

将以下英文提示粘贴到 Cursor、Claude Code、Codex 或其他智能体,让它帮你配置 MCP:

Install the dogabot MCP server in this agent environment.

Prerequisites (the user must do these in the dogabot app first):
1. Pro or Institutional plan
2. Open https://app.dogabot.com/developers → enable OAuth MCP (scopes + optional IP allowlist) → Save

Then configure this MCP client:
- Hosted URL: https://mcp.dogabot.com/mcp
- Preferred auth: OAuth (Cursor: choose "Needs login") — do NOT paste a Clerk session JWT, browser cookie, or login token
- Add this URL-only config to mcp.json / MCP settings (no Authorization header):

{
  "mcpServers": {
    "dogabot": {
      "type": "http",
      "url": "https://mcp.dogabot.com/mcp"
    }
  }
}

After adding: complete OAuth consent until the server shows connected/green.

Docs: https://learn.dogabot.com/help/api-keys-and-mcp and https://dogabot.com/mcp-server

If this client only supports stdio MCP, use `npx -y @dogabot/mcp` with env DOGABOT_API_KEY from the same MCP & API page — see https://github.com/dogabot/dogabot-mcp-server.

或手动添加 OAuth 配置:

{
  "mcpServers": {
    "dogabot": {
      "type": "http",
      "url": "https://mcp.dogabot.com/mcp"
    }
  }
}

步骤 3(可选):为 AI 代理连接 MCP

推荐: 用你的 API 密钥将 Cursor 指向托管 MCP URL(无需安装 Node)。使用 dogabot API 密钥(dbk_live_…),不要使用浏览器登录令牌。

{
  "mcpServers": {
    "dogabot": {
      "url": "https://mcp.dogabot.com/mcp",
      "headers": {
        "Authorization": "Bearer dbk_live_REPLACE_ME"
      }
    }
  }
}
  1. 创建密钥(步骤 1)并粘贴到上述配置。
  2. 保存为 .cursor/mcp.json(或合并到 mcpServers 下)。
  3. 重新加载 Cursor → Settings → Tools & MCP → 启用 dogabot。

可选的 stdio 包 @dogabot/mcp 会代理到同一托管端点,适用于仅支持命令式 MCP 的客户端。完整示例:github.com/dogabot/dogabot-mcp-server。

Claude Desktop / Claude Code

使用公共仓库中的 stdio 配置(examples/claude-desktop-config.json),或:

claude mcp add dogabot \
  --env DOGABOT_API_KEY=dbk_live_YOUR_KEY_HERE \
  -- npx -y @dogabot/mcp

Claude Desktop 要求严格 JSON — 不能有注释,也不能使用 ${env:…} 插值。

示例工具

托管服务器提供 57 个工具。主要工具包括:

读取(常见): list_automations、get_positions、get_ticker、get_candles、list_exchanges、get_backtest、get_backtest_signals、list_terminal_positions、list_terminal_emitters、list_exchange_balances、list_exchange_positions、list_exchange_orders、list_exchange_trades、list_exchange_income、get_terminal_symbol_rules。

list_exchange_balances 返回某交易所的实时钱包快照——不存储在 dogabot 中,也不是终端或自动化持仓。

list_exchange_positions 返回该交易所的实时未平仓合约(数量与方向)。现货交易所返回空列表。这不是终端会话持仓。

list_exchange_orders 返回未成交订单及近期成交/取消记录。这不是终端会话订单历史。币安和 Aster 的历史需要交易对。

list_exchange_trades 返回实时成交(不是订单对象)。不传 cursor 为最新页;传入 next_cursor 查看更早成交。币安和 Aster 需要交易对。

写入(有范围): place_terminal_order(需要 write:terminal;建议用 paper)。Leader 模式(broadcast_mode=leader)需要来自 list_terminal_emitters 的 Traders Emitter id、create_backtest / cancel_backtest(需要 write:backtest 以及机构 API 写入)。创建前检查 get_backtest_quota;每位用户最多可同时有 10 个回测排队或运行。回测的完整成交历史保留 24 小时,之后只保留最近 20 笔成交。

通过 MCP 管理自动化生命周期(create_automation、start_automation、stop_automation、update_automation、delete_automation)需要相应写入范围(write:automation / write:lifecycle),且这些范围须已授予你的密钥或 OAuth 配置。

Ask AI MCP 工具(create_ai_chat_conversation、ask_ai_chat、confirm_ai_chat_tool、…)需要 write:ask_ai(Pro)。

请在 docs.dogabot.com/mcp 查看完整目录,并在 dogabot.com/zh/mcp-server 查看配置示例。

MCP 故障排除

Institutional 写入权限

若合同包含 API 写入权限,dogabot 运维会在你的账户上启用。之后可创建带写入权限的密钥,并调用启动/停止自动化等操作 — 写入请求务必带上幂等键请求头,以便重试安全。同一写入门槛也适用于 MCP 的 create_backtest / cancel_backtest。

请联系客户经理或销售以配置 Institutional API 与 webhook。

安全提示

相关

Related in the app

Ready to put this into practice?

Create a free account and explore dogabot with paper trading.

View Pricing