Quickstart
Build
Create a paid MCP server with MCPay
You can create an MCP server in two ways: MCPay Build (zero-setup) or the MCPay SDK (full control).
MCPay Build
MCPay Build is a v0/Lovable-style flow to scaffold, preview, and monetize MCP servers—no boilerplate.
- Describe your tools in natural language.
- Preview & test them live while you iterate.
- Inspect the code that’s generated.
When you’re ready, one-click deploy: it creates a GitHub repo and deploys to Vercel.
Open the Builder → https://mcpay.tech/build
How it works (under the hood)
MCPay Build runs on an MCP server that manages everything via MCP tools, providing a full remote development environment (scaffolding, code edits, preview orchestration, pricing, and deploy).
- Explore the MCPay Build server → https://mcpay.tech/servers/23e2ab26-7808-4984-855c-ec6a7dc97c3a
- Dig into the code → https://github.com/microchipgnu/mcpay-build
MCPay SDK
The SDK gives you full control to define tools (free or paid), wire pricing, and integrate from clients. It handles HTTP 402
+ x402 automatically.
npm i mcpay @modelcontextprotocol/sdk viem zod
pnpm add mcpay @modelcontextprotocol/sdk viem zod
bun add mcpay @modelcontextprotocol/sdk viem zod
Server: create paid & free tools (Next.js Route Handler)
import { createPaidMcpHandler } from 'mcpay/handler'
import { z } from 'zod'
export const { GET, POST } = createPaidMcpHandler(async (server) => {
// Free tool
server.tool('ping', {}, async () => ({
content: [{ type: 'text', text: 'pong' }]
}))
// Paid tool
server.paidTool(
'hello',
{ price: 0.05, currency: 'USD' }, // per-call pricing
{ name: z.string().describe('Your name') }, // input schema
async ({ name }) => ({ // handler
content: [{ type: 'text', text: `Hello, ${name}!` }]
})
)
})
Environment Variables
MCPAY_API_KEY
you need a valid API Key that is used to validate and settle payments. It is also used to auto-discover your server and register under your account.MCPAY_API_URL
should be set to a running instance of MCPay (defaults to https://mcpay.tech)