article
README
🚀 Bitrefill MCP 服务器
Bitrefill MCP 服务器是一个基于 TypeScript 的服务器,它实现了模型上下文协议 (Model Context Protocol),能够向 AI 助手暴露 Bitrefill 功能。借助该服务器,用户可以方便地访问 Bitrefill 服务,实现搜索礼品卡、手机充值等操作。
🚀 快速开始
服务器运行步骤
- 安装依赖项:
npm install - 构建服务器:
npm run build - 开发模式(自动重建):
npm run watch - 调试:
使用 MCP 监视器进行调试,命令如下:
该工具将提供一个浏览器 URL,用于访问调试工具。npm run inspector
📦 安装指南
通过 Smithery 安装
自动安装 Bitrefill 到 Claude Desktop:
npx -y @smithery/cli install @bitrefill/bitrefill-mcp-server --client claude
在 Claude Desktop 中配置
在相应路径下添加服务器配置:
- MacOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%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"
}
}
}
}
在 Cline 中配置
- 打开 Cline 设置。
- 进入“MCP 服务器”选项卡。
- 点击“配置 MCP 服务器”。
- 添加以下配置:
{
"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"
}
}
}
}
在 Cursor 中配置
- 打开 Cursor 设置。
- 进入“功能”设置。
- 在“MCP 服务器”部分,点击“添加新 MCP 服务器”。
- 输入名称并选择类型为“command”。
- 在“Command”字段中输入:
npx -y bitrefill-mcp-server
使用 Docker 运行
- 构建镜像:
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 服务器,为您的应用添加强大的区块链数据查询功能。
微信扫一扫