email-mcp: Command for Claude Code

.claude/commands/clean-email.md

clean-email is a command for Claude Code from marlinjai/email-mcp. It costs 21 tokens per session (998 once invoked), scanned A, original, MIT.

An email-cleaning workflow that processes junk mail across connected email accounts. It checks spam folders, removes messages from blocked domains, and sorts or rescues other messages according to the workflow.

In plain words
What is it for?
Use it to inspect recent spam, delete mail from configured domains, classify messages, and move or rescue messages across supported accounts.
Why use it?
It reduces the manual work of reviewing unwanted messages in several inboxes while keeping potentially useful mail from being lost.

Command for Claude Code

Written for Claude Code: installed under .claude/.

This is marlinjai/email-mcp's own configuration. It tells Claude Code how to work on email-mcp 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 email-mcp 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 marlinjai/email-mcp. 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/marlinjai/email-mcp/main/.claude/commands/clean-email.md
Clone the repo
git clone --depth 1 https://github.com/marlinjai/email-mcp

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/marlinjai/email-mcp/clean-email/github.svg)](https://agentmods.dev/commands/marlinjai/email-mcp/clean-email)
Your own site
<a href="https://agentmods.dev/commands/marlinjai/email-mcp/clean-email"><img src="https://agentmods.dev/badge/commands/marlinjai/email-mcp/clean-email/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for clean-email

Your own site · 80×15
<a href="https://agentmods.dev/commands/marlinjai/email-mcp/clean-email"><img src="https://agentmods.dev/badge/commands/marlinjai/email-mcp/clean-email.svg" alt="Reviewed on agentmods" width="80" 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. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found 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 8d ago against content hash b11d9ee0c189, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 8d 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

Copies of this mod

1 near-identical copy found in the catalogue:

.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. 8d 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 marlinjai/email-mcp (19 stars, last pushed yesterday), 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. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.