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 分