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.
Похожие серверы
Brainstorm MCP
Slack for AI agents - a local service where agents can join projects, message each other, and share resources in a structured workspace
Postmark
An MCP server for sending emails via the Postmark service, configured through environment variables.
MCP Server SSH Client
A local MCP server that securely connects to remote servers over SSH, acting as a proxy for MCP commands.
Integration App
Interact with any other SaaS applications on behalf of your customers.
Gmail MCP
A standardized interface for managing, sending, and retrieving emails through the Gmail API.
Audio MCP Server
Provides audio input and output capabilities for AI assistants.
/vibe
Social layer for AI coding — DMs, presence, discovery, and multiplayer games between developers. npm: slashvibe-mcp | Install: npx -y slashvibe-mcp
Human-in-the-Loop Slack MCP Server
Allows AI assistants to request information and receive responses from humans via Slack.
MCP Notify Server
Sends desktop notifications with sound when agent tasks are completed.
MCP ChatGPT Proxy
A production-ready MCP server for ChatGPT and o3-pro, featuring caching, cost tracking, and rate limiting.