mxroute-cli 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +524 -241
  2. package/dist/commands/accounts.js +19 -59
  3. package/dist/commands/accounts.js.map +1 -1
  4. package/dist/commands/aliases.js +8 -57
  5. package/dist/commands/aliases.js.map +1 -1
  6. package/dist/commands/audit.d.ts +1 -0
  7. package/dist/commands/audit.js +278 -0
  8. package/dist/commands/audit.js.map +1 -0
  9. package/dist/commands/auth.d.ts +0 -1
  10. package/dist/commands/auth.js +0 -69
  11. package/dist/commands/auth.js.map +1 -1
  12. package/dist/commands/autoresponder.js +10 -59
  13. package/dist/commands/autoresponder.js.map +1 -1
  14. package/dist/commands/benchmark.d.ts +1 -0
  15. package/dist/commands/benchmark.js +134 -0
  16. package/dist/commands/benchmark.js.map +1 -0
  17. package/dist/commands/bulk.d.ts +2 -0
  18. package/dist/commands/bulk.js +201 -0
  19. package/dist/commands/bulk.js.map +1 -0
  20. package/dist/commands/catchall.js +5 -38
  21. package/dist/commands/catchall.js.map +1 -1
  22. package/dist/commands/completions.d.ts +1 -0
  23. package/dist/commands/completions.js +138 -0
  24. package/dist/commands/completions.js.map +1 -0
  25. package/dist/commands/config.d.ts +1 -0
  26. package/dist/commands/config.js +42 -0
  27. package/dist/commands/config.js.map +1 -1
  28. package/dist/commands/cron.d.ts +2 -0
  29. package/dist/commands/cron.js +114 -0
  30. package/dist/commands/cron.js.map +1 -0
  31. package/dist/commands/diff.d.ts +1 -0
  32. package/dist/commands/diff.js +125 -0
  33. package/dist/commands/diff.js.map +1 -0
  34. package/dist/commands/dns-setup.d.ts +1 -0
  35. package/dist/commands/dns-setup.js +256 -0
  36. package/dist/commands/dns-setup.js.map +1 -0
  37. package/dist/commands/dns-watch.d.ts +1 -0
  38. package/dist/commands/dns-watch.js +67 -0
  39. package/dist/commands/dns-watch.js.map +1 -0
  40. package/dist/commands/dns.js +28 -6
  41. package/dist/commands/dns.js.map +1 -1
  42. package/dist/commands/dnsapi.js +10 -59
  43. package/dist/commands/dnsapi.js.map +1 -1
  44. package/dist/commands/doctor.d.ts +1 -0
  45. package/dist/commands/doctor.js +143 -0
  46. package/dist/commands/doctor.js.map +1 -0
  47. package/dist/commands/domains.js +4 -27
  48. package/dist/commands/domains.js.map +1 -1
  49. package/dist/commands/export-import.d.ts +2 -0
  50. package/dist/commands/export-import.js +189 -0
  51. package/dist/commands/export-import.js.map +1 -0
  52. package/dist/commands/filters.js +8 -57
  53. package/dist/commands/filters.js.map +1 -1
  54. package/dist/commands/forwarders.js +8 -57
  55. package/dist/commands/forwarders.js.map +1 -1
  56. package/dist/commands/ip.d.ts +1 -0
  57. package/dist/commands/ip.js +70 -0
  58. package/dist/commands/ip.js.map +1 -0
  59. package/dist/commands/lists.js +15 -80
  60. package/dist/commands/lists.js.map +1 -1
  61. package/dist/commands/monitor.d.ts +4 -0
  62. package/dist/commands/monitor.js +189 -0
  63. package/dist/commands/monitor.js.map +1 -0
  64. package/dist/commands/open.d.ts +1 -0
  65. package/dist/commands/open.js +53 -0
  66. package/dist/commands/open.js.map +1 -0
  67. package/dist/commands/quota.js +11 -48
  68. package/dist/commands/quota.js.map +1 -1
  69. package/dist/commands/send.d.ts +1 -0
  70. package/dist/commands/send.js +43 -1
  71. package/dist/commands/send.js.map +1 -1
  72. package/dist/commands/share.d.ts +1 -0
  73. package/dist/commands/share.js +217 -0
  74. package/dist/commands/share.js.map +1 -0
  75. package/dist/commands/spam.js +9 -42
  76. package/dist/commands/spam.js.map +1 -1
  77. package/dist/commands/status.js +62 -30
  78. package/dist/commands/status.js.map +1 -1
  79. package/dist/commands/troubleshoot.js.map +1 -1
  80. package/dist/commands/webhook.d.ts +3 -0
  81. package/dist/commands/webhook.js +124 -0
  82. package/dist/commands/webhook.js.map +1 -0
  83. package/dist/commands/whoami.d.ts +1 -0
  84. package/dist/commands/whoami.js +40 -0
  85. package/dist/commands/whoami.js.map +1 -0
  86. package/dist/index.js +171 -6
  87. package/dist/index.js.map +1 -1
  88. package/dist/mcp.js.map +1 -1
  89. package/dist/utils/blacklist.d.ts +17 -0
  90. package/dist/utils/blacklist.js +65 -0
  91. package/dist/utils/blacklist.js.map +1 -0
  92. package/dist/utils/directadmin.js +1 -1
  93. package/dist/utils/directadmin.js.map +1 -1
  94. package/dist/utils/dns.d.ts +1 -1
  95. package/dist/utils/dns.js +3 -3
  96. package/dist/utils/dns.js.map +1 -1
  97. package/dist/utils/registrars.d.ts +35 -0
  98. package/dist/utils/registrars.js +324 -0
  99. package/dist/utils/registrars.js.map +1 -0
  100. package/dist/utils/shared.d.ts +20 -0
  101. package/dist/utils/shared.js +64 -0
  102. package/dist/utils/shared.js.map +1 -0
  103. package/dist/utils/theme.js +0 -1
  104. package/dist/utils/theme.js.map +1 -1
  105. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # mxroute-cli
2
2
 
