MailOtter
Provides tools for managing multiple Gmail accounts, including cross-account search, reading emails, identifying top senders, previewing and confirming bulk trash or archive actions, and undoing logged actions.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
A little help for a lot of mail.
MailOtter lets your AI assistant (Claude, or any MCP client) search and clean up all your Gmail accounts at once, without the scary parts:
π Search everywhere. One search across every inbox you own.
π Top senders. Find out who's actually filling your inbox.
ποΈ Bulk trash, two steps. Preview first ("43 emails, here are 5"), act only after you say yes.
β©οΈ Undo anything. Every trash or archive is logged and can be reversed.
π₯ Archive to clear the inbox without deleting.
And what it can't do, by design:
βοΈ It can't send email. MailOtter has no send function at all. (Honest note: Google's
gmail.modifypermission, which MailOtter needs for Trash, would technically allow sending. The guarantee comes from MailOtter's code, which tests check.)π₯ It can't permanently delete. Mail goes to Trash, which you can recover for 30 days.
π§© It can't do half a job. If a search matches more than the limit (2,000 by default), it refuses and changes nothing.
β±οΈ It can't act on stale previews. A preview code works once, for 15 minutes, on exactly the emails it showed. Mail that arrives later is never touched, and mail already changed since the preview is skipped.
π It can't half-connect. Every account is reached before anything changes. A crash mid-way still leaves a journal, so
undoworks.
It runs on your own computer (Linux, macOS or WSL). Your mail goes only between your computer and Google.
It deliberately stays under Gmail's per-account speed limit, so big jobs take time: about 7 minutes to trash 1,000 emails, and about 2 minutes to scan 250 for top senders.
Install
pipx install git+https://github.com/Choplac/mailotterRelated MCP server: A1 Gmail MCP
One-time Google setup (about 15 minutes)
Gmail needs a "client key" that belongs to you:
Go to Google Cloud Console and create a project (any name).
Under APIs & Services β Library, open Gmail API and click Enable.
Open Google Auth Platform β Get started. App name:
MailOtter. Audience: External.Under Audience β Test users, add every Gmail address you want to manage.
Under Clients β Create client, choose Desktop app, then click Download JSON.
Run
mailotter setup ~/Downloads/client_secret_XXXX.json, then delete the download.
While your Google app is in Testing, Google makes sign-ins expire after 7 days. To avoid re-signing weekly, open Audience and click Publish app. It stays private to you, and Google shows an "unverified app" warning at sign-in, which is expected for a personal tool.
Sign in your accounts
mailotter login personal --email you@gmail.com
mailotter login old --email old.you@gmail.com
mailotter accountslogin prints a link. Open it, sign in, and allow access. If your browser can't reach the
computer (some WSL, SSH or container setups), use mailotter login personal --manual.
Use it from the command line
mailotter top-senders # who fills your inboxes
mailotter search "from:newsletter@shop.com" # across all accounts
mailotter trash "from:newsletter@shop.com older_than:3m" # preview, then type yes
mailotter archive "category:promotions" -a personal
mailotter history
mailotter undo # reverse the last actionThe search words are Gmail's own.
Save attachments
mailotter save-attachments "from:reports@example.com has:attachment" -a work --to ~/reports --pdf-onlySaves the attachments of the newest matching emails (20 by default, -n for more) in one account.
It only reads mail: nothing is labelled, archived, trashed or marked read.
Files are named
<date>-<message id>.<ext>(-2,-3for the second and third attachment of an email, so a rerun after a failed download gives the same names), never after the attachment's own name, which a stranger chose; attachments that have no name are saved too. A file that really is a PDF always ends in.pdf, with or without--pdf-only.--pdf-onlykeeps only files that really are PDFs.A new folder is created private to you, and files are readable only by you.
It never overwrites. A file already saved with the same content is skipped; a different file with the same name is reported as a conflict and left alone. Attachments over 25 MB are refused.
This is command line only: the assistant tools below cannot save files.
Use it from Claude Code
claude mcp add mailotter -- mailotter serveThen just ask: "Who sends me the most mail across all my accounts? Preview trashing the newsletters older than 3 months."
Keep yourself in the loop: when Claude asks permission to run confirm_action, read the
preview first. Don't add confirm_action to your always-allow list.
Tools
Tool | What it does | Changes mail? |
| Your accounts and nicknames | No |
| Gmail search in one account or | No |
| Read one email (plain text) | No |
| Biggest senders over recent mail | No |
| Count and examples, plus a one-time code | No |
| Carry out a preview | Yes (reversible) |
| Reverse a confirmed action | Yes (restores) |
| Recent actions and their ids | No |
Safety notes
Emails are written by strangers. MailOtter tells the assistant never to follow instructions found inside an email, and the two-step confirm means a sneaky email can't trash your mail on its own.
Files live in
~/.config/mailotter(or$MAILOTTER_HOME) and only your user can read them:client_secret.json,tokens/<nickname>.json,state/history.jsonl.To revoke access completely, run
mailotter logout <nickname>and remove MailOtter at https://myaccount.google.com/permissions.Undo works for as long as Gmail keeps Trash (30 days).
Develop
python -m venv .venv && .venv/bin/pip install -e '.[test]'
.venv/bin/pytest # uses an in-memory fake Gmail, never a real inboxLicense
MIT. See also the privacy policy.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Multiple Gmail accounts, editable Google Sheets & Docs for AI agents. Deny-by-default access rules.
Your SyncGaze Mail in any AI app: search, summarise and draft mail. Sending needs your approval.
Search and triage all your mailboxes; draft replies and campaigns; send only as you allow.
Connect Gmail, iCloud Mail, Outlook, Yahoo Mail, Fastmail and other IMAP inboxes to ChatGPT, Claude and compatible AI assistants. Find emails by meaning across languages with semantic search. Ask AI to find customer conversations, summarize deadlines and draft follow-ups. Give a sales rep access to a shared outreach inbox or bring email into a compatible CRM. Share an iCloud custom-domain inbox with teammates without their own Apple ID or iCloud+ plan. Search results may be incomplete or stale; separate permissions control mail actions.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Gmail through OAuth2 authentication, allowing users to list, search, read emails, and create drafts with a safety-first design that prevents accidental sends by default.MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to search, read, draft, and send Gmail messages, as well as manage labels and trash using natural language.24168 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to read and draft emails across multiple Gmail accounts at once, with strict safeguards that prevent sending, deleting, or modifying mailbox settings.AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables an assistant to search and read mail across multiple Gmail accounts, create drafts in the correct account and thread, apply labels, archive or mark read reversibly, and view events from every calendar in read-only mode. Sending and deleting are deliberately not exposed, so all outgoing mail is reviewed and sent by the user.17 npmMIT