Skip to main content
Glama
yahoo-mail-mcp

yahoo-mail-mcp

by ktrann24

yahoo-mail-mcp

CI Python 3.11+ License: MIT Status: Alpha

Safely audit and clean up large Yahoo Mail backlogs from any MCP client. yahoo-mail-mcp scans header metadata, groups mail by account and sender domain, and keeps review separate from mailbox mutation.

WARNING

This is alpha, single-owner software. Start with a small scan and review every Archive, Delete, or Unsubscribe action before approving it.

Message bodies and attachments are never downloaded or indexed.

What it does

  • Scans very large Yahoo mailboxes without downloading message bodies.

  • Resumes interrupted historical scans and incrementally picks up new mail.

  • Browses and searches cached sender, subject, date, size, and unsubscribe data.

  • Lists one-click, mailto, and manual unsubscribe candidates without exposing URLs.

  • Groups activity by account and exact sender domain.

  • Supports Keep, Needs Review, Archive, Delete, and Unsubscribe decisions.

  • Moves deleted mail to Trash without permanent expunge.

  • Runs locally over stdio or remotely over authenticated Streamable HTTP.

  • Supports one account with simple variables or multiple explicitly scoped accounts.

Related MCP server: Gmail Storage & Cleanup MCP

How cleanup works

  1. Connect with a Yahoo app password.

  2. Scan message headers into SQLite.

  3. Review messages or sender groups.

  4. Tag an account/domain pair with a decision.

  5. Preview the exact affected snapshot.

  6. Approve execute_decisions to Archive, move to Trash, or unsubscribe.

Nothing modifies Yahoo Mail until execute_decisions runs against an explicitly tagged account and sender domain.

Five-minute local setup

Requirements:

  • Python 3.11 or newer

  • uv

  • A Yahoo app password

  • An MCP client such as Cursor or Claude Desktop

Generate an app password from Yahoo Account Security. Never use your regular Yahoo password.

git clone https://github.com/ktrann24/yahoo-mail-mcp.git
cd yahoo-mail-mcp
uv sync
cp .env.example .env
chmod 600 .env

Edit .env:

YAHOO_ACCOUNT_NAME=personal
YAHOO_EMAIL=you@yahoo.com
YAHOO_APP_PASSWORD=your-yahoo-app-password

Register it with Cursor:

cp .cursor/mcp.json.example .cursor/mcp.json

Replace the placeholder in .cursor/mcp.json with the absolute path to your clone, then restart Cursor. The real file is ignored because it is machine-specific.

Start by asking:

List my configured accounts, then scan up to 100 messages from the Inbox of account personal. Do not modify any mail.

Connect a Notion Custom Agent

Notion needs a publicly reachable Streamable HTTP endpoint. The supported deployment uses Railway with a persistent volume, HTTPS, Host validation, and bearer authentication.

Follow the complete Railway and Notion setup guide.

After connecting, keep Notion's write-tool policy set to Always ask for:

  • set_decisions, which only records account-scoped review choices.

  • execute_decisions, which performs Archive, Delete, or Unsubscribe actions.

Multiple accounts

Use YAHOO_ACCOUNTS instead of the three single-account variables:

YAHOO_ACCOUNTS='[
  {"name":"personal","email":"one@yahoo.com","app_password":"app-password-one"},
  {"name":"work","email":"two@yahoo.com","app_password":"app-password-two"}
]'

Names must be unique. Sender groups, decisions, previews, and execution are scoped by account. Mutating tools require an explicit account when more than one is configured.

Example MCP prompts

Read-only exploration:

List configured accounts and show the scan status. Do not modify mail.

Start a background scan of at most 100 Inbox messages for account personal, then report the job ID.

Show the largest sender groups for account personal, including counts, recent dates, and available unsubscribe methods.

Show one-click unsubscribe candidates for account personal, sorted by message count. Do not unsubscribe yet.

Safe review:

Tag newsletter.example.com as Archive for account personal. Do not execute the decision.

Preview Archive decisions for account personal and show the exact count and sender breakdown. Do not execute.

Tools

Read and scan:

  • list_accounts

  • scan_mailbox, start_scan_job, get_scan_job, list_scan_jobs

  • get_scan_status, triage_new_mail

  • list_recent_messages, search_messages, get_message_headers

  • list_sender_groups, get_sender_detail

  • list_unsubscribe_candidates

Review and mutation:

  • set_decisions: records an account/domain decision without touching mail.

  • preview_cleanup: returns exact counts and a short-lived confirmation token.

  • execute_decisions: performs approved Archive, Delete, or Unsubscribe actions.

  • export_review_csv, import_review_csv: local-only spreadsheet round trip.

Remote mode intentionally omits CSV tools because arbitrary server filesystem paths are unsafe over the network.

