Gmail Attachments MCP logo

Gmail Attachments MCP

Downloads Gmail attachments locally through three read-only MCP tools or equivalent CLI commands.

Install Gmail Attachments MCP

Pick your client, then add it in one click or paste the config.

STDIOPython
~/Library/Application Support/Claude/claude_desktop_config.json
claude_desktop_config.json
{
  "mcpServers": {
    "gmail-attachments-mcp": {
      "command": "uvx",
      "args": [
        "gmail-attachments-mcp"
      ],
      "env": {
        "GMAIL_MCP_CREDENTIALS": "YOUR_VALUE_HERE",
        "GMAIL_MCP_TOKEN": "YOUR_VALUE_HERE",
        "GMAIL_MCP_DEFAULT_DEST_DIR": "YOUR_VALUE_HERE",
        "GMAIL_MCP_SCOPES": "YOUR_VALUE_HERE",
        "XDG_CONFIG_HOME": "YOUR_VALUE_HERE"
      }
    }
  }
}

Settings → Developer → Edit Config, merge this into mcpServers, then fully quit and reopen Claude Desktop.

Values are written into the snippet above so you can paste it as is. They never leave your browser.

We couldn’t confirm it starts correctly

The install command installed and started the server, which then stopped for configuration (such as an API key) that our sandbox does not have — expected for servers that connect to your account.

uvx gmail-attachments-mcp

No response to initialize.

This is an experimental automated check and can have false negatives — missing environment variables, a slow cold install, etc. It doesn’t necessarily mean something’s wrong. Last checked .

Overview

gmail-attachments-mcp MCP server searches Gmail and downloads attachment bytes to a local directory through a small, read-only toolset. It authenticates with a Google OAuth client created by the user, stores a refresh token locally, and communicates with MCP clients over stdio. Use it when an agent needs actual attachment files rather than Gmail attachment IDs and metadata, or when scheduled shell and cron downloads are needed.

Use cases

  • Search Gmail for recent invoices and download their attachments
  • Collect resume files from the latest matching email
  • Save every attachment from a known Gmail thread
  • Schedule recurring attachment downloads with cron

Key features

  • Search Gmail threads with standard query syntax
  • Download all attachments from a thread
  • Download attachments from the latest matching thread
  • Filter downloads by file extension
  • Use read-only Gmail OAuth by default
  • Run through MCP or the standalone CLI

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked

Recent health check succeeded.

16/16 checks healthy over the last 76d

Supply-chain signal

No high-severity advisories surfaced by our automated scan.

Critical 0High 0Medium 0Low 0

Scanned 12d ago via OSV.dev · gmail-attachments-mcp (PyPI)

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars4Stargazers on the source repository.
Last commit5mo agoMost recent push to the default branch.
Install checkRunsOur sandbox started it; it then asked for an API key or config.

How Gmail Attachments MCP works

What gmail-attachments-mcp MCP server does

gmail-attachments-mcp MCP server connects an MCP client to a user-owned Gmail account and writes matching attachments to disk. Its API is intentionally limited to three operations: searching messages, downloading all attachments from a known thread, and downloading attachments from the newest search result.

The server requests the gmail.readonly scope by default. It can read Gmail data needed for search and downloads, but its default authorization cannot send messages, delete mail, or modify mailbox content. This makes it suitable for workflows such as collecting invoices, resumes, reports, or other files already received in Gmail.

A standalone command-line interface exposes the same functionality. The CLI can be used directly from a shell or scheduled with cron, so an MCP client is not required for automated downloads.

How it works

After installation, the operator creates a Google Cloud project, enables the Gmail API, configures an OAuth consent screen, and creates a Desktop OAuth client. The setup command opens a browser for consent and saves a refresh token locally. Later invocations use that cached token, allowing headless commands and scheduled jobs after the initial authorization.

The gmail_search tool accepts Gmail's standard query syntax and returns thread summaries, including subjects, senders, dates, snippets, message counts, attachment counts, and attachment filenames. gmail_download_thread_attachments takes a thread ID and saves every attachment in that thread. gmail_download_latest_matching combines a search with a download for the single most recent match. Download operations can receive a destination directory and file-extension filters.

