A comprehensive CLI and MCP server for managing MXroute email hosting. Full account management, automated DNS configuration, email sending, spam control, security auditing, monitoring, and more -- all from your terminal.
__ ____ __ _
| \/ \ \/ /_ __ ___ _ _| |_ ___
| |\/| |\ /| '__/ _ \| | | | __/ _ \
| | | |/ \| | | (_) | |_| | || __/
|_| |_/_/\_\_| \___/ \__,_|\__\___|
Email Hosting Management CLI
- Features
- Installation
- Quick Start
- Credentials
- Command Reference
- Configuration
- MCP Server
- Automated DNS Setup
- Monitoring and Cron
- Shell Completions
- Development
- Requirements
- License
- 60+ command groups, 140+ subcommands -- manage every aspect of MXroute from the terminal
- Full mail client -- read, compose, reply, forward, search, and manage emails via IMAP/SMTP directly from the CLI
- Agentic email via MCP -- 78+ tools exposed via the Model Context Protocol, including full mailbox access for AI agents
- Business provisioning -- manifest-based bulk setup, welcome emails, credential export, employee offboarding, quota policies
- Multi-account support -- all mail tools accept a
profileparameter for operating on different accounts without switching - Automated DNS setup -- configure MX, SPF, DKIM, and DMARC records via Cloudflare, Porkbun, DigitalOcean, or Namecheap APIs
- Security auditing -- score your domains against DNS, SPF lookup count, catch-all, and forwarding loop checks
- Blacklist monitoring -- check your server IP against 10 DNS blacklists
- Health monitoring -- cron-friendly health checks with alert support
- Bulk operations -- create accounts and forwarders from CSV, bulk mark/delete/move emails
- Export/import -- back up and restore your entire configuration as JSON
- Email webhook -- local HTTP server that relays email through MXroute SMTP
- Secure config -- credentials stored with
0600permissions in~/.config/mxroute-cli/
npm install -g mxroute-cliThis installs two binaries:
mxroute-- the CLImxroute-mcp-- the MCP server
# 1. Run the interactive setup wizard
mxroute setup
# Or configure step by step:
mxroute config setup # SMTP credentials (for sending email)
mxroute auth login # DirectAdmin API auth (for account management)
# 2. Check your DNS records
mxroute dns check
# 3. View your account dashboard
mxroute statusExample -- status dashboard:
┌─ Account Status ────────────────────────────────────────┐
│ Profile default │
│ Server fusion.mxrouting.net │
│ Account user@example.com │
│ │
│ DNS Health │
│ MX ✔ SPF ✔ DKIM ✔ DMARC ✔ CNAME ● │
│ │
│ SMTP API ✔ Connected │
└──────────────────────────────────────────────────────────┘
The CLI uses two types of credentials:
| Credential | Purpose | Where to find |
|---|---|---|
| Server hostname | Identifies your MXroute server | Control Panel -> DNS section (e.g., tuesday, fusion) |
| Email + password | SMTP API (sending email) | Your email account credentials |
| DirectAdmin username | API authentication | Your DirectAdmin login username |
| Login Key | API authentication (recommended) | Control Panel -> Login Keys -> Create new key |
Why Login Keys? They are more secure than passwords -- you can restrict permissions, set expiry dates, and revoke them without changing your password.
Which commands need which credentials:
| Credential | Required for |
|---|---|
| SMTP credentials | send, test, webhook, monitor |
| DirectAdmin Login Key | domains, accounts, forwarders, autoresponder, catchall, spam, dnsrecords, filters, lists, aliases, quota, audit, doctor, export |
| None (server name only) | dns check, dns records, dns generate, info, troubleshoot, ip |
| Command | Description |
|---|---|
mxroute setup |
Interactive setup wizard -- configures CLI, MCP server, and skills |
mxroute status |
Account dashboard with auth status, DNS health, and connectivity |
mxroute whoami |
Quick account overview |
mxroute open [target] |
Open MXroute panels in your browser |
mxroute config setup # Interactive configuration wizard
mxroute config smtp # Configure SMTP credentials
mxroute config remove-smtp # Remove SMTP credentials
mxroute config show # Show current config (passwords masked)
mxroute config profiles # List all saved profiles
mxroute config switch [name] # Switch between profiles
mxroute config delete [name] # Delete a profilemxroute auth login # Interactive login with Login Key
mxroute auth status # Verify stored credentials are valid
mxroute auth logout # Remove stored credentialsExample:
$ mxroute auth login
? Server hostname: fusion
? DirectAdmin username: myuser
? Login Key: ••••••••
✔ Authentication successful!Full IMAP/SMTP email client built into the CLI -- read, compose, reply, forward, search, and manage emails without leaving the terminal. Zero external dependencies (raw TLS sockets).
mxroute mail inbox # List recent messages (default: 25)
mxroute mail inbox -c 50 # List 50 messages
mxroute mail inbox -f Sent # List messages in Sent foldermxroute mail read <uid> # Read email by UID
mxroute mail read <uid> -f Sent # Read from specific foldermxroute mail compose -t user@example.com -s "Subject" -b "Body"
mxroute mail compose -t user@example.com -s "Hi" -b "Body" --cc cc@example.com --bcc bcc@example.com
mxroute mail compose -t user@example.com -s "Hi" -b "Body" -a file.pdf -a image.pngmxroute mail reply <uid> -b "Reply body"
mxroute mail forward <uid> -t other@example.com
mxroute mail forward <uid> -t other@example.com -n "FYI, see below"mxroute mail search "keyword" # Search subject, from, body
mxroute mail search "keyword" -f Sent # Search specific folder
mxroute mail search "keyword" -l 100 # Limit resultsmxroute mail delete <uid> # Delete message
mxroute mail move <uid> -d Archive # Move to foldermxroute mail mark-read <uid> # Mark as read
mxroute mail mark-unread <uid> # Mark as unreadmxroute mail folders # List all folders
mxroute mail folder-create "Projects" # Create folder
mxroute mail folder-delete "Projects" # Delete foldermxroute mail unread # Unread count in INBOX
mxroute mail unread -f "Custom Folder" # Unread count in custom foldermxroute mail save-attachment <uid> # Save all attachments
mxroute mail save-attachment <uid> -i 0 -o ./downloads # Save specific attachmentmxroute domains list # List all domains with alias counts
mxroute domains info [domain] # Show details for a domainmxroute accounts list [domain] # List email accounts
mxroute accounts create [domain] # Create an email account (interactive)
mxroute accounts delete [domain] # Delete an email account
mxroute accounts passwd [domain] # Change account passwordExample:
$ mxroute accounts create example.com
? Username (before @example.com): info
? Password: ••••••••
? Confirm password: ••••••••
? Quota in MB (0 = unlimited): 0
? Create info@example.com? Yes
✔ Created info@example.commxroute forwarders list [domain] # List all forwarders
mxroute forwarders create [domain] # Create a forwarder (interactive)
mxroute forwarders delete [domain] # Delete a forwardermxroute autoresponder list [domain] # List all autoresponders
mxroute autoresponder create [domain] # Create autoresponder (opens editor)
mxroute autoresponder edit [domain] # Edit existing autoresponder
mxroute autoresponder delete [domain] # Delete an autorespondermxroute catchall get [domain] # Show current catch-all setting
mxroute catchall set [domain] # Configure catch-all (interactive)Options: forward to existing account, forward to custom email, reject (:fail:), or disable (:blackhole:).
mxroute filters list [domain] # List filters for an account
mxroute filters create [domain] # Create a filter (interactive)
mxroute filters delete [domain] # Delete a filterSupports matching on from, to, subject, or body with actions to discard, forward, or move to a folder.
mxroute lists list [domain] # List all mailing lists
mxroute lists create [domain] # Create a mailing list
mxroute lists delete [domain] # Delete a mailing list
mxroute lists members [domain] # Show members of a list
mxroute lists add-member [domain] # Add a member
mxroute lists remove-member [domain] # Remove a membermxroute aliases list [domain] # List domain aliases
mxroute aliases add [domain] # Add a domain alias
mxroute aliases remove [domain] # Remove a domain aliasHow aliases work: If
primary.comhasuser@primary.com, addingalias.comas a pointer meansuser@alias.comalso works -- all accounts are shared.
mxroute quota show # Account-wide usage overview
mxroute quota set [domain] # Set quota for a specific accountExample output:
┌─ Resource Usage ─────────────────────────────────────────────┐
│ Disk Usage 3.19MB / 100.0GB [--------------------] 0% │
│ Bandwidth 1.26MB / unlimited │
│ Email Accounts 12 / unlimited │
│ Domains 3 / unlimited │
│ Forwarders 1 / unlimited │
└──────────────────────────────────────────────────────────────────┘
mxroute dns check [domain] # Health check via DNS lookup
mxroute dns records [domain] # Show required DNS records for your server
mxroute dns generate [domain] # Generate zone file for your DNS provider
mxroute dns setup [domain] # Auto-configure via registrar API
mxroute dns watch [domain] # Real-time DNS propagation monitoringWhat dns check verifies:
- MX -- primary and relay records pointing to your MXroute server
- SPF --
v=spf1 include:mxroute.com -allpresent with hard fail - DKIM --
x._domainkeyTXT record with valid DKIM1 key - DMARC --
_dmarcTXT record with quarantine or reject policy - CNAME -- custom hostnames for mail/webmail (optional)
dns generate supports: Cloudflare, Namecheap, Route53/AWS, and generic providers.
Manage DNS records directly on your MXroute server. Requires authentication.
mxroute dnsrecords list [domain] # List all DNS records from server
mxroute dnsrecords add [domain] # Add a record (A, AAAA, CNAME, MX, TXT, SRV)
mxroute dnsrecords delete [domain] # Delete a DNS record
mxroute dnsrecords dkim [domain] # Retrieve the full DKIM keymxroute send # Interactive composer
mxroute send -t user@example.com -s "Subject" -b "Body" # Send with flags
mxroute send -t user@example.com -s "Hi" --html -b "<h1>Hello</h1>" # HTML email
mxroute send -f alias@example.com -t user@example.com -s "Hi" -b "Body" # Custom from
mxroute send -t user@example.com -s "Report" --file report.pdf # With attachment| Flag | Description |
|---|---|
-t, --to <email> |
Recipient email address |
-s, --subject <text> |
Email subject line |
-b, --body <text> |
Email body content |
-f, --from <email> |
Sender address (defaults to configured account) |
--html |
Treat body as raw HTML |
--file <path> |
Attach a file |
mxroute test # Send a test email to yourselfStart a local HTTP server that accepts POST requests and relays them as email through MXroute SMTP.
mxroute webhook # Start on default port 3025
mxroute webhook --port 8080 # Custom portEndpoints:
POST /send-- send an email ({ "to": "...", "subject": "...", "body": "..." })GET /health-- health check
mxroute spam status [domain] # Show current SpamAssassin config
mxroute spam enable [domain] # Enable with defaults (score 5, spam folder)
mxroute spam disable [domain] # Disable SpamAssassin
mxroute spam config [domain] # Interactive configuration wizardConfiguration options: required score (1-10), spam delivery action (move to folder, leave in inbox, delete), high score threshold, and high score action.
Run a comprehensive security audit across all domains with a scored report.
mxroute audit # Full security audit with scoreChecks: DNS configuration, SPF lookup count, catch-all settings, forwarding loops, and more.
mxroute ip # Check server IP against 10 DNS blacklistsCron-friendly health check that tests DNS, port connectivity, and SMTP API across all domains.
mxroute monitor # Run health check with full output
mxroute monitor --quiet # Exit code only (0 = healthy, 1 = issue)
mxroute monitor --alert # Send email alert on failuremxroute cron setup # Install monitoring cron job
mxroute cron remove # Remove monitoring cron jobmxroute doctor # Run checks across all domainsmxroute benchmark # Test IMAP/SMTP connection speedmxroute export # Export all domains to JSON
mxroute export example.com # Export specific domainmxroute import backup.json # Restore from export filemxroute diff before.json after.json # Compare two export filesmxroute bulk accounts accounts.csv # Create accounts from CSV
mxroute bulk forwarders fwd.csv # Create forwarders from CSVTools for onboarding and offboarding employees, bulk account setup, and credential distribution.
mxroute password # Change your own email password (verifies current password via IMAP first)Provision an entire company from a single JSON manifest file.
mxroute provision plan manifest.json # Dry-run: show what would be created or skipped
mxroute provision apply manifest.json # Execute: create all accounts, forwarders, and settings
mxroute provision generate [domain] # Generate a manifest from existing domain configExample manifest:
{
"company": "Acme Corp",
"domains": [{
"name": "acme.com",
"accounts": [
{ "user": "alice", "quota": 5000 },
{ "user": "bob", "quota": 2000 }
],
"forwarders": [
{ "from": "info", "to": "alice@acme.com" },
{ "from": "support", "to": "bob@acme.com" }
]
}]
}Accounts without a password field get a random 16-character password generated automatically.
mxroute welcome-send [domain] # Send setup instructions to selected accountsSends branded HTML emails with IMAP/SMTP settings, webmail links, and client setup guides (Outlook, Apple Mail, Thunderbird, mobile).
mxroute credentials-export [domain] # Export account info as CSV, 1Password CSV, or JSONOutput includes email addresses, server settings, and connection details. Files written with 0600 permissions.
mxroute deprovision [domain] # Offboard an account: forward, auto-reply, or deleteOptions:
- Forward emails to another employee's account
- Set auto-reply + forwarding (transition period)
- Delete immediately
mxroute quota-policy apply [domain] # Apply uniform or per-role quotas
mxroute quota-policy generate [domain] # Generate sample policy fileExample policy file:
{
"rules": [
{ "pattern": "admin*", "quota": 10000 },
{ "pattern": "*", "quota": 2000 }
]
}mxroute ssl-check # Check SSL certs on IMAP/SMTP/POP3/DirectAdmin ports
mxroute ssl-check example.com # Check specific hostnamemxroute reputation # Check SPF/DKIM/DMARC/MX/blacklist scoring
mxroute reputation example.com # Check specific domainmxroute test-delivery # Send test email and measure delivery timemxroute rate-limit # Check sending rate against 400/hr limitmxroute accounts-search <query> # Search accounts across all domainsmxroute cleanup # Find orphaned forwarders, autoresponders, conflictsmxroute password-audit # Audit account passwords for weak patternsmxroute header-analyze # Parse and analyze email headers for routing/auth/spam infomxroute templates list # List saved templates
mxroute templates save <name> # Save a new template
mxroute templates send <name> # Send using a template with variable substitution
mxroute templates delete <name> # Delete a templatemxroute usage-history # Show current usage with historical trends and sparklinesmxroute troubleshoot # Launch interactive wizardCovers 10 issue categories:
- Emails going to spam (Gmail)
- Emails going to spam (Microsoft)
- Cannot connect to server
- Authentication failures
- Emails not being delivered
- DNS configuration issues
- SSL certificate warnings
- Common error messages (550 Auth Required, Sender Verify Failed, etc.)
- Migration issues (imapsync guide)
- Spam filter blocking legitimate mail
mxroute share # Generate setup page for terminal
mxroute share user@example.com # Generate for specific emailProduces an HTML page or terminal output with connection details to share with end users.
Quick reference for email client settings and service details.
mxroute info connections # IMAP/SMTP/POP3 ports table
mxroute info webmail # Webmail URLs (Crossbox, Roundcube)
mxroute info caldav # CalDAV/CardDAV setup
mxroute info api # SMTP API endpoint and limits
mxroute info limits # Service limits and policies
mxroute info panels # Management and Control Panel URLs
mxroute info all # Everything at once
mxroute info client <name> # Client setup guide (ios, outlook, thunderbird, generic)Connection settings:
| Protocol | Port | Encryption | Recommended |
|---|---|---|---|
| IMAP | 993 | SSL/TLS | Yes |
| IMAP | 143 | STARTTLS | Alternative |
| POP3 | 995 | SSL/TLS | Yes |
| POP3 | 110 | STARTTLS | Alternative |
| SMTP | 465 | SSL/TLS | Yes |
| SMTP | 587 | STARTTLS | Alternative |
| SMTP | 2525 | STARTTLS | If 587 blocked |
Configuration is stored at ~/.config/mxroute-cli/config.json with file permissions 0600 (owner-only read/write).
Manage different MXroute accounts from one CLI:
# Create profiles
mxroute config setup # First run creates "default" profile
mxroute config setup # Enter "work" as profile name for second
# Switch between them
mxroute config switch # Interactive picker
mxroute config switch work # Switch directly by name
mxroute config profiles # List all profiles
# Delete a profile
mxroute config delete old # Delete by nameThe mxroute-mcp binary exposes 78+ tools via the Model Context Protocol, allowing AI assistants to manage your MXroute account and operate as a full email agent.
- Claude Code
- Claude Desktop
- Cursor
- Windsurf
- OpenCode
- Cline
- Continue.dev
The setup wizard auto-detects installed clients and configures them:
mxroute setupAdd to your MCP client config:
{
"mcpServers": {
"mxroute": {
"command": "mxroute-mcp",
"args": []
}
}
}Account Management: domains, email accounts, forwarders, autoresponders, catch-all, spam config, DNS records, DKIM keys, email filters, mailing lists, domain aliases, quota management, DNS health checks.
DNS Provider Routing: list_dns_providers -- list all supported DNS providers with credential status, showing which providers are configured and ready for automated record creation.
Mail Client (IMAP/SMTP): list_messages, read_email, search_emails, send_email (with CC/BCC), reply_email, forward_email, delete_email, move_email, mark_email (read/unread/flagged/unflagged), get_unread_count, list_mail_folders, create_mail_folder, delete_mail_folder, download_attachment.
Bulk Operations: bulk_mark, bulk_delete, bulk_move -- operate on multiple messages at once.
Profile Management: list_profiles -- discover configured accounts. All mail tools accept an optional profile parameter to target a specific account without switching the global profile.
Security & Diagnostics: security_audit, check_reputation, ssl_check, password_audit, health_check, cleanup_audit, validate_forwarders, analyze_headers.
Utilities: test_delivery, check_rate_limit, search_accounts, export_config, usage_history.
Templates: list_templates, save_template, send_template, delete_template -- email template CRUD with {{variable}} substitution.
Business Provisioning: self_service_password, provision_plan, provision_execute, provision_generate, welcome_send, credentials_export, deprovision_account, quota_policy_apply -- manifest-based bulk setup, credential distribution, employee offboarding, and role-based quotas.
AI agents can operate on multiple email accounts by passing the profile parameter:
// List messages from the "work" profile
{ "tool": "list_messages", "arguments": { "profile": "work", "count": 10 } }
// Send email from the "personal" profile
{ "tool": "send_email", "arguments": { "profile": "personal", "to": "friend@example.com", "subject": "Hi", "body": "Hello!" } }
// Discover available profiles
{ "tool": "list_profiles", "arguments": {} }The dns setup command can automatically create all required MXroute DNS records at your registrar via API.
| Provider | API Support | Credentials Needed |
|---|---|---|
| Cloudflare | Full | API Token |
| Porkbun | Full | API Key + Secret Key |
| DigitalOcean | Full | API Token |
| GoDaddy | Full | API Key + API Secret |
| Hetzner DNS | Full | API Token |
| Vercel DNS | Full | Bearer Token |
| Namecheap | Limited* | API Key + Username |
| AWS Route53 | Detection only† | Access Key ID + Secret + Region |
| Google Cloud DNS | Detection only† | Service Account JSON + Project ID |
* Namecheap's API requires IP whitelisting and only supports domains registered through Namecheap.
† Detection only: the provider is auto-detected from your nameservers for routing purposes, but automated record creation is not supported. Use the AWS CLI or gcloud to apply the generated records.
The CLI can auto-detect your DNS provider by querying your domain's nameservers, then automatically route operations to the right provider:
# Auto-detect and route DNS setup
mxroute dns setup example.com
# List all configured providers and their credential status
mxroute dns providers
# Pre-configure credentials for a specific provider
mxroute dns providers-setup cloudflare
mxroute dns providers-setup porkbunProvider credentials are stored per-provider under providers in your config file and reused automatically on subsequent runs.
mxroute dns setup example.comThe wizard will:
- Ask which provider manages your DNS
- Prompt for API credentials (saved for reuse)
- Retrieve your DKIM key from the server
- Create MX, SPF, DKIM, and DMARC records automatically
- Verify the records propagated correctly
After making DNS changes, watch propagation in real time:
mxroute dns watch example.comThe monitor command checks DNS records, port connectivity (IMAP/SMTP), and SMTP API health across all your domains.
# Full output
mxroute monitor
# Silent mode for cron (exit code only)
mxroute monitor --quiet
# Send email alert on failure
mxroute monitor --alertInstall automatic monitoring that runs on a schedule:
# Install the cron job
mxroute cron setup
# Remove the cron job
mxroute cron removeGenerate shell completion scripts for tab completion of commands and options.
mxroute completions bash # Bash completions
mxroute completions zsh # Zsh completions
mxroute completions fish # Fish completionsInstall for your shell:
# Bash
mxroute completions bash >> ~/.bashrc
# Zsh
mxroute completions zsh >> ~/.zshrc
# Fish
mxroute completions fish > ~/.config/fish/completions/mxroute.fishgit clone https://github.com/t-rhex/mxroute-cli.git
cd mxroute-cli
npm install
npm run build| Script | Description |
|---|---|
npm run build |
Compile TypeScript |
npm run dev |
Watch mode for development |
npm test |
Run tests (Vitest) |
npm run test:watch |
Run tests in watch mode |
npm run test:coverage |
Run tests with coverage |
npm run lint |
Lint with ESLint |
npm run lint:fix |
Auto-fix lint issues |
npm run format |
Format with Prettier |
npm run typecheck |
Type check without emitting |
npm run ci |
Full CI pipeline (lint + typecheck + build + test) |
150+ tests across 24+ test files covering API, audit, benchmark, blacklist, CLI, completions, config, diff, DirectAdmin, DNS, IMAP, mail/MIME, MCP, monitor, provisioning, share, theme, and webhook functionality.
- ESLint and Prettier enforce consistent style
- Husky pre-commit hooks run lint-staged on every commit
- GitHub Actions CI validates on Node.js 20 and 22
- Tag-based release workflow publishes to npm with provenance
src/
index.ts # CLI entry point (Commander.js)
mcp.ts # MCP server entry point (78+ tools)
commands/ # 50 command modules (includes mail client)
utils/ # Shared utilities (API, config, DNS, DirectAdmin, IMAP, MIME, registrars)
tests/ # 24+ test files (Vitest)
Releases are automated via GitHub Actions. Push a version tag to trigger npm publish:
npm run release # Patch version bump
npm run release:minor # Minor version bump
npm run release:major # Major version bump| Panel | URL | Purpose |
|---|---|---|
| Management Panel | https://management.mxroute.com | Subscriptions, invoices, payment, support tickets |
| Control Panel | https://panel.mxroute.com | Email accounts, forwarders, domains, DNS, spam, webmail |
| Whitelist Request | https://whitelistrequest.mxrouting.net | Request IP/domain whitelist for spam filter |
- Node.js >= 20
- An MXroute email hosting account
MIT