MCPay Build

MCPay Build

Enables no-code creation, preview, deployment, and monetization of MCP servers via x402 micropayments, including a virtual file system, sandbox preview, and tool monetization.

Category
Visit Server

README

MCPay Build

<img src="./assets/mcpay-hero-painting.png" alt="MCPay Build Banner" width="600">

MCPay Build is an MCP server that acts as a no-code builder for MCP Servers with built-in monetization.
It lets developers design, preview, and deploy MCP servers to GitHub + Vercel β€” and instantly monetize tool usage with x402 micropayments via MCPay.

πŸ‘‰ Build β†’ Preview β†’ Deploy β†’ Monetize

Our vision is an agent-to-agent economy powered by microtransactions, where AI agents can autonomously pay to use tools. MCPay Build provides the rails to make that future possible.


πŸ–ΌοΈ Workflow


β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Build   β”‚ ───▢ β”‚  Preview  β”‚ ───▢ β”‚  Deploy   β”‚ ───▢ β”‚   Monetize    β”‚
β”‚ (AI/MCP)  β”‚      β”‚ (sandbox) β”‚      β”‚ (Vercel)  β”‚      β”‚ (MCPay/x402)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


Big Picture

This repo implements an MCP server β€œfactory”:

  • Lets an AI/chat (or you) spin up a brand-new MCP server in memory.
  • Provides tools to edit files, manage deps, run type checks, format, version, and preview live.
  • Deploys your server into a real Node.js environment using Vercel Sandbox.
  • Monetizes expensive operations (preview, run_command, stream_logs, etc.) using MCPay (per-call x402 micropayments).

Flow:
Create session β†’ edit files β†’ preview in sandbox β†’ get live URL β†’ iterate β†’ export as ZIP β†’ monetize tools.


✨ Features

  • MCPay integration β†’ free + paid tools side-by-side, billed automatically
  • Simple API β†’ server.tool(...) & server.paidTool(...) via mcpay/handler
  • Vercel-ready β†’ vercel.json + function exports (GET/POST/OPTIONS)
  • Type-safe β†’ modern TypeScript + Zod validation
  • Dev UX β†’ session/file/diff/format tools, ts-check, logs, live preview

πŸš€ Quickstart

1. Install dependencies

pnpm install

2. Configure environment

MCPAY_API_KEY=your_api_key     # required for paid tools
MCPAY_API_URL=https://api.mcpay.tech  # optional

3. Run locally

pnpm dlx vercel dev

Server runs at http://localhost:3000.

4. Connect from MCP client

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "mcpay-local": { "url": "http://localhost:3000" }
  }
}

Under the Hood

Main runtime & routing

  • Hono as the HTTP framework.
  • Open CORS (all origins/headers/methods allowed).
  • GET / β†’ serves a system prompt describing tools + philosophy.
  • All other routes β†’ handled by createPaidMcpHandler(...).
  • Function exports (GET/POST/OPTIONS) β†’ deploys cleanly to Vercel.

State & storage

  • Sessions in Vercel KV (session:{id}) with virtual file system + sandbox metadata.
  • Commits in KV (commit:{session}:{commit}) for full snapshots.
  • Logs/ZIPs uploaded to Vercel Blob with public URLs.

Templates & defaults

When you run create_session, it seeds:

  • index.ts β€” MCP server template (with hello + get-time tools).
  • package.json, tsconfig.json, .gitignore, .env.example, README.md.

Preview = live sandbox

preview tool does:

  1. Loads session + hashes files.

  2. Reuses existing sandbox if files unchanged (<30 min).

  3. Else:

    • Creates fresh Vercel Sandbox (Node 22, 2 vCPUs).
    • Uploads files.
    • Detects Node/npm versions.
    • Installs deps (npm/yarn/pnpm).
    • Runs build if available.
    • Starts server (npm start or fallback).
    • Health-checks endpoints until ready.
    • Aggregates logs (uploads long logs to Blob).

Returns: sandbox ID, preview URL, logs, node/npm versions, status.


Built-in Tools

Paid (metered via MCPay)

  • create_session β€” bootstrap project
  • preview β€” deploy to sandbox, return live URL
  • download_session β€” zip + upload project
  • run_command β€” exec arbitrary shell in sandbox
  • stream_logs β€” live-tail logs

Free

  • File ops: add_or_update_file, delete_file, get_file, list_files, get_all_codebase
  • Env ops: add_env_key, list_env_keys, delete_env_key
  • Package ops: add_dependency, debug_package_json
  • Quality: ts_check, npm_audit, format_file
  • Versioning: commit, diff, revert, get_logs
  • Info: get_environment_info, get_session_stats, stop_preview, force_refresh_sandbox

Monetization

  • MCP handler is created with createPaidMcpHandler.
  • Paid tools have explicit { price, currency }.
  • Requires MCPAY_API_KEY (and optional MCPAY_API_URL).

Example:

server.paidTool(
  "analyze-data",
  "Analyze data (paid)",
  { price: 0.1, currency: "USD" },
  { data: z.string(), format: z.enum(["json","csv"]) },
  async ({ data, format }) => ({
    content: [{ type: "text", text: `Analyzed ${format} data` }]
  })
);

πŸ›  Typical Flow

  1. create_session β†’ new ID
  2. add_or_update_file β†’ edit index.ts
  3. ts_check + format_file
  4. commit β†’ snapshot
  5. preview β†’ live sandbox URL
  6. stream_logs β†’ monitor in real time
  7. download_session β†’ zip/export

πŸ“¦ Deployment

Deploy to Vercel:

pnpm dlx vercel

Set env vars in project settings:

  • MCPAY_API_KEY
  • MCPAY_API_URL (optional)

❗ Notes

  • Blob uploads are public β†’ don’t commit secrets.
  • Sandbox per tool (for some ops) β†’ isolation at cost of speed/$$.
  • .env handling β†’ only keys are tracked; actual secrets must be set in runtime env.

πŸ“„ License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured