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.
相關伺服器
Telephony MCP Server
Make voice calls and send SMS messages using the Vonage API.
MCP ChatGPT Proxy
A production-ready MCP server for ChatGPT and o3-pro, featuring caching, cost tracking, and rate limiting.
Discord
Enables AI assistants to interact with the Discord platform, allowing them to send messages, manage channels, and perform other actions.
MCP Notify
Monitor the Model Context Protocol (MCP) Registry for new, updated, and removed servers. Get real-time notifications via Discord, Slack, Email, Telegram, Microsoft Teams, Webhooks, or RSS feeds. Includes CLI, Go SDK, REST API, and MCP server for AI assistants.
Unipile
Access and manage messages from multiple platforms using the Unipile API.
OpenAI Speech-to-Text
Transcribe audio files using OpenAI's Speech-to-Text API.
Ntfy
An ntfy MCP server for sending/fetching ntfy notifications to your self-hosted ntfy server from AI Agents 📤 (supports secure token auth & more - use with npx or docker!)
Zoom MCP Server
Schedule and manage Zoom meetings with AI assistance. Requires Zoom API credentials for configuration.
Integration App
Interact with any other SaaS applications on behalf of your customers.
Audio MCP Server
Provides audio input and output capabilities for AI assistants.