使用说明

项目简介

Bitrefill MCP Server 是一个实现了 Model Context Protocol (MCP) 的服务器,旨在为 Claude 等 AI 助手提供访问 Bitrefill 服务的桥梁。通过此服务器,AI 助手可以查询 Bitrefill 上的礼品卡、手机充值等产品信息,并获取详细的产品数据。

主要功能点

  • 资源访问 (Resources):
    • 'bitrefill://product-types': 获取 Bitrefill 上可用的产品类型列表 (例如:礼品卡、充值卡等)。
    • 'bitrefill://categories/{type}': 获取特定产品类型下的可用类别列表 (例如:礼品卡类型下的 "电商", "娱乐" 等类别)。
  • 工具调用 (Tools):
    • 'search': 搜索礼品卡、eSIM卡、手机充值等产品。可以根据关键词、国家、语言、类别等条件进行搜索。
    • 'detail': 获取指定产品的详细信息,例如产品描述、价格、使用条款等。
    • 'categories': 获取完整的产品类型和类别映射关系,方便用户了解可搜索的产品范围。

安装步骤

  1. 安装 Node.js 和 npm: 确保你的系统已安装 Node.js 和 npm (Node 包管理器)。
  2. 下载仓库代码: 从 GitHub 仓库 https://github.com/bitrefill/bitrefill-mcp-server 下载代码到本地。
  3. 安装依赖: 在仓库根目录下打开终端,运行命令 'npm install' 安装项目依赖。
  4. 构建项目: 运行命令 'npm run build' 构建服务器代码。

服务器配置

MCP 服务器需要配置到 MCP 客户端 (例如 Claude, Cline, Cursor) 中才能使用。以下是针对不同客户端的配置示例,你只需要将配置信息添加到对应的客户端设置中即可。注意:以下配置信息为 JSON 格式,直接复制粘贴到客户端的配置文件中即可,无需修改代码。

Claude Desktop 配置

修改 Claude Desktop 的配置文件 ('claude_desktop_config.json'),添加 'mcpServers' 配置项。

  • MacOS: '~/Library/Application Support/Claude/claude_desktop_config.json'
  • Windows: '%APPDATA%/Claude/claude_desktop_config.json'
{
  "mcpServers": {
    "bitrefill": {  // 服务器名称,可以自定义
      "command": "npx", // 启动命令,这里使用 npx
      "args": ["-y", "bitrefill-mcp-server"] // 启动参数,执行 bitrefill-mcp-server
    }
  }
}

Cline 配置

在 Cline 扩展设置的 "MCP Servers" 选项卡中,点击 "Configure MCP Servers",添加以下配置。

{
  "mcpServers": {
    "github.com/bitrefill/bitrefill-mcp-server": { // 服务器名称,建议使用仓库地址
      "command": "npx", // 启动命令,这里使用 npx
      "args": ["-y", "bitrefill-mcp-server"], // 启动参数,执行 bitrefill-mcp-server
      "disabled": false, // 设置为 false 启用服务器
      "autoApprove": ["search", "detail", "categories"] // 自动批准的工具列表,无需每次调用都请求用户授权
    }
  }
}

Cursor 配置

在 Cursor 设置的 "Features" -> "MCP Servers" 部分,点击 "Add new MCP Server",选择 "command" 类型,并填写以下信息。

  • Name: bitrefill-mcp-server (自定义服务器名称)
  • Type: command
  • Command: 'npx -y bitrefill-mcp-server' (启动命令和参数)

基本使用方法

配置完成后,在支持 MCP 协议的 AI 客户端中 (例如 Claude, Cline, Cursor),AI 助手将能够:

  1. 发现 Bitrefill 服务器提供的功能。 客户端会自动检测并显示可用的资源和工具。
  2. 使用 'search' 工具搜索商品。 例如,你可以指示 AI 助手 "使用 Bitrefill 搜索 Amazon 礼品卡"。
  3. 使用 'detail' 工具获取商品详情。 如果搜索结果返回了商品 ID,你可以让 AI 助手使用该 ID 调用 'detail' 工具获取更详细的信息。
  4. 使用 'categories' 工具了解商品分类。 在搜索前,可以使用 'categories' 工具了解 Bitrefill 提供的商品类型和类别,以便更精确地进行搜索。
  5. 访问 'product-types' 和 'product-categories' 资源获取商品类型和类别信息。 客户端可以请求这些资源以获取结构化的产品信息。

注意: 由于 MCP 服务器通过 stdio 与客户端通信,调试可能相对复杂。可以使用仓库 README 中推荐的 MCP Inspector 工具辅助调试。

信息

分类

商业系统