emailcheck-diagnose
# EmailCheck Diagnose
**A free email list health check that runs inside your AI agent** — syntax,
typo fixes, disposable domains, role accounts and MX presence, with no API
key and zero dependencies. When you need more, one key unlocks the deep
layer: a 0–100 score, a verdict, domain age and catch-all risk per address.
Built for Claude Code / Codex / Cursor-style agents: install it as a skill,
hand it a list, get an evidence-backed report.
## MCP server
This repo is also a **Model Context Protocol (MCP) server**: `mcp_server.py`
speaks MCP over stdio (JSON-RPC, protocol version 2024-11-05) using only the
Python standard library — no dependencies, no MCP SDK required. It exposes
two tools, implemented on top of the same local checker:
| Tool | Input | Output |
|---|---|---|
| `check_email` | `{ "email": "user@example.com" }` | Full verdict object (status, issues, suggestion, MX records, deep layer when a key is set) |
| `check_emails` | `{ "emails": ["a@x.com", "b@y.com"] }` | Per-address verdicts plus a summary (totals by status, disposable, typos, MX) |
Run it directly:
```bash
python3 mcp_server.py
```
Or with Docker (a `Dockerfile` is included, `python:3.12-slim`, no installs):
```bash
docker build -t emailcheck-diagnose .
docker run -i emailcheck-diagnose
```
Add it to any MCP client (e.g. Claude Desktop `claude_desktop_config.json`):
```json
{
"mcpServers": {
"emailcheck-diagnose": {
"command": "python3",
"args": ["/path/to/emailcheck-diagnose/mcp_server.py"],
"env": { "EMAILCHECK_RAPIDAPI_KEY": "your_key_here" }
}
}
}
```
The `EMAILCHECK_RAPIDAPI_KEY` env var is optional — without it the free
local layer runs; with it the deep layer (score, verdict, domain age,
catch-all risk) activates for each address, exactly as in the CLI.
## Install
```bash
git clone https://github.com/binbin7418-dotcom/emailcheck-diagnose.git
cp -r emailcheck-diagnose ~/.claude/skills/ # personal, all projects
# or: cp -r emailcheck-diagnose .claude/skills/ # per project
```
Requires Python 3.8+. Standard library only — nothing to pip install.
Then just ask your agent to check some addresses, or run the script
yourself:
```bash
python3 ~/.claude/skills/emailcheck-diagnose/scripts/check.py --file list.txt
```
## Example 1 — a few addresses
```bash
python3 scripts/check.py alice@acme-corp.com user@gmial.com temp@mailinator.com ceo@proton.me
```
```json
{"email": "alice@acme-corp.com", "format_valid": true, "issues": ["no_mx_records"], "suggestion": null, "disposable": false, "role_account": false, "free_provider": false, "mx": {"status": "none", "records": []}, "status": "invalid", "deep": null}
{"email": "user@gmial.com", "format_valid": true, "issues": ["likely_domain_typo", "no_mx_records"], "suggestion": "user@gmail.com", "disposable": false, "role_account": false, "free_provider": false, "mx": {"status": "none", "records": []}, "status": "invalid", "deep": null}
{"email": "temp@mailinator.com", "format_valid": true, "issues": ["disposable_domain"], "suggestion": null, "disposable": true, "role_account": false, "free_provider": false, "mx": {"status": "found", "records": ["mail.mailinator.com", "mail2.mailinator.com"]}, "status": "warning", "deep": null}
{"email": "ceo@proton.me", "format_valid": true, "issues": ["role_account", "free_provider"], "suggestion": null, "disposable": false, "role_account": true, "free_provider": true, "mx": {"status": "found", "records": ["mail.protonmail.ch", "mailsec.protonmail.ch"]}, "status": "ok", "deep": null}
```
Summary (stderr):
```
=== EmailCheck Diagnose - summary ===
Total checked: 4
Format valid: 4
Format invalid: 0
Status ok: 1
Status warning: 1
Status invalid: 2
Disposable domains: 1
Role accounts: 1
Free providers: 1
Likely domain typos: 1
Duplicates: 0
MX found/none/unknown: 2 / 2 / 0
Deep layer (API key): off
Needs attention:
- alice@acme-corp.com [invalid] no_mx_records
- user@gmial.com [invalid] likely_domain_typo, no_mx_records -> did you mean user@gmail.com?
- temp@mailinator.com [warning] disposable_domain
```
## Example 2 — a dirty list file
The checker is built for real-world exports: blank lines, `#` comments,
quoted addresses, `mailto:` residue, duplicates, Unicode and malformed
rows are all handled and flagged — the run never crashes. The repo's
`tests/samples.txt` is a fixed 35-address dirty set used as the
regression baseline:
```
=== EmailCheck Diagnose - summary ===
Total checked: 35
Format valid: 23
Format invalid: 12
Status ok: 9
Status warning: 5
Status invalid: 21
Disposable domains: 4
Role accounts: 6
Free providers: 8
Likely domain typos: 5
Duplicates: 1
MX found/none/unknown: 14 / 9 / 0
Deep layer (API key): off
```
Run the regression yourself:
```bash
python3 tests/run_tests.py # runs the sample set twice, asserts consistency
```
## Free layer vs deep layer
| | Free layer (no key) | Deep layer (EmailCheck API key) |
|---|---|---|
| Syntax validation | ✅ pragmatic RFC subset | ✅ |
| Domain typo suggestion | ✅ edit distance vs ~120 providers | ✅ |
| Disposable domains | ✅ built-in 400-domain list | ✅ |
| Role accounts | ✅ | ✅ |
| MX presence | ✅ via DNS-over-HTTPS | ✅ |
| 0–100 risk score | ❌ | ✅ |
| Verdict (valid / risky / invalid) | ❌ (local status only) | ✅ |
| Domain age (RDAP registration data) | ❌ | ✅ |
| Catch-all risk signal | ❌ | ✅ |
| Batch | ✅ any list size, local | ✅ up to 100 addresses per API call |
The free layer is deliberately honest: it never claims to verify that a
mailbox exists. If you need per-mailbox confidence, that's the deep layer.
## Deep layer
```bash
export EMAILCHECK_RAPIDAPI_KEY=your_key_here
python3 scripts/check.py --file list.txt
```
Get a key on RapidAPI — the free BASIC tier includes 100 calls/month,
and one batch call validates up to 100 addresses:
**[EmailCheck on RapidAPI](https://rapidapi.com/binbin7418/api/emailcheck-email-validation-api?utm_source=github&utm_medium=referral&utm_campaign=20261205-emailcheck-skill)**
BASIC $0 · 100 calls/month — PRO $9/month · 10,000 calls — ULTRA
$29/month · 50,000 calls.
## Notes
- MX lookups use Cloudflare's public DNS-over-HTTPS. No network? The MX
field degrades to `unknown` and affected addresses are marked
`warning`, never `invalid`. Use `--no-mx` for a fully offline run.
- A null MX record (RFC 7505 — "this domain accepts no mail") counts as
no MX.
- Your addresses are processed locally in free mode; nothing is uploaded
anywhere except the DNS queries for MX records.
## License
MIT
TDQS
Scored across 2 tools
The two tools are cleanly separated by cardinality: check_email handles one address, check_emails handles a list. Descriptions explicitly state input shape and output shape (single verdict vs. per-address verdicts plus summary counts), leaving no realistic chance of misselection.
Both names follow the same verb_noun convention (check_email / check_emails), so the pattern is predictable. The only deviation is that singular vs. plural is the sole differentiator, which is consistent but visually subtle.
Two tools is on the thin side, though justified since the server wraps a single diagnostic pipeline and only needs a single-item and batch entry point. A batch tool could arguably cover both cases, so the pair is borderline rather than ideal.
The surface covers the stated diagnostic domain well: syntax, typo suggestion, disposable/role detection, free-provider flag, and MX lookup, with an explicit note that mailbox/SMTP verification is out of scope. Minor gaps remain around things like domain-age or provider reputation detail, but nothing that blocks typical workflows.