加密货币API服务器

Luno MCP Server是一个基于Model Context Protocol的服务器,提供对Luno加密货币交易所API的访问,支持与VS Code等MCP兼容客户端的集成。

  • by luno
  • Go
  • 本地部署
  • 28 星标
  • 更新于
在 GitHub 查看 luno/luno-mcp

使用说明

Luno MCP服务器

A. 模型上下文协议 (MCP)服务器,提供对Luno加密货币交易所API的访问。

该服务器支持与Claude Code/VCode/Cursor(以及其他兼容MCP的客户端)集成,提供与Luno加密货币交易所相关的上下文信息和功能。

入门

某些工具需要您的Luno API密钥和机密。从你的 Luno帐户设置.

标准配置 (Docker)适用于大多数MCP客户端:

{
  "mcpServers": {
    "luno": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "LUNO_API_KEY_ID=YOUR_API_KEY_ID",
        "-e", "LUNO_API_SECRET=YOUR_API_SECRET",
        "ghcr.io/luno/luno-mcp:latest"
      ]
    }
  }
}
Claude Code

使用Docker:

claude mcp add luno -- docker run --rm -i -e LUNO_API_KEY_ID=YOUR_API_KEY_ID -e LUNO_API_SECRET=YOUR_API_SECRET ghcr.io/luno/luno-mcp:latest

或者,如果你是从源代码构建的:

claude mcp add luno -e LUNO_API_KEY_ID=YOUR_API_KEY_ID -e LUNO_API_SECRET=YOUR_API_SECRET -- luno-mcp
Claude Desktop

一行安装和配置(macOS):

curl -fsSL https://raw.githubusercontent.com/luno/luno-mcp/main/claude-desktop-install.sh | \
  LUNO_API_KEY_ID=<key> LUNO_API_SECRET=<secret> sh

或者将标准配置添加到您的 claude_desktop_config.json 手动(安装指南).

Cursor

首选 Cursor Settings → MCP → Add new MCP Server.使用 command 键入命令 docker 以及上面标准配置中的args。

或者将标准配置添加到您的 .cursor/mcp.json.

Windsurf

遵循Windsurf MCP 文档.使用上面的标准配置。

VS Code (manual configuration)

点击上面的徽章,一键安装Docker,或将以下内容添加到您的VS代码中 settings.json 或 .vscode/mcp.json:

使用Docker

{
  "inputs": [
    {"id": "luno_api_key_id", "type": "promptString", "description": "Luno API Key ID", "password": true},
    {"id": "luno_api_secret", "type": "promptString", "description": "Luno API Secret", "password": true}
  ],
  "servers": {
    "luno": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "LUNO_API_KEY_ID=${input:luno_api_key_id}",
        "-e", "LUNO_API_SECRET=${input:luno_api_secret}",
        "ghcr.io/luno/luno-mcp:latest"
      ]
    }
  }
}

来源

{
  "inputs": [
    {"id": "luno_api_key_id", "type": "promptString", "description": "Luno API Key ID", "password": true},
    {"id": "luno_api_secret", "type": "promptString", "description": "Luno API Secret", "password": true}
  ],
  "servers": {
    "luno": {
      "command": "luno-mcp",
      "env": {
        "LUNO_API_KEY_ID": "${input:luno_api_key_id}",
        "LUNO_API_SECRET": "${input:luno_api_secret}"
      }
    }
  }
}

SSE运输

{
  "servers": {
    "luno": {
      "type": "sse",
      "url": "http://localhost:8080/sse"
    }
  }
}
Building from source

需要Go 1.25或更高版本。

直接安装:

go install github.com/luno/luno-mcp/cmd/server@latest

或者克隆并构建:

git clone https://github.com/luno/luno-mcp
cd luno-mcp
go build -o luno-mcp ./cmd/server

可选地使其在系统范围内可用:

sudo mv luno-mcp /usr/local/bin/
Homebrew (macOS)

通过安装 家酿 使用 luno/自制程序luno mcp 点击:

brew tap luno/luno-mcp
brew install luno-mcp

然后配置您的MCP客户端:

{
  "mcpServers": {
    "luno": {
      "command": "luno-mcp",
      "args": ["--transport", "stdio"],
      "env": {
        "LUNO_API_KEY_ID": "YOUR_API_KEY_ID",
        "LUNO_API_SECRET": "YOUR_API_SECRET"
      }
    }
  }
}

