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_email tool requires a payment on-chain. If they want your attention, they’ve got to pay for it.

Deploy with Vercel


✨ Features

  • ⚑ 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.

⚑ Quickstart

1. Install dependencies

bun install

2. Configure environment

Create 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-devnet

3. Start the MCP server

bun run index.ts

By default this serves at http://localhost:3000/mcp

4. Run the example client

In a second terminal, run:

bun run example/client.ts

The client will:

  • Fetch your MCP tools
  • Pay to use send_email
  • Deliver an email via Resend

🧠 How it works

  • The MCP server exposes a single paid tool: send_email
  • Each invocation requires an on-chain payment
  • Payments are handled by mcpay and settled to your configured wallet addresses
  • Emails are sent via the Resend API

This makes your inbox pay-to-access.


βš™οΈ Configuration

Server (index.ts)

  • toolPricing: Set per-tool prices
  • payTo: Configure your payout addresses for supported networks
  • facilitator.url: Payment facilitator endpoint

Client (example/client.ts)

  • MCP_SERVER_URL: Points to your MCP server
  • createSigner: Creates EVM + Solana signers from private keys

πŸ§ͺ Commands

# Install deps
bun install

# Start the MCP server
bun run index.ts

# Run the example MCP client
bun run example/client.ts

🧩 Tech Stack


πŸ“œ License

MIT β€” build cool stuff and make people pay to email you.