yahoo-mail-mcp

yahoo-mail-mcp

Enables safe auditing and cleanup of large Yahoo Mail backlogs by scanning headers, grouping by account and sender domain, and allowing review-then-execute actions (archive, delete, unsubscribe) without downloading message bodies.

Category
访问服务器

README

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.

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.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选