3
- A powerful CLI for managing [MXroute](https://mxroute.com) email hosting -- full account management, DNS verification, email sending, spam configuration, troubleshooting, and more via the DirectAdmin API.
3
+ A comprehensive CLI and MCP server for managing [MXroute](https://mxroute.com) email hosting. Full account management, automated DNS configuration, email sending, spam control, security auditing, monitoring, and more -- all from your terminal.
4
4
 
5
5
  ```
6
6
  __ ____ __ _
@@ -12,65 +12,152 @@ A powerful CLI for managing [MXroute](https://mxroute.com) email hosting -- full
12
12
  Email Hosting Management CLI
13
13
  ```
14
14
 
15
+ [![npm version](https://img.shields.io/npm/v/mxroute-cli)](https://www.npmjs.com/package/mxroute-cli)
16
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
17
+ [![CI](https://github.com/t-rhex/mxroute-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/t-rhex/mxroute-cli/actions)
18
+
19
+ ---
20
+
21
+ ## Table of Contents
22
+
23
+ - [Features](#features)
24
+ - [Installation](#installation)
25
+ - [Quick Start](#quick-start)
26
+ - [Credentials](#credentials)
27
+ - [Command Reference](#command-reference)
28
+ - [Core](#core)
29
+ - [Email Management](#email-management)
30
+ - [DNS Management](#dns-management)
31
+ - [Email Sending](#email-sending)
32
+ - [Spam and Security](#spam-and-security)
33
+ - [Monitoring and Operations](#monitoring-and-operations)
34
+ - [Data Management](#data-management)
35
+ - [Troubleshooting](#troubleshooting)
36
+ - [Connection Info](#connection-info)
37
+ - [Configuration](#configuration)
38
+ - [MCP Server](#mcp-server)
39
+ - [Automated DNS Setup](#automated-dns-setup)
40
+ - [Monitoring and Cron](#monitoring-and-cron)
41
+ - [Shell Completions](#shell-completions)
42
+ - [Development](#development)
43
+ - [Requirements](#requirements)
44
+ - [License](#license)
45
+
46
+ ---
47
+
15
48
  ## Features
16
49
 
17
- - **Full account management** -- domains, email accounts, forwarders, autoresponders, mailing lists, domain aliases
18
- - **DNS management** -- health checks (MX, SPF, DKIM, DMARC), record management via API, DKIM key retrieval, zone file generation
19
- - **Email sending** -- send emails via MXroute's SMTP API with interactive composer or CLI flags
20
- - **Spam control** -- SpamAssassin configuration, catch-all addresses, email filters
21
- - **Quota monitoring** -- disk usage, bandwidth, account counts with visual progress bars
22
- - **Troubleshooting** -- interactive wizard covering 10 common issue categories
23
- - **Connection reference** -- IMAP/SMTP/POP3 ports, webmail URLs, CalDAV/CardDAV setup, client guides
50
+ - **41 command groups, 100+ subcommands** -- manage every aspect of MXroute from the terminal
51
+ - **Automated DNS setup** -- configure MX, SPF, DKIM, and DMARC records via Cloudflare, Porkbun, DigitalOcean, or Namecheap APIs
52
+ - **MCP server** -- 36 tools exposed via the Model Context Protocol for AI-assisted email management
53
+ - **Security auditing** -- score your domains against DNS, SPF lookup count, catch-all, and forwarding loop checks
54
+ - **Blacklist monitoring** -- check your server IP against 10 DNS blacklists
55
+ - **Health monitoring** -- cron-friendly health checks with alert support
56
+ - **Bulk operations** -- create accounts and forwarders from CSV files
57
+ - **Export/import** -- back up and restore your entire configuration as JSON
58
+ - **Email webhook** -- local HTTP server that relays email through MXroute SMTP
24
59
  - **Multi-profile support** -- manage multiple MXroute accounts from one CLI
25
60
  - **Secure config** -- credentials stored with `0600` permissions in `~/.config/mxroute-cli/`
26
61
 
27
- ## Install
62
+ ---
63
+
64
+ ## Installation
28
65
 
29
66
  ```bash
30
67
  npm install -g mxroute-cli
31
68
  ```
32
69
 
70
+ This installs two binaries:
71
+ - `mxroute` -- the CLI
72
+ - `mxroute-mcp` -- the MCP server
73
+
74
+ ---
75
+
33
76
  ## Quick Start
34
77
 
35
78
  ```bash
36
- # 1. Configure SMTP credentials (for sending email)
37
- mxroute config setup
79
+ # 1. Run the interactive setup wizard
80
+ mxroute setup
38
81
 
39
- # 2. Authenticate with DirectAdmin API (for account management)
40
- mxroute auth login
82
+ # Or configure step by step:
83
+ mxroute config setup # SMTP credentials (for sending email)
84
+ mxroute auth login # DirectAdmin API auth (for account management)
41
85
 
42
- # 3. Check your DNS records
86
+ # 2. Check your DNS records
43
87
  mxroute dns check
44
88
 
45
- # 4. View full account status dashboard
89
+ # 3. View your account dashboard
46
90
  mxroute status
47
91
  ```
48
92
 
49
- ### Getting Your Credentials
93
+ **Example -- status dashboard:**
94
+ ```
95
+ ┌─ Account Status ────────────────────────────────────────┐
96
+ │ Profile default │
97
+ │ Server fusion.mxrouting.net │
98
+ │ Account user@example.com │
99
+ │ │
100
+ │ DNS Health │
101
+ │ MX ✔ SPF ✔ DKIM ✔ DMARC ✔ CNAME ● │
102
+ │ │
103
+ │ SMTP API ✔ Connected │
104
+ └──────────────────────────────────────────────────────────┘
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Credentials
50
110
 
51
111
  The CLI uses two types of credentials:
52
112
 
53
113
  | Credential | Purpose | Where to find |
54
114
  |---|---|---|
55
- | **Server hostname** | Identifies your MXroute server | Control Panel (panel.mxroute.com) -> DNS section. Looks like `tuesday`, `fusion`, etc. |
56
- | **Email + password** | SMTP API (sending email) | Your email account credentials (same as email client login) |
115
+ | **Server hostname** | Identifies your MXroute server | Control Panel -> DNS section (e.g., `tuesday`, `fusion`) |
116
+ | **Email + password** | SMTP API (sending email) | Your email account credentials |
57
117
  | **DirectAdmin username** | API authentication | Your DirectAdmin login username |
58
- | **Login Key** | API authentication (recommended over password) | Control Panel -> Login Keys -> Create new key |
118
+ | **Login Key** | API authentication (recommended) | Control Panel -> Login Keys -> Create new key |
59
119
 
60
- > **Why Login Keys?** They're more secure than passwords -- you can restrict permissions, set expiry dates, and revoke them without changing your password.
120
+ > **Why Login Keys?** They are more secure than passwords -- you can restrict permissions, set expiry dates, and revoke them without changing your password.
121
+
122
+ **Which commands need which credentials:**
123
+
124
+ | Credential | Required for |
125
+ |---|---|
126
+ | **SMTP credentials** | `send`, `test`, `webhook`, `monitor` |
127
+ | **DirectAdmin Login Key** | `domains`, `accounts`, `forwarders`, `autoresponder`, `catchall`, `spam`, `dnsrecords`, `filters`, `lists`, `aliases`, `quota`, `audit`, `doctor`, `export` |
128
+ | **None** (server name only) | `dns check`, `dns records`, `dns generate`, `info`, `troubleshoot`, `ip` |
61
129
 
62
130
  ---
63
131
 
64
132
  ## Command Reference
65
133
 
66
- ### Authentication
134
+ ### Core
135
+
136
+ | Command | Description |
137
+ |---|---|
138
+ | `mxroute setup` | Interactive setup wizard -- configures CLI, MCP server, and skills |
139
+ | `mxroute status` | Account dashboard with auth status, DNS health, and connectivity |
140
+ | `mxroute whoami` | Quick account overview |
141
+ | `mxroute open [target]` | Open MXroute panels in your browser |
142
+
143
+ #### config -- Configuration Management
144
+
145
+ ```bash
146
+ mxroute config setup # Interactive configuration wizard
147
+ mxroute config smtp # Configure SMTP credentials
148
+ mxroute config remove-smtp # Remove SMTP credentials
149
+ mxroute config show # Show current config (passwords masked)
150
+ mxroute config profiles # List all saved profiles
151
+ mxroute config switch [name] # Switch between profiles
152
+ mxroute config delete [name] # Delete a profile
153
+ ```
67
154
 
68
- Authenticate with the DirectAdmin API to unlock account management commands.
155
+ #### auth -- Authentication
69
156
 
70
157
  ```bash
71
- mxroute auth login # Interactive login with Login Key
72
- mxroute auth status # Verify stored credentials are valid
73
- mxroute auth logout # Remove stored credentials
158
+ mxroute auth login # Interactive login with Login Key
159
+ mxroute auth status # Verify stored credentials are valid
160
+ mxroute auth logout # Remove stored credentials
74
161
  ```
75
162
 
76
163
  **Example:**
@@ -82,297 +169,332 @@ $ mxroute auth login
82
169
  ✔ Authentication successful!
83
170
  ```
84
171
 
85
- ### Configuration & Profiles
172
+ ---
173
+
174
+ ### Email Management
175
+
176
+ #### domains -- Domain Management
86
177
 
87
- Configure SMTP credentials for sending email. Supports multiple profiles for managing different accounts.
178
+ ```bash
179
+ mxroute domains list # List all domains with alias counts
180
+ mxroute domains info [domain] # Show details for a domain
181
+ ```
182
+
183
+ #### accounts -- Email Accounts
88
184
 
89
185
  ```bash
90
- mxroute config setup # Interactive configuration wizard
91
- mxroute config show # Show current active configuration
92
- mxroute config profiles # List all saved profiles
93
- mxroute config switch # Switch between profiles (interactive)
94
- mxroute config switch work # Switch to a named profile
95
- mxroute config delete # Delete a profile (interactive)
96
- mxroute config delete old # Delete a named profile
186
+ mxroute accounts list [domain] # List email accounts
187
+ mxroute accounts create [domain] # Create an email account (interactive)
188
+ mxroute accounts delete [domain] # Delete an email account
189
+ mxroute accounts passwd [domain] # Change account password
97
190
  ```
98
191
 
99
- **Example -- multiple profiles:**
192
+ **Example:**
100
193
  ```bash
101
- $ mxroute config setup # Creates "default" profile
102
- $ mxroute config setup # Enter "work" as profile name
103
- $ mxroute config switch # Pick which profile to use
194
+ $ mxroute accounts create example.com
195
+ ? Username (before @example.com): info
196
+ ? Password: ••••••••
197
+ ? Confirm password: ••••••••
198
+ ? Quota in MB (0 = unlimited): 0
199
+ ? Create info@example.com? Yes
200
+ ✔ Created info@example.com
104
201
  ```
105
202
 
106
- ### Status Dashboard
203
+ #### forwarders / fwd -- Email Forwarders
204
+
205
+ ```bash
206
+ mxroute forwarders list [domain] # List all forwarders
207
+ mxroute forwarders create [domain] # Create a forwarder (interactive)
208
+ mxroute forwarders delete [domain] # Delete a forwarder
209
+ ```
107
210
 
108
- Get a complete overview of your account in one command.
211
+ #### autoresponder / vacation -- Autoresponders
109
212
 
110
213
  ```bash
111
- mxroute status # Full dashboard: account info, DNS health, API test
112
- mxroute # Same as status (default command)
214
+ mxroute autoresponder list [domain] # List all autoresponders
215
+ mxroute autoresponder create [domain] # Create autoresponder (opens editor)
216
+ mxroute autoresponder edit [domain] # Edit existing autoresponder
217
+ mxroute autoresponder delete [domain] # Delete an autoresponder
113
218
  ```
114
219
 
115
- Shows: active profile, server, account, domain, DNS health scores for MX/SPF/DKIM/DMARC/CNAME, and SMTP API connectivity test.
220
+ #### catchall -- Catch-All / Default Address
116
221
 
117
- ---
222
+ ```bash
223
+ mxroute catchall get [domain] # Show current catch-all setting
224
+ mxroute catchall set [domain] # Configure catch-all (interactive)
225
+ ```
118
226
 
119
- ### Domains
227
+ Options: forward to existing account, forward to custom email, reject (`:fail:`), or disable (`:blackhole:`).
120
228
 
121
- List and inspect domains on your MXroute account.
229
+ #### filters -- Email Filters
122
230
 
123
231
  ```bash
124
- mxroute domains list # List all domains with alias counts
125
- mxroute domains info # Show details for configured domain
126
- mxroute domains info example.com # Show details for specific domain
232
+ mxroute filters list [domain] # List filters for an account
233
+ mxroute filters create [domain] # Create a filter (interactive)
234
+ mxroute filters delete [domain] # Delete a filter
127
235
  ```
128
236
 
129
- ### Email Accounts
237
+ Supports matching on from, to, subject, or body with actions to discard, forward, or move to a folder.
130
238
 
131
- Create, list, delete, and manage passwords for email accounts.
239
+ #### lists / mailinglist -- Mailing Lists
132
240
 
133
241
  ```bash
134
- mxroute accounts list # List accounts (prompts for domain if multiple)
135
- mxroute accounts list example.com # List accounts for specific domain
136
- mxroute accounts create # Interactive account creation
137
- mxroute accounts create example.com # Create account on specific domain
138
- mxroute accounts delete example.com # Delete an account (picks from list)
139
- mxroute accounts passwd example.com # Change password (picks from list)
242
+ mxroute lists list [domain] # List all mailing lists
243
+ mxroute lists create [domain] # Create a mailing list
244
+ mxroute lists delete [domain] # Delete a mailing list
245
+ mxroute lists members [domain] # Show members of a list
246
+ mxroute lists add-member [domain] # Add a member
247
+ mxroute lists remove-member [domain] # Remove a member
140
248
  ```
141
249
 
142
- Aliases: `accounts add` = `accounts create`, `accounts rm` = `accounts delete`, `accounts password` = `accounts passwd`
250
+ #### aliases -- Domain Aliases / Pointers
143
251
 
144
- **Example -- creating an account:**
145
252
  ```bash
146
- $ mxroute accounts create example.com
147
- ? Username (before @example.com): info
148
- ? Password: ••••••••
149
- ? Confirm password: ••••••••
150
- ? Quota in MB (0 = unlimited): 0
151
- ? Create info@example.com? Yes
152
- ✔ Created info@example.com
253
+ mxroute aliases list [domain] # List domain aliases
254
+ mxroute aliases add [domain] # Add a domain alias
255
+ mxroute aliases remove [domain] # Remove a domain alias
153
256
  ```
154
257
 
155
- ### Email Forwarders
258
+ > **How aliases work:** If `primary.com` has `user@primary.com`, adding `alias.com` as a pointer means `user@alias.com` also works -- all accounts are shared.
156
259
 
157
- Redirect email from one address to another.
260
+ #### quota -- Quota and Usage
158
261
 
159
262
  ```bash
160
- mxroute forwarders list [domain] # List all forwarders
161
- mxroute forwarders create [domain] # Create a forwarder (interactive)
162
- mxroute forwarders delete [domain] # Delete a forwarder (picks from list)
263
+ mxroute quota show # Account-wide usage overview
264
+ mxroute quota set [domain] # Set quota for a specific account
163
265
  ```
164
266
 
165
- Aliases: `fwd list`, `fwd create`, `fwd delete`; `forwarders add`, `forwarders rm`
267
+ **Example output:**
268
+ ```
269
+ ┌─ Resource Usage ─────────────────────────────────────────────┐
270
+ │ Disk Usage 3.19MB / 100.0GB [--------------------] 0% │
271
+ │ Bandwidth 1.26MB / unlimited │
272
+ │ Email Accounts 12 / unlimited │
273
+ │ Domains 3 / unlimited │
274
+ │ Forwarders 1 / unlimited │
275
+ └──────────────────────────────────────────────────────────────────┘
276
+ ```
277
+
278
+ ---
166
279
 
167
- ### Autoresponders / Vacation Messages
280
+ ### DNS Management
168
281
 
169
- Set up automatic replies for email accounts (e.g., "I'm out of office").
282
+ #### dns -- DNS Health and Records
170
283
 
171
284
  ```bash
172
- mxroute autoresponder list [domain] # List all autoresponders
173
- mxroute autoresponder create [domain] # Create autoresponder (picks account, opens editor)
174
- mxroute autoresponder edit [domain] # Edit existing autoresponder message
175
- mxroute autoresponder delete [domain] # Delete an autoresponder
285
+ mxroute dns check [domain] # Health check via DNS lookup
286
+ mxroute dns records [domain] # Show required DNS records for your server
287
+ mxroute dns generate [domain] # Generate zone file for your DNS provider
288
+ mxroute dns setup [domain] # Auto-configure via registrar API
289
+ mxroute dns watch [domain] # Real-time DNS propagation monitoring
176
290
  ```
177
291
 
178
- Aliases: `vacation list`, `vacation create`, `vacation edit`, `vacation delete`
292
+ **What `dns check` verifies:**
293
+ - **MX** -- primary and relay records pointing to your MXroute server
294
+ - **SPF** -- `v=spf1 include:mxroute.com -all` present with hard fail
295
+ - **DKIM** -- `x._domainkey` TXT record with valid DKIM1 key
296
+ - **DMARC** -- `_dmarc` TXT record with quarantine or reject policy
297
+ - **CNAME** -- custom hostnames for mail/webmail (optional)
298
+
299
+ **`dns generate` supports:** Cloudflare, Namecheap, Route53/AWS, and generic providers.
179
300
 
180
- ### Catch-All / Default Address
301
+ #### dnsrecords / dnsapi -- DNS Record Management via API
181
302
 
182
- Control what happens to email sent to non-existent addresses on your domain.
303
+ Manage DNS records directly on your MXroute server. Requires authentication.
183
304
 
184
305
  ```bash
185
- mxroute catchall get [domain] # Show current catch-all setting
186
- mxroute catchall set [domain] # Configure catch-all (interactive)
306
+ mxroute dnsrecords list [domain] # List all DNS records from server
307
+ mxroute dnsrecords add [domain] # Add a record (A, AAAA, CNAME, MX, TXT, SRV)
308
+ mxroute dnsrecords delete [domain] # Delete a DNS record
309
+ mxroute dnsrecords dkim [domain] # Retrieve the full DKIM key
187
310
  ```
188
311
 
189
- **Catch-all options:**
190
- - **Forward to existing account** -- picks from your email accounts
191
- - **Forward to custom email** -- any external address
192
- - **Reject** (`:fail:`) -- bounce back to sender
193
- - **Disable** (`:blackhole:`) -- silently discard
312
+ ---
194
313
 
195
- ### SpamAssassin
314
+ ### Email Sending
196
315
 
197
- Configure server-side spam filtering per domain.
316
+ #### send -- Send Email via SMTP
198
317
 
199
318
  ```bash
200
- mxroute spam status [domain] # Show current SpamAssassin config
201
- mxroute spam enable [domain] # Enable with defaults (score 5, spam folder)
202
- mxroute spam disable [domain] # Disable SpamAssassin
203
- mxroute spam config [domain] # Interactive configuration wizard
319
+ mxroute send # Interactive composer
320
+ mxroute send -t user@example.com -s "Subject" -b "Body" # Send with flags
321
+ mxroute send -t user@example.com -s "Hi" --html -b "<h1>Hello</h1>" # HTML email
322
+ mxroute send -f alias@example.com -t user@example.com -s "Hi" -b "Body" # Custom from
323
+ mxroute send -t user@example.com -s "Report" --file report.pdf # With attachment
204
324
  ```
205
325
 
206
- Aliases: `spam on` = `spam enable`, `spam off` = `spam disable`, `spam show` = `spam status`
326
+ | Flag | Description |
327
+ |---|---|
328
+ | `-t, --to <email>` | Recipient email address |
329
+ | `-s, --subject <text>` | Email subject line |
330
+ | `-b, --body <text>` | Email body content |
331
+ | `-f, --from <email>` | Sender address (defaults to configured account) |
332
+ | `--html` | Treat body as raw HTML |
333
+ | `--file <path>` | Attach a file |
207
334
 
208
- **`spam config` options:**
209
- - **Required score** (1-10) -- lower = more aggressive filtering
210
- - **Spam delivery** -- move to spam folder, leave in inbox, or delete
211
- - **High score threshold** -- separate action for very high scoring spam
212
- - **High score action** -- what to do with high-scoring spam
335
+ #### test -- Test Email
213
336
 
214
- > **Note:** MXroute also has "Expert Spam Filtering" which is separate from SpamAssassin. Manage it at Management Panel -> Spam Filters.
337
+ ```bash
338
+ mxroute test # Send a test email to yourself
339
+ ```
215
340
 
216
- ### Email Filters
341
+ #### webhook -- Email Webhook Server
217
342
 
218
- Create per-account email filtering rules (server-side).
343
+ Start a local HTTP server that accepts POST requests and relays them as email through MXroute SMTP.
219
344
 
220
345
  ```bash
221
- mxroute filters list [domain] # List filters (picks account)
222
- mxroute filters create [domain] # Create a filter (interactive)
223
- mxroute filters delete [domain] # Delete a filter (picks from list)
346
+ mxroute webhook # Start on default port 3025
347
+ mxroute webhook --port 8080 # Custom port
224
348
  ```
225
349
 
226
- **Filter options:**
227
- - **Match field**: from, to, subject, body
228
- - **Match type**: contains, equals, starts with, ends with
229
- - **Actions**: discard, forward to address, move to folder
350
+ **Endpoints:**
351
+ - `POST /send` -- send an email (`{ "to": "...", "subject": "...", "body": "..." }`)
352
+ - `GET /health` -- health check
230
353
 
231
- ### Mailing Lists
354
+ ---
232
355
 
233
- Create and manage mailing lists for group communication.
356
+ ### Spam and Security
357
+
358
+ #### spam -- SpamAssassin Configuration
234
359
 
235
360
  ```bash
236
- mxroute lists list [domain] # List all mailing lists
237
- mxroute lists create [domain] # Create a new mailing list
238
- mxroute lists delete [domain] # Delete a mailing list
239
- mxroute lists members [domain] # Show members of a list
240
- mxroute lists add-member [domain] # Add a member to a list
241
- mxroute lists remove-member [domain] # Remove a member from a list
361
+ mxroute spam status [domain] # Show current SpamAssassin config
362
+ mxroute spam enable [domain] # Enable with defaults (score 5, spam folder)
363
+ mxroute spam disable [domain] # Disable SpamAssassin
364
+ mxroute spam config [domain] # Interactive configuration wizard
242
365
  ```
243
366
 
244
- Aliases: `mailinglist list`, `lists ls`, `lists add`, `lists rm`
367
+ Configuration options: required score (1-10), spam delivery action (move to folder, leave in inbox, delete), high score threshold, and high score action.
245
368
 
246
- ### Domain Aliases / Pointers
369
+ #### audit -- Security Audit
247
370
 
248
- Make one domain share all email accounts with another domain.
371
+ Run a comprehensive security audit across all domains with a scored report.
249
372
 
250
373
  ```bash
251
- mxroute aliases list [domain] # List domain aliases/pointers
252
- mxroute aliases add [domain] # Add a domain alias
253
- mxroute aliases remove [domain] # Remove a domain alias
374
+ mxroute audit # Full security audit with score
254
375
  ```
255
376
 
256
- > **How aliases work:** If `primary.com` has `user@primary.com`, adding `alias.com` as a pointer means `user@alias.com` will also work -- all accounts are shared.
377
+ Checks: DNS configuration, SPF lookup count, catch-all settings, forwarding loops, and more.
257
378
 
258
- ### Quota & Usage
379
+ #### ip / blacklist -- IP Blacklist Check
259
380
 
260
- Monitor disk usage, bandwidth, and resource limits.
381
+ ```bash
382
+ mxroute ip # Check server IP against 10 DNS blacklists
383
+ ```
384
+
385
+ ---
386
+
387
+ ### Monitoring and Operations
388
+
389
+ #### monitor -- Health Monitoring
390
+
391
+ Cron-friendly health check that tests DNS, port connectivity, and SMTP API across all domains.
261
392
 
262
393
  ```bash
263
- mxroute quota # Account-wide usage overview with progress bars
264
- mxroute quota-set [domain] # Set quota for a specific email account
394
+ mxroute monitor # Run health check with full output
395
+ mxroute monitor --quiet # Exit code only (0 = healthy, 1 = issue)
396
+ mxroute monitor --alert # Send email alert on failure
265
397
  ```
266
398
 
267
- **Example output:**
399
+ #### cron -- Cron Job Management
400
+
401
+ ```bash
402
+ mxroute cron setup # Install monitoring cron job
403
+ mxroute cron remove # Remove monitoring cron job
268
404
  ```
269
- ┌─ Resource Usage ─────────────────────────────────────────────┐
270
- │ Disk Usage 3.19MB / 100.0GB [--------------------] 0% │
271
- │ Bandwidth 1.26MB / unlimited │
272
- │ Email Accounts 12 / unlimited │
273
- │ Domains 3 / unlimited │
274
- │ Forwarders 1 / unlimited │
275
- └──────────────────────────────────────────────────────────────────┘
405
+
406
+ #### doctor / healthcheck -- Comprehensive Diagnostics
407
+
408
+ ```bash
409
+ mxroute doctor # Run checks across all domains
276
410
  ```
277
411
 
278
- ---
412
+ #### benchmark / bench -- Connection Speed Test
279
413
 
280
- ### DNS Management
414
+ ```bash
415
+ mxroute benchmark # Test IMAP/SMTP connection speed
416
+ ```
281
417
 
282
- Two approaches to DNS: **health checks** (read-only, queries public DNS) and **record management** (read/write, via DirectAdmin API).
418
+ ---
283
419
 
284
- #### DNS Health Check
420
+ ### Data Management
285
421
 
286
- Verify your domain's DNS records are correctly configured for MXroute by querying public DNS servers.
422
+ #### export -- Export Configuration
287
423
 
288
424
  ```bash
289
- mxroute dns check # Check configured domain
290
- mxroute dns check example.com # Check specific domain
291
- mxroute dns records # Show required DNS records for your server
292
- mxroute dns records example.com # Show for specific domain
293
- mxroute dns generate # Generate zone file (picks DNS provider)
294
- mxroute dns generate example.com # Generate for specific domain
425
+ mxroute export # Export all domains to JSON
426
+ mxroute export example.com # Export specific domain
295
427
  ```
296
428
 
297
- **What `dns check` verifies:**
298
- - **MX** -- primary and relay records pointing to your MXroute server
299
- - **SPF** -- `v=spf1 include:mxroute.com -all` present, single record, hard fail
300
- - **DKIM** -- `x._domainkey` TXT record with valid DKIM1 key
301
- - **DMARC** -- `_dmarc` TXT record with quarantine or reject policy
302
- - **CNAME** -- custom hostnames for mail/webmail (optional)
303
-
304
- **`dns generate` supports:**
305
- - Cloudflare (with proxy-off warning)
306
- - Namecheap
307
- - Route53 / AWS (with quoting notes)
308
- - Generic / other providers
429
+ #### import -- Import Configuration
309
430
 
310
- #### DNS Records (via DirectAdmin API)
431
+ ```bash
432
+ mxroute import backup.json # Restore from export file
433
+ ```
311
434
 
312
- Manage DNS records directly on your MXroute server. Requires authentication (`mxroute auth login`).
435
+ #### diff -- Compare Exports
313
436
 
314
437
  ```bash
315
- mxroute dnsrecords list [domain] # List all DNS records from server
316
- mxroute dnsrecords add [domain] # Add a record (A, AAAA, CNAME, MX, TXT, SRV)
317
- mxroute dnsrecords delete [domain] # Delete a DNS record
318
- mxroute dnsrecords dkim [domain] # Retrieve the full DKIM key for your domain
438
+ mxroute diff before.json after.json # Compare two export files
319
439
  ```
320
440
 
321
- Aliases: `dnsapi list`, `dnsapi add`, etc.
441
+ #### bulk -- Bulk Operations
442
+
443
+ ```bash
444
+ mxroute bulk accounts accounts.csv # Create accounts from CSV
445
+ mxroute bulk forwarders fwd.csv # Create forwarders from CSV
446
+ ```
322
447
 
323
448
  ---
324
449
 
325
- ### Send Email
450
+ ### Troubleshooting
326
451
 
327
- Send email via MXroute's SMTP API. Requires SMTP configuration (`mxroute config setup`).
452
+ #### troubleshoot / diagnose -- Interactive Wizard
328
453
 
329
454
  ```bash
330
- mxroute send # Interactive composer (opens editor for body)
331
- mxroute send -t user@example.com -s "Subject" -b "Body text" # Send with flags
332
- mxroute send -t user@example.com -s "Hi" --html -b "<h1>Hello</h1>" # HTML body
333
- mxroute send -f alias@example.com -t user@example.com -s "Hi" -b "Body" # Custom from
334
- mxroute test # Send a test email to yourself
455
+ mxroute troubleshoot # Launch interactive wizard
335
456
  ```
336
457
 
337
- **Options:**
338
- | Flag | Description |
339
- |---|---|
340
- | `-t, --to <email>` | Recipient email address |
341
- | `-s, --subject <text>` | Email subject line |
342
- | `-b, --body <text>` | Email body content |
343
- | `-f, --from <email>` | Sender address (defaults to configured username) |
344
- | `--html` | Treat body as raw HTML (otherwise auto-wrapped) |
345
-
346
- **SMTP API limitations:**
347
- - 400 emails per hour per email address
348
- - Single recipient per request
349
- - No file attachments
350
- - Body size limit ~10MB
351
- - Marketing/promotional email is prohibited
458
+ Covers 10 issue categories:
352
459
 
353
- ### Connection Info
460
+ 1. Emails going to spam (Gmail)
461
+ 2. Emails going to spam (Microsoft)
462
+ 3. Cannot connect to server
463
+ 4. Authentication failures
464
+ 5. Emails not being delivered
465
+ 6. DNS configuration issues
466
+ 7. SSL certificate warnings
467
+ 8. Common error messages (550 Auth Required, Sender Verify Failed, etc.)
468
+ 9. Migration issues (imapsync guide)
469
+ 10. Spam filter blocking legitimate mail
354
470
 
355
- Quick reference for email client settings, webmail URLs, and service details.
471
+ #### share -- Shareable Setup Page
356
472
 
357
473
  ```bash
358
- mxroute info connections # IMAP/SMTP/POP3 ports table
359
- mxroute info webmail # Webmail URLs (Crossbox, Roundcube)
360
- mxroute info caldav # CalDAV/CardDAV server and setup guides
361
- mxroute info api # SMTP API endpoint, fields, and limits
362
- mxroute info limits # Service limits and policies
363
- mxroute info panels # Management and Control Panel URLs
364
- mxroute info all # Everything at once
474
+ mxroute share # Generate setup page for terminal
475
+ mxroute share user@example.com # Generate for specific email
365
476
  ```
366
477
 
367
- **Email client setup guides:**
478
+ Produces an HTML page or terminal output with connection details to share with end users.
479
+
480
+ ---
481
+
482
+ ### Connection Info
483
+
484
+ Quick reference for email client settings and service details.
485
+
368
486
  ```bash
369
- mxroute info client ios # Apple Mail (iPhone/iPad)
370
- mxroute info client outlook # Microsoft Outlook
371
- mxroute info client thunderbird # Mozilla Thunderbird
372
- mxroute info client generic # Generic IMAP/SMTP settings
487
+ mxroute info connections # IMAP/SMTP/POP3 ports table
488
+ mxroute info webmail # Webmail URLs (Crossbox, Roundcube)
489
+ mxroute info caldav # CalDAV/CardDAV setup
490
+ mxroute info api # SMTP API endpoint and limits
491
+ mxroute info limits # Service limits and policies
492
+ mxroute info panels # Management and Control Panel URLs
493
+ mxroute info all # Everything at once
494
+ mxroute info client <name> # Client setup guide (ios, outlook, thunderbird, generic)
373
495
  ```
374
496
 
375
- **Connection settings reference:**
497
+ **Connection settings:**
376
498
 
377
499
  | Protocol | Port | Encryption | Recommended |
378
500
  |---|---|---|---|
@@ -384,64 +506,223 @@ mxroute info client generic # Generic IMAP/SMTP settings
384
506
  | SMTP | 587 | STARTTLS | Alternative |
385
507
  | SMTP | 2525 | STARTTLS | If 587 blocked |
386
508
 
387
- ### Troubleshooting
509
+ ---
510
+
511
+ ## Configuration
512
+
513
+ Configuration is stored at `~/.config/mxroute-cli/config.json` with file permissions `0600` (owner-only read/write).
388
514
 
389
- Interactive troubleshooting wizard that walks you through diagnosing and fixing common issues.
515
+ ### Multiple Profiles
516
+
517
+ Manage different MXroute accounts from one CLI:
518
+
519
+ ```bash
520
+ # Create profiles
521
+ mxroute config setup # First run creates "default" profile
522
+ mxroute config setup # Enter "work" as profile name for second
523
+
524
+ # Switch between them
525
+ mxroute config switch # Interactive picker
526
+ mxroute config switch work # Switch directly by name
527
+ mxroute config profiles # List all profiles
528
+
529
+ # Delete a profile
530
+ mxroute config delete old # Delete by name
531
+ ```
532
+
533
+ ---
534
+
535
+ ## MCP Server
536
+
537
+ The `mxroute-mcp` binary exposes 36 tools via the [Model Context Protocol](https://modelcontextprotocol.io), allowing AI assistants to manage your MXroute account.
538
+
539
+ ### Supported Clients
540
+
541
+ - Claude Code
542
+ - Claude Desktop
543
+ - Cursor
544
+ - Windsurf
545
+ - OpenCode
546
+ - Cline
547
+ - Continue.dev
548
+
549
+ ### Quick Setup
550
+
551
+ The setup wizard auto-detects installed clients and configures them:
390
552
 
391
553
  ```bash
392
- mxroute troubleshoot # Launch interactive wizard
393
- mxroute diagnose # Alias
554
+ mxroute setup
555
+ ```
556
+
557
+ ### Manual Configuration
558
+
559
+ Add to your MCP client config:
560
+
561
+ ```json
562
+ {
563
+ "mcpServers": {
564
+ "mxroute": {
565
+ "command": "mxroute-mcp",
566
+ "args": []
567
+ }
568
+ }
569
+ }
394
570
  ```
395
571
 
396
- **Covers 10 issue categories:**
397
- 1. **Emails going to spam (Gmail)** -- mail-tester, DNS checks, filter training, Postmaster Tools
398
- 2. **Emails going to spam (Microsoft)** -- Microsoft-specific steps, SNDS reputation
399
- 3. **Cannot connect to server** -- ports, firewall, ISP blocking, live connection test
400
- 4. **Authentication failures** -- username format, password reset, encryption settings
401
- 5. **Emails not being delivered** -- DNS check, sender verification, bounce analysis
402
- 6. **DNS configuration issues** -- common mistakes checklist, live DNS check
403
- 7. **SSL certificate warnings** -- CNAME setup, certificate request steps
404
- 8. **Common error messages** -- 550 Auth Required, Sender Verify Failed, 5.7.515, etc.
405
- 9. **Migration issues** -- imapsync command, step-by-step migration guide
406
- 10. **Spam filter blocking legitimate mail** -- whitelist requests, filter toggle
572
+ ### Available MCP Tools
573
+
574
+ The MCP server provides tools for domains, email accounts, forwarders, autoresponders, catch-all, spam config, DNS records, DKIM keys, email filters, mailing lists, domain aliases, quota management, sending email, and DNS health checks.
407
575
 
408
576
  ---
409
577
 
410
- ## Configuration
578
+ ## Automated DNS Setup
411
579
 
412
- ### Config file
580
+ The `dns setup` command can automatically create all required MXroute DNS records at your registrar via API.
413
581
 
414
- Configuration is stored at `~/.config/mxroute-cli/config.json` with file permissions `0600` (owner-only read/write).
582
+ ### Supported Registrars
583
+
584
+ | Registrar | API Support | Credentials Needed |
585
+ |---|---|---|
586
+ | **Cloudflare** | Full | API Token |
587
+ | **Porkbun** | Full | API Key + Secret Key |
588
+ | **DigitalOcean** | Full | API Token |
589
+ | **Namecheap** | Limited | API Key + Username |
590
+
591
+ ### Usage
415
592
 
416
593
  ```bash
417
- mxroute config show # View current config (passwords masked)
594
+ mxroute dns setup example.com
418
595
  ```
419
596
 
420
- ### Two credential types
597
+ The wizard will:
598
+ 1. Ask which registrar manages your DNS
599
+ 2. Prompt for API credentials (saved for reuse)
600
+ 3. Retrieve your DKIM key from the server
601
+ 4. Create MX, SPF, DKIM, and DMARC records automatically
602
+ 5. Verify the records propagated correctly
421
603
 
422
- | Type | Used for | Command | Required for |
423
- |---|---|---|---|
424
- | **SMTP credentials** | Sending email | `mxroute config setup` | `send`, `test` |
425
- | **DirectAdmin Login Key** | Account management | `mxroute auth login` | `domains`, `accounts`, `forwarders`, `autoresponder`, `catchall`, `spam`, `dnsrecords`, `filters`, `lists`, `aliases`, `quota` |
604
+ ### Propagation Monitoring
426
605
 
427
- Commands that only read public DNS (`dns check`, `dns records`, `dns generate`) and display static info (`info`, `troubleshoot`) work without any credentials -- just a server name.
606
+ After making DNS changes, watch propagation in real time:
428
607
 
429
- ### Multiple profiles
608
+ ```bash
609
+ mxroute dns watch example.com
610
+ ```
430
611
 
431
- Manage different MXroute accounts from one CLI:
612
+ ---
613
+
614
+ ## Monitoring and Cron
615
+
616
+ ### Health Monitoring
617
+
618
+ The `monitor` command checks DNS records, port connectivity (IMAP/SMTP), and SMTP API health across all your domains.
432
619
 
433
620
  ```bash
434
- # Create profiles
435
- mxroute config setup # First run creates "default" profile
436
- mxroute config setup # Enter "work" as profile name for second
621
+ # Full output
622
+ mxroute monitor
437
623
 
438
- # Switch between them
439
- mxroute config switch # Interactive picker
440
- mxroute config switch work # Switch by name
441
- mxroute config profiles # List all profiles
624
+ # Silent mode for cron (exit code only)
625
+ mxroute monitor --quiet
442
626
 
443
- # Delete a profile
444
- mxroute config delete old # Delete by name
627
+ # Send email alert on failure
628
+ mxroute monitor --alert
629
+ ```
630
+
631
+ ### Cron Job Setup
632
+
633
+ Install automatic monitoring that runs on a schedule:
634
+
635
+ ```bash
636
+ # Install the cron job
637
+ mxroute cron setup
638
+
639
+ # Remove the cron job
640
+ mxroute cron remove
641
+ ```
642
+
643
+ ---
644
+
645
+ ## Shell Completions
646
+
647
+ Generate shell completion scripts for tab completion of commands and options.
648
+
649
+ ```bash
650
+ mxroute completions bash # Bash completions
651
+ mxroute completions zsh # Zsh completions
652
+ mxroute completions fish # Fish completions
653
+ ```
654
+
655
+ **Install for your shell:**
656
+
657
+ ```bash
658
+ # Bash
659
+ mxroute completions bash >> ~/.bashrc
660
+
661
+ # Zsh
662
+ mxroute completions zsh >> ~/.zshrc
663
+
664
+ # Fish
665
+ mxroute completions fish > ~/.config/fish/completions/mxroute.fish
666
+ ```
667
+
668
+ ---
669
+
670
+ ## Development
671
+
672
+ ### Setup
673
+
674
+ ```bash
675
+ git clone https://github.com/t-rhex/mxroute-cli.git
676
+ cd mxroute-cli
677
+ npm install
678
+ npm run build
679
+ ```
680
+
681
+ ### Scripts
682
+
683
+ | Script | Description |
684
+ |---|---|
685
+ | `npm run build` | Compile TypeScript |
686
+ | `npm run dev` | Watch mode for development |
687
+ | `npm test` | Run tests (Vitest) |
688
+ | `npm run test:watch` | Run tests in watch mode |
689
+ | `npm run test:coverage` | Run tests with coverage |
690
+ | `npm run lint` | Lint with ESLint |
691
+ | `npm run lint:fix` | Auto-fix lint issues |
692
+ | `npm run format` | Format with Prettier |
693
+ | `npm run typecheck` | Type check without emitting |
694
+ | `npm run ci` | Full CI pipeline (lint + typecheck + build + test) |
695
+
696
+ ### Test Suite
697
+
698
+ 78 tests across 15 test files covering API, audit, benchmark, blacklist, CLI, completions, config, diff, DirectAdmin, DNS, MCP, monitor, share, theme, and webhook functionality.
699
+
700
+ ### Code Quality
701
+
702
+ - ESLint and Prettier enforce consistent style
703
+ - Husky pre-commit hooks run lint-staged on every commit
704
+ - GitHub Actions CI validates on Node.js 20 and 22
705
+ - Tag-based release workflow publishes to npm with provenance
706
+
707
+ ### Project Structure
708
+
709
+ ```
710
+ src/
711
+ index.ts # CLI entry point (Commander.js)
712
+ mcp.ts # MCP server entry point
713
+ commands/ # 35 command modules
714
+ utils/ # Shared utilities (API, config, DNS, DirectAdmin, registrars)
715
+ tests/ # 15 test files (Vitest)
716
+ ```
717
+
718
+ ### Releasing
719
+
720
+ Releases are automated via GitHub Actions. Push a version tag to trigger npm publish:
721
+
722
+ ```bash
723
+ npm run release # Patch version bump
724
+ npm run release:minor # Minor version bump
725
+ npm run release:major # Major version bump
445
726
  ```
446
727
 
447
728
  ---
@@ -454,9 +735,11 @@ mxroute config delete old # Delete by name
454
735
  | **Control Panel** | https://panel.mxroute.com | Email accounts, forwarders, domains, DNS, spam, webmail |
455
736
  | **Whitelist Request** | https://whitelistrequest.mxrouting.net | Request IP/domain whitelist for spam filter |
456
737
 
738
+ ---
739
+
457
740
  ## Requirements
458
741
 
459
- - Node.js >= 18
742
+ - Node.js >= 20
460
743
  - An [MXroute](https://mxroute.com) email hosting account
461
744
 
462
745
  ## License