BTCPayServer支付处理服务

一个全面的BTCPayServer集成模型上下文协议(MCP)服务器,提供支付处理、商店管理、用户管理、Webhook处理等功能,并具备完整的API覆盖。

  • by Abhijay007
  • TypeScript
  • 本地部署
  • 2 星标
  • 更新于
在 GitHub 查看 abhijay007/btcpayserver-mcp

使用说明

BTCPayServer模型上下文协议服务器(测试版)

用于BTCPayServer集成的全面模型上下文协议(MCP)服务器,提供支付处理、商店管理、用户管理、webhook处理等工具,并全面覆盖API。

工具参考

BTCPayServer MCP服务器提供了一套与BTCPayServer API交互的简化工具:

工具 描述 主要用途
get_service_info 发现服务可用的方法 探索和发现
get_method_info 获取详细的参数要求 请求准备
btcpay_request 执行对BTCPayServer的API调用 执行操作

与AI助手集成

Claude桌面集成

对于Claude Desktop集成,请将此配置添加到您的 claude_desktop_config.json:

{
  "mcpServers": {
    "btcpayserver-mcp": {
      "command": "node",
      "args": ["path/to/btcpayserver-mcp/dist/index.js"],
      "env": {
        "BTCPAY_BASE_URL": "https://your-btcpay-instance.com",
        "BTCPAY_API_KEY": "your_api_key_here",
        "BTCPAY_STORE_ID": "your_default_store_id"
      }
    }
  }
}

服务目录

BTCPayServer MCP提供对BTCPay服务器完整的API生态系统的访问。看看 BTCPayServer API文档 有关每项服务的详细信息:

支付服务

服务 描述
invoices 创建、管理和跟踪比特币付款发票
payment-requests 创建捐款或定期账单的付款请求
lightning-internal 管理内部闪电网络操作
lightning-store 存储级闪电网络配置
lightning-address Lightning地址管理和设置

店铺管理

服务 描述
stores 存储创建、配置和管理
stores-email 配置和管理存储电子邮件设置和SMTP
stores-payment-methods 管理商店的可用付款方式
stores-payout-processors 配置自动支付处理
stores-payouts 管理和处理商店付款
stores-rates 汇率配置和管理
stores-users 存储用户访问和权限管理
stores-wallet 商店钱包管理和运营

用户和访问管理

服务 描述
users 用户帐户管理
api-keys API密钥创建和权限管理
authorization OAuth和授权流管理

集成与自动化

服务 描述
webhooks 实时事件通知和webhook管理
notifications 系统通知和警报
apps BTCPayServer应用程序集成和插件
pull-payments 拉取付款请求和退款管理

系统

服务 描述
server-info 服务器状态、版本和配置信息

使用模式

为了通过MCP与BTCPayServer API进行最佳交互:

1.发现: 使用 get_service_info 探索可用的方法

get_service_info(serviceName: "invoices")

2.了解: 使用 get_method_info 了解参数要求

get_method_info(serviceName: "invoices", methodName: "create")

3.执行: 使用 btcpay_request 执行操作

btcpay_request(serviceName: "invoices", methodName: "create", parameters: {storeId: "your-store-id", amount: "10.00", currency: "USD"})

安装

  1. 克隆此存储库:
git clone <repository-url>
cd btcpayserver-mcp
  1. 安装依赖项:
npm install
  1. 构建项目:
npm run build

配置

MCP服务器需要以下环境变量:

  • BTCPAY_BASE_URL -您的BTCPayServer实例URL(例如。, https://btcpay.example.com)
  • BTCPAY_API_KEY -您的BTCPayServer API密钥
  • BTCPAY_STORE_ID -(可选)操作的默认存储ID

设置BTCPayServer API密钥

  1. 登录您的BTCPayServer实例
  2. 首选 账户 → 管理账户 → API密钥
  3. 点击 生成密钥
  4. 为您的用例选择所需的权限:
    • 店铺管理: btcpay.store.canmodifystoresettings
    • 付款请求: btcpay.store.cancreateinvoice
    • 用户管理: btcpay.user.canmodifyprofile
    • Webhooks: btcpay.store.webhooks.canmodifywebhooks
    • 等。。
  5. 复制生成的API密钥

环境设置

创建一个 .env 项目根目录中的文件:

BTCPAY_BASE_URL=https://your-btcpay-instance.com
BTCPAY_API_KEY=your_api_key_here
BTCPAY_STORE_ID=your_default_store_id

或者直接设置环境变量:

export BTCPAY_BASE_URL=https://your-btcpay-instance.com
export BTCPAY_API_KEY=your_api_key_here
export BTCPAY_STORE_ID=your_default_store_id

用法

运行MCP服务器

npm start

发展:

npm run dev

开发与调试

使用MCP检查器: MCP检查器为测试提供了一个可视化界面:

# Build the project
npm run build

# Start the inspector with the BTCPayServer MCP Server
npx @modelcontextprotocol/inspector node dist/index.js

开发工作流程:

  1. 克隆存储库
  2. 安装依赖项: npm install
  3. 启动开发模式: npm run build
  4. 运行服务器: node dist/index.js
  5. 使用MCP检查器测试您的更改

MCP服务器提供全面的错误处理:

  • 配置错误:缺少环境变量
  • API错误:BTCPayServer API通信问题
  • 验证错误:输入参数无效
  • 身份验证错误:API密钥无效或过期

所有错误的格式都正确,并返回描述性消息。

发展

项目结构

src/
├── index.ts              # Main MCP server implementation
├── services/             # BTCPayServer service implementations
│   ├── base-service.ts   # Base service class
│   ├── invoices.ts       # Invoice management
│   ├── payment-requests.ts # Payment request handling
│   ├── stores.ts         # Store management
│   ├── webhooks.ts       # Webhook management
│   └── ...               # Other service modules
├── utils/
│   └── btcpay-client.ts  # BTCPayServer API client
└── types.ts              # TypeScript type definitions

建筑

npm run build

在发展中奔跑

npm run dev

安全考虑

  1. API密钥安全:从不将API密钥提交到版本控制
  2. 环境变量:使用安全的环境变量管理
  3. Webhook的秘密:始终使用webhook密钥进行验证
  4. 超文本传输安全协议:确保BTCPayServer实例使用HTTPS
  5. 权限:API密钥权限使用最小权限原则

BTCPayServer兼容性

此MCP服务器与BTCPayServer v1.7.0及更高版本兼容。它使用官方的BTCPayServer REST API v1。

贡献

  1. 分叉存储库
  2. 创建要素分支
  3. 提交您的更改
  4. 推到分支
  5. 创建拉取请求

许可证

MIT许可证-有关详细信息,请参阅许可证文件。

支持

对于问题和疑问:

  1. 查看BTCPayServer文档
  2. 查看API参考资料
  3. 在此存储库中打开问题

帮助我们改进此MCP

注: 某些方法可能无法正常工作。请通过报告要求和提出拉取请求来帮助我们改进这些要求。此外,为了让它跟上API的最新版本,我们需要继续更新它。