MCP Billing Gateway

by sapph1re

Not rated
GitHub

About

Reverse proxy that adds Stripe billing and x402 crypto payments to any MCP server

Details

Author
sapph1re
Categories
Developer Tools, Other, API

Setup

Install MCP Billing Gateway in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/sapph1re/mcp-billing-gateway-sdk

Follow the installation instructions in the repository README, then restart your MCP client.

AddStripe subscriptions,per-call credits, andx402 crypto paymentsto 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

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

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

Add to.cursor/mcp.jsonin your project:

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

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

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.

AI Agent → MCP Billing Gateway → Your MCP Server (billing enforced here)

- Register as an operator and get an API key
- Register your MCP server URL + pricing plan
- Point callers to your proxy slug:https://mcp-billing-gateway-production.up.railway.app/proxy/{your-slug}/mcp
- Callers pay via Stripe API key or x402 USDC — billing is handled transparently

- 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

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" }
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" }'
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

{ "mcpServers": { "my-server": { "url": "https://mcp-billing-gateway-production.up.railway.app/proxy/my-server/mcp", "headers": { "Authorization": "Bearer CALLER_API_KEY" } } } }
# 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" # }

Register and monetize an existing MCP server

# 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

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

┌─────────────┐ ┌──────────────────────┐ ┌──────────────────┐ │ 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.

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

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

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Per-call billing and monetization for MCP servers — add usage metering, API key validation, and Stripe payouts to any MCP tool with 2 lines of code.

Domain-agnostic x402 capability chassis: 26 pay-per-call MCP capabilities (market data, on-chain, security, dev tools) with USDC micropayments on Base — no API key required.

One remote MCP server for 500+ production APIs — Stripe, HubSpot, Postgres, Gmail, and more. OAuth and API key auth, credential management, and a CLI.

Discover and call hundreds of paid APIs from any MCP client using prepaid USDC credits — no wallet, no gas, no per-provider SDKs.

53 production-ready AI tools via MCP with x402 USDC payments on Base L2 — web scraping, crypto data, AI generation, OCR, and more.

Integrate AI tools and agents with Cashfree's Payment Gateway, Payouts, and SecureID APIs.

A lightweight wrapper around the NOWPayments API that enables seamless interaction with crypto payments through LLM-powered interfaces.

The Pine Labs Online MCP Server implements the Model Context Protocol (MCP) to enable seamless integration between Pine Labs’ online payment APIs and AI tools. It allows AI assistants to perform Pine Labs Online API operations, empowering developers to build intelligent, AI-driven payment applications with ease.

AI agent API marketplace-discover, call, and pay for services with USDC payments. List your own AI services and earn money per call.

AI intelligence oracle + cross-border settlement rail. 10-layer Stability Oracle (climate, macro, FX, ESG) with x402 pay-per-call API. USDC/EURC settlement on Base at 1.385% all-in.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.