Safety and privacy

  • Scans use read-only folders and BODY.PEEK for selected header fields.

  • UIDVALIDITY changes invalidate stale folder data.

  • Decisions and mutations are scoped to an explicit account and domain.

  • Archive and Delete use recoverable UID MOVE operations.

  • Large moves require a 15-minute, single-use token bound to the exact snapshot.

  • Live UIDVALIDITY and sender domains are checked before moves.

  • One-click unsubscribe blocks private addresses, unrelated domains, DNS rebinding, and redirects.

  • Candidate listings identify advertised methods; execution repeats final endpoint and DNS safety validation.

  • Destructive actions are written to the SQLite audit log.

  • Browse tools do not expose raw unsubscribe URLs.

SQLite stores account aliases, folders, UIDs, sender metadata, subjects, dates, sizes, unsubscribe headers, decisions, checkpoints, and audit logs. It does not store message bodies or attachments. Protect the database and hosting environment as sensitive personal data.

See SECURITY.md for the complete deployment assumptions and private vulnerability reporting process.

Configuration

Common variables:

  • YAHOO_EMAIL, YAHOO_APP_PASSWORD, YAHOO_ACCOUNT_NAME: one account.

  • YAHOO_ACCOUNTS: JSON array for multiple accounts.

  • YAHOO_MAIL_MCP_DB: SQLite path.

  • YAHOO_MAIL_MCP_DELETE_THRESHOLD: large-move confirmation threshold.

  • YAHOO_MAIL_MCP_BATCH_SIZE: IMAP fetch batch size.

  • YAHOO_MAIL_MCP_LOG_LEVEL: Python log level.

Hosted mode also requires a bearer token and allowed hostname. See .env.example and docs/railway.md.

Why Yahoo needs special handling

Large Yahoo mailboxes may expose only a limited standard IMAP window. This project handles Yahoo's UIDONLY, PARTIAL, and MESSAGELIMIT extensions internally, using checkpointed batches and constant memory instead of requiring thousands of MCP tool calls.

Alpha limitations

  • This is self-hosted software for one trusted owner, not a multi-tenant service.

  • Yahoo app passwords and indexed metadata live wherever it is deployed.

  • Very large historical scans may require multiple background jobs.

  • Sender-provided unsubscribe headers can be missing or require manual action.

  • Live mailbox mutations remain manual release checks.

See the public release checklist.

Development

Use synthetic fixtures only—never commit real mailbox data or credentials.

