Gmail Agent
Gmail for AI agents: search, read, download attachments, send, reply, drafts, labels.
- Transport
- Not stated
- Package
- —
- Registry id
- io.github.dremok/gmail-agent
No install snippet on purpose. A working MCP config is a command, its arguments and an environment block — the last two are where API keys live, so this catalogue never stores them and cannot publish them. Follow the link above for the authors' own instructions.
Gmail for AI agents and the people who run them: search, read, download attachments, send, reply, forward, drafts, labels and trash.
gmail-agent is one small Python package with two faces:
- a CLI for agents that have a shell (Claude Code, Codex, Aider, your own scripts), with
--jsonoutput - an MCP server over stdio for clients like Claude Desktop and Claude Code
It talks directly to the Gmail API from your machine using your own Google Cloud OAuth client, so there is no third-party server in between. You choose how much access it gets when you log in, from read-only up to full.
Why another one? A lot of real agent work with mail is about attachments: find last quarter's invoices, save them, read the PDFs. The hosted Gmail connectors can't save files to disk, and the most used open-source Gmail MCP server is archived. gmail-agent handles attachments well, shows you any write before it happens, and only offers the tools your login allows. See How it compares.
What it does
Read
- Search with Gmail syntax (
from:,has:attachment,filename:pdf,newer_than:30d, ...), paginated - Read a message or a whole thread as plain text (HTML mail is converted)
- List labels and drafts
Attachments
- List a message's attachments with name, type, size and part id
- Download from one message, or every attachment from every message matching a query
- Extract text from PDF and text attachments without saving them
Downloads never overwrite anything. If invoice.pdf exists, the next one becomes invoice_1.pdf, and you get the real paths back. Names are sanitized, so a file called ../../.ssh/config lands as config inside the folder you picked.
Write
- Send new mail with attachments, Cc/Bcc, plain text or HTML
- Reply and reply-all in the same thread (In-Reply-To, References and thread id are set, the original is quoted)
- Forward, including the original attachments
- Drafts: create, list, show, update, send, delete
- Labels: create, rename, delete, add to and remove from messages or threads
- Mark read or unread, star, archive
- Trash and untrash; permanent delete behind an explicit flag
Every write command takes --dry-run, which prints the exact API request and, for mail, the MIME message without changing anything. With --json, results include the ids of whatever was sent or created.
Quick start
You need uv (or pipx) and Python 3.11+.
uv tool install gmail-agent # or: pipx install gmail-agent
For the latest unreleased changes: uv tool install git+https://github.com/dremok/gmail-agent.
Then set it up once (about 5 minutes, guided):
gmail-agent setup # Google Cloud project, OAuth client and login; default access level is "modify"
gmail-agent status # shows the logged-in account and access level
gmail-agent search "has:attachment newer_than:7d"
Then connect your agent. In Claude Code: /plugin install gmail-agent --marketplace dremok/gmail-agent. For Codex, Gemini CLI, VS Code, Cursor and Claude Desktop, see MCP server.
How it compares
Checked against each project's source and docs in October 2026. Corrections are welcome as issues.
From the project's README.