x402mail
Send and receive emails via Python SDK or MCP. No API keys, no accounts - your wallet is your identity. Pay per call with USDC on Base via the x402 protocol. $0.005 per email.
Quickstart
Send your first email
Prerequisite: You need a wallet with USDC on Base. $1 USDC = 200 emails. See Wallet Setup below.
Install
terminal Copy
pip install x402mail[cdp]
export CDP_API_KEY_ID="your-key-id" # from cdp.coinbase.com
export CDP_API_KEY_SECRET="your-key-secret"
export CDP_WALLET_SECRET="your-wallet-secret"
send.py Copy
from x402mail import X402Mail
mail = X402Mail.from_cdp()
mail.send(
to="[email protected]",
subject="Hello from x402mail",
body="Sent with 3 lines of Python!"
)
That's it. The SDK handles x402 payment signing automatically. See SDK reference below.
SDK Reference
Your inbox address is derived from your wallet: inbox-{wallet_prefix}@x402mail.com. It's created automatically on first use — use mail.address to see your wallet address.
mail.send(to: str, subject: str, body: str, reply_to: str = None, reply_to_message_id: int = None) $0.005
Send an email. Use reply_to_message_id to thread replies.
{"message_id": "re_abc123xyz", "inbox": "[email protected]"}
mail.inbox() → dict $0.001
Get your inbox address and message counts.
{"inbox": "[email protected]", "total": 5, "unread": 2}
mail.messages(limit: int = 10, unread_only: bool = False) $0.002
List inbox messages. Returns previews, not full bodies.
[{
"id": 1,
"from": "[email protected]",
"subject": "Hello",
"preview": "Thanks for reaching out...",
"received_at": "2026-01-15T10:30:00+00:00",
"is_read": false
}]
mail.read(message_id: int) $0.001
Read a specific message. Marks it as read.
{
"id": 1,
"from": "[email protected]",
"subject": "Hello",
"body": "Thanks for reaching out. I'd love to discuss this further.",
"received_at": "2026-01-15T10:30:00+00:00",
"message_id": "<[email protected]>",
"in_reply_to": null
}
MCP Server for AI Agents
Run a local MCP server so LLMs can send and receive email. The server handles x402 payments internally — the AI just sees simple tools.
terminal Copy
# With pip
x402mail mcp
# Or without installing
uvx x402mail mcp
Claude Desktop / Cursor Config
Install first: pip install x402mail[cdp]
mcp_config.json Copy
{
"mcpServers": {
"x402mail": {
"command": "x402mail",
"args": ["mcp"],
"env": {
"CDP_API_KEY_ID": "your-key-id",
"CDP_API_KEY_SECRET": "your-key-secret",
"CDP_WALLET_SECRET": "your-wallet-secret"
}
}
}
}
Or use a private key instead: "X402MAIL_PRIVATE_KEY": "0x..."
Available Tools
| Tool | Cost | Description |
|---|---|---|
| send_email | $0.005 | Send an email |
| get_inbox | $0.001 | Get inbox address + counts |
| list_messages | $0.002 | List inbox messages |
| read_message | $0.001 | Read a specific message |
Wallet Setup
You need a wallet with USDC on Base. Your wallet is your identity — your inbox address is derived from it automatically.
Recommended CDP Server Wallet
Managed wallet via Coinbase — no private keys to manage. Follow the CDP quickstart guide to get your API keys, then set the env vars shown in the Quickstart above.
Alternative: Private Key
Use any EVM wallet. Fund it with USDC on Base (Chain ID: 8453).
import os
from x402mail import X402Mail
mail = X402Mail(private_key=os.getenv("EVM_PRIVATE_KEY"))
$1 USDC = 200 emails. That's enough to test extensively. Start small.
Pricing
| Action | SDK Method | Cost (USDC) |
|---|---|---|
| Send an email | mail.send() | $0.005 |
| Get inbox info | mail.inbox() | $0.001 |
| List messages | mail.messages() | $0.002 |
| Read a message | mail.read() | $0.001 |
Spam Protection
There are no rate limits — payment is the rate limit. Spam is handled by AI classification.
AI spam filter
Every email body is classified by an LLM before sending. Detected spam is rejected and the payment is non-refundable.
Cooldowns
After 5 spam strikes, your wallet enters a 30-minute cooldown. During cooldown, all endpoints return an error. No permanent bans.
Related Servers
Zoom Transcript
An MCP server for interacting with transcripts from Zoom Cloud Recordings.
Email sending MCP
Sends emails using the Resend API. Requires a Resend API key.
WhatsApp (TypeScript/Baileys)
Connects a personal WhatsApp account to an AI agent using the WhatsApp Web multi-device API.
ElevenLabs
The official ElevenLabs MCP server
mcp-gmail
MCP server for full Gmail operations via Unipile API. 9 tools: send, reply, list, read, delete, search, labels, attachments, drafts. Dry-run by default, 55 unit tests. MIT licensed.
mcp-proxy
A standalone proxy to connect STDIO-based MCP clients with HTTP (SSE) based MCP servers.
MCP Feedback Collector
An MCP server for collecting interactive user feedback, including text and images, through a graphical interface.
WhatsApp API Multi Device Version
A multi-device WhatsApp API server for AI agents and tools.
Slack
Interact with Slack workspaces, enabling message sending, channel management, and user interactions.
Theagora
Agent-to-agent service exchange with atomic escrow, cryptographic verification, and per-function reputation. 27 MCP tools.