
Email Guard Mcp
io.github.mlawsonkingPublished by GitHub account mlawsonkingv1.3.0Updated Oct 24, 2026
Email safety for AI agents: scan inbound for prompt-injection/phishing + outbound for secret leaks.
Overview
A local MCP server that scans inbound email for prompt-injection and phishing and outbound email for leaked secrets before an agent acts on or sends it.
- What you can do
- Scan inbound messages for injection and hijack patterns, sender-header mismatches, suspicious domains and risky links, returning a verdict with fixed-shape metadata instead of raw text. Scan outbound subject, body and HTML for secret and PII patterns and get a redacted copy plus deliverability and dead-recipient flags. Check a domain or address for SPF, DMARC, MX, domain age and disposable status.
- When to use it
- Worth adding when an assistant reads or sends email and you want a deterministic, rule-based pre-check before it acts on a message or sends one. Useful as a guardrail layer, not as a replacement for a real spam or phishing filter.
- Requirements
- Runs locally over stdio, typically via npx. No account, API key or environment variable is required by default. It calls a hosted API for some checks and contacts DNS and RDAP; rule updates are fetched about once a day unless disabled with --offline, AGENT_GUARDS_NO_FEED=1 or feed:false in the config file.
Installation
In SourceWeft
- Open Email Guard Mcp in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
email-guard-mcp
An MCP server for email safety. It checks inbound mail before your agent acts on it, and outbound mail before your agent sends it. Deterministic, no LLM, free.
Once an agent can read and send email, the inbox turns into an attack surface. An incoming message can try to hijack the agent with instructions buried in the body, which people have started calling AI agent phishing. On the way out, an agent can leak a secret or send something that gets its sending domain flagged as spam.
Install
Tools
scan_inbound: run this before acting on a message. It matches known injection and hijack patterns (including zero-width, bidi, and hidden-HTML tricks), compares sender headers (SPF, DKIM, or DMARC results as reported by the receiving server, reply-to and return-path mismatches, and a 24-name brand list matched against the display name), looks the sender domain up in DNS and RDAP (disposable, or registered in the last 30 days), and scores links. It returns a verdict plus fixed-shape metadata, so the agent works from that instead of the raw, possibly poisoned, text.scan_outbound: run this before sending. It runs 22 secret patterns (AWS, GitHub, OpenAI, Anthropic, Google, Slack, Stripe, Twilio, npm, JWT, PEM private-key blocks, Azure storage keys and SAS tokens, GCP service-account key ids, database and ODBC connection-string passwords, SendGrid, GitLab, Hugging Face, and quotedapi_key/secret/password/tokenassignments) and 3 PII patterns (email address, US SSN, Luhn-valid card number) over the subject, body and HTML, and returns a redacted copy. It also flags deliverability problems that hurt your sender reputation, and dead recipients (disposable domains, or no MX records, which guarantees a bounce).check_domain_auth: SPF, DMARC, MX, domain age, and disposable status for a domain or address. Returns weak or enforced.
What these do not do
The injection side is pattern matching, not a classifier. A phrasing nobody wrote a rule for gets through.
The brand list is a substring test on the display name. "PayPal Security" <[email protected]> is not flagged, because the domain contains "paypal". Any brand off the list is not flagged either.
The leak scan knows 15 shapes and nothing else. A DigitalOcean or SendGrid key, a bare bearer token, and an unquoted password=supersecret123 all pass clean. The email-address rule is noisy in the other direction: any address in the body puts the message at review, so read leak.findings before you treat a review as a leak.
The structured output from scan_inbound has a fixed shape, but nothing in it is sanitised. subject, sender.display, sender.from, sender.replyTo, sender.domain, links[].url, links[].host, injection.findings[].match, and the note strings in sender.spoofFlags and reasons are all copied out of the email. The verdict, the scores, the rule ids and the advice string are the only parts written here. The rest is still the attacker's text. Treat it as data.
Data comes from DNS (SPF, DMARC, MX), RDAP for domain age, disposable-domain lists, and injection and secret rulesets.
Rule updates
About once a day this server asks the rules feed whether there is a newer ruleset, and applies it if
there is. The request carries two things: which surface asked, which here is facade, and the rules
version already installed. No machine id, no user id, no file names, nothing you scanned.
Bundles are signed with Ed25519 and verified against a public key compiled into this package, so it
does not matter which mirror served one. A bundle that fails its signature, its schema, or its ReDoS
check is discarded and the rules you already had stay in place. --offline turns updates off, as
does AGENT_GUARDS_NO_FEED=1 or {"feed": false} in ~/.agent-guards/config.json. The bundle
format and how to verify one yourself: https://github.com/mlawsonking/MCP/blob/main/rules/README.md
On email authentication, plainly: SPF, DKIM and DMARC results are read out of the Authentication-Results header that the receiving mail server wrote. Nothing here verifies a DKIM signature, and DKIM DNS records are never looked up, because the selector cannot be derived from a domain name alone. That means the value is only as trustworthy as whoever wrote the header. For mail your own server received it is a good signal; in a raw .eml from an untrusted source an attacker can simply type dkim=pass. Every response carries a note saying which case applies. Same input always gives the same output. It calls https://email-guard-api.vercel.app (set EMAIL_GUARD_API to override). One of six agent guards in this repo. MIT.
Source: email-guard-mcp/README.md at commit 91f3fa7
Tools
0Version history
1- v1.3.0LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts