Skip to main content

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

Project description

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.


🔧 Features

  • ✅ Add @price(...) decorators to your MCP tools to enable payments
  • 🔁 Choose between different payment flows (elicit, confirm, etc.)
  • 🔌 Pluggable support for providers like Walleot, Stripe, and more
  • ⚙️ Easy integration with FastMCP or other MCP servers

🧭 Payment Flows

The payment_flow parameter controls how the user is guided through the payment process. Choose the strategy that fits your use case:

  • PaymentFlow.TWO_STEP (default)
    Splits the tool into two separate MCP methods.
    The first step returns a payment_url and a next_step method for confirmation.
    The second method (e.g. confirm_add_payment) verifies payment and runs the original logic.
    Supported in most clients.

  • PaymentFlow.ELICITATION Sends the user a payment link when the tool is invoked. If the client supports it, a payment UI is displayed immediately. Once the user completes payment, the tool proceeds.

  • PaymentFlow.PROGRESS
    Shows payment link and a progress indicator while the system waits for payment confirmation in the background. The result is returned automatically once payment is completed.

  • PaymentFlow.OOB (Out-of-Band)
    Not yet implemented.

All flows require the MCP client to support the corresponding interaction pattern. When in doubt, start with TWO_STEP.


🚀 Quickstart

Install the SDK from PyPI:

pip install paymcp

Initialize PayMCP:

from paymcp import PayMCP, price, PaymentFlow

PayMCP(
    mcp,  # your FastMCP instance
    providers={
        "provider_name": {"api_key": "your-api-key-here"},
    },
    payment_flow=PaymentFlow.ELICITATION
)

Use the @price decorator on any tool:

@mcp.tool()
@price(amount=0.19, currency="USD")
def add(a: int, b: int) -> int:
    return a + b

🧩 Supported Providers

  • Walleot
  • ✅ Stripe
  • 🔜 Want another provider? Open an issue or submit a pull request!

📄 License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paymcp-0.0.1.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paymcp-0.0.1-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file paymcp-0.0.1.tar.gz.

File metadata

  • Download URL: paymcp-0.0.1.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.2 CPython/3.10.14 Darwin/24.3.0

File hashes

Hashes for paymcp-0.0.1.tar.gz
Algorithm Hash digest
SHA256 22251dbf758e42bfef0d22e7f138a4b6d992b457d575237f6b2bb6b842a583e6
MD5 8051f6a049d8217d96da7475f44fb297
BLAKE2b-256 fbaca28772048bbf74ed57f7fb23e5b05696a505f55f3da081a1be27d23dc30e

See more details on using hashes here.

File details

Details for the file paymcp-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: paymcp-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.2 CPython/3.10.14 Darwin/24.3.0

File hashes

Hashes for paymcp-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7cc3f4fddb1363ed2f18be9e237260c54c513f2406db107ef7cb96f96312084c
MD5 28fa8f832c6d041037003ce305779bc6
BLAKE2b-256 86d007e9ed9aa4cb696f74869e9177155677dc9f1e7ea3a37b0dd73d445a7aaf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page