Skip to main content

PayMCP

Provider-agnostic payment layer for MCP (Model Context Protocol) tools and agents.

PayMCP is a lightweight SDK that helps you add monetization to your MCP-based tools, servers, or agents. It supports multiple payment providers and integrates seamlessly with MCP's tool/resource interface.

Key Features

  • Simple Integration - For Python, add @price(...) decorators to your MCP tools. For TypeScript, add a price variable in registerTool() to enable payments
  • Flexible Coordination Modes - Choose between different payment modes (two-step, resubmit, elicitation, progress, dynamic tools)
  • Built-in and Custom Providers - Most top payment providers are built in, and you can easily add custom providers
  • Framework Agnostic - Easy integration with FastMCP or other MCP servers
  • Production Ready - Built for reliability and scale

Quick Example

from mcp.server.fastmcp import FastMCP, Context
from paymcp import PayMCP, price
from paymcp.providers import StripeProvider

mcp = FastMCP("AI agent name")

PayMCP(mcp, providers=[StripeProvider(apiKey="sk_test_...")])

@mcp.tool()
@price(amount=1.00, currency="USD")
def add_numbers(a: int, b: int, ctx: Context) -> int:
"""Add two numbers together"""
return a + b

Coordination Modes

PayMCP supports multiple coordination modes to fit different use cases:

  • TWO_STEP - Split tool execution into initiate/confirm steps (default, most compatible)
  • RESUBMIT - First call returns HTTP 402 with a payment ID and payment URL; the retry completes once payment is verified
  • ELICITATION - Payment link during tool execution (requires elicitation capability from MCP Clients)
  • PROGRESS - Experimental auto-checking of payment status (requires progress capability from MCP Clients)
  • DYNAMIC_TOOLS - Dynamic tool lists that expose the next valid action (requires listChanged support from MCP Clients)

See the list of clients and their capabilities here: https://modelcontextprotocol.io/clients

Supported Providers

ProviderStatusFeatures
Stripe✅ AvailableCards, ACH, international payments
Walleot✅ AvailablePre-purchased credits, auto payments
PayPal✅ AvailablePayPal balance, cards, bank transfers
Square✅ AvailableCards, in-person payments
Adyen✅ AvailableGlobal payments, 40+ countries
Coinbase Commerce✅ AvailableBitcoin, Ethereum, stablecoins

Getting Started

  1. Installation - Install PayMCP via pip or npm
  2. Basic Setup - Configure your first provider
  3. Add Pricing - Monetize your tools
  4. Test Integration - Verify everything works

Security Notice

PayMCP is NOT compatible with STDIO mode deployments where end users download and run MCP servers locally. This would expose your payment provider API keys to end users, creating serious security vulnerabilities.

PayMCP must be deployed as a hosted service where:

  • You control the server environment
  • API keys remain secure on your infrastructure
  • Users connect via network protocols (HTTP, WebSocket, etc.)

Ready to start? Check out our Quickstart Guide to get up and running in minutes.