MCP Billing Gateway

io.github.sapph1re由 GitHub 账号 sapph1re 发布v0.1.3更新于 Oct 27, 2026

Billing proxy for MCP servers. Adds Stripe and x402 crypto payments without writing billing code.

已验证Streamable HTTP可网页运行金融开发者工具商业与电商

概览

AI 生成的概览

托管式计费代理,让助手注册 MCP 服务器、设置定价方案,并查看 Stripe 或 x402 加密支付的用量与收入。

可以做什么
  • 注册并管理运营者账户,包括 Stripe Connect 入驻与账户状态查询
  • 注册、列出、查看、更新和软删除 MCP 服务器,含上游地址与公开状态
  • 为服务器创建、列出和更新定价方案
  • 查看用量分析(调用次数、收入、主要调用方)以及收入汇总与打款记录
适用场景
适合希望用按次计费、订阅或加密小额支付为 MCP 服务器变现、又不想自己写计费代码的运营者,也适合让助手代为管理服务器、方案和收入数据。
运行要求
可使用托管远程端点,或在本地用 uvx 或 pip 运行 PyPI 包(需要 Python)。需要运营者账户;README 说明注册后会返回 API 密钥,作为 Bearer 令牌用于服务器和方案管理。收款需完成 Stripe Connect 入驻,调用方通过 Stripe 或 x402 USDC 付费。
安装前请注意
这些工具会创建、更新和软删除服务器与方案,注册还会启动 Stripe Connect 入驻,因此改动会影响真实计费。运营者 API 密钥是能控制服务器和收入的凭据,不要暴露在共享对话中。定价方案会向调用方实际收费,支付与打款经由 Stripe 和 Base 上的 x402 USDC 完成。服务器地址和用量数据会发送到托管网关。

安装

在 SourceWeft 中

  1. 打开 控制台中的 MCP Billing Gateway,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.sapph1re%2Fmcp-billing-gateway/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "billing-gateway": {
      "type": "http",
      "url": "https://mcp-billing-gateway-production.up.railway.app/mcp/"
    }
  }
}

README

MCP Billing Gateway

[Glama MCP Server] [MCP.Directory]

Add Stripe subscriptions, per-call credits, and x402 crypto payments to any MCP server — without writing billing code.

MCP Billing Gateway is a hosted billing proxy that sits between AI agents and your MCP server. It handles payment verification, usage tracking, and tier enforcement automatically. You register your server, set a pricing plan, and point callers to the proxied URL. No billing code required.

Live service: https://mcp-billing-gateway-production.up.railway.app

Tutorial: Monetize any MCP server in 10 minutes — step-by-step demo with working code

Installation

bash
pip install mcp-billing-gateway

Or with uvx:

bash
uvx mcp-billing-gateway

Configuration for Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

json
{  "mcpServers": {    "mcp-billing-gateway": {      "command": "uvx",      "args": ["mcp-billing-gateway"]    }  }}

Configuration for Cursor

Add to .cursor/mcp.json in your project:

json
{  "mcpServers": {    "mcp-billing-gateway": {      "command": "uvx",      "args": ["mcp-billing-gateway"]    }  }}

Restart your editor after adding the configuration to activate the MCP server.

Tools

ToolDescription
get_billing_infoReturns service capabilities, supported payment methods, features, and integration docs

The local MCP server provides service discovery. The full billing functionality runs on the hosted gateway — register as an operator and proxy your MCP servers through it.

How it works

AI Agent → MCP Billing Gateway → Your MCP Server            (billing enforced here)
  1. Register as an operator and get an API key
  2. Register your MCP server URL + pricing plan
  3. Point callers to your proxy slug: https://mcp-billing-gateway-production.up.railway.app/proxy/{your-slug}/mcp
  4. Callers pay via Stripe API key or x402 USDC — billing is handled transparently

Features

  • Per-call billing — charge callers per tool call (fiat or crypto)
  • Subscriptions — monthly/annual Stripe plans with call limits
  • Tiered pricing — free tier + paid tiers based on usage
  • x402 micropayments — accept USDC on Base from AI agents with no API keys
  • Operator dashboard — track revenue, usage, and callers in real time
  • MCP transport — full Streamable HTTP MCP transport at /mcp/ endpoint

Quick Start

1. Register as operator

bash
curl -X POST https://mcp-billing-gateway-production.up.railway.app/api/v1/operator/register \  -H "Content-Type: application/json" \  -d '{"email": "[email protected]", "name": "Your Name"}'

Response:

json
{  "operator_id": "op_abc123",  "api_key": "bg_live_xxxxxxxxxxxx",  "message": "Operator registered successfully"}

2. Register your MCP server

bash
curl -X POST https://mcp-billing-gateway-production.up.railway.app/api/v1/servers \  -H "Authorization: Bearer bg_live_xxxxxxxxxxxx" \  -H "Content-Type: application/json" \  -d '{    "name": "My MCP Server",    "upstream_url": "https://your-mcp-server.com/mcp",    "proxy_slug": "my-server"  }'

3. Create a pricing plan

bash
curl -X POST https://mcp-billing-gateway-production.up.railway.app/api/v1/servers/{server_id}/plans \  -H "Authorization: Bearer bg_live_xxxxxxxxxxxx" \  -H "Content-Type: application/json" \  -d '{    "name": "Pay as you go",    "billing_model": "per_call",    "price_per_call_usd_micro": 10000,    "free_calls_per_month": 100  }'

