Creating Paid MCP Servers with PaidMCP

Creating Paid MCP Servers with PaidMCP

Alby releases PaidMCP, an easy to use SDK for creating paid Model Context Protocol (MCP) servers, built entirely on open protocols. Developers can now expose their services to AI assistants and charge for their use, opening up new revenue streams in the AI space.

Understanding MCP

The Model Context Protocol (MCP) is an open standard that enables AI assistants and LLMs to connect with external services and tools. Anthropic describes it as "a USB-C port for AI applications," providing a standardized way to connect AI models with various data sources and tools.

MCP marks the beginning of the end for traditional UIs. Instead, users interact with products and services through their well-known chat interface - and their MCP-powered AI assistant handles the rest.

The Future on MCP

Imagine 5 years from now - you might have only 1 app - your AI assistant. You can tell it things like: "Pay $5 to my friend Bob" or "Order some Sushi" or "Book a hotel near Bangkok airport for next Tuesday". How does the AI know how to do these things? MCP servers give the AI the exact tools it needs to perform these requests, a lot of which will require payments.

You can experience a glimpse of this future with Alby MCP: an MCP server which allows your AI assistant to speak bitcoin. Alby MCP supports any NWC-enabled lightning wallet like Alby Hub or any other NWC-enabled wallet.

Closed Payments on MCP

The current solution for building paid MCP servers is to use Stripe's agent toolkit and Cloudflare's Agent SDK, however:

  • Payments are not seamless - the agent flow is interrupted as the user must manually open a checkout page and enter their details.
  • Difficult developer setup: The paid MCP Boilerplate requires 3 different accounts setup (Cloudflare, Google Cloud login, Stripe customer billing) and many steps to enable users to pay for your MCP server.
  • Delayed settlement and chargeback risks: You have to wait up to 120 days to be sure the money is yours. If your customer does a chargeback, you lose the money plus pay a large fee.
  • Privileged access only: only customers with a credit card can pay for your service.
  • Using a closed payment solution on an open protocol: The huge success of MCP is due to being a simple, open protocol that works with any AI assistant or tool. Wouldn't it be better if we could use an open protocol for payments, too?

PaidMCP - The Open Alternative

PaidMCP is built on top of @modelcontextprotocol/sdk, The official Typescript SDK for Model Context Protocol. With a few lines of code you can change your free MCP server to a paid MCP server:

Instead of Stripe, PaidMCP connects to your bitcoin lightning wallet over NWC. Nostr Wallet Connect (NWC) is a "USB-C port for lightning wallets", allowing any application to connect to any lightning wallet or node.

Any time an AI assistant requests one of your paid tools, PaidMCP will generate a lightning invoice and return it as the tool output. Once the AI assistant has paid, it will do the same request again. PaidMCP will verify the payment, and then provide access to your tool as normal. This flow can be executed by AI assistants without user intervention.

NWC provides a seamless, secure, receive-only connection from your MCP Server to your wallet. Currently it works best with the self-custodial Alby Hub wallet. But you can use any other NWC-enabled wallet.

On the AI assistant side, with any lightning wallet connected (for example via the Alby MCP server) customers can seamlessly pay for tool usage and set budgets to protect themselves against excess spending.

Instant settlement combined with unfairly cheap fees on bitcoin's lightning network enable a superior payment experience to what is possible with credit cards, both for the service and the user (or agent).

Usage-based Payments

Traditional payment methods are limited to subscriptions or purchasing credits in advance. Bitcoin lightning payments enable payments per individual tool usage. Users can pay for usage rather than have to make a decision in advance on how much they are willing to pay and whether a subscription is worthwhile.

Try PaidMCP Today

Alby has an example paid MCP server that costs 21 sats to fetch weather data. You can connect the Alby MCP server (instructions here) to make a payment with your preferred agent, and the remote weather MCP server (https://weather-mcp.fly.dev/mcp or https://weather-mcp.fly.dev/sse). Then simply ask "What's the weather in Berlin?".

You can also fork our PaidMCP Boilerplate and get started building paid tools right away.

To dig deeper into how PaidMCP works. To build your own paid MCP server, visit https://github.com/getAlby/paidmcp.

Let us know what you build!