uv sync
uv run ruff format --check .
uv run ruff check .
uv run mypy src/yahoo_mail_mcp
uv run pytest -q
uv build
uv run twine check dist/*

See CONTRIBUTING.md and CHANGELOG.md.

License

MIT. See LICENSE.

Available Tools

18 tools
execute_decisionsA
Destructive

Execute tagged decisions. THE ONLY DESTRUCTIVE TOOL.

account is required unless exactly one account is configured. decision="archive": moves messages from domains tagged 'archive' to the provider's Archive folder. decision="delete": moves tagged messages to Trash (recoverable). If either total exceeds the safety threshold, a confirm_token from a fresh preview_cleanup call is required.

decision="unsubscribe": for each domain tagged 'unsubscribe', performs RFC 8058 one-click POST or sends a mailto unsubscribe email. Plain http links are never auto-fetched; they are returned as manual items.

Domains tagged 'keep' or 'needs_review' are never touched.

Inputs: decision (required), account, confirm_token.

export_review_csvB

Export all sender groups to a CSV for spreadsheet review.

Edit the decision column (keep / unsubscribe / archive / delete / needs_review) and re-import with import_review_csv.

Inputs: path (required).

get_message_headersA
Read-onlyIdempotent

Get the cached headers for one exact account/folder/UID reference.

Includes sender, subject, date, size, decision and safe unsubscribe method names. It never returns raw unsubscribe links or a message body.

Inputs: uid (required), folder (required), account (required).

get_scan_jobB
Read-onlyIdempotent

Get status and, when complete, the result of one background scan.

Inputs: job_id (required).

get_scan_statusA
Read-onlyIdempotent

Show scan progress per folder (from checkpoints), without connecting to IMAP.

Inputs: account.

get_sender_detailA
Read-onlyIdempotent

Full detail for one sender domain: addresses, folder breakdown, up to 20 sample subjects, and unsubscribe methods for one account.

Inputs: domain (required), account.

import_review_csvA

Import decisions from a CSV previously produced by export_review_csv.

Only account, sender_domain, decision and notes are read. Account may be omitted only when exactly one account is configured.

Inputs: path (required).

list_accountsA
Read-onlyIdempotent

List configured Yahoo accounts with their folders and message counts.

Connects to each account over IMAP, so this also verifies that the app passwords work.

Inputs: no named parameters.

list_recent_messagesA
Read-onlyIdempotent

List recently scanned messages using cached headers only.

Run scan_mailbox first. Results include account, folder, UID, UIDVALIDITY and a staleness field. Sender email is hidden by default; raw unsubscribe links and message bodies are never returned.

Inputs: limit, since, folder, offset, +2 more.

list_scan_jobsC
Read-onlyIdempotent

List recent background scans, optionally filtered by status.

Inputs: limit, status.

list_sender_groupsA
Read-onlyIdempotent

List scanned mail grouped by account and sender domain.

Every group includes its account. Pass account to limit the result. sort is one of: count, size, recent, oldest, domain. decision filters by tag: keep, unsubscribe, archive, delete, needs_review (needs_review includes untagged domains). Paginate with limit/offset.

Inputs: sort, limit, offset, account, +2 more.

list_unsubscribe_candidatesA
Read-onlyIdempotent

List sender domains with cached unsubscribe methods for one account.

method is all, one_click, mailto, or manual. One-click candidates advertise RFC 8058 support and an HTTPS endpoint, but final DNS, domain, and network safety validation occurs only during execute_decisions. Raw unsubscribe URLs and sender addresses are never returned.

Inputs: sort, limit, method, offset, +1 more.

preview_cleanupA
Read-onlyIdempotent

Dry run for execute_decisions: exact counts of affected messages for one account and per domain, plus a confirm_token.

Nothing in Yahoo Mail is modified. The token is required by execute_decisions for large Archive or Delete operations.

Inputs: account, decision.

scan_mailboxA
Read-onlyIdempotent

Scan a Yahoo account's folders, pulling header-level data only.

Does all the heavy lifting internally: fetches sender, subject, date, size and List-Unsubscribe headers in batches, and persists them to the local database. Progress is checkpointed continuously, so if the scan is interrupted, calling this tool again resumes where it left off. Once a folder has been fully scanned, later calls only pick up new mail.

By default scans all folders except Trash, Drafts and Sent. Pass folders to scan specific ones, or max_messages to cap this run (useful for a first validation pass).

Inputs: account (required), folders, max_messages.

search_messagesA
Read-onlyIdempotent

Search cached message headers without connecting to IMAP.

Free-text query matches subject, sender domain and sender email. Additional exact filters can narrow account, folder, sender, date, unsubscribe availability and decision. List results never expose raw unsubscribe URLs or message bodies.

Inputs: sort, limit, query, since, +11 more.

set_decisionsA

Batch-tag sender domains with account-scoped cleanup decisions.

Each entry: {"account": "personal", "domain": "example.com", "decision": "keep|unsubscribe|archive|delete|needs_review", "notes": "optional"}. account may be supplied once as a tool argument or per entry. It is inferred only when exactly one account is configured. This tool never modifies Yahoo Mail.

Inputs: entries (required), account.

start_scan_jobA
Read-onlyIdempotent

Start a durable background header scan and return immediately.

Use this for large scans from remote clients that impose request timeouts. Poll get_scan_job with the returned job_id. If the server restarts, starting a new job resumes from the stored IMAP checkpoints.

Inputs: account (required), folders, max_messages.

triage_new_mailB
Read-onlyIdempotent

Incrementally scan new mail since the last scan and triage it.

Never deletes or unsubscribes anything. Returns:

  • suggestions: new messages from domains you already tagged (keep/archive/delete/unsubscribe), grouped by decision

  • new_senders: domains never seen before this run, for review

  • attention: new messages that look personal (no List-Unsubscribe header), which usually deserve a human look

Inputs: account (required), folders.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 18 tools

    Disambiguation5/5

    Each tool has a distinct purpose: scanning, listing, decision tagging, execution, export/import, etc. Even similar-sounding tools like list_sender_groups, list_unsubscribe_candidates, and list_recent_messages are clearly differentiated by their descriptions.

    Naming Consistency4/5

    Most tools follow a verb_noun pattern (e.g., list_accounts, scan_mailbox, execute_decisions). Minor inconsistency with triage_new_mail (verb at start but not consistent with other patterns) and some tools lack a clear verb (e.g., get_scan_job vs. list_scan_jobs).

    Tool Count5/5

    18 tools is appropriate for the email cleanup domain. The count covers the core workflow stages (scan, review, decide, execute) without being overwhelming or too sparse.

    Completeness4/5

    The tool set covers the full cleanup lifecycle: scanning, reviewing senders, tagging decisions, previewing, executing, and exporting/importing reviews. Minor gaps exist, such as undoing decisions or managing multiple cleanup passes, but core functionality is well-covered.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables bulk Gmail inbox cleanup including trashing emails, managing filters, and extracting unsubscribe links, with dry-run previews and automatic retry/backoff to handle rate limits.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables monitoring shared Google storage quota and recovering Gmail space by scanning cleanup candidates, scoring them deterministically, and requiring review before moving non-protected messages to Trash.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables controlling Yahoo Mail from Claude in plain English — read, search, organize, delete, and send emails, with a two-phase confirmation step to prevent accidental destructive actions.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Claude to read, search, organize, and clean up Yahoo Mail emails over IMAP without Yahoo API keys.
      4
      MIT