4. Connect callers to your proxied server

json
{  "mcpServers": {    "my-server": {      "url": "https://mcp-billing-gateway-production.up.railway.app/proxy/my-server/mcp",      "headers": {        "Authorization": "Bearer CALLER_API_KEY"      }    }  }}

Payment Methods

MethodBest forHow
Stripe subscriptionHuman developersMonthly or annual plan via Stripe Checkout
Stripe per-callHuman developersCredits consumed per tool call
x402 micropaymentsAI agentsUSDC on Base, no API keys needed

Examples

Check gateway capabilities

python
# Using the MCP clientresult = await session.call_tool("get_billing_info")print(result)# {#   "service": "MCP Billing Gateway",#   "version": "0.1.0",#   "payment_methods": ["stripe_subscription", "stripe_metered", "x402_crypto"],#   "features": ["Per-call usage tracking", "Tiered pricing", ...],#   "live_service": "https://mcp-billing-gateway-production.up.railway.app"# }

Register and monetize an existing MCP server

bash
# 1. RegisterAPI_KEY=$(curl -s -X POST .../api/v1/operator/register \  -H "Content-Type: application/json" \  -d '{"email": "[email protected]", "name": "Dev"}' | jq -r .api_key)
# 2. Add your serverSERVER_ID=$(curl -s -X POST .../api/v1/servers \  -H "Authorization: Bearer $API_KEY" \  -H "Content-Type: application/json" \  -d '{"name": "my-tool", "upstream_url": "https://my-tool.com/mcp", "proxy_slug": "my-tool"}' \  | jq -r .server_id)
# 3. Set pricing: $0.01 per call, 100 free calls/monthcurl -X POST .../api/v1/servers/$SERVER_ID/plans \  -H "Authorization: Bearer $API_KEY" \  -H "Content-Type: application/json" \  -d '{"name": "Starter", "billing_model": "per_call", "price_per_call_usd_micro": 10000, "free_calls_per_month": 100}'
# Callers now connect via: .../proxy/my-tool/mcp

Operator Dashboard

Access your dashboard at:

https://mcp-billing-gateway-production.up.railway.app/dashboard

Track revenue, usage, active callers, and configure your servers in real time.

API Reference

Operator endpoints

EndpointMethodDescription
/api/v1/operator/registerPOSTCreate operator account
/api/v1/operator/profileGETView profile and API keys
/api/v1/operator/statsGETRevenue and usage stats

Server management

EndpointMethodDescription
/api/v1/serversPOSTRegister an MCP server
/api/v1/serversGETList your servers
/api/v1/servers/{id}/plansPOSTCreate pricing plan

Proxy

EndpointMethodDescription
/proxy/{slug}/*ANYProxied calls with billing enforcement
/mcp/ANYStreamable HTTP MCP transport

Architecture

┌─────────────┐     ┌──────────────────────┐     ┌──────────────────┐│  AI Agent /  │────▶│  MCP Billing Gateway │────▶│  Your MCP Server ││  MCP Client  │◀────│  (hosted on Railway)  │◀────│  (upstream)      │└─────────────┘     └──────────────────────┘     └──────────────────┘                         │                         ├── Payment verification (Stripe / x402)                         ├── Usage tracking & rate limiting                         ├── Tier enforcement                         └── Operator dashboard

The gateway is a transparent proxy. Callers interact with your MCP server normally — the gateway intercepts requests, verifies payment, tracks usage, and forwards to your upstream server.

Self-hosted

The gateway is open for use at the hosted URL above. For self-hosted deployments, clone the server repository and deploy via Docker:

bash
docker build -t mcp-billing-gateway .docker run -p 3000:3000 mcp-billing-gateway

License

MIT

来源:README.md,提交 7e6e2e3

工具

12

register_operator

Register a new operator account with Stripe Connect onboarding

输入参数name必填email必填

get_operator_info

Get current operator profile and status

输入参数api_key必填

list_servers

List all MCP servers registered by the operator

输入参数api_key必填

create_server

Register a new MCP server for billing

输入参数name必填api_key必填auth_modeis_publictransportproxy_slug必填descriptionupstream_url必填

get_server

Get server details including pricing plans

输入参数api_key必填server_id必填

update_server

Update server settings (name, description, upstream_url, is_public, status)

输入参数namestatusapi_key必填is_publicserver_id必填descriptionupstream_url

delete_server

Soft-delete a server (can be restored)

输入参数api_key必填server_id必填

create_plan

Create a pricing plan for a server

输入参数name必填api_key必填server_id必填is_defaultbilling_model必填free_calls_per_monthsubscription_intervalsubscription_call_limitprice_per_call_usd_microsubscription_price_usd_cents

list_plans

List pricing plans for a server

输入参数api_key必填server_id必填

update_plan

Update a pricing plan

输入参数nameapi_key必填plan_id必填is_activeis_defaultfree_calls_per_monthprice_per_call_usd_micro

get_usage

Get usage analytics for a server (calls, revenue, top callers)

输入参数tofromapi_key必填server_id必填

get_revenue

Get revenue summary and payout history

输入参数api_key必填

版本历史

1
  1. v0.1.3最新Sep 16, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分