Bitrefill MCP 服务器是一个基于 TypeScript 的服务器,它实现了模型上下文协议 (Model Context Protocol),能够向 AI 助手暴露 Bitrefill 功能。借助该服务器,用户可以方便地访问 Bitrefill 服务,实现搜索礼品卡、手机充值等操作。
npm install
npm run build
npm run watch
npm run inspector
该工具将提供一个浏览器 URL,用于访问调试工具。自动安装 Bitrefill 到 Claude Desktop:
npx -y @smithery/cli install @bitrefill/bitrefill-mcp-server --client claude
在相应路径下添加服务器配置:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%/Claude/claude_desktop_config.json配置内容如下:
{
"mcpServers": {
"bitrefill": {
"command": "npx",
"args": ["-y", "bitrefill-mcp-server"],
"env": {
"BITREFILL_API_SECRET": "your_api_key_here",
"BITREFILL_API_ID": "your_api_id_here"
}
}
}
}
{
"mcpServers": {
"github.com/bitrefill/bitrefill-mcp-server": {
"command": "npx",
"args": ["-y", "bitrefill-mcp-server"],
"disabled": false,
"autoApprove": ["search", "detail", "categories"],
"env": {
"BITREFILL_API_ID": "your_api_id_here",
"BITREFILL_API_SECRET": "your_api_key_here"
}
}
}
}
npx -y bitrefill-mcp-server
docker build -t bitrefill-mcp-server .
docker run -e BITREFILL_API_SECRET=your_api_key_here -e BITREFILL_API_ID=your_api_id_here bitrefill-mcp-server
docker run -v $(pwd):/app --env-file .env bitrefill-mcp-server
bitrefill-mcp-server/
├── src/
│ ├── main.ts # 主程序入口
│ ├── tools/ # 各个工具实现
│ │ ├── search.ts # 搜索功能
│ │ ├── detail.ts # 详细信息查询
│ │ └── categories.ts # 类别管理
├── .env.example # 环境变量示例文件
└── package.json # 项目依赖及脚本配置
在根目录创建 .env 文件,并添加以下内容:
BITREFILL_API_SECRET=your_api_key_here
BITREFILL_API_ID=your_api_id_here
以下是几种常见操作的使用示例:
{
"tool": "search",
"args": ["bitcoin", "ethereum"]
}
{
"tool": "detail",
"args": ["BTC"]
}
{
"tool": "categories",
"command": "list"
}
⚠️ 重要提示
- 服务器默认绑定到
localhost:4012。- 确保环境变量正确设置,以启用
create_invoice工具。- 使用 Docker 时,确保已安装 Docker 并配置正确。
通过以上步骤,您可以轻松集成 Bitrefill 的 MCP 服务器,为您的应用添加强大的区块链数据查询功能。