AI & Integrations

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

ToolDescription
list_campaignsList all campaigns with stats (sent, opens, replies, bounces)
get_campaignGet detailed info about a specific campaign
pause_campaignPause a running campaign
resume_campaignResume a paused campaign
get_statsGet overall outreach statistics
list_sendersList all sender accounts with health scores
list_domainsList all sending domains with DNS status
verify_domainTrigger DNS verification for a domain
list_listsList all lead lists with counts
validate_listTrigger email validation on a lead list
verify_emailVerify a single email address (deep SMTP check)
get_repliesGet recent email replies
get_activityGet daily activity chart for the last N days

Setup for Claude Desktop

1

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.

2

Get your session token

Login to your Cleanmails dashboard, open browser DevTools → Application → Cookies, and copy the auth_token value.

3

Configure Claude Desktop

Edit your Claude Desktop MCP config file:

claude_desktop_config.json
{
  "mcpServers": {
    "cleanmails": {
      "command": "/path/to/cleanmails-mcp",
      "args": [
        "--api-url", "https://your-cleanmails-domain.com",
        "--api-key", "YOUR_AUTH_TOKEN"
      ]
    }
  }
}
4

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:

.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:

VariableDescription
CLEANMAILS_API_URLYour Cleanmails server URL (e.g., https://app.yourdomain.com)
CLEANMAILS_API_KEYYour 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?"
Protocol Version

The Cleanmails MCP server implements protocol version 2024-11-05 and uses stdio transport (stdin/stdout JSON-RPC).

Troubleshooting

IssueSolution
Tools not appearingCheck 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 refusedEnsure your Cleanmails server is running and accessible from your machine