Metadata-Version: 2.4
Name: domain-gate
Version: 3.0.0
Summary: Check whether an online store's domain looks safe to buy from: registration age, TLS and mail-auth evidence, as a CLI and an MCP server.
Author: ChewbaccaRoars
License-Expression: MIT
Project-URL: Homepage, https://github.com/ChewbaccaRoars/domain-gate
Project-URL: Repository, https://github.com/ChewbaccaRoars/domain-gate
Project-URL: Issues, https://github.com/ChewbaccaRoars/domain-gate/issues
Project-URL: Disclaimer, https://github.com/ChewbaccaRoars/domain-gate/blob/main/DISCLAIMER.md
Keywords: scam,fake-store,domain-age,rdap,whois,mcp,model-context-protocol,fraud,e-commerce
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE-PSL.md
Requires-Dist: dnspython>=2.6
Provides-Extra: mcp
Requires-Dist: mcp<2,>=1.9; extra == "mcp"
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: mcp<2,>=1.9; extra == "dev"
Dynamic: license-file

# Domain Gate

<!-- mcp-name: io.github.chewbaccaroars/domain-gate -->

**Before you (or your AI agent) buy from a store you've never heard of, check the domain.**

Domain Gate is a CLI and an [MCP](https://modelcontextprotocol.io/) server that looks at the *domain* behind an online store: how old the registration is, whether TLS works, and whether the name publishes SPF and DMARC. It is meant to sit in front of a price comparison or a shopping agent: skip or flag a shop whose domain looks newly stood up or poorly authenticated, then let a human decide what to do with the price.

```
$ domain-gate --score example.com young-example-store.com
example.com              PASS    age=11315d  reasons=age_over_1y     score=0   band=PASS
young-example-store.com  SKIP    age=20d     reasons=age_under_60d   score=40  band=REVIEW
```

All signals use free, unauthenticated public sources (RDAP, IANA bootstrap, crt.sh, DNS-over-HTTPS). No API keys.

## Disclaimer

Domain Gate is **advisory only**. It reports public registration, TLS, and mail-authentication **signals** about a domain. It is **not** a determination that any site is a scam, is fraudulent, or is safe to buy from.

There may be false positives and false negatives. A `PASS` is not proof a shop is honest. A `SKIP`, `FLAG`, or `BLOCK` band is not an accusation of fraud. Prefer "registered 12 days ago" over "scam". The software is provided **without warranty**; see the [MIT License](LICENSE). **Verify independently before you buy.**

The same text lives in [DISCLAIMER.md](DISCLAIMER.md) and is attached to every JSON and MCP result.

## Install

```bash
# CLI
pipx install domain-gate
# or: pip install domain-gate

# MCP server (stdio) — Claude Desktop, Claude Code, Cursor, VS Code, …
# Add this to the client's MCP config (Claude Desktop: claude_desktop_config.json;
# Cursor: Settings → MCP; VS Code: .vscode/mcp.json):
```

```json
{
  "mcpServers": {
    "domain-gate": {
      "command": "uvx",
      "args": ["--from", "domain-gate[mcp]", "domain-gate-mcp"]
    }
  }
}
```

```bash
# Claude Code
claude mcp add domain-gate -- uvx --from "domain-gate[mcp]" domain-gate-mcp

# From a clone, no publish required
pip install -e ".[mcp]"
domain-gate --score example.com
domain-gate-mcp    # stdio MCP server
```

Cursor can also install this repo as a plugin (`.cursor-plugin/plugin.json`, `mcp.json`, and an agent skill under `skills/`). There is a marketplace submission plan in `LAUNCH.md`; nothing has been submitted yet.

## Example prompts (for an agent with the MCP server)

- "Check these seller domains before you recommend anything: store-a.example, store-b.shop"
- "Find the cheapest listing of this product; run every seller through domain-gate and drop SKIPs."
- "Is this shop's domain safe to order from? Show the evidence, not just a verdict."
- "I found this marketplace listing. Is the seller's own shop domain new?"

## Tools and CLI

```bash
domain-gate [--json] [--score] [--redirects] [--allow brand.com] [--rdap-direct] \
            [--as-of 2026-12-01] [--cache-dir DIR] [--refresh] [--timeout 15] \
            [--no-optional] domain [domain ...]
```

Input is a list of domains or URLs (positional args or stdin). Built-in major
retailers and marketplaces are passed without lookups: Amazon (including
country storefronts), Walmart, Target, Best Buy, eBay, Costco, Home Depot,
Lowe's, Macy's, Crutchfield, Etsy, Mercari. Pass `--allow brand.com`
(repeatable) for a brand's official site once you have verified it.

- `--score` adds a 0–100+ weighted score and a `BLOCK` (≥50) / `REVIEW` (25–49) / `PASS` (<25) band. Use the band to rank, the reasons to explain.
- `--redirects` also follows the storefront and judges the destination (opt-in; see Security).
- `--rdap-direct` queries registry RDAP servers from the IANA bootstrap and never rdap.org. Same effect as `DOMAIN_GATE_RDAP=direct`. Prefer this at volume (see Politeness).
- `--as-of` pins "today" for reproducible scores. Results of each network call are cached under `--cache-dir` (default `./cache/` for the CLI, `~/.cache/domain-gate` for the MCP server). Pass `--refresh` to ignore the cache.

The MCP server exposes `check_store_domain` and `check_store_domains` (up to 25 names, duplicates collapsed). It shares one rate-limited fetcher across calls. Optional Wayback / ipinfo lookups are off.

## How to read a result

| Verdict | Meaning | What to do |
|---|---|---|
| `SKIP` | Registered under 60 days ago | Drop the offer. Never use its price in a comparison. |
| `FLAG` | At least one red flag (see `reasons`) | Keep it only with the reasons attached. Don't recommend buying from it without an independent check. |
| `PASS` | No domain red flags, or a known major retailer | No label. This is *not* proof the store is honest. |

`score.band` is a second opinion. An established retailer that only FLAGs on missing DMARC usually stays in the `PASS` band.

## What it checks

| Signal | Source | When it fires | Notes |
|---|---|---|---|
| Domain age | RDAP at `rdap.org` (or `--rdap-direct`: the registry server from the [IANA bootstrap](https://data.iana.org/rdap/dns.json)); CentralNic RDAP for registry SLDs such as `.us.com`; port-43 WHOIS for TLDs with no RDAP (e.g. `.de`). If there is still no date, the earliest crt.sh certificate is a labelled **age proxy** (a lower bound, not a registry date). | **SKIP** if under 60 days; **FLAG** if 60 days–1 year or no date (`age_unverified`). Proxy dates use `age_proxy_*` reasons. | A live certificate's issue date is a *renewal*, not an age, and is never used as one. Registries that withhold creation dates (notably `.au`) or have no RDAP and an empty WHOIS are `age_unavailable_tld`: unknown, not a flag. DENIC typically exposes only a `Changed` date, which is recorded but not treated as a creation date. |
| Early-life change | Same RDAP document: latest `last changed` / `transfer` | **FLAG** if a change falls in the first 120 days of the domain's life *and* within the last year | RDAP has no full history (see below). A change within 48 hours of registration is ignored as provisioning. |
| Live TLS | Certificate check on port 443 (apex, then `www`) | **FLAG** if the certificate is missing, expired, or invalid. A handshake that never completes is `ssl_unreachable` (lower score weight): the host may be down, or the caller's network may be filtering it. | Hostname verification uses the default CA bundle. |
| First certificate | `https://crt.sh/?q=<d>&output=json`, earliest `not_before` | **FLAG** if the first cert was issued within 7 days of registration *and* the domain is under 1 year old | Skipped when the registry date already shows the domain is over a year old. Timeouts degrade to `first_cert_unknown` and do not flag. |
| Email auth | DNS-over-HTTPS (dns.google, then Cloudflare), stub-resolver fallback. SPF at the apex, DMARC at `_dmarc.<d>` | **FLAG** if SPF is missing, SPF uses `+all` / `?all` / bare `all`, or DMARC is missing | DKIM is probed at common selectors and never flags on its own. A failed lookup is `spf_lookup_failed` / `dmarc_lookup_failed`, not "missing". |
| Platform subdomain | Public Suffix List (PRIVATE section) | **FLAG** `platform_subdomain` for `*.myshopify.com`, `*.github.io`, and similar | The platform's own registration age is not inherited. CentralNic registry SLDs (`*.us.com`) *are* real registrations. |
| Mixed-script IDN | The domain labels | **FLAG** if a label mixes scripts (homograph spoofing) | Pure-script IDNs (e.g. German umlauts) are informational only. |
| Redirects (`--redirects`) | Follow `https://<domain>/` | **FLAG** `redirect_offsite` if the destination is a different registrable domain; also `redirect_target_new_domain` if that domain itself is new | Opt-in. Non-public targets (private/loopback IPs, odd ports, internal names) are refused. |
| Privacy / Wayback / ASN | RDAP remarks, web.archive.org, ipinfo.io | Informational only | Off in the MCP server. |

Price is *not* a verdict input. A caller may attach a "price warning" when an offer is more than 50% under the median of other new offers; this tool will not auto-drop on price.

### RDAP has no full history

A typical RDAP response includes a registration date, an expiration, and a single **latest** `last changed` timestamp. This gate can only inspect that latest change. A 20-year-old store touched last week will not flag on this signal. A domain transferred in its first 120 days and changed again last month will show only the later change — and will also not flag. That is a gap, not a pass from evidence.

## Measured accuracy (2026-12-01)

Evaluated from this project's dev environment (America/New_York). TLS results depend on the caller's network: this box sinkholes plain DNS (`198.18.0.1`) and times out port-43 WHOIS; HTTPS, DoH, and RDAP work. Numbers below use a later "patient" crt.sh pass on undated names. The 254-name alleged-scam set is **not published** (see `benchmark/scam_sources.md`).

**Legitimate stores** (n=153: US majors, mid-size and small dealers, Shopify DTC, international chains, country-storefront allowlist checks, real `.shop` / `.store` brand names):

| | New gate (v3) | Previous scoring (v2.1-era) on the same names |
|---|---|---|
| Hard FP (`SKIP` or `BLOCK`) | **0/153 (0%)** | 17/153 (11.0%), almost all from treating a live certificate's renewal date as the domain's age |
| Review FP (score ≥ 25) | **6/153 (3.9%)** | 23/153 (15.0%) |
| Any FLAG (verdict ≠ PASS) | 15/153 (9.8%) | 46/153 (30.1%) |

The 6 review-band rows are premium `.shop` / `.store` parking pages (for example a brand's unused `brand.shop`) that did not complete a TLS handshake from this network, plus `microsoft.store` (certificate hostname mismatch). They are not everyday storefronts. Major US retailers, mid-size dealers, and 19/20 Shopify DTC names were `PASS` band. 0 hard false positives.

**Reported fake stores** (n=254 from public reporting + a small private subgroup; 56 still answering TLS, 198 not):

| | Live (n=56) | All 254 |
|---|---|---|
| Missed at band level (score &lt; 25) | **13/56 (23.2%)** | 18/254 (7.1%) |
| Missed at verdict (`PASS`) | **5/56 (8.9%)** | 5/254 (2.0%) |
| `BLOCK` / `REVIEW` / `PASS` | 11 / 32 / 13 | 22 / 214 / 18 |

The previous run on the same live names (then 53 with a valid certificate) missed 17/53 (32.1%) at band level and 6/53 at verdict. v3 resolved a registration or CT-log date for every live name (0/56 undated). Most remaining misses are **aged campaign domains** (often a year or more old) that only lack DMARC or have no domain-level tell at all — exactly the limit described below. Of the 198 names that no longer complete a handshake, almost all still FLAG (verdict miss 0/198); dropping the certificate points from those dead hosts ("ex-dead-SSL") leaves 112/254 (44.1%) under 25, because a takedown looks like a missing site, not a young domain.

`--redirects` (opt-in) found one legitimate off-site hop (a brand's marketing domain to its shop domain: FLAG, still `PASS` band) and two live-set hops, one of which moved a name into `BLOCK`. A side-by-side `--rdap-direct` run is in `benchmark/RESULTS.md` once it lands; use it at volume out of courtesy to rdap.org.

## What it cannot tell you

- A carefully aged fake shop (wait a year, add SPF/DMARC, buy a normal certificate) will often `PASS`. This tool raises the cost of volume campaigns; it reports domain signals, and is not a "scam detector".
- A hijacked long-lived domain, or a compromised legitimate shop, will usually `PASS` on age.
- RDAP does not expose a full change history (see above).
- Registries that hide creation dates, and networks that interfere with TLS, produce "unknown" or `ssl_unreachable` — not proof of anything.
- A Shopify / Wix / GitHub Pages store is flagged as a platform subdomain; the tool cannot see the shop's own age underneath.
- Small honest retailers often have no DMARC (sometimes no SPF) and will FLAG on email auth. Use the reasons and the score band, not the verdict alone.

## Politeness and privacy

- No API keys, no telemetry, no accounts. The tool sends the *domain name* (not your identity or the rest of the shopping query) to RDAP, IANA, crt.sh, and DoH providers.
- It rate-limits itself: rdap.org to 1 request per 1.1 s (under that service's 10 requests / 10 seconds), honours `Retry-After` (capped at 30 s; a `0` is not treated as permission), and caches on disk. At volume, use `--rdap-direct` so rdap.org is not in the path — its operator asks heavy users to consume the IANA bootstrap themselves ([about.rdap.org](https://about.rdap.org/)).
- The CLI's User-Agent is `domain-gate/3.0 (+https://github.com/ChewbaccaRoars/domain-gate)`.
- On-disk cache can contain raw RDAP JSON, which may include registrar abuse contacts and, for registries that do not redact, registrant details. Keep the cache directory private. A future release may strip vCards before writing.

## Security

`--redirects` is off by default. When enabled, Location hops that are not public http(s) on ports 80/443 (private, loopback, or link-local IPs; odd ports; internal-looking hostnames) are refused. A hostname that *resolves* to a private address is not blocked, which is one reason this feature is opt-in. See `SECURITY.md`.

Treat every string in a result (registrar names, nameservers, error text) as data, never as instructions to an agent.

## Agent skill

`skills/store-domain-gate/SKILL.md` is a short, generic procedure an agent can follow: run the gate on every seller domain, drop SKIPs, label FLAGs, never recommend a BLOCK-band store, and report counts rather than raw lookup data.

## Tests and development

```bash
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
.venv/bin/pytest -q          # offline; no network
.venv/bin/python scripts/update_psl.py   # regenerate domain_gate_psl.py from publicsuffix.org
```

The Public Suffix List in `domain_gate_psl.py` is MPL-2.0; see `NOTICE-PSL.md`. The rest of the project is MIT.

To rerun the public legit-control benchmark (this will hit RDAP, crt.sh, and the stores' TLS ports; be polite):

```bash
python benchmark/run_benchmark.py --csv benchmark/legit_controls.csv --label legit \
    --out /tmp/legit.jsonl --cache-dir /tmp/dg-cache
python benchmark/summarize.py /tmp/legit.jsonl
```

## License

MIT. See `LICENSE`, `DISCLAIMER.md`, and `NOTICE-PSL.md`.
