一个全面的模型上下文协议(MCP)服务器,用于与BTCPayServer集成,提供支付处理、商店管理、用户管理、webhook处理等工具,并覆盖完整的API。
BTCPayServer MCP服务器提供了一组精简的工具,用于与BTCPayServer API进行交互:
| 工具 | 描述 | 主要用途 |
|---|---|---|
get_service_info | 发现服务可用的方法 | 探索和发现 |
get_method_info | 获取详细参数要求 | 请求准备 |
btcpay_request | 执行对BTCPayServer的API调用 | 执行操作 |
对于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提供了访问BTCPayServer完整API生态系统的能力。请参阅BTCPayServer API 文档以获取每个服务的详细信息:
| 服务 | 描述 |
|---|---|
invoices | 创建、管理和跟踪比特币发票以支付 |
payment-requests | 创建捐赠或定期账单的付款请求 |
lightning-internal | 管理内部闪电网络操作 |
lightning-store | 商店级别的闪电网络配置 |
lightning-address | 闪电地址管理和设置 |
| 服务 | 描述 |
|---|---|
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"})
git clone <repository-url>
cd btcpayserver-mcp
npm install
npm run build
MCP服务器需要以下环境变量:
BTCPAY_BASE_URL - 您的BTCPayServer实例URL(例如,https://btcpay.example.com)BTCPAY_API_KEY - 您的BTCPayServer API密钥BTCPAY_STORE_ID - (可选)默认商店ID用于操作btcpay.store.canmodifystoresettingsbtcpay.store.cancreateinvoicebtcpay.user.canmodifyprofilebtcpay.store.webhooks.canmodifywebhooks在项目根目录下创建一个.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
npm start
对于开发:
npm run dev
使用MCP Inspector: MCP Inspector提供了一个可视界面用于测试:
# 构建项目
npm run build
# 使用BTCPayServer MCP服务器启动检查器
npx @modelcontextprotocol/inspector node dist/index.js
开发工作流:
npm installnpm run buildnode dist/index.jsMCP服务器提供了全面的错误处理:
所有错误都经过正确格式化并带有描述性消息返回。
src/
├── index.ts # 主MCP服务器实现
├── services/ # BTCPayServer服务实现
│ ├── base-service.ts # 基础服务类
│ ├── invoices.ts # 发票管理
│ ├── payment-requests.ts # 付款请求处理
│ ├── stores.ts # 商店管理
│ ├── webhooks.ts # Webhook管理
│ └── ... # 其他服务模块
├── utils/
│ └── btcpay-client.ts # BTCPayServer API客户端
└── types.ts # TypeScript类型定义
npm run build
npm run dev
此MCP服务器兼容BTCPayServer v1.7.0及更高版本。它使用官方的BTCPayServer REST API v1。
MIT许可证 - 详情见LICENSE文件。
对于问题和疑问:
**注意:**某些方法可能无法正常工作。请帮助我们通过报告需求和提出拉取请求来改进它们。此外,为了跟上最新的API版本,我们需要继续更新它。