The server runs on the local machine. The OAuth client and token belong to the operator, and the documented design does not use a central service or telemetry.

Setup and configuration

Install the package with pip install gmail-attachments-mcp or uv tool install gmail-attachments-mcp. Import the downloaded Google OAuth client JSON with gmail-attachments-mcp setup --import-credentials <file>, then verify authorization with gmail-attachments-mcp status or a test search.

Configuration is environment-driven. GMAIL_MCP_CREDENTIALS selects the OAuth client secret file, GMAIL_MCP_TOKEN selects the cached token, and GMAIL_MCP_DEFAULT_DEST_DIR changes the default download directory from ~/Downloads. GMAIL_MCP_SCOPES can replace the default scope with a comma-separated value, while XDG_CONFIG_HOME changes the base configuration directory. Changing scopes requires reauthorization.

The default token location is ~/.config/gmail-attachments-mcp/token.json, or the corresponding directory under XDG_CONFIG_HOME. The token is stored with mode 0600; anyone with shell access to the account may be able to read Gmail through it. Keep both the token and OAuth configuration files out of source control.

Tools and capabilities

The gmail-attachments-mcp MCP server provides:

  • gmail_search(query, max_results=10): finds matching Gmail threads and reports attachment metadata.
  • gmail_download_thread_attachments(thread_id, dest_dir?, extensions?): downloads every attachment in a selected thread and reports each file's path, byte size, MIME type, and original filename.
  • gmail_download_latest_matching(query, dest_dir?, extensions?): searches Gmail and downloads attachments from the newest matching thread.

The same actions are available as CLI commands: search, thread, and latest. This supports interactive use, shell scripts, and cron jobs. MCP configuration points clients at the gmail-attachments-mcp serve command over stdio.

Limitations and notes

The toolset covers attachment retrieval rather than general mailbox management. It does not provide operations for sending mail, deleting messages, editing labels, or managing drafts. The default authorization is read-only, although changing GMAIL_MCP_SCOPES changes the security implications and requires the operator to manage those consequences.

Initial OAuth setup needs a browser. If a headless client reports that no valid token exists, authorize once from a terminal with browser access. Personal Gmail accounts must add the account as an OAuth test user; Google Workspace users can use an Internal consent-screen audience. Revoked or expired authorization can be renewed with gmail-attachments-mcp setup --reauth.

The project requires the user's own Google Cloud OAuth client rather than a shared API key or bundled secret. It is therefore a fit for developers who can complete Google Cloud configuration and want local control of Gmail credentials and downloaded files.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Gmail Attachments MCP

gmail-attachments-mcp is an MCP server that connects MCP clients to a user-authorized Gmail account and downloads attachment files locally. Its main tools are `gmail_search`, `gmail_download_thread_attachments`, and `gmail_download_latest_matching`. It uses read-only OAuth by default and also provides equivalent command-line operations for scripts and cron jobs.

Install it with `pip install gmail-attachments-mcp` or `uv tool install gmail-attachments-mcp`. Create a Google Cloud OAuth Desktop client, enable the Gmail API, then run `gmail-attachments-mcp setup --import-credentials <file>` to authorize and cache a token.

Add a server entry whose command is `gmail-attachments-mcp` and whose arguments are `["serve"]` to Claude Desktop's `claude_desktop_config.json`, then restart Claude Desktop. Complete the one-time Google OAuth setup before invoking the server.

Yes, download tools and the `latest` CLI command accept file-extension filters. For example, pass `.pdf` or use `--ext .pdf,.docx` with the CLI to restrict the downloaded attachment types.

Yes, it uses the `gmail.readonly` OAuth scope by default and cannot send, delete, or modify mail under that authorization. The scope can be changed with `GMAIL_MCP_SCOPES`, but doing so requires reauthorization and changes the security implications.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewGmail Attachments MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/gmail-attachments-mcp?style=directory)](https://allmcps.com/mcp/gmail-attachments-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/gmail-attachments-mcp"><img src="https://allmcps.com/api/badge/gmail-attachments-mcp?style=directory" alt="Gmail Attachments MCP on AllMCPs" /></a>