关于 Rebilla MCP Server
Rebilla MCP Server 将 MCP 客户端连接到 Rebillia Public API,用于管理计费数据。它通过工具操作客户、产品、订阅、发票等,并提供文档资源。
主要功能
- 01管理客户、地址和支付方式
- 02管理产品和费率方案
- 03处理订阅和发票
- 04查询交易与账单批次
- 05管理网关、货币和集成
- 06访问 API 文档及参考资源
适用场景
- 01维护客户记录和支付方式
- 02创建或更新产品及费率方案
- 03查看订阅、发票和交易
- 04通过 MCP 客户端查阅 Rebillia API 文档
MCP 相关
提供调用 Rebillia Public API 端点的工具,以及包含 API 文档和参考数据的资源。MCP 客户端通过 stdio 连接服务器。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
本地服务需要在你的电脑上运行后才能读取工具,维护者暂未提供工具列表。
详细介绍
Rebillia MCP 服务
用于 Rebillia Public API 的模型上下文协议(MCP)服务。它提供用于调用 API 的工具以及包含 API 文档的资源,以便 AI 助手管理客户、产品、费率计划并了解 API。
功能
- 工具 – 从 MCP 客户端(例如 Cursor、Claude Desktop)调用 Rebillia 端点:
- 客户(22 个工具)– 列出、获取、创建、更新、删除;发票(包括未付款发票)、订阅、日志;地址和付款方式;扣款/抵扣
- 产品(8 个工具)– 列出、获取、创建、更新、删除;更新状态;关联/取消关联外部产品
- 产品费率计划(7 个工具)– 按产品列出、获取、创建、更新、删除;更新状态;同步
- 产品费率计划扣款(5 个工具)– 按产品费率计划列出、获取、创建、更新、删除(包含 chargeType、chargeModel、billingPeriod、billingTiming 枚举和 chargeTier 数组)
- 订阅(19 个工具)– 列出、获取、创建、更新、删除;状态;下一次账单、即将产生的扣款、发票、日志、外部发票;订阅费率计划和费率计划扣款(添加/更新/移除)
- 发票(8 个工具)– 列出、获取、创建、更新、删除;扣款(银行卡/在线,带有 paymentType)、charge_external(线下)、作废
- 交易(4 个工具)– 列出(customerId、invoiceId、status、type、dateFrom/dateTo、companyGatewayId、orderBy/sortBy、分页)、获取、退款(金额以分为单位)、作废(仅限结算前)
- 账单批次(4 个工具)– 列出(按 completed/pending/error 筛选)、获取、更新(newDateTime,ISO 8601;仅限待处理)、获取账单批次发票
- 网关(9 个工具)– 列出全局网关(查询 gblGatewayId 和必需的设置键)、列出公司网关、获取、创建、更新、删除、测试网关、获取客户端令牌、创建设置意图
- 货币(7 个工具)– 列出、获取、创建、更新、删除、获取/设置默认货币
- 集成(8 个工具)– 列出、获取配置、按键获取/列出;外部发票、产品、订单状态
- 配送(2 个工具)– 列出配送服务、计算配送费用
- 筛选器(4 个工具)– 列出筛选器(必须指定 section)、创建筛选器、列出筛选字段、移除筛选器
- 文档(1 个工具)–
get_api_docs以 Markdown 格式返回概览或其他 API 文档(不进行外部获取) - 资源 – 通过 MCP 资源(
rebillia://docs/*)提供 API 文档:概览、模型、订阅状态、扣款类型、网关。地址工具可使用rebillia://globals/countries中的国家列表(id、code、name)。创建网关可使用rebillia://globals/gateways中的全局网关(gblGatewayId、requiredFields)。所有文档均为独立内容;请使用这些文档或该工具,而非获取外部 URL。 - 类型 – 与 Rebillia Public API 响应结构一致的 TypeScript 类型
要求
- Node.js 18+
- Rebillia API 密钥(见下文)
获取 API 密钥
- 前往 Rebillia 设置 / 欢迎页面。
- 选择套餐并继续。
- 注册(创建账户),或者如果你已有 Rebillia 账户,则登录。
- 进入公司页面后,打开仪表板。
- 在仪表板中,复制 API Token,并在环境或 MCP 客户端配置中将其用作
REBILLIA_API_KEY。
快速开始
无需安装——npx 会自动处理所有事情。获取 API Key 后,只需在下方的使用方法部分选择你的 AI 客户端并粘贴配置。
开发
供希望从源代码在本地运行服务的贡献者使用。
-
克隆并安装
cd /path/to/rebillia-mcp-server npm install -
配置环境
复制示例环境文件,并设置 API 密钥和可选的基础 URL:
cp .env.example .env编辑
.env:REBILLIA_API_KEY=your_api_key_here REBILLIA_API_URL=https://api.rebillia.com/v1REBILLIA_API_KEY– 必填。 所有请求均使用该值作为X-AUTH-TOKEN。REBILLIA_API_URL– 可选。默认为https://api.rebillia.com/v1(公共 API 需包含/v1)。
-
构建
npm run build
使用方法
该服务使用 stdio 传输:从 stdin 读取 JSON-RPC,并将响应写入 stdout。MCP 客户端以子进程方式连接到它。
配置 Claude Desktop
-
打开 Claude Desktop MCP 配置文件:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
在
mcpServers下添加 Rebillia 服务:{ "mcpServers": { "rebillia": { "command": "npx", "args": [“-y”, “@rebilliaai/mcp-server”], "env": { "REBILLIA_API_KEY": "YOUR_API_KEY", "REBILLIA_API_URL": "https://api.rebillia.com/v1" } } } } -
重启 Claude Desktop。 Rebillia 工具和资源(包括
get_api_docs)将会显示。你可以让 Claude 使用 Rebillia API,或“获取 API 文档”以了解概况。
配置 Cursor
- 打开 Cursor MCP 设置:
- 设置 → Cursor 设置 → MCP,或
- 直接打开 MCP 配置文件:
- macOS/Linux:
~/.cursor/mcp.json或项目级.cursor/mcp.json
- macOS/Linux:
- Windows:
%USERPROFILE%\.cursor\mcp.json
-
在 MCP 配置中添加 Rebillia 服务。示例:
{ "mcpServers": { "rebillia": { "command": "npx", "args": [“-y”, “@rebilliaai/mcp-server”], "env": { "REBILLIA_API_KEY": "your_api_key_here", "REBILLIA_API_URL": "https://api.rebillia.com/v1" } } } } -
重启 Cursor或重新加载 MCP 服务。Rebillia 工具和资源将在 AI 聊天中可用(例如,“列出客户”“获取 API 文档”)。
工具
响应为 Rebillia 公共 API 返回的 JSON(列表端点会分页,获取端点返回单个对象)。
客户(22 个工具)
| 工具 | 描述 |
|---|---|
list_customers | 列出客户(pageNo、itemPerPage、query、status、sortBy、orderBy、include、filterId)。 |
get_customer | 按 ID 获取客户(可选 include:addressbook、paymentmethod、lastInvoice、subscriptions、unpaidInvoices、externalCustomers)。 |
create_customer | 创建客户(firstName、lastName、email、可选字段)。 |
update_customer | 按 ID 更新客户。 |
delete_customer | 按 ID 删除客户。 |
get_customer_invoices | 获取客户的发票(可选:status = authorized|posted|canceled|partialPaid|paid|voided|refund|partialRefund、dateFrom、dateTo、subscriptionId、include、pageNo、itemPerPage)。 |
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 | 创建地址(name、contactName、street1、city、state、zip、countryCode(ISO 3166-1 alpha-2)、type,…)。 |
update_customer_address | 按 ID 更新地址(部分更新)。必填:customerId、addressId。可选:任意地址字段(例如 street1、city、state、zip、countryCode、name、contactName、street2、company、contactEmail、contactPhone、type(residential|commercial))。 |
delete_customer_address | 按 ID 删除地址。 |
list_customer_payment_methods | 列出客户的付款方式(pageNo、itemPerPage)。 |
get_customer_payment_method | 按 ID 获取付款方式。 |
create_customer_payment_method | 创建付款方式(与网关无关)。必填:companyGatewayId、type、paymentMethodNonce、billingAddress(countryCode,…)。通过 get_client_token 获取客户端凭据;使用你的付款界面生成 paymentMethodNonce。不接受原始卡片数据或特定网关字段。 |
update_customer_payment_method | 更新付款方式的账单地址(与网关无关)。必填:customerId、paymentMethodId、billingAddress(countryCode,…)。不接受付款或特定网关字段。 |
delete_customer_payment_method | 按 ID 删除付款方式。 |
list_customer_charges_credits | 列出费用/贷项(可选 status、type)。 |
create_customer_charge_credit | 创建费用/贷项(金额以美分计、description、type、companyCurrencyId、category,…)。 |
delete_customer_charge_credit | 按 ID 删除费用/贷项。 |
产品(8 个工具)
| 工具 | 描述 |
|---|---|
list_products | 列出产品(include:productRateplan、productRateplanCharge、chargeTier;status:published|draft|archived|disabled;name;category:baseProducts|addOn|bundleProduct|miscellaneous|service;orderBy、sortBy、itemPerPage、pageNo)。 |
get_product | 按 ID 获取产品。 |
create_product | 创建产品(name、category、可选 description、sku)。 |
update_product | 按 ID 更新产品。 |
delete_product | 按 ID 删除产品(会级联删除产品费率计划)。 |
update_product_status | 更新状态(published、archived、disabled)。 |
link_external_product | 关联外部产品(productId、companyIntegrationId、外部 productId、settings)。 |
unlink_external_product | 按 ID 取消关联外部产品。 |
产品费率计划(7 个工具)
| 工具 | 描述 |
|---|---|
list_product_rate_plans | 列出产品的产品费率计划(GET /products/{productId}/product-rateplans)。 |
get_product_rate_plan | 按 ID 获取产品费率计划。 |
create_product_rate_plan | 创建产品费率计划(productId、name、type:contract|ongoing|prepaid)。 |
update_product_rate_plan | 按 ID 更新产品费率计划。 |
delete_product_rate_plan | 按 ID 删除产品费率计划。 |
update_product_rate_plan_status | 更新状态(published、archived、disabled、discontinue)。 |
sync_product_rate_plan | 同步产品费率计划(POST …/sync)。 |
产品费率计划费用(5 个工具)
| 工具 | 描述 |
|---|---|
list_product_rate_plan_charges | 列出产品费率计划的费用(GET …/product-rateplan-charges)。 |
get_product_rate_plan_charge | 按 ID 获取产品费率计划费用。 |
create_product_rate_plan_charge | 创建产品费率计划费用(ratePlanId、name、chargeType、chargeModel、billCycleType、category、chargeTier 数组、taxable、weight、endDateCondition、…)。枚举值:chargeType(oneTime、recurring、usage)、chargeModel(flatFeePricing、perUnitPricing、tieredPricing、volumePricing)、billingPeriod(day、week、month、year)、billingTiming(inAdvance、inArrears)。 |
update_product_rate_plan_charge | 按 ID 更新产品费率计划费用。 |
delete_product_rate_plan_charge | 按 ID 删除产品费率计划费用。 |
订阅(19 个工具)
| 工具 | 描述 |
|---|---|
list_subscriptions | 列出订阅(include、query、orderBy、sortBy、filterId、status、customerId、companyGatewayId、dateFrom、dateTo、itemPerPage、pageNo)。status 支持:active、paused、requestPayment、archived。dateFrom/dateTo 是按创建时间范围筛选的 YYYY-MM-DD 日期。 |
get_subscription | 按 ID 获取订阅。 |
create_subscription | 根据产品费率计划创建订阅(productRatePlanId、customerId、customerPaymentMethodId、billingAddressId、effectiveStartDate)。 |
update_subscription | 按 ID 更新订阅。 |
delete_subscription | 按 ID 删除订阅。 |
update_subscription_status | 更新状态(例如 archived)。 |
get_subscription_upcoming_charges | 获取即将产生的费用。 |
get_subscription_invoices | 获取订阅的发票。 |
get_subscription_logs | 获取订阅的日志。 |
get_subscription_external_invoices | 获取外部发票。 |
list_subscription_rate_plans | 列出订阅中的费率计划(可选 status:active|pause|cancel|archived;type:ongoing|prepaid|contract,不区分大小写)。 |
get_subscription_rate_plan | 按 ID 获取费率计划。 |
add_subscription_rate_plan | 向订阅添加费率计划。 |
update_subscription_rate_plan | 更新费率计划(effectiveStartDate 等)。 |
remove_subscription_rate_plan | 移除订阅中的费率计划。 |
get_subscription_rate_plan_charge | 按 ID 获取费率计划费用。 |
add_subscription_rate_plan_charge | 向费率计划添加费用。必填:subscriptionId、ratePlanId、quantity、name、category(physical|digital)、chargeModel(flatFeePricing|perUnitPricing|tieredPricing|volumePricing)、billCycleType、chargeTier(数组:必填 currency、price;可选 startingUnit、endingUnit、priceFormat、tier)、chargeType(oneTime|recurring|usage)、endDateCondition(subscriptionEnd|fixedPeriod)、taxable(布尔值)、weight。当 chargeType 为 recurring 时,还必填 billingPeriodAlignment 和 specificBillingPeriod。 |
update_subscription_rate_plan_charge | 更新费率计划费用。必填:subscriptionId、chargeId、quantity、name、chargeModel、billCycleType、chargeTier(currency、price)、chargeType、endDateCondition、taxable、weight。当 chargeType 为 recurring 时,必填 billingPeriodAlignment。 |
remove_subscription_rate_plan_charge | 从费率计划中移除费用。 |
发票(8 个工具)
| 工具 | 描述 |
|---|---|
list_invoices | 列出发票(include、status、query、orderBy、sortBy、filterId、itemPerPage、pageNo)。 |
get_invoice | 按 ID 获取发票。 |
create_invoice | 创建发票。必填:companyCurrencyId、companyGatewayId、customerId、paymentMethodId、detail。可选的 billingAddress/shippingAddress 使用 countryCode(ISO 3166-1 alpha-2)。金额可以是 '41.00'(美元)或 4100(美分);工具始终会向 publicAPI 发送美分金额。 |
update_invoice | 更新发票(仅限已过账/请求付款的发票)。 |
delete_invoice | 按 ID 删除发票。 |
charge_invoice | 对发票扣款(银行卡/在线)。必填:invoiceId、amount(美分)、paymentType(例如 thirdPartyPaymentProvider)。 |
charge_invoice_external | 通过线下方式(现金/支票/电汇)扣款。必填:invoiceId、amount(美分)。 |
void_invoice | 作废发票(不可撤销)。 |
交易(4 个工具)
| 工具 | 描述 |
|---|---|
list_transactions | 列出交易(customerId、invoiceId、status、type、dateFrom、dateTo、companyGatewayId、orderBy、sortBy、itemPerPage、pageNo)。status:settled|authorized|declined|error|voided|requiresPaymentMethod|awaitingForSettlement|authorizeAndHold。type:sale|refund。 |
get_transaction | 按 ID 获取交易。 |
refund_transaction | 退款。必填:transactionId、amount(以美分为单位,例如 250 = $2.50)。 |
void_transaction | 作废交易(仅限结算前)。 |
账单批次(4 个工具)
| 工具 | 描述 |
|---|---|
list_bill_runs | 列出账单批次。可选:include(例如 invoice)、query(completed/pending/error)、orderBy、sortBy、itemPerPage、pageNo。 |
get_bill_run | 按 ID 获取账单批次。 |
update_bill_run | 更新账单批次计划。必填:billRunId、newDateTime(ISO 8601,例如 2026-02-26T20:05:00Z)。注意:此工具仅适用于状态为 pending 的账单批次。对 completed 或 error 状态的批次调用会失败。 |
get_bill_run_invoices | 获取账单批次的发票。可选:pageNo、itemPerPage。 |
网关(9 个工具)
| 工具 | 描述 |
|---|---|
list_global_gateways | 列出可用的全局网关类型(例如 Stripe、Braintree)。返回 gblGatewayId、name、keyName、requiredFields(设置键)和 fieldDetails。在调用 create_gateway 前先调用此工具,以查找有效的网关 ID 以及 setting 中需要传入的键。 |
list_gateways | 列出公司网关。 |
get_gateway | 按 ID 获取网关。 |
create_gateway | 创建网关。必填:gblGatewayId(来自 list_global_gateways)、setting(包含该网关 requiredFields 中各键的对象)。可选:displayName、card、paymentMethod。先使用 list_global_gateways 获取 gblGatewayId 和必填凭据字段名称。 |
update_gateway | 按 ID 更新网关。 |
delete_gateway | 按 ID 删除网关。 |
test_gateway | 测试网关连接。 |
get_client_token | 获取网关客户端凭据,用于初始化支付集成并生成供 create_customer_payment_method 使用的 paymentMethodNonce。与网关无关。必填:gatewayId。可选:customerId;PayFabric 必填,其他网关可选。 |
create_setup_intent | 通过 /gateways/{companyGatewayId}/customers/{customerId}/setup_intent 创建/获取 setup intent。将 setupIntent.id 用作 create_customer_payment_method 的 paymentMethodNonce(与网关无关的支付流程)。 |
网关创建示例流程:(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 | 计算配送费用(companyCurrencyId、fromZip、fromCountry、zip、country、weight、orderAmount 等)。 |
筛选器(4 个工具)
| 工具 | 描述 |
|---|---|
list_filters | 列出公司筛选器。必需参数:section(例如 subscriptions、invoices、customers、products、orders、billRuns)。 |
create_filter | 创建筛选器(section、displayName、rules)。 |
list_filter_fields | 列出某个 section 的筛选字段。 |
remove_filter | 根据 ID 删除公司筛选器(DELETE /companies/filters/{filterId})。 |
文档(1 个工具)
| 工具 | 描述 |
|---|---|
get_api_docs | 以 Markdown 格式获取 Rebillia API 文档。默认值:overview(基础 URL、身份验证、分页、日期、金额)。可选值:doc = overview | models | subscription-statuses | charge-types | gateways。使用此工具可让 Claude 阅读文档,而无需获取外部 URL。 |
资源
API 文档以 MCP 资源的形式通过 rebillia://docs/* 提供。使用 resources/list,然后通过 URI 调用 resources/read,或调用 get_api_docs 工具。所有文档均为独立内容;请勿获取外部 URL。
| URI | 描述 |
|---|---|
rebillia://docs/overview | 概述文档——基础 URL、身份验证、分页、日期格式、金额处理(请先阅读) |
rebillia://docs/models | 领域模型层次结构及关系 |
rebillia://docs/subscription-statuses | 订阅状态:active、paused、archived、requestPayment |
rebillia://docs/charge-types | chargeType、chargeModel、billingPeriod、billingTiming 枚举 |
rebillia://docs/gateways | 网关创建流程:使用 list_global_gateways 查找 gblGatewayId 和 requiredFields,然后构建 setting 并调用 create_gateway |
rebillia://globals/gateways | 全局网关列表(提供 client 时):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
脚本
| 脚本 | 命令 | 描述 |
|---|---|---|
| build | npm run build | 将 TypeScript 编译到 dist/ |
| start | npm start | 运行 node dist/index.js |
| dev | npm run dev | 使用 tsx 运行(无需构建) |
| test | npm test | 运行 Vitest |
| test:run | npm run test:run | 运行一次测试(非监视模式) |
许可证
MIT
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。