Skip to content

Authentication

CyberPay MCP Server 使用 API Key 认证。

获取 API Key

  1. 访问 CyberDash
  2. 使用钱包连接登录
  3. 进入 Settings → API Keys
  4. 创建新的 API Key

配置方式

环境变量

export CYBERPAY_API_KEY=cp_your_api_key

MCP 配置

在 MCP 配置文件中通过 env 字段传入:

{
  "mcpServers": {
    "cyberpay": {
      "command": "npx",
      "args": ["@cyberpay/mcp"],
      "env": {
        "CYBERPAY_API_KEY": "cp_your_api_key"
      }
    }
  }
}

REST API

直接调用 REST API 时,在 Header 中传入:

curl -X POST https://api.cyberpay.org/v1/service/call \
  -H "Authorization: Bearer cp_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"service_id": "card-list", "params": {"wallet": "0x..."}}'

API Key 类型

类型前缀权限
Productioncp_全部服务,真实交易
Testnetcp_test_全部服务,测试环境
Read-onlycp_ro_仅查询类服务

速率限制

计划限制突发
Free100 次/分钟200 次/分钟
Pro1000 次/分钟2000 次/分钟
Enterprise自定义自定义

超出限制返回 429 Too Many Requests

安全建议

  • 不要在客户端代码中暴露 API Key
  • 使用环境变量存储
  • 定期轮换 Key
  • 为不同环境使用不同的 Key
  • 监控 API Key 使用情况