mailwarden is a native Gmail MCP server designed to provide AI assistants with reliable, complete email classification and management capabilities. It communicates directly with the live Gmail API, does not rely on cached snapshots, and performs real-time label re-verification of search results to address the issue where the Gmail thread index may return stale read status.
Purpose
mailwarden is used to let AI assistants safely operate a Gmail mailbox, including searching, reading, labeling, archiving, moving to trash, downloading attachments, and "snoozing" email threads so they reappear in the inbox after a specified date. It is positioned as a general-purpose Gmail capability layer, allowing users to keep their own rules and logic in the AI client rather than in the server.
Main capabilities
- Mailbox-side snooze: Archive a thread and have it return to the inbox after a specified date. Implemented based on dated labels and scanning, it can be used in any client, is visible in Gmail, and remains effective after restarts.
- Trustworthy search: Gmail's threads.list may return incorrect results due to stale thread-level read status. mailwarden re-verifies each hit against its real-time labels and discards false positives from the index. Supports pageToken / nextPageToken pagination.
- Sender authentication: get_thread reports the SPF/DKIM/DMARC results recorded by the receiving server, reading only the reports that Gmail itself writes under mx.google.com, and explains whether the passing DKIM signature belongs to the From domain, marking it as unchecked when not checked.
- Bulk operations: bulk_modify archives or labels at a scale of 1000 emails per API request, supporting partial success reporting by chunk. The snooze scan uses the same bulk path.
- Structured output: Each tool declares an outputSchema and returns validated structuredContent as well as fenced JSON text. Failures are also structured, including error codes and retryable flags.
- Security design: No send tool, optional read-only mode, no telemetry, no ports open by default, download paths protected against symlinks, output protected against injection. All Gmail requests pass through an egress checkpoint, rejecting messages.send and all draft endpoints, permanent deletion, and forwarding settings. The only exception is unsubscribe / bulk_unsubscribe (manage tier), which contacts the unsubscribe endpoint specified in the email's own headers.
- Real email compatibility: Decodes RFC 2047 headers, decodes the body according to the declared character set, and retries with exponential backoff on 429/5xx.
- what_changed: A read-tier tool that answers "what has changed since I last looked" based on Gmail's own event log. You only need to pass the historyId returned by a previous call or get_profile, and it returns arrivals, departures, label additions/removals, and the next id. It does not store a mailbox mirror or index.
How to use
mailwarden runs as an MCP server and must be configured in an AI client. It provides different tiers (such as read, manage); the read tier uses the gmail.readonly scope, and the manage tier uses the gmail.modify scope. The OAuth flow can be switched to read-only scope via --read-only. The repository includes demo scripts (node scripts/probe-reverify.mjs, etc.) that can be run after cloning the repository to verify search recheck behavior without a Gmail account.
Use cases
- Letting an AI assistant perform daily triage, archiving, labeling, and snooze management on a Gmail mailbox.
- Scenarios that require sender authentication information to judge email authenticity.
- Scenarios that require batch processing of large numbers of emails but require partial success reporting.
- Using it together with a Workspace suite server (such as taylorwilsdon/google_workspace_mcp), delegating the email portion to mailwarden so that the suite server does not hold credentials capable of sending email.
Limitations
- It does not provide tools for sending, replying, forwarding, drafts, or permanent deletion.
- Batch tools (bulk_modify, create_filter's applyToExisting scan) act on the results returned by the index and do not perform per-item real-time rechecking; they report an unverifiedPredicates field indicating which conditions are based on the index. The crossCheck option can perform a second check, but consistency does not constitute evidence.
- Filter scans do not report unverifiedPredicates field; use verify: true to learn about actual changes.
- Specific information about fees, pricing, platform support, etc. is not provided in the materials.