MCP Billing Gateway SDK
MCP 计费网关
为任何 MCP 服务器添加 Stripe 订阅、按调用计费和 x402 加密货币支付功能,无需编写计费代码。
实时服务:https://mcp-billing-gateway-production.up.railway.app
功能概述
MCP 计费网关是一个位于您的 MCP 服务器前端的代理,可自动处理所有计费事宜:
按调用计费 — 按工具调用次数向调用者收费(法币或加密货币)
订阅 — 带有调用限制的月度/年度 Stripe 计划
分层定价 — 免费层级 + 基于使用量的付费层级
x402 微支付 — AI 代理无需 API 密钥即可通过 Base 链上的 USDC 进行支付
运营商仪表板 — 实时跟踪收入、使用量和调用者
工作原理
AI Agent → MCP Billing Gateway → Your MCP Server
(billing enforced here)注册为运营商
注册您的 MCP 服务器 URL 和定价计划
将调用者指向您的代理别名:
https://mcp-billing-gateway.../proxy/{your-slug}/...调用者通过 Stripe API 密钥或 x402 USDC 支付 — 计费过程透明处理
快速入门
注册为运营商
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"}'注册您的 MCP 服务器
curl -X POST https://mcp-billing-gateway-production.up.railway.app/api/v1/servers \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "My MCP Server",
"upstream_url": "https://your-mcp-server.com/mcp",
"proxy_slug": "my-server"
}'创建定价计划
curl -X POST https://mcp-billing-gateway-production.up.railway.app/api/v1/servers/{server_id}/plans \
-H "Authorization: Bearer YOUR_API_KEY" \
-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
}'调用者连接到您的代理服务器
{
"mcpServers": {
"my-server": {
"url": "https://mcp-billing-gateway-production.up.railway.app/proxy/my-server/mcp",
"headers": {
"Authorization": "Bearer CALLER_API_KEY"
}
}
}
}支付方式
方式 | 适用场景 | 如何操作 |
Stripe 订阅 | 人类开发者 | 月度/年度计划 |
Stripe 按调用计费 | 人类开发者 | 按调用消耗额度 |
x402 微支付 | AI 代理 | Base 链上的 USDC,无需 API 密钥 |
运营商仪表板
访问您的仪表板:
https://mcp-billing-gateway-production.up.railway.app/dashboard跟踪收入、使用量、活跃调用者并配置您的服务器。
API 参考
完整 API 文档请见:https://mcp-billing-gateway-production.up.railway.app/health
运营商端点
POST /api/v1/operator/register— 创建运营商账户GET /api/v1/operator/profile— 查看个人资料和 API 密钥GET /api/v1/operator/stats— 收入和使用统计信息
服务器管理
POST /api/v1/servers— 注册 MCP 服务器GET /api/v1/servers— 列出您的服务器POST /api/v1/servers/{id}/plans— 创建定价计划
代理
* /proxy/{slug}/*— 带有计费强制执行的代理调用
自托管
该网关现已开放使用。如果您需要自托管部署,请联系我们。
许可证
MIT
Latest Blog Posts
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