MCP Server
Cleanmails includes a built-in Model Context Protocol (MCP) server that lets you control your outreach platform directly from AI coding assistants like Claude Desktop, Cursor, or any MCP-compatible client.
What is MCP?
MCP (Model Context Protocol) is an open standard that allows AI assistants to interact with external tools. The Cleanmails MCP server exposes your campaigns, senders, domains, and lists as tools that an AI can read and control.
Available Tools
| Tool | Description |
|---|---|
list_campaigns | List all campaigns with stats (sent, opens, replies, bounces) |
get_campaign | Get detailed info about a specific campaign |
pause_campaign | Pause a running campaign |
resume_campaign | Resume a paused campaign |
get_stats | Get overall outreach statistics |
list_senders | List all sender accounts with health scores |
list_domains | List all sending domains with DNS status |
verify_domain | Trigger DNS verification for a domain |
list_lists | List all lead lists with counts |
validate_list | Trigger email validation on a lead list |
verify_email | Verify a single email address (deep SMTP check) |
get_replies | Get recent email replies |
get_activity | Get daily activity chart for the last N days |
Setup for Claude Desktop
Download the MCP binary
The MCP server binary is included in your Cleanmails installation at /opt/cleanmails/cleanmails-mcp. Copy it to your local machine.
Get your session token
Login to your Cleanmails dashboard, open browser DevTools → Application → Cookies, and copy the auth_token value.
Configure Claude Desktop
Edit your Claude Desktop MCP config file:
{
"mcpServers": {
"cleanmails": {
"command": "/path/to/cleanmails-mcp",
"args": [
"--api-url", "https://your-cleanmails-domain.com",
"--api-key", "YOUR_AUTH_TOKEN"
]
}
}
}Restart Claude Desktop
After saving the config, restart Claude Desktop. You should see "cleanmails" appear in the available tools list.
Setup for Cursor
The same binary works with Cursor. Add it to your .cursor/mcp.json:
{
"mcpServers": {
"cleanmails": {
"command": "/path/to/cleanmails-mcp",
"args": ["--api-url", "https://your-domain.com", "--api-key", "YOUR_TOKEN"]
}
}
}Environment Variables
Instead of CLI flags, you can use environment variables:
| Variable | Description |
|---|---|
CLEANMAILS_API_URL | Your Cleanmails server URL (e.g., https://app.yourdomain.com) |
CLEANMAILS_API_KEY | Your session/auth token |
Example Usage
Once connected, you can ask your AI assistant things like:
- "Show me my campaign stats for this week"
- "Pause the Q2 Outreach campaign"
- "Verify the email john@example.com"
- "Which senders have low health scores?"
- "Trigger validation on my Enterprise Leads list"
- "What's my reply rate over the last 14 days?"
The Cleanmails MCP server implements protocol version 2024-11-05 and uses stdio transport (stdin/stdout JSON-RPC).
Troubleshooting
| Issue | Solution |
|---|---|
| Tools not appearing | Check that the binary path is correct and executable (chmod +x) |
| API errors (401) | Your auth token may have expired — get a fresh one from the dashboard |
| Connection refused | Ensure your Cleanmails server is running and accessible from your machine |