Skip to main content
Glama
sapph1re

MCP Billing Gateway SDK

by sapph1re

MCP Billing Gateway

Glama MCP Server

Добавляйте подписки 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-gateway

Настройка для Claude 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

Инструменты

Инструмент

Описание

get_billing_info

Возвращает возможности сервиса, поддерживаемые способы оплаты, функции и документацию по интеграции

Локальный MCP-сервер обеспечивает обнаружение сервисов. Полный функционал биллинга работает на хостинговом шлюзе — зарегистрируйтесь как оператор и проксируйте свои MCP-серверы через него.

Как это работает

AI Agent → MCP Billing Gateway → Your MCP Server
            (billing enforced here)
  1. Зарегистрируйтесь как оператор и получите API-ключ

  2. Зарегистрируйте URL вашего MCP-сервера + тарифный план

  3. Направьте пользователей на ваш прокси-слаг: https://mcp-billing-gateway-production.up.railway.app/proxy/{your-slug}/mcp

  4. Пользователи платят через API-ключ Stripe или USDC (x402) — биллинг обрабатывается прозрачно

Функции

  • Биллинг за вызов — взимайте плату с пользователей за каждый вызов инструмента (фиат или крипто)

  • Подписки — ежемесячные/годовые планы Stripe с лимитами на вызовы

  • Многоуровневые тарифы — бесплатный уровень + платные уровни на основе использования

  • Микроплатежи x402 — принимайте USDC в сети Base от AI-агентов без API-ключей

  • Панель оператора — отслеживайте доход, использование и пользователей в реальном времени

  • Транспорт MCP — полноценный потоковый HTTP MCP-транспорт через эндпоинт /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-агентов

USDC в сети Base, 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

Эндпоинты оператора

Эндпоинт

Метод

Описание

/api/v1/operator/register

POST

Создание аккаунта оператора

/api/v1/operator/profile

GET

Просмотр профиля и API-ключей

/api/v1/operator/stats

GET

Статистика дохода и использования

Управление сервером

Эндпоинт

Метод

Описание

/api/v1/servers

POST

Регистрация MCP-сервера

/api/v1/servers

GET

Список ваших серверов

/api/v1/servers/{id}/plans

POST

Создание тарифного плана

Прокси

Эндпоинт

Метод

Описание

/proxy/{slug}/*

ANY

Проксируемые вызовы с контролем оплаты

/mcp/

ANY

Потоковый 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

Лицензия

MIT

Available Tools

1 tool
get_billing_infoBInspect

Get information about the MCP Billing Gateway service and integration options.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves information, implying a read-only operation, but fails to detail aspects like authentication needs, rate limits, response format, or error handling. This leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse and understand quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has zero parameters, 100% schema coverage, and an output schema exists, the description's focus on purpose is adequate. However, it lacks behavioral details (e.g., response structure, error cases) that could enhance completeness, especially since no annotations are provided to fill those gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the input schema coverage is 100%, so no parameter documentation is needed. The description appropriately does not discuss parameters, focusing instead on the tool's purpose, which aligns with the baseline expectation for parameterless tools.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get information') and target resource ('MCP Billing Gateway service and integration options'), making the purpose understandable. It lacks sibling tools for differentiation, but the scope is well-defined. No tautology or misleading elements are present.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool, such as for setup, troubleshooting, or comparison with other services. The description implies usage for general information retrieval but offers no context, alternatives, or exclusions, leaving the agent without operational direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.1.2
    • First observedget_billing_info

TDQS

B3.2/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap between tools, as there are no other tools to confuse it with. The tool's purpose is clearly defined as retrieving billing information, making disambiguation trivial.

Naming Consistency5/5

The single tool name 'get_billing_info' follows a clear verb_noun pattern (get + billing_info), which is consistent with itself. Since there are no other tools, there is no inconsistency to evaluate, and the naming is straightforward.

Tool Count2/5

A single tool is too few for a server named 'MCP Billing Gateway SDK', which suggests a broader scope for managing billing operations. This minimal set likely leaves significant gaps in functionality, such as creating, updating, or deleting billing data, making it inappropriate for comprehensive billing tasks.

Completeness1/5

The tool set is severely incomplete for a billing gateway domain, as it only provides a read operation (get_billing_info) without any support for create, update, delete, or other essential billing workflows. This will cause agent failures when attempting to perform full billing lifecycle management.

Maintenance

ActivitySlowing
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A 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.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Per-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
  • A
    license
    Not graded
    quality
    C
    maintenance
    Template 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