或者使用克劳德代码:

claude mcp add luno -e LUNO_API_KEY_ID=YOUR_API_KEY_ID -e LUNO_API_SECRET=YOUR_API_SECRET -- luno-mcp
Docker

使用上面的标准配置,或直接运行:

docker run --rm -i \
  -e LUNO_API_KEY_ID=YOUR_API_KEY_ID \
  -e LUNO_API_SECRET=YOUR_API_SECRET \
  ghcr.io/luno/luno-mcp:latest

对于SSE模式:

docker run --rm \
  -e LUNO_API_KEY_ID=YOUR_API_KEY_ID \
  -e LUNO_API_SECRET=YOUR_API_SECRET \
  -p 8080:8080 \
  ghcr.io/luno/luno-mcp:latest \
  --transport sse --sse-address 0.0.0.0:8080

可选环境变量:

  • LUNO_API_DEBUG=true --启用调试日志记录
  • LUNO_API_DOMAIN=api.staging.luno.com -覆盖API域
  • ALLOW_WRITE_OPERATIONS=true --启用写入操作(create_order, cancel_order, convert)

标准配置 (Docker)适用于大多数MCP客户端:

{
  "mcpServers": {
    "luno": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "LUNO_API_KEY_ID=YOUR_API_KEY_ID",
        "-e", "LUNO_API_SECRET=YOUR_API_SECRET",
        "ghcr.io/luno/luno-mcp:latest"
      ]
    }
  }
}
Claude Code

使用Docker:

claude mcp add luno -- docker run --rm -i -e LUNO_API_KEY_ID=YOUR_API_KEY_ID -e LUNO_API_SECRET=YOUR_API_SECRET ghcr.io/luno/luno-mcp:latest

或者,如果你是从源代码构建的:

claude mcp add luno -e LUNO_API_KEY_ID=YOUR_API_KEY_ID -e LUNO_API_SECRET=YOUR_API_SECRET -- luno-mcp
Claude Desktop

一行安装和配置(macOS):

curl -fsSL https://raw.githubusercontent.com/luno/luno-mcp/main/claude-desktop-install.sh | \
  LUNO_API_KEY_ID=<key> LUNO_API_SECRET=<secret> sh

或者将标准配置添加到您的 claude_desktop_config.json 手动(安装指南).

Cursor

首选 Cursor Settings → MCP → Add new MCP Server.使用 command 键入命令 docker 以及上面标准配置中的args。

或者将标准配置添加到您的 .cursor/mcp.json.

Windsurf

遵循Windsurf MCP 文档.使用上面的标准配置。

VS Code (manual configuration)

点击上面的徽章,一键安装Docker,或将以下内容添加到您的VS代码中 settings.json 或 .vscode/mcp.json:

使用Docker

{
  "servers": {
    "luno": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "LUNO_API_KEY_ID=${input:luno_api_key_id}",
        "-e", "LUNO_API_SECRET=${input:luno_api_secret}",
        "ghcr.io/luno/luno-mcp:latest"
      ],
      "inputs": [
         {"id": "luno_api_key_id", "type": "promptString", "description": "Luno API Key ID", "password": true},
         {"id": "luno_api_secret", "type": "promptString", "description": "Luno API Secret", "password": true}
      ]
    }
  }
}

来源

{
  "servers": {
    "luno": {
      "command": "luno-mcp",
      "env": {
        "LUNO_API_KEY_ID": "${input:luno_api_key_id}",
        "LUNO_API_SECRET": "${input:luno_api_secret}"
      },
      "inputs": [
        {"id": "luno_api_key_id", "type": "promptString", "description": "Luno API Key ID", "password": true},
        {"id": "luno_api_secret", "type": "promptString", "description": "Luno API Secret", "password": true}
      ]
    }
  }
}

SSE运输

{
  "servers": {
    "luno": {
      "type": "sse",
      "url": "http://localhost:8080/sse"
    }
  }
}
Building from source

需要Go 1.25或更高版本。

直接安装:

go install github.com/luno/luno-mcp/cmd/server@latest

或者克隆并构建:

git clone https://github.com/luno/luno-mcp
cd luno-mcp
go build -o luno-mcp ./cmd/server

可选地使其在系统范围内可用:

