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
访问服务器

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 APIserver.tool(...) & server.paidTool(...) via mcpay/handler
  • Vercel-readyvercel.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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选