MCP Billing Gateway SDK
MCP Billing Gateway
Stripeサブスクリプション、コールごとのクレジット課金、x402暗号資産決済を、課金コードを書くことなくあらゆるMCPサーバーに追加できます。
MCP Billing Gatewayは、AIエージェントとMCPサーバーの間に配置されるホスト型課金プロキシです。支払い検証、利用状況の追跡、プラン制限の適用を自動的に処理します。サーバーを登録し、料金プランを設定して、呼び出し元をプロキシURLに向けるだけです。課金コードは不要です。
ライブサービス: https://mcp-billing-gateway-production.up.railway.app
インストール
pip install mcp-billing-gatewayまたは uvx を使用する場合:
uvx mcp-billing-gatewayClaude Desktopの設定
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) または %APPDATA%\Claude\claude_desktop_config.json (Windows) に追加します:
{
"mcpServers": {
"mcp-billing-gateway": {
"command": "uvx",
"args": ["mcp-billing-gateway"]
}
}
}Cursorの設定
プロジェクト内の .cursor/mcp.json に追加します:
{
"mcpServers": {
"mcp-billing-gateway": {
"command": "uvx",
"args": ["mcp-billing-gateway"]
}
}
}設定を追加した後、エディタを再起動してMCPサーバーを有効にしてください。
Related MCP server: Agent Bazaar
ツール
ツール | 説明 |
| サービスの機能、サポートされている支払い方法、機能、統合ドキュメントを返します |
ローカルのMCPサーバーはサービスディスカバリを提供します。完全な課金機能はホスト型ゲートウェイ上で実行されます。オペレーターとして登録し、MCPサーバーをプロキシ経由で運用してください。
仕組み
AI Agent → MCP Billing Gateway → Your MCP Server
(billing enforced here)オペレーターとして登録し、APIキーを取得する
MCPサーバーのURLと料金プランを登録する
呼び出し元をプロキシスラッグに向ける:
https://mcp-billing-gateway-production.up.railway.app/proxy/{your-slug}/mcp呼び出し元はStripe APIキーまたはx402 USDCで支払う — 課金は透過的に処理されます
機能
コールごとの課金 — ツール呼び出しごとに課金(法定通貨または暗号資産)
サブスクリプション — コール制限付きの月額/年額Stripeプラン
段階的価格設定 — 無料プラン + 利用状況に応じた有料プラン
x402マイクロペイメント — APIキーなしでAIエージェントからBase上のUSDCを受け入れ可能
オペレーターダッシュボード — 収益、利用状況、呼び出し元をリアルタイムで追跡
MCPトランスポート —
/mcp/エンドポイントでの完全なStreamable HTTP MCPトランスポート
クイックスタート
1. オペレーターとして登録
curl -X POST https://mcp-billing-gateway-production.up.railway.app/api/v1/operator/register \
-H "Content-Type: application/json" \
-d '{"email": "you@example.com", "name": "Your Name"}'レスポンス:
{
"operator_id": "op_abc123",
"api_key": "bg_live_xxxxxxxxxxxx",
"message": "Operator registered successfully"
}2. MCPサーバーを登録
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. 料金プランを作成
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. 呼び出し元をプロキシサーバーに接続
{
"mcpServers": {
"my-server": {
"url": "https://mcp-billing-gateway-production.up.railway.app/proxy/my-server/mcp",
"headers": {
"Authorization": "Bearer CALLER_API_KEY"
}
}
}
}支払い方法
方法 | 最適な用途 | 方法 |
Stripeサブスクリプション | 人間の開発者 | Stripe Checkout経由の月額または年額プラン |
Stripeコールごと課金 | 人間の開発者 | ツール呼び出しごとにクレジットを消費 |
x402マイクロペイメント | AIエージェント | Base上のUSDC、APIキー不要 |
例
ゲートウェイ機能の確認
# Using the MCP client
result = 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"
# }既存のMCPサーバーの登録と収益化
# 1. Register
API_KEY=$(curl -s -X POST .../api/v1/operator/register \
-H "Content-Type: application/json" \
-d '{"email": "dev@example.com", "name": "Dev"}' | jq -r .api_key)
# 2. Add your server
SERVER_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/month
curl -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オペレーターダッシュボード
ダッシュボードへのアクセス:
https://mcp-billing-gateway-production.up.railway.app/dashboard収益、利用状況、アクティブな呼び出し元を追跡し、サーバーをリアルタイムで設定します。
APIリファレンス
オペレーターエンドポイント
エンドポイント | メソッド | 説明 |
| POST | オペレーターアカウントの作成 |
| GET | プロフィールとAPIキーの表示 |
| GET | 収益と利用統計 |
サーバー管理
エンドポイント | メソッド | 説明 |
| POST | MCPサーバーの登録 |
| GET | サーバー一覧の取得 |
| POST | 料金プランの作成 |
プロキシ
エンドポイント | メソッド | 説明 |
| ANY | 課金制限付きのプロキシ呼び出し |
| ANY | Streamable HTTP MCPトランスポート |
アーキテクチャ
┌─────────────┐ ┌──────────────────────┐ ┌──────────────────┐
│ 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ゲートウェイは透過的なプロキシです。呼び出し元は通常通りMCPサーバーとやり取りします。ゲートウェイがリクエストをインターセプトし、支払いを検証し、利用状況を追跡して、アップストリームのサーバーに転送します。
セルフホスト
ゲートウェイは上記のホスト型URLで利用可能です。セルフホスト環境の場合は、サーバーリポジトリをクローンし、Docker経由でデプロイしてください:
docker build -t mcp-billing-gateway .
docker run -p 3000:3000 mcp-billing-gatewayライセンス
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA comprehensive framework for building and deploying commercial MCP servers with integrated billing, usage metering, and Stripe payment processing. It enables developers to monetize AI tools through a complete ecosystem including API key management, affiliate tracking, and automated deployment scripts.
- AlicenseNot gradedqualityCmaintenancePer-call billing and metering proxy for MCP tool servers. Providers set pricing via the open MCP Billing Spec (MIT), consumers pay through Stripe Connect with signed receipts and SLA monitoring.MIT
- AlicenseNot gradedqualityAmaintenanceStripe Billing - MCP server providing AI-powered tools and automation by MEOK AI Labs11MIT
- AlicenseNot gradedqualityCmaintenanceTemplate for creating MCP servers with a server-side paywall gate, enabling free local usage and premium hosted tier with Stripe and x402 payment lanes.MIT
Related MCP Connectors
MCP server integrating with Stripe - tools for customers, products, payments, and more.
Monetize any MCP server: x402 paywall, pay-per-call billing in USDC on Base, agent marketplace.
Stripe MCP Pack — read-only access to Stripe data via API key.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sapph1re/mcp-billing-gateway-sdk'
If you have feedback or need assistance with the MCP directory API, please join our Discord server