Get the FREE Ultimate OpenClaw Setup Guide →

x402-deploy

Turn any API or MCP server into a paid service with x402

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio nirholas-x402-deploy npx -y @nirholas/x402-deploy

How to use

x402-deploy is a one-click deployment tool that wraps your existing API or MCP server with a payment gateway, enabling monetization of API calls through crypto-based payments. It supports automatic discovery and deployment to popular platforms (Railway, Fly.io, Vercel, or Docker), a live earnings dashboard, and per-call pricing options. By integrating with MCP servers and the @modelcontextprotocol/sdk, x402-deploy makes it straightforward to restrict access to paid API endpoints and track usage and revenue in real time. Use the CLI to initialize your project, deploy to the cloud, and monitor earnings with the dashboard, all from a single tool.

You can run this tool against MCP servers and general Express/FastAPI/Next.js projects. The CLI provides commands for initializing your project configuration, deploying the deployment bundle (which includes the x402 gateway, payment verification, and analytics), and managing pricing and deployment status. It’s designed to minimize changes to your existing code while adding a robust monetization layer and a live analytics surface for operators and owners of MCP-based services.

How to install

Prerequisites:

  • Node.js and npm installed on your machine
  • Optional: Docker if you plan to deploy via Docker

Install the x402-deploy CLI globally:

npm install -g @nirholas/x402-deploy

Alternatively, you can run it with npx without permanent installation:

npx -y @nirholas/x402-deploy

Usage overview:

# Initialize (detects project automatically)
x402-deploy init

# Deploy (creates wallet, deploys, registers)
x402-deploy deploy

# Watch earnings
x402-deploy dashboard

Project setup steps:

  1. Ensure your API/MCP server is running locally or accessible to the deployment platform.
  2. Run x402-deploy init to detect the project type and configuration automatically.
  3. Run x402-deploy deploy to provision the payment gateway, deploy to the chosen platform, and register the service for monetization.
  4. Open x402-deploy dashboard to monitor earnings and usage in real time.

Additional notes

Tips and notes:

  • This project integrates with MCP servers via the @modelcontextprotocol/sdk, so ensure your MCP implementation is compatible.
  • Pricing is configurable via the CLI (per-call or custom routes). You can adjust pricing rules in the deployment configuration or via the dashboard commands.
  • Supported deployment targets include Railway, Fly.io, Vercel, and Docker; ensure your target accounts are set up and authenticated before deploying.
  • Environment variables you may encounter or need to set include wallet addresses, API keys for the payment gateway, and any platform-specific deployment credentials. Placeholder examples:
    • X402_WALLET_ADDRESS: your monetization wallet address
    • X402_API_KEY: integration key for the x402 gateway
    • X402_PLATFORM_AUTH: token or credentials for the deployment platform
  • If you encounter issues with discovery, verify that your project structure matches supported types (MCP servers via @modelcontextprotocol/sdk, Express/FastAPI/Next.js, etc.).
  • Review the documentation links in the repository for detailed configuration, deployment platforms, pricing strategies, and dashboard usage.

Related MCP Servers

Sponsor this space

Reach thousands of developers