# gmail-tidy-mcp [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/imkath/gmail-tidy-mcp  
**GitHub Stars:** 2  
**npm Downloads (last month):** 639  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/gmail-tidy-mcp

## Description
Organize several Gmail accounts: labels, filters, archiving, drafts. Never sends or deletes mail.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "gmail-tidy-mcp": {
    "command": "npx",
    "args": ["-y","gmail-tidy-mcp"]
  }
}
```

## Documentation

## What gmail-tidy-mcp does

gmail-tidy-mcp gives an AI assistant a constrained set of Gmail tools for several connected accounts. It can search one account or all accounts, read messages and threads, inspect attachments, analyze sender and newsletter activity, and manage labels. Organization actions include applying or removing labels, archiving by removing the `INBOX` label, and marking messages as read by removing `UNREAD`.

The server also manages Gmail filters and drafts. Drafts can be created as replies, updated without replacing unspecified fields, and given local file attachments. A signature can be changed, and `recent_changes` provides a record of modifications made during sessions. It cannot send, reply to, forward, delete, or move mail to Trash or Spam.

## How it works

Accounts are connected through Google OAuth using PKCE and a random state value, with the local redirect bound to `127.0.0.1`. After authentication, the account address and granted scopes are checked before credentials are saved. Each account receives a short label for use in requests such as organizing mail in a particular account.

Gmail content is treated as untrusted input. Returned messages and attachments are placed in fenced blocks with per-call markers, while HTML, control characters, zero-width characters, Unicode tag characters, and text-direction controls are filtered. The server adds heuristic notices for issues such as suspected prompt injection, authentication failures, misleading links, lookalike senders, and suspicious reply addresses.

Large searches and sender or newsletter scans fetch data in small batches and back off when Gmail applies quota pressure. Changes and saved files are logged locally without message bodies, draft text, or signature contents.

## Setup and configuration

Node.js 22 or newer is required. Setup uses a Google OAuth client created by the operator rather than a shared client or third-party service. The server requests `gmail.modify` for Gmail changes and `gmail.settings.basic` for filter operations; Google does not provide a draft-only scope that excludes sending.

OAuth tokens are encrypted in `~/.config/gmail-tidy-mcp/tokens.enc` with file mode 600. The encryption key is kept in the macOS Keychain, Linux Secret Service, or a DPAPI-protected Windows file. Operators can instead provide a 64-character hexadecimal key through `GMAIL_TIDY_KEY`.

Draft attachments must be located under Downloads, Desktop, or Documents, or under directories listed in `GMAIL_TIDY_ATTACH_DIRS`. The server blocks hidden locations and its own configuration directory. Saved attachments go to `~/Downloads/gmail-tidy-mcp` and cannot overwrite existing files.

## Tools and capabilities

- Connect and inspect accounts with `list_accounts`, `check_accounts`, `connect_account`, and `finish_connect_account`.
- Search Gmail syntax in one account or across all accounts with `search_emails` and `search_all_accounts`.
- Read messages, threads, and attachments with `get_email`, `get_thread`, and `get_attachment`.
- Review sender volume and newsletters with `sender_stats` and `newsletters`.
- Create, rename, recolor, show, hide, and list nested labels.
- Organize up to 5,000 messages per operation by adding or removing labels, archiving, or marking them read.
- Create, list, and delete filters; skipping the inbox requires explicit `skip_inbox: true`.
- Create, list, and update drafts, including replies and permitted local attachments.
- Review changes through `recent_changes` and change only the Gmail signature with `set_signature`.

## Limitations and notes

The no-send and no-delete boundary is enforced by the server’s fixed tool set and tested in the project. It is not a restriction on the OAuth token itself: a stolen token together with its encryption key could have the permissions granted by `gmail.modify`.

Security findings are heuristics and cannot identify every malicious message. A model could still archive or relabel mail, create an inbox-skipping filter, remove a filter, alter a draft or signature, or save a flagged attachment when `allow_risky: true` is supplied. Filter deletion cannot be recovered through the server. Drafts are never sent automatically.

Potentially dangerous executables, scripts, mismatched file types, unsafe archives, macro-enabled Office files, and PDFs with JavaScript or automatic actions are refused or flagged. Draft header fields reject line breaks to prevent hidden header injection. On macOS, saved files receive the quarantine flag.

_Full upstream README: https://allmcps.com/mcp/gmail-tidy-mcp/readme_