sudo mv luno-mcp /usr/local/bin/
Docker

使用上面的标准配置,或直接运行:

docker run --rm -i \
  -e LUNO_API_KEY_ID=YOUR_API_KEY_ID \
  -e LUNO_API_SECRET=YOUR_API_SECRET \
  ghcr.io/luno/luno-mcp:latest

对于SSE模式:

docker run --rm \
  -e LUNO_API_KEY_ID=YOUR_API_KEY_ID \
  -e LUNO_API_SECRET=YOUR_API_SECRET \
  -p 8080:8080 \
  ghcr.io/luno/luno-mcp:latest \
  --transport sse --sse-address 0.0.0.0:8080

可选环境变量:

  • LUNO_API_DEBUG=true --启用调试日志记录
  • LUNO_API_DOMAIN=api.staging.luno.com -覆盖API域
  • ALLOW_WRITE_OPERATIONS=true --启用写入操作(create_order, cancel_order, convert)

特性

  • 资源:访问账户余额、交易历史记录等
  • 工具:创建和管理订单、检查价格和查看交易详细信息的功能
  • 安全:使用Luno API密钥进行安全身份验证
  • VS代码集成:易于与VSCode或其他AI IDE集成

可用工具

工具 类别 描述 需要授权 写入
get_ticker 市场数据 获取交易对的当前股票信息 ❌ ❌
get_tickers 市场数据 列出给定配对(或全部)的股票代码 ❌ ❌
get_order_book 市场数据 获取交易对的订单簿 ❌ ❌
list_trades 市场数据 列出货币对的最近交易 ❌ ❌
get_candles 市场数据 获取货币对的烛台市场数据 ❌ ❌
get_markets_info 市场数据 列出所有支持的市场参数信息 ❌ ❌
get_balances 账户信息 获取所有账户的余额 ✅ ❌
create_order 交易 创建新的买入或卖出订单 ✅ ✅
cancel_order 交易 取消现有订单 ✅ ✅
list_orders 交易 列出未结订单 ✅ ❌
list_transactions 交易记录 列出账户的交易记录 ✅ ❌
get_transaction 交易 获取特定交易的详细信息 ✅ ❌
convert 交易 立即在两种货币之间转换 ✅ ✅

命令行选项

  • --transport:运输类型(stdio, sse,或 streamable-http;默认值: stdio)
  • --sse-address:SSE和流式HTTP传输的地址(默认值: localhost:8080)
  • --domain:Luno API域(默认值: api.luno.com)
  • --log-level:日志级别(debug, info, warn, error,默认值: info)
  • --allow-write-operations:启用写入操作(create_order, cancel_order, convert).也可通过以下方式配置 ALLOW_WRITE_OPERATIONS env 是

例子

使用钱包

您可以要求您的法学硕士显示您的钱包余额:

What are my current wallet balances on Luno?

交易

您可以要求您的法学硕士帮助您进行交易:

Create a limit order to buy 0.001 BTC at 50000 ZAR

交易记录

您可以要求您的法学硕士展示您的交易历史:

Show me my recent Bitcoin transactions

市场数据

你可以要求你的法学硕士展示市场数据:

Show me recent trades for XBTZAR
What's the latest price for Bitcoin in ZAR?

安全考虑

此工具需要有权访问您的Luno帐户的API凭据。使用API密钥时要特别小心,特别是那些具有撤销权限的密钥。建议仅使用特定用例所需的权限创建API密钥。

写入操作控制

默认情况下,MCP服务器在 只读模式 — create_order, cancel_order,以及 convert 没有暴露。要启用它们,请设置 ALLOW_WRITE_OPERATIONS 到 true, 1,或 yes。有关在何处添加此标志,请参阅上面的配置示例。

API证书的最佳实践

  1. 创建受限权限API密钥:只授予您的用例绝对必要的权限
  2. 从不将凭据提交到版本控制:确保 .env 文件始终在您的 .gitignore
  3. 定期旋转API键:定期重新生成API密钥,以限制潜在泄漏的影响
  4. 监控API使用情况:定期检查您的Luno帐户是否有任何未经授权的活动
  5. 默认情况下使用只读模式:仅在特别需要时启用写入操作

贡献

如果你想为这个项目的发展做出贡献,请参阅 贡献.md 文件指南。

许可证

MIT许可证