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.
संबंधित सर्वर
Local Network Request MCP Server
Sends HTTP requests to endpoints on the local network.
Gossiper Shopify Admin MCP Server
Control Shopify Admin tasks with agents or via prompt. Ultra slim integration, fast and secure.
Desktop Notification
Send cross-platform desktop notifications from AI assistants.
Wizzypedia MCP Server
Interact with Wizzypedia through the MediaWiki API, supporting both read-only and authenticated operations.
NANDA AI Agent Sunday Hack
An MCP server integrating WhatsApp messaging and ElevenLabs AI voice capabilities into VS Code.
Facebook Ads
MCP server acting as an interface to the Facebook Ads, enabling programmatic access to Facebook Ads data and management features.
Voice Mode
A server for natural voice conversations with AI assistants like Claude and ChatGPT.
RocketMQ
A server for interacting with Apache RocketMQ, a distributed messaging and streaming platform, requiring environment variables for configuration.
MCP Server SSH Client
A local MCP server that securely connects to remote servers over SSH, acting as a proxy for MCP commands.
Tiny Chat
A simple chat application that requires an external database configuration.