Rebillia MCP服务器
模型上下文协议(MCP)服务器 Rebillia公用API。它暴露了 工具 调用API,以及 资源 通过API文档,人工智能助手可以管理客户、产品、费率计划,并了解API。
特性
- 工具 –从您的MCP客户端(例如Cursor、Claude Desktop)调用Rebillia端点:
- 客户 (22个工具)-列出、获取、创建、更新、删除;发票(包括未付)、订阅、日志;地址和付款方式;费用/贷项 - 产品 (8个工具)-列出、获取、创建、更新、删除;更新状态;链接/取消链接外部产品 - 产品费率计划 (7个工具)-按产品列出、获取、创建、更新、删除;更新状态;同步 - 产品费率计划费用 (5个工具)-按产品费率计划列出,获取、创建、更新、删除(使用chargeType、chargeModel、billingPeriod、billingTiming枚举和chargeTier数组) - 订阅 (19个工具)-列出、获取、创建、更新、删除;地位;下一张账单、即将发生的费用、发票、日志、外部发票;订阅费率计划和费率计划费用(添加/更新/删除) - 发票 (8个工具)-列出、获取、创建、更新、删除;charge(卡/在线支付类型),charge_外部(离线),无效
- 交易 (4个工具)-列表(customerId、invoiceId、状态、类型、日期发件人/收件人、companyGatewayId、orderBy/sortBy、分页)、获取、退款(金额 分),无效(仅在结算前)
- 比尔跑了 (4个工具)-列表(按已完成/待处理/错误过滤)、获取、更新(newDateTime,ISO 8601;仅待处理)、获取账单运行发票
- 网关 (9个工具)-列出全局网关(发现gblGatewayId和所需的设置密钥),列出公司网关,获取、创建、更新、删除、测试网关,获取客户端令牌,创建设置意图
- 货币 (7个工具)-列出、获取、创建、更新、删除、获取/设置默认货币
- 集成 (8个工具)-列表、获取配置、按键获取/列表;外部发票、产品、订单状态
- 运输 (2个工具)-列出运输服务,计算运输
- 过滤器 (4个工具)-列出筛选器(必填部分),创建筛选器,列出筛选器字段,删除筛选器
- 文档 (1个工具)-
get_api_docs返回概述或其他API文档作为markdown(无外部获取) - 资源 -通过MCP资源提供API文件(
rebillia://docs/*):概述、型号、订阅状态、收费类型、网关。国家列表位于rebillia://globals/countries(id、代码、名称)用于地址工具。全球网关rebillia://globals/gateways(gblGatewayId,requiredFields)用于创建网关。所有文件都是独立的;使用这些或工具,而不是获取外部URL。 - 类型 –与Rebillia Public API响应形状对齐的TypeScript类型
需求
- Node.js 18+
- Rebillia API密钥(见下文)
获取API密钥
- 首选 Rebillia设置/欢迎.
- 选择一个计划 并继续。
- 注册 (创建帐户)或 登录 如果您已经拥有Rebillia帐户。
- 加入公司后,打开 仪表盘.
- 在仪表板中, 复制您的API代币 并将其用作
REBILLIA_API_KEY在您的环境或MCP客户端配置中。
设置
- 克隆并安装
cd /path/to/rebillia-mcp-server
npm install- 配置环境
复制示例env文件并设置API密钥和可选的基本URL:
cp .env.example .env编辑 .env:
REBILLIA_API_KEY=your_api_key_here
REBILLIA_API_URL=https://api.rebillia.com/v1- REBILLIA_API_KEY – 必修的。 用作 X-AUTH-TOKEN 对于所有请求。 - REBILLIA_API_URL –可选。默认为 https://api.rebillia.com/v1 (包括 /v1 用于公共API)。
- 构建
npm run build用法
运行服务器
开发(无构建步骤):
npm run dev生产:
npm run build
npm start或者运行二进制文件:
./node_modules/.bin/rebillia-mcp-server服务器使用 标准 传输:它从stdin读取JSON-RPC并将响应写入stdout。MCP客户端作为子进程连接到它。
配置Claude桌面
- 构建服务器 (如果你还没有):
npm run build- 打开Claude Desktop MCP配置文件:
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - 窗户: %APPDATA%\Claude\claude_desktop_config.json
- 添加Rebillia服务器 在...之下
mcpServers:
{
"mcpServers": {
"rebillia": {
"command": "npx",
"args": ["@rhinosaas/rebillia-mcp-server"],
"env": {
"REBILLIA_API_KEY": "YOUR_API_KEY",
"REBILLIA_API_URL": "https://api.rebillia.com/v1"
}
}
}
}- 重新启动克劳德桌面。 Rebillia工具和资源(包括
get_api_docs)将出现。您可以要求Claude使用Rebillia API或“获取API文档”以获取概述信息。
配置光标
- 构建服务器:
npm run build- 打开光标MCP设置:
- 设置 → 光标设置 → 主控程序,或 - 直接打开MCP配置文件: - macOS/Linux: ~/.cursor/rebillia-mcp-server.json 或项目级别 .cursor/mcp.json
- 窗户:
%USERPROFILE%\.cursor\rebillia-mcp-server.json
- 添加Rebillia服务器 在MCP配置中。例子:
{
"mcpServers": {
"rebillia": {
"command": "npx",
"args": ["@rhinosaas/rebillia-mcp-server"],
"env": {
"REBILLIA_API_KEY": "your_api_key_here",
"REBILLIA_API_URL": "https://api.rebillia.com/v1"
}
}
}
}- 重新启动游标 或者重新加载MCP服务器。Rebillia工具和资源将在AI聊天中提供(例如“列出客户”、“获取API文档”)。
工具
响应是来自Rebillia Public API的JSON(列表端点分页,get为单个对象)。
客户(22工具)
| 工具 | 说明 | |||||||
|---|---|---|---|---|---|---|---|---|
list_customers | 列出客户(pageNo、itemPerPage、query、status、sortBy、orderBy、include、filterId)。 | |||||||
get_customer | 按ID获取客户(可选包括:地址簿、付款方式、lastInvoice、订阅、未付款发票、外部客户)。 | |||||||
create_customer | 创建客户(名字、姓氏、电子邮件、可选字段)。 | |||||||
update_customer | 按ID更新客户 | |||||||
delete_customer | 按ID删除客户 | |||||||
get_customer_invoices | 获取客户的发票(可选:状态=已授权 | 已过账 | 已取消 | 部分已支付 | 已支付 | 作废 | 退款 | 部分退款、日期从、日期到、订阅ID、包含、页码、项目每页)。 |
get_customer_unpaid_invoices | 为客户获取未付发票(GET /customers/{customerId}/invoices/unpaid)可选 pageNo, itemPerPage. | |||||||
get_customer_subscriptions | 为客户获取订阅。 | |||||||
get_customer_logs | 为客户获取日志。 | |||||||
list_customer_addresses | 列出客户的通讯簿条目(pageNo,itemPerPage)。 | |||||||
get_customer_address | 通过ID获取地址 | |||||||
create_customer_address | 创建地址(姓名、联系人姓名、街道1、城市、州、邮政编码、国家代码(ISO 3166-1 alpha-2)、类型等)。 | |||||||
update_customer_address | 按ID更新地址(部分更新)。必填项:customerId、addressId。可选:任何地址字段(例如街道1、城市、州、邮政编码、国家代码、姓名、联系人姓名、街道2、公司、联系人电子邮件、联系人电话、类型(住宅 | 商业))。 | ||||||
delete_customer_address | 按ID删除地址 | |||||||
list_customer_payment_methods | 列出客户的付款方式(pageNo,itemPerPage)。 | |||||||
get_customer_payment_method | 通过ID获取付款方式 | |||||||
create_customer_payment_method | 创建支付方式(网关无关)。必填项:companyGatewayId、类型、, 付款方式,账单地址(国家代码,…)。通过Get_client_token获取客户端凭据;使用您的支付UI生成paymentMethodNonce。没有原始卡数据或网关特定字段。 | |||||||
update_customer_payment_method | 更新付款方式账单地址(网关无关)。必填项:customerId、paymentMethodId、账单地址(国家代码,…)。没有支付或网关特定字段。 | |||||||
delete_customer_payment_method | 按ID删除付款方式 | |||||||
list_customer_charges_credits | 列出费用/积分(可选状态、类型)。 | |||||||
create_customer_charge_credit | 创建费用/信用(金额 分、描述、类型、公司当前ID、类别等)。 | |||||||
delete_customer_charge_credit | 按ID删除费用/信用 |
产品(8工具)
| 工具 | 说明 | |||||||
|---|---|---|---|---|---|---|---|---|
list_products | 列出产品(包括:productRateplan、productRateplan Charge、chargeTier;状态:已发布 | 草稿 | 已存档 | 已禁用;名称;类别:base产品 | 插件 | 捆绑产品 | 杂项 | 服务;orderBy、sortBy、itemPerPage、pageNo)。 |
get_product | 按ID获取产品 | |||||||
create_product | 创建产品(名称、类别、可选描述、sku)。 | |||||||
update_product | 按ID更新产品 | |||||||
delete_product | 按ID删除产品(级联到产品费率计划)。 | |||||||
update_product_status | 更新状态(已发布、已存档、已禁用)。 | |||||||
link_external_product | 链接外部产品(产品ID、公司集成ID、外部产品ID、设置)。 | |||||||
unlink_external_product | 按ID取消外部产品链接 |
产品费率计划(7个工具)
| 工具 | 说明 | ||
|---|---|---|---|
list_product_rate_plans | 列出产品的产品费率计划(GET/products/{productId}/产品费率计划)。 | ||
get_product_rate_plan | 按ID获取产品费率计划 | ||
create_product_rate_plan | 创建产品费率计划(productId、名称、类型:合同 | 进行中 | 预付)。 |
update_product_rate_plan | 按ID更新产品费率计划 | ||
delete_product_rate_plan | 按ID删除产品费率计划 | ||
update_product_rate_plan_status | 更新状态(已发布、已存档、已禁用、停止)。 | ||
sync_product_rate_plan | 同步产品费率计划(POST…/Sync)。 |
产品费率计划费用(5个工具)
| 工具 | 说明 |
|---|---|
list_product_rate_plan_charges | 列出产品费率计划的产品费率计划费用(GET…/产品费率计划收费)。 |
get_product_rate_plan_charge | 按ID获取产品费率计划费用 |
create_product_rate_plan_charge | 创建产品费率计划费用(ratePlanId、名称、chargeType、chargeModel、billCycleType、类别、, chargeTier 数组、应税、重量、endDateCondition等)。枚举:计费类型(一次性、重复、使用)、计费模式(固定费用定价、按单位定价、分层定价、数量定价)、计费周期(日、周、月、年)、计费时间(提前、拖欠)。 |
update_product_rate_plan_charge | 按ID更新产品费率计划费用 |
delete_product_rate_plan_charge | 按ID删除产品费率计划费用 |
订阅(19个工具)
| 工具 | 说明 | |||||||
|---|---|---|---|---|---|---|---|---|
list_subscriptions | 列出订阅(包括、查询、orderBy、sortBy、filterId、状态、customerId、companyGatewayId、dateFrom、dateTo、itemPerPage、pageNo)。 status 支持:活动、暂停、请求付款、存档。 dateFrom/dateTo 是 YYYY-MM-DD 创建了AT范围过滤器。 | |||||||
get_subscription | 按ID获取订阅 | |||||||
create_subscription | 根据产品费率计划创建订阅(productRatePlanId、customerId、customerPaymentMethodId、billingAddressId、effectiveStartDate)。 | |||||||
update_subscription | 按ID更新订阅 | |||||||
delete_subscription | 按ID删除订阅 | |||||||
update_subscription_status | 更新状态(例如已存档)。 | |||||||
get_subscription_upcoming_charges | 即将到来的指控。 | |||||||
get_subscription_invoices | 订阅发票。 | |||||||
get_subscription_logs | 订阅日志。 | |||||||
get_subscription_external_invoices | 外部发票。 | |||||||
list_subscription_rate_plans | 订阅费率计划(可选状态:活动 | 暂停 | 取消 | 已存档;类型:正在进行 | 预付 | 合同,不区分大小写)。 | ||
get_subscription_rate_plan | 按ID获取费率计划 | |||||||
add_subscription_rate_plan | 将费率计划添加到订阅中。 | |||||||
update_subscription_rate_plan | 更新费率计划(生效日期等)。 | |||||||
remove_subscription_rate_plan | 从订阅中删除费率计划。 | |||||||
get_subscription_rate_plan_charge | 按ID获取费率计划费用 | |||||||
add_subscription_rate_plan_charge | 将费用添加到费率计划中。必填项:subscriptionId、ratePlanId、数量、名称、类别(物理 | 数字)、chargeModel(flatFeePricing | perUnitPricing | tiered Pricing | volumePricing)、billCycleType、chargeTier(数组:货币、所需价格;可选起始单位、结束单位、价格格式、层级)、charge Type(一次性 | 重复使用 | 使用)、endDateCondition(subscriptionEnd | fixedPeriod)、应税(布尔值)、重量。当chargeType重复出现时,还需要账单周期对齐和特定的账单周期。 |
update_subscription_rate_plan_charge | 更新费率计划费用。必填项:subscriptionId、chargeId、数量、名称、chargeModel、billCycleType、chargeTier(货币、价格)、chargeType、endDate条件、应税、重量。当chargeType重复出现时,需要billingPeriod对齐。 | |||||||
remove_subscription_rate_plan_charge | 从费率计划中删除费用。 |
发票(8个工具)
| 工具 | 说明 |
|---|---|
list_invoices | 列出发票(包括、状态、查询、orderBy、sortBy、filterId、itemPerPage、pageNo)。 |
get_invoice | 按ID获取发票 |
create_invoice | 创建发票。必填项:companyCurrentId、companyGatewayId、customerId、paymentMethodId、详细信息。可选的账单地址/发货地址使用国家代码(ISO 3166-1 alpha-2)。金额可以是“41.00”(美元)或4100(美分);该工具总是向publicAPI发送美分。 |
update_invoice | 更新发票(仅过账/请求付款)。 |
delete_invoice | 按ID删除发票 |
charge_invoice | 收费发票(卡/在线)。必填项:发票ID、金额(美分)、付款类型(例如第三方付款提供商)。 |
charge_invoice_external | 线下收费(现金/支票/电汇)。必填项:发票ID,金额(美分)。 |
void_invoice | 无效发票(不可撤销)。 |
交易(4种工具)
| 工具 | 说明 | ||||||||
|---|---|---|---|---|---|---|---|---|---|
list_transactions | 列出交易记录(customerId、invoiceId、状态、类型、日期发件人、日期收件人、公司网关Id、orderBy、sortBy、itemPerPage、pageNo)。 status:已结算 | 已授权 | 已拒绝 | 错误 | 已作废 | 需要支付方式 | 等待结算 | 已被授权并持有。 type:出售 | 退款。 |
get_transaction | 按ID获取交易 | ||||||||
refund_transaction | 退款交易。必填项:交易ID、金额(以美分计例如250=2.50美元)。 | ||||||||
void_transaction | 无效交易(仅在结算前)。 |
Bill runs(4个工具)
| 工具 | 说明 |
|---|---|
list_bill_runs | 列表法案运行。可选:包括(例如发票)、查询(已完成/待处理/错误)、orderBy、sortBy、itemPerPage、pageNo。 |
get_bill_run | 按ID运行账单 |
update_bill_run | 更新账单运行时间表。必填:billRunId,newDateTime(ISO 8601,例如2026-02-26T20:05:00Z)。注意:此工具仅适用于状态为待定的账单运行。对已完成或错误运行的调用将失败。 |
get_bill_run_invoices | 获取账单运行的发票。可选:页码,每页项目数。 |
网关(9个工具)
| 工具 | 说明 |
|---|---|
list_global_gateways | 列出可用的全球网关类型(例如Stripe、Braintree)。退货 gbl网关ID名称,密钥名称, 必填字段 (设置键)和字段详细信息。之前叫这个 create_gateway 发现有效的网关ID以及要传入的密钥 setting. |
list_gateways | 列出公司网关。 |
get_gateway | 按ID获取网关 |
create_gateway | 创建网关。必修的: gbl网关ID (从 list_global_gateways), 设置 (具有来自该网关的密钥的对象 requiredFields).可选:displayName、card、paymentMethod。使用 list_global_gateways 首先获取gblGatewayId和所需的凭据字段名称。 |
update_gateway | 按ID更新网关 |
delete_gateway | 按ID删除网关 |
test_gateway | 测试网关连接。 |
get_client_token | 获取网关客户端凭据以初始化您的支付集成并生成 付款方式 对于create_customer_payment_方法。网关不可知。必填项:gatewayId。可选:customerId; PayFabric需要,其他人可选。 |
create_setup_intent | 通过以下方式创建/检索设置意图 /gateways/{companyGatewayId}/customers/{customerId}/setup_intent.使用setupIntent.id作为 付款方式 用于create_customer_payment_method(网关无关的支付流)。 |
网关创建示例流程: (1) 呼叫 list_global_gateways (无参数)。(2)选择一个网关(例如Stripe、Braintree)并记录其 gblGatewayId 和 requiredFields(3)建立一个 setting 使用这些密钥和凭据值创建对象。(4)电话 create_gateway 说完这个 gblGatewayId 和 setting。参见 rebillia://docs/gateways 或 get_api_docs 随着 doc: "gateways" 了解全部细节。
货币(7种工具)
| 工具 | 说明 |
|---|---|
list_currencies | 列出公司货币。 |
get_currency | 按ID获取货币 |
create_currency | 创建公司货币。 |
update_currency | 按ID更新货币 |
delete_currency | 按ID删除货币 |
get_default_currency | 获取默认公司货币。 |
set_default_currency | 按ID设置默认货币 |
集成(8个工具)
| 工具 | 说明 |
|---|---|
list_integrations | 列出公司集成。 |
get_integration_config | 按ID获取集成配置 |
get_integration_by_key | 按键进行集成。 |
list_integrations_by_key | 按键列出集成。 |
list_external_invoices | 列出外部发票。 |
list_external_products | 列出外部产品(需要productName)。 |
get_external_product | 按ID获取外部产品 |
list_order_statuses | 列出订单状态。 |
发货(2个工具)
| 工具 | 说明 |
|---|---|
list_shipping_services | 列出运输服务。 |
calculate_shipping | 计算运费(公司货币ID、来自邮政编码、来自国家、邮政编码、国家、重量、订单金额等)。 |
过滤器(4个工具)
| 工具 | 说明 |
|---|---|
list_filters | 列出公司筛选器。必填:部分(例如订阅、发票、客户、产品、订单、账单)。 |
create_filter | 创建过滤器(节、显示名称、规则)。 |
list_filter_fields | 列出节的筛选字段。 |
remove_filter | 按ID删除公司筛选器(Delete/companys/filters/{filterId})。 |
文档(1个工具)
| 工具 | 说明 | ||||
|---|---|---|---|---|---|
get_api_docs | 获取Rebillia API文档作为降价。默认值:概述(基本URL、身份验证、分页、日期、金额)。可选:doc=概述 | 型号 | 订阅状态 | 收费类型 | 网关。使用此功能,Claude可以在不获取外部URL的情况下读取文档 |
资源
API文件作为MCP资源公开在 rebillia://docs/*.使用 resources/list 然后 resources/read 使用URI,或调用 get_api_docs 工具。所有文件都是独立的;不要获取外部URL。
| URI | 描述 |
|---|---|
rebillia://docs/overview | 概述文档-基本URL、身份验证、分页、日期格式、金额处理(请先阅读此内容) |
rebillia://docs/models | 领域模型层次结构和关系 |
rebillia://docs/subscription-statuses | 订阅状态:活动、暂停、已存档、请求付款 |
rebillia://docs/charge-types | chargeType、chargeModel、billingPeriod、billingTiming枚举 |
rebillia://docs/gateways | 网关创建流程:使用 list_global_gateways 发现gblGatewayId和requiredFields,然后构建 setting 并致电 create_gateway |
rebillia://globals/gateways | 全局网关列表(当客户端提供时):gblGatewayId、name、keyName、requiredFields、fieldDetails-与一起使用 create_gateway |
项目结构
src/
├── index.ts # MCP server entry, tools + resources handlers
├── client.ts # HTTP client for Rebillia API (X-AUTH-TOKEN)
├── types.ts # Rebillia API types (customers, invoices, etc.)
├── services/ # API call layer (used by tools)
│ ├── customerServices.ts
│ ├── productServices.ts
│ ├── productRatePlanServices.ts
│ ├── productRatePlanChargeServices.ts
│ ├── subscriptionServices.ts
│ ├── invoiceServices.ts
│ ├── transactionServices.ts
│ ├── billRunServices.ts
│ ├── gatewayServices.ts
│ ├── globalGatewayService.ts
│ ├── countryResolverService.ts
│ ├── currencyServices.ts
│ ├── integrationServices.ts
│ ├── shippingServices.ts
│ └── filterServices.ts
├── tools/
│ ├── index.ts # Tool registry, getToolDefinitions(), executeTool()
│ ├── types.ts # Tool definition and handler types
│ ├── customers/ # Customer tools (22)
│ ├── products/ # Product tools (8)
│ ├── product_rate_plans/ # Product rate plan tools (7)
│ ├── product_rate_plan_charges/ # Product rate plan charge tools (5)
│ ├── subscriptions/ # Subscription tools (19)
│ ├── invoices/ # Invoice tools (8)
│ ├── transactions/ # Transaction tools (4)
│ ├── bill_runs/ # Bill run tools (4)
│ ├── gateways/ # Gateway tools (9)
│ ├── currencies/ # Currency tools (7)
│ ├── integrations/ # Integration tools (8)
│ ├── shipping/ # Shipping tools (2)
│ ├── filters/ # Filter tools (4)
│ └── docs/ # get_api_docs (1)
├── resources/
│ ├── index.ts # listResources(), readResource()
│ └── api-docs.ts # registerResources(), doc resources, getDocContent()
├── prompts/ # (reserved for MCP prompts)
└── types/
└── addressInput.ts脚本
| 脚本 | 命令 | 描述 |
|---|---|---|
| 建造 | npm run build | 将TypeScript编译为 dist/ |
| 开始 | npm start | 快跑 node dist/index.js |
| dev | npm run dev | 跑步 tsx (无构建) |
| 测试 | npm test | 运行Vitest |
| 测试:运行 | npm run test:run | 运行一次测试(非监视模式) |
许可证
麻省理工学院
