BitRefill MCP 服务器是基于 TypeScript 的最小可行产品(MCP)服务器,借助 Model Context Protocol 提供 BitRefill 服务。它能实现礼品卡与电子货币搜索、手机充值等功能,为用户使用比特币购买礼品卡和充值手机提供便利。
BitRefill MCP 服务器通过 Model Context Protocol (MCP) 提供工具,让 AI 助手(如 Claude)调用 BitRefill 的功能。其工作流程如下:
由于服务器通过标准输入输出 (stdio) 进行通信,可使用任何支持 MCP 的工具进行调试。
git clone https://github.com/bitrefill/bitrefill-mcp-server.git
cd bitrefill-mcp-server
npm install
要通过 Smithery 自动安装 BitRefill:
npx -y @smithery/cli install @bitrefill/bitrefill-mcp-server --client claude
docker build -t bitrefill-mcp-server .
docker run -it --rm -e BITREFILL_API_SECRET=your_api_key_here -e BITREFILL_API_ID=your_api_id_here bitrefill-mcp-server
在根目录下创建一个 .env
文件(可参考 .env.example
),并添加以下内容:
BITREFILL_API_SECRET=your_api_key_here
BITREFILL_API_ID=your_api_id_here
注意:如果没有设置 API 凭证,create_invoice
工具将不可用,并且不会注册到 MCP 服务器中。
npm run build
npm run watch
由于 BitRefill MCP 服务器通过 stdio 进行通信,调试可能具有挑战性。我们推荐使用 MCP Inspector:
npm run inspector
Inspector 将提供一个 URL,用于在浏览器中访问调试工具。
在以下路径添加服务器配置:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
配置内容如下:
{
"mcpServers": {
"bitrefill": {
"command": "npx",
"args": ["@smithery/cli", "start"],
"env": {
"BITREFILL_API_SECRET": "your_api_key_here",
"BITREFILL_API_ID": "your_api_id_here"
}
}
}
}
在 ~/.config/eline/mcp-config.json
文件中添加以下内容:
{
"servers": {
"bitrefill": {
"command": "npx",
"args": ["@smithery/cli", "start"],
"env": {
"BITREFILL_API_SECRET": "your_api_key_here",
"BITREFILL_API_ID": "your_api_id_here"
}
}
}
}
在 config/cursor.mcp.json
文件中添加以下内容:
{
"servers": {
"bitrefill": {
"command": "npx",
"args": ["@smithery/cli", "start"],
"env": {
"BITREFILL_API_SECRET": "your_api_key_here",
"BITREFILL_API_ID": "your_api_id_here"
}
}
}
}
bitrefill-mcp-server/
├── src/ # 源代码
│ ├── server.ts # 主服务器文件
│ └── tools/ # 可用工具
└── package.json # 项目依赖和配置