EmailMCP: Command for Claude Code

.claude/commands/clean-email.md

clean-email is a command for Claude Code from tuoc1226-maker/EmailMCP. It costs 21 tokens per session (998 once invoked), scanned A, a copy of clean-email, MIT.

An email-cleaning command that processes junk or spam folders across connected accounts. It classifies messages, rescues emails, sorts them, and blocks domains listed in a project blocklist.

In plain words
What is it for?
Use it to inspect recent junk mail, delete messages from blocklisted sender domains, classify or rescue messages, and organize spam across Gmail, iCloud, Outlook, and other IMAP accounts.
Why use it?
It reduces manual spam review by applying the same cleanup workflow to multiple email accounts and automatically removing messages from blocked domains.

Command for Claude Code

Written for Claude Code: installed under .claude/.

This is tuoc1226-maker/EmailMCP's own configuration. It tells Claude Code how to work on EmailMCP itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything EmailMCP configures →

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/marlinjai/software.

Reuse

Borrowing it

Nothing to install: this file belongs to tuoc1226-maker/EmailMCP. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/tuoc1226-maker/EmailMCP/main/.claude/commands/clean-email.md
Clone the repo
git clone --depth 1 https://github.com/tuoc1226-maker/EmailMCP

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for clean-email

README.md
[![agentmods](https://agentmods.dev/badge/commands/tuoc1226-maker/emailmcp/clean-email.svg)](https://agentmods.dev/commands/tuoc1226-maker/emailmcp/clean-email)
Your own site
<a href="https://agentmods.dev/commands/tuoc1226-maker/emailmcp/clean-email"><img src="https://agentmods.dev/badge/commands/tuoc1226-maker/emailmcp/clean-email.svg" alt="Measured on agentmods" height="20"></a>
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 998 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00021 $0.00998
Opus 5 $0.00010 $0.00499
Sonnet 5 $0.00004 $0.00200
Haiku 4.5 $0.00002 $0.00100

Measured 5d ago against content hash b11d9ee0c189, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

clean-email scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to clean-email — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/commands/clean-email.md · 102 lines

How it starts

The opening of the file, as written. The whole thing — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Clean My Email

You are an email triage assistant. Use the IMAP MCP tools to clean junk/spam folders across all connected email accounts.

Setup

  • Blocklist location: config/blocklist.json in this project directory (/Users/marlinjai/software dev/clean-my-email/)
  • MCP Server: imap (nikolausm/imap-mcp-server with multi-account support)

Workflow

1. Load blocklist

Read config/blocklist.json from the project directory. This contains domains whose emails should be auto-deleted without classification.

2. Connect to all accounts

Use imap_list_accounts to see available accounts. For each account, use imap_connect to ensure it's connected.

3. For each account, process junk/spam folder

Use imap_list_folders to find the junk/spam folder for the account. Common names:

  • Gmail: [Gmail]/Spam
  • iCloud: Junk
  • Outlook: Junk Email

Use imap_search_emails on the junk/spam folder to get recent emails (last 7 days). If there are many, process in batches of 20.

4. Pre-filter: Auto-delete blocklisted domains

For each email, extract the sender's domain. If it matches a domain in blocked_domains, delete it immediately using imap_delete_email. Count these as "auto-deleted".

5. Classify remaining emails

For each remaining email, use imap_get_email to read its content. Classify it into one of:

  • JUNK: Obvious spam, scams, phishing, unwanted marketing from unknown senders → Delete using imap_delete_email → Add sender domain to blocked_domains in blocklist

  • NOT JUNK: Legitimate email that was incorrectly flagged as spam → Use imap_send_email to forward the email content to the user's own inbox address with subject prefix "[Rescued from Spam] " → Delete the original from spam using imap_delete_email → Print a summary: sender, subject, brief description of contents

  • PROMOTION/NEWSLETTER: Legitimate promotional or newsletter content → Use imap_list_folders to find a matching promotions folder → If a matching folder exists and move is possible, describe what folder it belongs in → If no matching folder, leave it and note it in the report → Do NOT add to blocklist (these are opted-in)

Read the full file on GitHub · 102 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 102 lines · 21 tokens per session scan A b11d9ee0c189

Subscribe to this mod's changes

clean-email is a command published in the GitHub repository tuoc1226-maker/EmailMCP (0 stars, last pushed 2mo ago), licensed MIT. It adds 21 tokens to every session and 998 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to clean-email, differing in 0 lines, and is treated as a copy.