SPAMCP is a minimal paid MCP server that charges people crypto to send you emails. Itβs built with Hono + MCP, uses mcpay for payments, and includes a working MCP client using the Vercel AI SDK.
π‘ Every call to your
send_emailtool requires a payment on-chain. If they want your attention, theyβve got to pay for it.
- β‘ MCP server with Hono β Runs on Bun, exposing MCP tools over HTTP.
- πΈ Payment-gated tools β Require on-chain payment (EVM or Solana) using mcpay.
- π¬ Email sending β Delivers emails via the Resend API.
- π€ Example MCP client β Uses the Vercel AI SDK to call your tools and auto-handle payments.
- π§© Easy deployment β Bun-first, Vercel-ready, environment-driven config.
bun installCreate a .env file (Bun auto-loads it) based on .env.example:
# Email sending
RESEND_API_KEY=your_resend_api_key
RESEND_FROM=no-reply@example.com
RECIPIENT_EMAIL=alice@example.com,bob@example.com
# Payments
FACILITATOR_URL=https://facilitator.x402.rs
TOOL_PRICE_SEND_EMAIL=$0.005
# Payout addresses
EVM_ADDRESS=0xYourEvmAddress
SVM_ADDRESS=YourSolanaAddress
# Example client
MCP_SERVER_URL=http://localhost:3000/mcp
EVM_PRIVATE_KEY=0x...
SVM_PRIVATE_KEY=0x...
EVM_NETWORK=base
SVM_NETWORK=solana-devnetbun run index.tsBy default this serves at http://localhost:3000/mcp
In a second terminal, run:
bun run example/client.tsThe client will:
- Fetch your MCP tools
- Pay to use
send_email - Deliver an email via Resend
- The MCP server exposes a single paid tool:
send_email - Each invocation requires an on-chain payment
- Payments are handled by
mcpayand settled to your configured wallet addresses - Emails are sent via the Resend API
This makes your inbox pay-to-access.
Server (index.ts)
toolPricing: Set per-tool pricespayTo: Configure your payout addresses for supported networksfacilitator.url: Payment facilitator endpoint
Client (example/client.ts)
MCP_SERVER_URL: Points to your MCP servercreateSigner: Creates EVM + Solana signers from private keys
# Install deps
bun install
# Start the MCP server
bun run index.ts
# Run the example MCP client
bun run example/client.ts- Bun β Fast runtime
- Hono β Web framework
- mcpay β Payment-gated MCP tools
- x402 β On-chain payments
- Resend β Email delivery
- Vercel AI SDK β MCP client interface
- Model Context Protocol β Tool-calling protocol
MIT β build cool stuff and make people pay to email you.
