Skip to main content
Prerequisites: An existing MCP server built with the official @modelcontextprotocol/sdk package. Cloudflare MCP package (@cloudflare/agents) support coming soon.Want your MCP framework supported? Contact us at cheng@payo.dev

1. Create an Account

1

Go to payo.dev

Visit payo.dev and click Get Started.
2

Sign in with Google

Authenticate using your Google account.
3

Select your role

Choose Provider to access the provider dashboard.

2. Create an API Key

On your first visit, you’ll be prompted to create your first API key.
1

Name your key

Give it a name like “Production Server”.
2

Copy the key

Copy the key immediately. It starts with sk_live_ and won’t be shown again.
This key authenticates charge requests. Keep it secret and never expose it in client-side code.

3. Install the SDK

4. Wrap Your Server

Import withPayments and wrap your MCP server:
server.ts

5. Set Environment Variable

Store your API key as an environment variable:
For production, use your hosting provider’s secrets management (Vercel, Railway, etc.).

6. Deploy

Deploy your server as you normally would. The SDK handles payment automatically:
  1. Free tools (price: 0) execute immediately
  2. Paid tools charge the agent first, then execute
  3. No token? Returns a helpful error message

How Charging Works

When an agent calls get_weather:
  1. Agent sends a tool call request with their token
  2. SDK intercepts and sees the price is $0.01
  3. SDK calls Payo to charge the agent
  4. Payo validates and transfers $0.01 from agent to provider
  5. SDK executes your tool handler
  6. Result returned to agent

Example: Complete Server

Here’s a full example with multiple tools:
weather-server.ts

Monitoring Earnings

View your earnings in the Wallet page:
  • Total earnings
  • Transaction history (tool, amount, agent, timestamp)
  • Withdrawal options (coming soon)

Next Steps

SDK Configuration

All configuration options

Setting Prices

How to set and update prices

Error Handling

Customize error messages

SDK Reference

Full API documentation