Listed from the MCP registry; nobody on Odel publishes it.
Gmail MCP server for email triage: search, labels, archive, trash, unsubscribe, snooze.
Runs on your machine from its package; the steps are below.
At most: creates or changes data: records, files, settings.
Odel charges nothing per call. The publisher may charge for its own service.
Runs locally over stdio
This server isn't hosted — your MCP client launches it from a package registry. Use one of the commands below, or drop the config into your client (e.g. Claude Desktop).
Run
npx -y mailwarden
MCP client config
{
"mcpServers": {
"mailwarden": {
"command": "npx",
"args": [
"-y",
"mailwarden"
]
}
}
}A reliable, native Gmail MCP server — full mailbox triage for AI assistants, with the feature no other Gmail MCP server ships: mailbox-side snooze.
threads.list — the call any thread search goes through — can
answer is:unread from a stale thread-level read state: measured in one real mailbox, 86% of
the threads it returned held no unread message at all; in a second mailbox, no drift whatsoever.
You cannot tell which mailbox you are in without looking, so search re-verifies every hit against
its live labels. Paginated via pageToken/nextPageToken. (the measurements)get_thread reports the SPF/DKIM/DMARC results
the receiving server recorded, so "is this really from my bank?" is answered from the message's
own headers instead of from how the domain looks. It reads Gmail's own report only — the one
written under the id mx.google.com; a message can carry forged ones of its own — says whether a passing
DKIM signature belongs to the From domain, and says unchecked when nobody checked, because a
missing check is not a passing one.bulk_modify archives/labels everything matching a query at
1000 messages per API request — with per-chunk partial-success reporting instead of
all-or-nothing. The snooze sweep uses the same batch path.outputSchema and returns validated
structuredContent alongside fenced JSON text — no parsing guesswork for clients. Failures are
structured as well: a code and a retryable flag, so a client can tell "try again later" from
"re-authorize" without reading prose.messages.send, drafts.send, permanent deletion and forwarding
settings, whatever a compromised or careless caller asks for — and every other draft endpoint too,
unless you switch on the opt-in drafts tier, which
saves drafts for you to send yourself. One deliberate exception:
unsubscribe / bulk_unsubscribe (manage tier) contact the opt-out endpoint named in a message's
own header — the only non-Google host mailwarden ever reaches, and a read-tier deployment makes
no outbound request at all. Details under
Security & privacy and
Unsubscribing.=?UTF-8?B?…?= → readable text),
bodies decoded by their bytes and their declared charset (text Gmail already converted to UTF-8 is read as UTF-8 whatever the header says, anything else in the charset it names; no mojibake for ISO-8859-1/Shift_JIS mail),
429/5xx retried with exponential backoff.Connectors that sync or cache your mailbox can lag behind it — and even Gmail's own search index is sometimes loose (see below). mailwarden talks straight to the live Gmail API (no cached snapshot) and re-verifies what the index returns, so what you see is what's actually there. It's a generic Gmail capability layer — keep your own rules/logic in your AI client, not in the server.
search goes one step further than the raw API: Gmail's threads.list index can answer read-state operators from a stale copy of that state, so is:unread returns threads you finished reading weeks ago — in one measured mailbox, the large majority of what came back. Since every hit is fetched live anyway, search re-checks the unambiguous predicates (is:unread/is:read/is:starred/in:inbox/category:…, with negation) against each thread's true labels and drops the index's false positives.
Most Gmail MCP servers cover the same read/label/send surface. Two capabilities are still unique to mailwarden as far as we have looked (mailbox-side snooze, search re-verification), and one deliberate omission is a security feature, not a gap. A third, sender authentication, was unique when it shipped and no longer is: @agentcomms/gmail-mcp has read Authentication-Results since 18 September 2026, trusting only the report whose authserv-id is mx.google.com. It has its own column below since 13 October 2026. Google's own server is also narrower than it looks: draft-only, and no trash, filters or unsubscribe.
| Capability | mailwarden | Google official | taylorwilsdon | a-bonus | aaronsb | klodr | agentcomms | gmail-tidy |
|---|---|---|---|---|---|---|---|---|
| Mailbox-side snooze — archive now, resurface in the inbox on a date/time or preset | ✅ | — | — | — | — | — | — | — |
| Search-result re-verification — drops the thread index's false positives against live labels | ✅ | — | — | — | — | — | — | — |
| Sender authentication — SPF/DKIM/DMARC as the receiving server recorded them, on every message | ✅ Gmail's own report only, values token-validated, DKIM alignment | — | — | — | — | — | ✅ Gmail's own report only, DKIM alignment | ⚠️ fail values from the first header, issuer unchecked |
| Sweep / bulk over a query — one action across every thread a search returns | ✅ 1000/req, partial-success | — | ⚠️ batch by explicit ids; filter apply relabels over a query, no re-check | — | ✅ previewed query, up to 10,000, no re-check | ⚠️ batch by explicit ids | ⚠️ batch by explicit ids, exact per-message undo | ⚠️ over a query, capped at 5,000, no preview or re-check |
| Unsubscribe — per-sender overview + RFC 8058 one-click opt-out, no send scope needed | ✅ | — | ⚠️ header shown, no action | — | — | — | — | ⚠️ link shown, no action |
| Inbox triage overview — one call that buckets what is waiting | ✅ sender/label/age + header signals | — | — | ✅ heuristic flags + stats | ⚠️ unread list, no buckets | — | — | ⚠️ sender stats + newsletter list, no buckets |
| Server-side filters — rules that keep triaging with no assistant in the loop | ✅ never forwarding | — | ✅; ⚠️ forwarding allowed | — | ✅ previewed; ⚠️ forwarding allowed unless draft-only policy | ✅ never forwarding | — | ✅ never forwarding or trash |
| No send tools — by design — a prompt-injected mail has no exfiltration path | ✅ no compose by default; ⚠️ opt-in draft-only tier | ⚠️ draft-only | ❌ sends; ⚠️ send tool dropped under --read-only or a gmail level below send | ❌ sends | ❌ sends; ⚠️ opt-in draft-only policy or a read-only account | ❌ sends; ⚠️ opt-in recipient allowlist | ❌ sends; ⚠️ per-message approval, in chat by default | ⚠️ draft-only |
| Least-privilege tool tiers — OAuth scopes derived from the tools you enable | ✅ | ⚠️ scope split | ⚠️ --permissions narrows scopes per service (cumulative or +-union); tiers narrow tools only | — | ⚠️ per-account read/readwrite, at call time | ⚠️ inverse: tools gated by the scopes requested at login | ⚠️ tier per mailbox picks the scopes; writes checked against the grant at call time | — |
| Token encryption at rest | ✅ AES-256-GCM by default, key in the OS keystore; a passphrase where there is none | n/a (hosted) | ⚠️ file mode 0600; bucket CMEK on GCS; in OAuth 2.1 mode also a Fernet copy, key derived from the server's secret | ⚠️ file mode 0600; remote: AES-256-GCM via FastMCP, key TOKEN_ENCRYPTION_KEY or random per start | — | — | ✅ OS keychain by default; owner-only file by choice | ✅ AES-256-GCM by default, key in the OS keystore |
| No vendor cloud — you operate the server | ✅ | ❌ Google-hosted | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Structured outputs — every tool declares an outputSchema | ✅ | ✅ documented per tool in its reference | — | — | — | ⚠️ two tools (download_email, download_all_attachments), more planned | ✅ every tool | — |
Snapshot as of 13 October 2026 — the oldest of the seven column checks (Google's reference, last read that day), and so the only date the table as a whole can claim. Each repository column is brought forward by reading the diff against the revision recorded in docs/comparison-sources.json whenever npm run table-sources reports a move. On 25 October 2026 four of them moved at once. aaronsb went to 9c9f8033 (v4.8.0), and two of its cells with it: since 16 October 2026 it applies a label change to everything a query matches, behind a preview that counts the set, keeps the ids on the server and hands back a token valid once for thirty minutes (up to 10,000 messages; the matches are not re-checked), and it creates, updates and deletes filters behind the same kind of preview — forwarding included unless its draft-only policy is set. taylorwilsdon went to fcbf5a2c (v2.2.0); --permissions now also takes a union such as gmail:readonly+send that grants only the named levels, which the least-privilege cell now names. klodr went to e5c080c3 (3.0.0); create_filter now refuses a forwarding action whatever the scopes, and its filter cell says so. agentcomms went to 261cae4f (0.28.0, with per-recipient rules on what it sends); no cell moves. On 8 November 2026 all six repository columns had moved again — taylorwilsdon to aa91bf75, a-bonus to 22856e1f, aaronsb to 5bf9ef73, klodr to ed1e7785, agentcomms to 42efa4c8, gmail-tidy to 00921c8f — and each diff was read with their draft tools in view; no cell moves. On 24 November 2026 four of them had moved again — taylorwilsdon to 21ad3daa (v2.6.0), a-bonus to 2b40e402 (v2.1.2), aaronsb to b0aecf1d (v4.9.1), klodr to 86360997 (v3.0.1) — and no cell moves with them; the same round found one taylorwilsdon cell that had been short since the start, token encryption (see below). Google's tool reference, last read on 13 October 2026, documents an output schema on every one of its eleven tools; it is still Developer Preview, with no send, trash, filter, snooze, unsubscribe or query-driven tool. — = not offered / not documented. Columns are the servers a reader is most likely to reach for — Google's first-party one, plus the three largest community servers still under maintenance — and klodr, which comes closest to mailwarden's own least-privilege design. agentcomms (@agentcomms/gmail-mcp, read at 01cee751 on 13 October 2026) was added the same day for two reasons: it is the only other server we know of that reads Authentication-Results, and it pins that read to Gmail's own report, which is stricter than what mailwarden did until then and the reason mailwarden now does the same; and its npm reach overtook klodr's within a month of its first release. Its bulk path is per id, not per query, but every change returns an exact per-message undo — the design mailwarden's bulk_modify adopted as undo: true. It sends, behind a per-message approval whose default is a yes in the conversation; its own README says the software cannot tell that yes from the agent's, and offers a terminal confirmation (confirm) or no sending at all (never) instead. gmail-tidy (gmail-tidy-mcp, read at 6df48c69 on 25 October 2026) was added that day because its stated position is the closest to this one: no send tool and no trash, a build test that fails on either, and filters that can neither forward nor trash. It does write drafts, which puts it on the send row next to Google's server rather than next to this one — its own README says plainly that its token could send. It was ahead of mailwarden on one row, and mailwarden has since taken the same design over: it encrypts the token by default, with the key in the OS keystore. Its bulk runs over a query, capped at 5,000 messages, with neither a preview nor a re-check, and it reads SPF/DKIM/DMARC failures from the first Authentication-Results header without asking which server wrote it. Its npm reach matched mailwarden's within ten days of its first release. aaronsb was added on 8 September 2026, and the reason it was missing is worth stating plainly: the selection had been made by capability overlap, so a server an order of magnitude larger than the smallest column sat outside the table while that column stayed in it. It earns its place on the send row rather than on size. It can be made to refuse sending — GWS_SAFETY_POLICY=draft-only-email (since 25 March 2026, v2.0.0) blocks send, reply, replyAll and forward whenever they would send, and since 10 November 2026 (v4.9.1) lets them through with draft: true to save a draft instead; and since 17 August 2026 (v4.3.0) an account can be authorized read-only, so that its token cannot send either. It was not the first: taylorwilsdon drops send_gmail_message under --read-only since 1 February 2026 (v1.9.0) and under a gmail permission level below send since 28 February 2026 (v1.13.1), which an entry of 24 November 2026 corrected after csitte.at re-read every column; agentcomms has since joined them with a never send policy, binding on the agent only under its confirm change policy, since under the default chat one an agent can loosen it again — and the difference that keeps the row honest is where the promise lives: there, sending is the default and the refusal is an operator's environment variable; here, no tool to send was ever written. Its no-delete policy stands in the same relation to this project's trash-only rule. The filter row asks the same question from the other end, and a third project shows why it is one: c0webster/hardened-google-workspace-mcp, a fork of the taylorwilsdon column made for no reason but this one, removes create_gmail_filter and delete_gmail_filter outright because a filter can forward — which is exactly the risk, answered by dropping the capability. mailwarden keeps the capability and removes the risk instead: create_filter has no way to express a forward, and list_filters surfaces the ones that already exist so they can be audited. That fork also shows where a promise of this kind usually leaks, which is why the row above is about the tool surface and the egress guard rather than about scopes: it drops gmail.send but keeps gmail.compose — commented "for draft creation/editing only (NOT sending)" — and gmail.modify. Google documents the first as "Manage drafts and send emails" and the second as "Read, compose, and send emails", so the promise does not rest on one scope too many but on two, and gmail.modify alone would be enough — the same scope this project holds in its own manage tier, which is exactly why the row points at the tool surface. Its token can send; only its tool list cannot. The most installed Gmail server is absent for that reason and not by oversight: GongRzhe/Gmail-MCP-Server is archived, its last commit dating to August 2025, and it still drew 112,163 npm downloads in the month to 29 August 2026. Reach and currency are different questions, and a comparison of what a server does today can only answer the second. Send capability is listed as a security property: mailwarden's lack of it is intentional (see Security & privacy). The encryption row asks who holds the key: mailwarden keeps a random key in the OS keystore by default, as gmail-tidy does, and falls back to a passphrase you set where no keystore is reachable — and to a plaintext file where you set none, which is why the cell names both; taylorwilsdon relies on file permissions locally and on the storage bucket's own CMEK when hosted on GCS — protection against a stolen file in the first case, against a stolen disk in the second; a-bonus writes its token at file mode 0600 locally, and in remote mode hands it to the FastMCP proxy, which encrypts it with AES-256-GCM under TOKEN_ENCRYPTION_KEY or, where that is unset, under a random key for each start (since 27 March 2026, v1.5.0). In taylorwilsdon's OAuth 2.1 HTTP mode the proxy layer underneath (FastMCP) keeps a second copy of the Google tokens, Fernet-encrypted on every backend that persists them (its default, disk and Valkey; the opt-in memory backend holds them unencrypted and only while it runs) with a key derived from the server's JWT signing key or OAuth client secret — encryption the server does itself, with the key in its own configuration rather than in a keystore; the plaintext 0600 copy is written as well, except in the stateless variant of that mode, which writes no plaintext file, so the encrypted copy is the only one stored, or none with the memory backend. That has been so since 23 December 2025 (v1.7.0), and every reading here missed it until 24 November 2026. The last row asks who operates the server, not where it happens to run: self-hosting is common ground here, and every community server on this table offers some remote deployment except aaronsb, klodr, agentcomms and gmail-tidy (stdio only) — mailwarden via --http, taylorwilsdon over streamable HTTP with OAuth 2.1, a-bonus on Cloud Run. Running one of them on your own host is not a cloud copy; running it on the vendor's is.
The moat isn't any single row — it's snooze + live re-verification together: an actual inbox-workflow layer that acts on the mailbox's current state, not a cached snapshot. Where others have caught up it's noted honestly above: at-rest encryption (taylorwilsdon; by default and with the key in the OS keystore, agentcomms and gmail-tidy, whose design mailwarden has since taken over), scope-driven tool gating (klodr inversely; taylorwilsdon in our direction, and further than this row said until it was corrected — besides --read-only, which switches the OAuth flow to the read-only scope map, he has had per-service permission levels since 25 February 2026: --permissions gmail:organize builds the requested set from cumulative levels — readonly, organize, drafts, send, full — and his tool registry then disables every tool whose declared scopes fall outside them, deliberately skipping scope-hierarchy expansion so that organize really does exclude gmail.send. What separates that from this row's claim is the direction, not the strength: the level is picked per service rather than derived from the tools you enable, so --tool-tier core --tools gmail still asks for the full Gmail scopes unless a level is named, and neither mode has a guard at the request itself. Our August round read only the tier path and understated him here from 26 August on; re-read in his auth/permissions.py, auth/scopes.py and core/tool_registry.py at 54b1c56 on 7 September 2026 — the day we read, at the revision his repository stood at. The tier half was checked on 26 August 2026 and corrected the same day by csitte.at, who verified it against their own clone rather than taking our word for it), a richer per-message triage heuristic (a-bonus), and bulk organize over a mailbox (the hosted mcpemails.com, which has no snooze either). What none of them do is act on a query and check the mailbox's answer before acting on it — taylorwilsdon's filter apply, aaronsb's previewed modifyMatching and gmail-tidy's organize_emails now do the first half, all over messages.list, and none of them the second.
mailwarden is a Gmail server, not a Workspace suite — if you want Calendar, Drive, Docs and Sheets
from one place, a broad server like taylorwilsdon/google_workspace_mcp covers ground this one never
will, and the two are not mutually exclusive. Adding both is a reasonable setup, and the reason to is
the token, not the tool count: a suite server that can send mail holds a credential that can send
mail, for every mailbox it is pointed at. Giving Gmail to mailwarden instead means the mail half of
your setup has no compose, reply, forward or send tool at all — or, with the opt-in drafts tier,
tools that save drafts and none that send them. Where that promise rests differs by
tier, and the distinction matters: on read Google enforces it at the token (gmail.readonly,
which the send endpoints reject), while on manage it rests on the tool surface — Gmail does
accept gmail.modify for sending, so the scope alone is no guarantee. In both cases the egress
guard refuses messages.send and drafts.send in the server itself, and every
other draft endpoint unless the drafts tier is on, so an injected message in your inbox has no
tool to reach for and no endpoint to reach.
Practical shape: point the suite server at the services you want and disable its Gmail tools
(--disabled-tools, or a tier that omits them), and run mailwarden alongside for mail. Keep the
tier rule in mind — at most one mailbox per client config should carry
writing tiers.
Ask an assistant to "archive the unread promotional mail that's already skipped my inbox" and it will reach for the obvious query, category:updates is:unread -in:inbox. A server that trusts Gmail's index now archives threads you had already read — mail you never meant to touch, gone in a bulk action you can't easily reverse.
Measured, not asserted. In one real mailbox (~70,000 messages), category:updates is:unread returned 131 threads through threads.list, and only 17 of them held an unread message — 87% stale. The same query, same mailbox, same minute, asked through messages.list instead: 19 messages, none stale. So this is not "Gmail search is unreliable" — the thread view of read state lags while the per-message view does not, and search goes through threads.list. A second mailbox, measured identically on the same day, drifted not at all.
Method, all three queries, the controls, and what the finding is not (it is not the index dropping the predicate, and not a quirk of exotic operator combinations): Gmail's thread index can answer is:unread from a stale read state — a standalone report, every figure traced to a recorded measurement.
Which is the whole point: a server cannot know which kind of mailbox it is in. Re-verification costs nothing where nothing drifts, and saves you where it does — in the measurement above, every thread search dropped was genuinely read, and it discarded no genuinely unread mail.
Where it is not free: the bulk tools. search re-verifies because it fetches every hit anyway; bulk_modify (and create_filter's applyToExisting sweep) is sized in thousands of messages, where one fetch per hit is a different order of cost. Both act on what the index returns — and bulk_modify reports unverifiedPredicates, the conditions from your query that were taken on the index's word (+UNREAD, -INBOX, …). Empty means there was nothing to distrust. Non-empty and the result has to be read-state-precise? Resolve the set with search first and act on those thread ids. A dryRun does not close this gap: it re-reads the same index, so it confirms how big the set is, never whether it is right. What its previewToken does close is the other gap, between showing a set and changing one: without it, the write runs the query again and changes whatever matches by then.
The filter sweep does not report that field, deliberately. Its query is not yours — create_filter builds one from the criteria, parenthesising a query criterion and double-quoting every from/to/subject value, and both of those switch the predicate derivation off. The list would come back empty for every filter you can define, and an empty list here would read as "nothing to distrust" when it means "could not tell". So the caveat stays in prose, where it holds without exception: treat a sweep as acting on the index's answer, whatever it matched. Use verify: true to learn what the sweep actually changed, and search when the set has to be right before anything is written.
A cheaper half-measure, honestly labelled. bulk_modify also takes crossCheck: true, which asks Gmail the same question a second way before writing: every derived predicate is re-run as a label filter (labelIds) rather than as a query operator, and any message the two routes disagree about is left untouched and reported. The cost is one extra list call per predicate — flat, independent of how many messages match — where re-verification costs one fetch per hit. What it buys is bounded and worth stating plainly: a disagreement is real evidence, agreement is none at all, because both routes read the same index and an index can be consistently wrong. So unverifiedPredicates still reports what it always did, cross-check or not, and only search re-checks against the mailbox itself. Whether the two routes ever diverge in practice is unmeasured — node scripts/probe-crosscheck.mjs measures exactly that in your own mailbox, read-only and ids only.
mailwarden fetches every hit live anyway, so search re-checks the unambiguous predicates (is:unread, is:read, in:inbox, category:…, with negation) against each thread's true labels and drops the index's false positives before any tool sees them. The bulk action then runs on exactly the set you asked for. This is the difference between acting on what Gmail indexed and acting on what's actually in the mailbox right now — and it's why snooze/sweep are safe to hand to an assistant: the sweep resurfaces only threads whose snooze is genuinely due, verified against live labels at run time.
See it yourself — no Gmail account needed. From a clone of the repo (the demo is a repo-only verification script, not part of the npm package):
git clone https://github.com/csitte/mailwarden && cd mailwarden
npm install && npm run build
node scripts/demo-reverify.mjs
There is a second script next to it, node scripts/probe-reverify.mjs, which measures the same thing in your mailbox instead of a fake one — read-only, metadata only (no subject, sender or body is fetched), printing counts and label names. It is how the numbers above were produced, and how you can check whether your mailbox drifts at all.
The demo drives the real search() against a fake Gmail API whose index is deliberately stale (returns a read thread for an is:unread query, exactly as Gmail does) and shows mailwarden dropping the false positive. It asserts the outcome, so it exits non-zero if the behavior ever regresses. The same case is locked by unit tests in test/gmail.test.ts ("drops index false positives via live-label re-verify").
A recurring check — what came in since I last looked — is the expensive shape for a live server: the
obvious way to answer it is to search the whole slice again and compare. what_changed (read tier)
answers it from Gmail's own event log instead. Hand it the historyId a previous call or get_profile
returned, and it comes back with what arrived, what left, and which labels went on or came off, plus the
next id to keep.
This is not a cache, and the distinction is the whole design. The only thing that persists between calls is one number, and it persists in the caller. mailwarden still stores nothing about the mailbox, keeps no mirror and no index, and every call remains live against the Gmail API — the same rule as everywhere else here.
Two properties worth knowing before relying on it. It reports events, not state: a message marked
unread and then read appears under both, and both are true — for how the mailbox looks now, ask
search. And Gmail keeps roughly a week of history, after which an id is refused; mailwarden turns that
refusal into an error rather than an empty result, because nothing changed and I can no longer tell
you what changed call for opposite reactions and only one of them is safe to act on.
authentication answers, and what it doesn'tEvery message from get_thread carries an authentication object: the SPF, DKIM and DMARC
results the receiving server recorded, plus the domains each check actually validated.
{
"spf": "pass", "mailedBy": "forwarder.example", // envelope sender SPF checked
"dkim": "pass", "signedBy": "authority.example", // the signature DMARC can pass on
"alsoSignedBy": ["forwarder.example", "esp.example"], // further signatures that passed
"dmarc": "pass", "headerFrom": "authority.example", // the From domain DMARC evaluated
"dkimAligned": true, // a passing signer is the From domain
"authservId": "mx.google.com", // who asserts all of the above
"returnPath": "bounces+…@forwarder.example"
}
Read dmarc first. It is the only one of the three that ties a passing check to the From
address a human sees. spf: "pass" on its own says an envelope sender was authorised to send —
something a lookalike domain gets in minutes.
The domains do not have to match, and a mismatch is not a finding. The object above has the
shape of a real receipt, forwarded through a custom domain on a mail-routing service before it
reached the mailbox. Forwarding rewrites the envelope sender (mailedBy and returnPath become the
forwarder) and adds the forwarder's own DKIM signature, while the sender's signature travels on
intact behind it — so DMARC still passes, and headerFrom still names the original sender. That is
why DMARC, not SPF, is the check that carries meaning here. Treat the domains as the explanation
of a result, not as a test of their own.
Several signatures: the one that counts is reported. A message often carries more than one
DKIM signature — the sender's, its mail provider's, a forwarder's. signedBy is the passing one
aligned with the From domain wherever there is one, because that is the one DMARC passes on;
alsoSignedBy names the other domains whose signature also passed, which is where a forwarder
shows. Through 0.25.0 the first signature was reported, and a re-signing forwarder puts its own in
front: in a mailbox that receives through Cloudflare Email Routing, 156 of 167 received messages
read as dkimAligned: false although each carried an aligned, passing signature further down
(measured 30 October 2026, see docs/measurements.json).
What a pass does not mean. That the mail really came from that domain — not that the domain deserves anything. A phisher holds perfect SPF, DKIM and DMARC on the lookalike domain he registered this morning; authentication tells you who sent it, and the answer can be "exactly who it claims to be, and that is the problem".
dkimAligned answers the question a signature raises. Anyone can sign mail with a key for a
domain they own, so dkim: "pass" alone says only that someone signed. dkimAligned says whether
that someone is the From domain, or a parent or child of it. For two sibling subdomains it says
nothing: news.bank.example and mail.bank.example are aligned, a.co.uk and b.co.uk are not,
and without a public-suffix list the two cases look the same — so the field is absent rather than
wrong. false means that no passing signature belongs to the From domain — a forwarder that
altered the message (a mailing list adding a footer breaks the sender's signature) leaves only its
own. It is absent when DKIM did not pass. As with the domains, false is an explanation, not a
verdict — dmarc remains the check to read first.
What unchecked: true means. The message carried no Authentication-Results header from
Gmail — nobody looked. It is not a failure, and it is not a pass. The header is written by a server that
receives a message, so anything that never arrived from outside — your own sent mail, for
instance — should be expected to have none.
Forged reports. A message can carry Authentication-Results headers of its own — an attacker
writes whatever he likes into the mail he sends. Only Gmail's own report is read: the topmost
one whose authserv-id is mx.google.com, the trust boundary RFC 8601 tells a reader to rely on.
A report under any other id is never read, however convincing it looks, and a message that has
none from Gmail is unchecked even if it carries a forged one under another id. The limit: mail that
reached the mailbox without passing Gmail's inbound mail server — fetched from another account over
POP, or inserted by an app — may carry no Gmail report at all, and a forged one that claims
mx.google.com is then indistinguishable from the real thing. Mail Gmail received itself always
carries its own report on top, so there a forgery is never read; otherReports counts every report
that was not read. (Through 0.22.1 the first report was read whatever its id — right wherever Gmail
had written one, and wrong exactly where it had not.) Values are validated as tokens rather than passed through, so a field that reads
like a verdict cannot carry a sentence. If two results for the same method disagree — a second DKIM
signature that failed — the disagreement shows up in alsoReported instead of being swallowed.
| Tool | What it does |
|---|---|
search | Gmail query syntax → thread summaries (from/subject/date of the first message, lastMessageId/lastMessageDate/lastMessageFrom of the last and lastMessageSent when that was you, unread as a boolean, attachments by name, type and size, labels, Gmail's snippet — which is the last message's); read-state/category predicates are re-verified against each hit's live labels; paginated via pageToken/nextPageToken. Each hit carries signals — newsletter (List-Id / List-Unsubscribe / Precedence bulk, junk or list), automated (Auto-Submitted, auto-reply/suppress headers, no-reply-style senders), calendar (text/calendar or .ics part), replyToMismatch (Reply-To on another domain than From; a subdomain of the same domain counts as the same), displayNameSpoof (the From display name shows an address or URL on another domain than the one the mail came from — "service@paypal.com" <x@evil.example>), lookalikeDomain (a label of the From domain mixes Latin with Cyrillic, Greek or Armenian letters, as homograph domains do) — read off the first message's headers/MIME, no extra call. Spam and trash are excluded unless the query says in:spam / in:trash — see Looking in spam |
get_thread | Full thread: headers, plaintext + HTML bodies, attachment metadata. Every message also carries authentication — SPF/DKIM/DMARC as the receiving server reported them, plus the domains each check validated (signedBy/mailedBy/headerFrom), who asserts it (authservId), the returnPath, alsoReported for results that contradict each other, alsoSignedBy for further domains whose DKIM signature passed, otherReports for reports that were not read, dkimAligned for whether a passing DKIM signer is the From domain, and unchecked: true when the message carried no report from Gmail — see Judging a sender. full: false fetches headers and labels only — it then omits plaintextBody/htmlBody/attachments and sets metadataOnly: true, rather than reporting them empty for a request that never looked; it is deprecated in favour of bodies: "none" (same quota, real attachment list), and combining it with bodies is rejected as invalid_input. For a long or HTML-heavy thread, shrink the answer instead: bodies: "text" keeps only the plaintext (an HTML-only mail is reduced to text and marked bodyFromHtml), bodies: "new" is text without the quoted history at the end of a reply (the trailing > block with its attribution line, or an Outlook Original Message block; inline answers, answers below a quote and forwarded messages, also an Outlook forward by its Fwd/FW/WG subject, stay whole; an answer below an Outlook plain-text header block goes with it) and marks a cut message quotedStripped, bodies: "none" keeps headers, authentication and the real attachment list without any body, lastN returns only the newest N messages and afterMessageId only those after one already read. Same quota whatever is kept; messageCount and omittedMessages always say how much of the thread the answer shows. A message whose HTML hides text from its reader (inline display:none, font-size:0 and the like, or the hidden attribute) carries hiddenTextChars, the length of that text — counted, not removed; a block an @media rule shows again (on a phone, say) does not count. links: true adds each message's visible links as {text, url, host}, read by an HTML5 parser as a browser reads them: host is the host that opens, text the link's visible text (hiddenText: true when the link hides some) — compare the two; opt-in, because a newsletter's list is long. Links whose text names another domain than they open, or that hide text, come first. HTML that would make the parser build more than 250,000 nodes or take more than a second (a 1 MB newsletter of tables builds under half and parses in a fifth) is not read, and the message says htmlTooComplex. See Security & privacy |
read_attachment | The text inside an attachment, without saving it: plain text (txt, csv, xml, json, ics, …), a gzip file, or the text entries of a ZIP archive — DMARC aggregate reports, exports, logs. The format is decided by the bytes, never by the declared name or type, and text that is not UTF-8 (an Excel CSV from Windows) is read as windows-1252 and marked guessedCharset; binary formats are refused with a pointer to download_attachment. Every size is capped before it is spent (5 MiB unpacked per entry, 20 MiB per archive, 50 entries), so a zip bomb stops at the limit. One answer carries at most maxChars characters of text across all entries (default 30,000, at most 100,000); a cut entry reports nextOffset, and offset continues it. For an archive, list: true shows names, sizes and text lengths first, and entry (a name or a pattern like *.csv) reads only what is needed, naming the rest in notSelectedNames; binary, encrypted, oversized and nested-archive entries are listed as skipped, not opened. Nothing is written to disk, and the text is fenced and stripped of hidden characters like a mail body |
list_labels | All labels (system + user) |
get_profile | Connected account's address, total message/thread counts and the mailbox's current historyId — confirm which mailbox is wired up before acting. Also which server answers: serverVersion (bare only for a release build, otherwise with the commit, e.g. 0.23.0+a5ff4a7), build, serverPath (the directory the running code was loaded from) and account, for the moment a documented tool seems missing and the question is whether the build you think is running actually is. Under --demo, demo: true and account: "(demo)" |
what_changed | Mailbox events since a historyId you hold — arrivals, removals, labels on and off, in one call |
triage_digest | Structured overview of a mailbox slice for decisions: top senders (each with the signals its threads carry), label and age buckets, unread + attachment counts, and how many threads are newsletters / automated / calendar invites / reply-to mismatches — instead of a raw thread list |
follow_ups | Who is waiting on whom: threads whose last message is yours and unanswered for a few days (a note to your own address is left out; one other recipient in To or Cc keeps it), and inbox threads whose last message came from a person rather than a newsletter or a no-reply notice. Decided on each thread's last message and its live labels, so a thread the index still files under the inbox after it was archived is dropped |
list_unsubscribe | What opt-out options a thread advertises (List-Unsubscribe), plus body links when it advertises none — contacts nobody |
list_subscriptions | A mailbox slice grouped by sender: thread/unread counts, the date span each was seen over, and each one's opt-out options — one header fetch per sender, contacts nobody. sendersFound reports how many senders there were before topN truncated the list |
create_label | Create a user label (idempotent; nested via Parent/Child) and return its id; an optional backgroundColor/textColor pair colours it, including one that already exists |
modify_labels | Add/remove labels by name or id — an unknown name in add is auto-created (archive = remove INBOX, read = remove UNREAD). Takes threadId, or threadIds (a list of up to a hundred) to apply one change to an approved list in one call; the answer then reports changed, failed and notAttempted per thread |
bulk_modify | Batch label changes for every message matching a query — 1000 messages per API request, partial success reported per chunk (thread-id list capped at 500, submittedThreadCount has the total). Counts say submitted, because messages.batchModify answers 204 with no body and ignores unknown ids silently; verify: true reads the labels back and returns verified {applied, notApplied, unverifiable} — the only observed outcome on offer. Acts on the raw index, so unverifiedPredicates names the conditions it could not vouch for (see below). dryRun: true resolves the query and reports the matched threads and the labels it would create, touching nothing — and, when anything matched, returns a previewToken: the server holds that exact message set for half an hour, and the write that passes the token back with the same query and label change acts on that set and nothing else. Mail that began to match in between is left alone and counted in fromPreview.newMatches; a reworded query or a different change is refused before the first write; a token works once. undo: true reads each affected thread's labels live before writing and returns undo, the exact per-message inverse (up to 500 messages; with undo: true nothing is written unless the plan can be built) |
undo_bulk_modify | Replays the undo plan a bulk_modify returned: each message gets back exactly the labels it lost and loses exactly the ones it gained, so mail that was already in the target state stays as it was — which swapping add and remove would not do. Takes label ids only, as the plan carries them; a label the bulk change created stays in the mailbox, empty |
archive / mark_read / mark_unread | Convenience wrappers; like modify_labels they take threadIds for a list |
trash / untrash | Move to / restore from Trash |
download_attachment | Save an attachment to a local path (never overwrites — collisions get a numeric suffix). On Windows the file is marked as downloaded from the Internet (Mark of the Web), as a browser marks it, so opening an executable or a macro document warns first; markedAsDownloaded says whether that worked. No mark on macOS or Linux |
export_thread | Write a whole thread to a local file instead of returning it — Markdown for people (headers and attachment names as code, so a preview never loads an image or follows a link the sender wrote; sender authentication; each body in a fence the mail text cannot close) or JSON as get_thread returns it. Same path rules as attachments |
unsubscribe | One-click opt-out (RFC 8058) using the endpoint from the message's own header — the only tool that contacts a non-Google host (details) |
bulk_unsubscribe | The same for several threads, sequentially and at most one request per sender (remembered across calls for as long as the server runs, so a retry contacts nobody twice); partial success reported per thread. dryRun: true runs the same header reads and dedupe and reports the endpoint each thread wouldCall — contacting nobody |
snooze | Archive now, resurface on/after a date (YYYY-MM-DD), a date+time (2026-06-20 9am), or a preset (tomorrow, tomorrow 9am, weekend, next week, a weekday name, in N days, in N hours) |
unsnooze | Cancel a snooze, return to inbox now |
list_snoozed | All snoozed threads + due dates |
sweep_snoozed | Resurface threads whose snooze is due (run on demand, via cron, or the daemon); batched, with partial-failure reporting. dryRun: true answers "what is due right now?" (dueLabels/dueThreads) without waking anything |
list_filters | All Gmail filters (criteria + label actions); surfaces any forward address on existing filters for auditing |
preview_filter | Check a filter before creating it: how many messages its criteria match today (currentMatches, from the same index an applyToExisting sweep would use), which existing filters have exactly the same criteria (sameCriteria) and which share a from/to/subject/query value with it (overlapping, with the shared fields named), which addLabels names would be created, and whether the action trashes every future match. Read-only; same validation as create_filter |
create_filter | Create a server-side auto-triage rule (criteria → label actions only; no forwarding — see below). Optionally applyToExisting to also sweep matching mail already in the mailbox |
delete_filter | Delete a filter by id |
create_draft | drafts tier, off by default. Save a reply (recipients, subject and threading taken from the thread) or a new message as a Gmail draft, optionally with attachments — files from MAILWARDEN_ATTACH_DIR, or attachments of a message in the reply's thread. Never sent — you send it from Gmail. from picks one of the account's send-as addresses; quote quotes the answered message below a reply; the sender's signature from Gmail's settings is added unless signature: false; forward: true forwards a mail of the thread, with its attachments, to the people you name. A new message, any address the thread did not already contain, any file from the disk and any sender other than the main address is confirmed in a client dialog; the exceptions are a draft to your own address alone with MAILWARDEN_DRAFT_SELF_WITHOUT_DIALOG=1, and every draft with MAILWARDEN_DRAFT_CONFIRM=off (details) |
update_draft | drafts tier. Replace the text, and optionally the subject, recipients or attachments, of a draft create_draft wrote; any other draft is refused, and so is one changed in Gmail since (it takes the draft's last messageId). Attachments not mentioned, and the sender, are kept; quote quotes the answered message again (forward forwards the mail again), and the signature is added again unless signature: false. A new address, a new file or a new alias sender is confirmed like one in create_draft |
All tools declare an outputSchema and return structured content (validated, machine-readable)
alongside the same JSON as fenced text — clients never have to parse prose.
A failure is structured too: isError plus a fenced JSON body with a code
(not_authorized, needs_reauth, insufficient_scope, forbidden_operation, not_found,
rate_limited, upstream_unavailable, network_error, invalid_input, declined_by_user, internal_error) and a
retryable flag, alongside the sentence a human reads. So "wait and try again" versus "re-run
mailwarden --auth" is something a client can decide, not something it has to infer from wording
that may be reworded next release. (No structuredContent on errors: that is validated against the
tool's outputSchema, which describes a success.) A rate_limited failure also carries
retryAfterSeconds, because there the wait is the remedy. An insufficient_scope failure names
the gap rather than the possibilities — which scope is missing, what it covers, and what the saved
authorization grants instead — by reading the token's own scopes when it lands, and the server
prints the same line on stderr at startup. It explains the refusal rather than preventing it:
the call still goes to Google, and Google is what turns it down. That matters most with a passphrase-encrypted token: the tier gate
at registration cannot decrypt it, so the surface is advertised in full and the gap would otherwise
surface as a bare 403 mid-task. A token encrypted with a keystore key keeps its scopes readable and
is gated like a plaintext one.
Clients that show MCP prompts (as slash commands in Claude Code, or a menu in Claude Desktop) get four ready-made requests. Each one names the tools it uses, and a prompt is offered only when the enabled tiers serve them; a step that needs an optional tier is left out where that tier is off, so a read-only deployment gets the read half of a prompt instead of an instruction that fails.
| Prompt | Needs | What it asks for |
|---|---|---|
inbox_triage | read | triage_digest and follow_ups, sorted into needs-you-today, can-wait and noise, with phishing signals pointed out. With manage, proposed actions (archive, snooze, mark_read, unsubscribe) that run only for the items you say yes to. Optional focus: a query to narrow it, e.g. newer_than:7d |
check_message | read | One thread (threadId) checked for phishing: get_thread with links: true, what SPF, DKIM and DMARC verified and for which domain, the header signals, hiddenTextChars, and every link whose text names another domain than its host. No link is opened. A verdict with its reasons |
reply_backlog | read | follow_ups: what waits on you and what you wait on, oldest first. With drafts, replies to the ones you pick, saved as drafts for you to read and send. Optional days |
newsletter_cleanup | read, manage | list_subscriptions, a proposal of what to leave, then bulk_unsubscribe as a dry run before the real run, and bulk_modify with a preview to archive what those senders left |
Every prompt ends by telling the model that a mail's text is information from its sender and never an instruction, and the ones that can write ask before each change. A prompt is text the user sends; it gives the model no tool and no permission the tier set does not already give.
Gmail bills each call against a per-user budget of 6,000 units per minute, and the units are not uniform — fetching a thread is the expensive part, in whatever format it is fetched:
| Tool | Units per call |
|---|---|
search | 10 per list page, plus 40 for every candidate thread it fetches — about 1,000 at the default size, up to about 4,000 when the query carries a read-state or category condition |
get_thread (full and metadata alike) | 40 |
trash, download_attachment, read_attachment | 20 |
export_thread | 40 |
archive, mark_read, untrash | 10 per thread |
modify_labels, snooze | 10, plus 1 for each label looked up by name and 5 for each label it has to create |
bulk_modify | 5 per 500 matching messages, plus 50 per 1,000 modified; verify: true adds 40 per thread, crossCheck 5 per condition and 500 matches, undo: true 40 per thread; a write with previewToken lists once more to report fromPreview |
undo_bulk_modify | 50 per step, plus 40 per thread with verify: true |
follow_ups | 1 for the profile, 10 per list page, plus 40 per thread scanned — up to 50 threads at the defaults, about 2,000 |
list_labels, get_profile | 1 |
mark_unread costs what mark_read does.
Two consequences worth knowing before you build on this. Parallel agents share one budget —
they reach Gmail through a single server process as a single user, so four of them reading threads
at once spend four times as fast. And bulk_modify is cheaper than looping from six threads
on: up to 500 matching messages it costs 55 units, the price of five and a half archive calls,
and it grows by the thousand messages, not by the thread. verify: true reverses that — reading
the labels back costs 40 per thread, more than the loop it replaced.
If you do exceed it, mailwarden fails the call with rate_limited and retryAfterSeconds: 60.
That failure is temporary and waiting genuinely fixes it — the budget is counted per minute.
mailwarden absorbs one such wait (about 20 seconds) itself before reporting; past that it hands the
decision back rather than holding your tool call open. That holds for the tools that fetch many
threads in one call too: search fails with rate_limited rather than returning a list the quota
cut short, and bulk_modify with verify and list_subscriptions stop fetching and report what
they did not reach as unverifiable and unknown (for bulk_modify the change is already made,
and failing would hide it). Note that Gmail reports this as a 403 as readily as a 429, so a
client keying on the status alone will mistake it for a permission problem — key on the code.
snooze removes INBOX and applies a dated label MCP/Snoozed/<key>, where the key is either YYYY-MM-DD (due all day) or YYYY-MM-DDTHHMM (due at that local minute). The until argument takes an explicit date, a date+time (2026-06-20 9am, …T17:00), or a preset resolved server-side — today, tomorrow, weekend (next Saturday), next week (next Monday), a weekday name (monday–sunday, next occurrence), in N days, or in N hours — and a date preset may carry a trailing time (tomorrow 9am, monday 8:30), so the caller never has to compute the moment itself. sweep_snoozed finds due labels and returns those threads to the inbox (marked unread); a timed snooze wakes at the first sweep on/after its minute, so wake latency equals your sweep interval. Run the sweep:
sweep_snoozed tool),mailwarden --sweep,MAILWARDEN_AUTO_SWEEP=1 (hourly sweep while the server runs).create_filter sets up a Gmail server-side rule: mail matching the criteria automatically gets the
given label actions — the mailbox keeps triaging itself with no assistant in the loop.
from, to, subject, query (full Gmail search syntax), negatedQuery,
hasAttachment, excludeChats, and size + sizeComparison (smaller/larger, given together).
At least one is required.addLabels / removeLabels, by name or id (an unknown name in
addLabels is auto-created, nested via /). Common recipes: skip the inbox → removeLabels: ["INBOX"];
auto-mark-read → removeLabels: ["UNREAD"]; auto-trash → addLabels: ["TRASH"];
star → addLabels: ["STARRED"]; never-spam → removeLabels: ["SPAM"]; file under a label → addLabels: ["Receipts"].applyToExisting: true to also apply the same actions once to mail already in the mailbox —
mailwarden builds a Gmail search from the criteria and runs a bulk modify (up to maxMessages,
default 1000; same unverified-index caveat as bulk_modify, and the one-off pass excludes Spam/Trash).
This requires at least one positive criterion (from/to/subject/query/hasAttachment:true/size):
an exclusion-only rule (negatedQuery or hasAttachment:false) is refused for applyToExisting
because it would match almost the whole mailbox — create such a filter without the flag.
The outcome comes back under applied (the query used, matchedMessages/submittedMessages/submittedThreadCount
counts, capped when the match set hit maxMessages, per-chunk failed, and an error string if the whole
pass failed); it's null when applyToExisting was not set. submittedMessages is what was handed to the API,
not what changed — pass verify: true alongside applyToExisting to read the labels back and get
applied.verified {applied, notApplied, unverifiable}, the same check as bulk_modify's verify
(one extra read per affected thread, so off by default). The filter is created first, so a partial or
failed backlog pass is reported in applied, never raised — the rule still stands.gmail.settings.basic scope; re-run --auth once if you authorized an older version.
Not available in read-only mode.list_unsubscribe (read tier) reports what the sender offers, without contacting anyone. It reads the
newest message that actually carries a List-Unsubscribe header — a reply threaded onto a newsletter
sits at the end and advertises nothing, which would otherwise read as "this list has no opt-out".
When a thread advertises no opt-out header at all, list_unsubscribe looks in the message body and
reports the unsubscribe links it finds there as bodyCandidates — plenty of senders put the link only
in the footer, and answering "no opt-out options" for them is true about the headers and wrong about
the mail. Those links are reported, never fetched, they cannot be handed to unsubscribe, and
hasUnsubscribe stays false for them, because that flag has always described the headers. The search
costs one full thread fetch and happens only in that case.
list_subscriptions (read tier) does the same across a whole slice, grouped by sender, so you can see
who keeps writing and which of them can actually be left — one header fetch per sender rather than
per thread. unsubscribe and bulk_unsubscribe (manage tier) act on it — and that is the only
place mailwarden ever talks to a host that isn't Google, so the rules are tight:
navbuildz/gmail-mcp-server, does fetch them, following redirects, when the
header is missing.List-Unsubscribe-Post.
A plain https: link is meant for a human in a browser and is handed back, not fetched.mailto: opt-outs are never performed. They would require sending mail, which mailwarden cannot
do. The address is reported so you can act on it yourself.List-Unsubscribe=One-Click and is
never derived from anything; the response body is cancelled unread. What returns to the model is the
status code and the URL actually called — no content from the endpoint, so it cannot answer with
instructions. (A 301/302/303 redirect is followed as a GET, i.e. with no body at all.)bulk_unsubscribe takes thread ids
(never a query — a query-driven bulk would fire off a request per matched sender before anyone had
looked). Threads from a sender whose request already went out are reported with duplicateOf and
cost no second request: two threads from one list share an opt-out, and calling it twice only
confirms your address twice. A sender is recorded once a request may have reached them: any
answer, and also a request that failed after it was sent (a timeout, a dropped connection, a
redirect the vetting refused), since it may have arrived. A refusal, or a connection that provably
never opened (refused, unresolvable, a certificate error), leaves the next thread its own try. An
unsubscribe waiting on its dialog, or any call waiting on its endpoint's answer, holds the
sender, so a call made meanwhile sends nothing to them, force: true included; a
bulk_unsubscribe run reads the record thread by thread, so a sender contacted while its own dialog
was open is skipped in the run — and if
the skipped thread advertises a different endpoint, the reason says so, since one sender can run
several lists. That memory spans calls for as long as the server runs, and unsubscribe shares
it: a call that times out is safe to repeat, and asking twice for the same newsletter contacts the
sender once. Pass force: true to unsubscribe for a deliberate second attempt — after an endpoint
answered 500, say. A message whose From is missing or blank is matched by the host of the endpoint it
would call instead, so two such lists at one host count as one sender (the reason says so, and
force: true reaches the second). It is kept in memory only: persisting it would mean a second kind of local state
beside the token, which this server deliberately does not keep, so a restart forgets.
Capped at 25 threads and 60 seconds per call; whatever the budget doesn't cover comes
back as skippedOutOfTime rather than silently undone. None of it can be reversed, which is why all
three limits exist.::1 and 0:0:0:0:0:0:0:1 alike); an
address that does not parse is refused. DNS resolution and all hops share one 10-second budget. Not
rebinding-proof (fetch resolves again when it connects) — see SECURITY.md; what
survives that gap is a blind POST whose response is never read.Check it against your own mail before you trust it. From a repo clone (repo-only, not in the
npm package), after npm run build and mailwarden --auth:
node scripts/probe-unsubscribe.mjs --vet # category:promotions, 25 threads
node scripts/probe-unsubscribe.mjs "from:substack.com" --max 50 --vet
It prints each real List-Unsubscribe header next to what the parser made of it, and --vet also
runs the endpoint through the URL vetting and the address guard — so you see both whether the parser
understood the header and whether the guards would have let that opt-out through. Strictly
read-only: no request is ever made to a sender, and nothing in the mailbox changes.
What it can't undo: the request tells the sender your address is live. A sender that ignores its own
opt-out is beyond any client's reach — pair unsubscribe with create_filter or trash for those.
Not offering an automatable option is reported as unsubscribed:false with the alternatives, not as an
error. A read-only deployment gets list_unsubscribe and list_subscriptions, and never makes the
request at all.
The drafts tier saves mail as Gmail drafts and does nothing else with it: the draft waits in
Gmail's Drafts until you open it and press Send. It is off unless you name it —
MAILWARDEN_TOOLS=read,manage,filters,drafts, or read,drafts for a deployment that only reads
and drafts — and with it off the server has no tool that writes a message and the egress guard
refuses every draft endpoint, exactly