gmail-agent
概览
作者提供的说明(英文原文)
Gmail for AI agents: search, read, download attachments, send, reply, drafts, labels.
PopNx MCP 的三大支柱
这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。
- 用户评价i暂无评价评价功能将在后续阶段与账户功能一起开放
- 我们的基础检查i2 项中通过 2 项依据公开信息检查;尚未扫描代码
- 使用情况i非常新↓ 43/周 · ★ 1
它能帮你做什么
我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。
- 连接方式: 在你的电脑上运行
- 传输方式: stdio
- 分类: 聊天与邮件
安装
选择你使用的 AI 应用,然后复制设置。
安装之前
- 基础检查:2 项中通过 2 项
- 在你的电脑上运行,拥有你的用户账户的权限(文件、网络、应用)。
- 需要你自己填写:
GMAIL_AGENT_CONFIG_DIR,GMAIL_AGENT_ALLOWED_DIRS
你需要
你用的是哪个应用?
在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。
打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json
{
"mcpServers": {
"gmail-agent": {
"command": "uvx",
"args": [
"gmail-agent",
"mcp"
],
"env": {
"GMAIL_AGENT_CONFIG_DIR": "your-value",
"GMAIL_AGENT_ALLOWED_DIRS": "your-value"
}
}
}
}在终端中运行这条命令
claude mcp add gmail-agent --env GMAIL_AGENT_CONFIG_DIR=your-value --env GMAIL_AGENT_ALLOWED_DIRS=your-value -- uvx gmail-agent mcp运行前请先填写空着的值。
或者自己复制设置
粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json
{
"mcpServers": {
"gmail-agent": {
"command": "uvx",
"args": [
"gmail-agent",
"mcp"
],
"env": {
"GMAIL_AGENT_CONFIG_DIR": "your-value",
"GMAIL_AGENT_ALLOWED_DIRS": "your-value"
}
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
或者自己复制设置
粘贴到项目中的 .vscode/mcp.json
{
"servers": {
"gmail-agent": {
"type": "stdio",
"command": "uvx",
"args": [
"gmail-agent",
"mcp"
],
"env": {
"GMAIL_AGENT_CONFIG_DIR": "your-value",
"GMAIL_AGENT_ALLOWED_DIRS": "your-value"
}
}
}
}浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。
这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。
你的选择通过 Cookie 保存在这台设备上,无需账户。
需要你填写的值
GMAIL_AGENT_CONFIG_DIRenvConfig dir with credentials.json and token (default ~/.config/gmail-agent)GMAIL_AGENT_ALLOWED_DIRSenvExtra folders, besides ~/Downloads, the tools may save attachments to and attach files from (separated by :)
这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。
哪些应用可以使用它
依据这个服务器的连接方式和各应用自己的文档,检查于 2026年11月10日。
在你的电脑上运行,适用于
ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast
它能做什么
它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。
基础检查i
我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月11日
- ✓ 通过
作者与仓库一致
注册名称已通过 GitHub 账户 dremok 验证,该账户拥有此仓库
- ✓ 通过
仍在维护
代码最后更新于30天前
- … 尚未检查
有许可证
我们还没有从 GitHub 读取这个仓库
- – 不适用
端点有响应
它在你的电脑上运行,没有互联网端点
- – 不适用
使用 OAuth 登录
在你的电脑上运行,改用本地设置
- … 尚未检查
工具描述中没有隐藏指令
它在你的电脑上运行;我们只能读取互联网端点的工具列表
与“聊天与邮件”中的其他服务器比较i
- 星标数多于此分类中其他 1933 个服务器的 77%
- 发布到注册中心的时间比此分类中其他 1933 个服务器的 47% 更新
- 基础检查结果等于或优于此分类中其他 1933 个服务器的 100%
与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。
常见问题
gmail-agent 安全吗?
它在 2 项适用的基础检查中通过了 2 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。
它需要哪些密钥或代码?
注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。
它在我的电脑上运行还是在云端?
它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。
它还在维护吗?
GitHub 仓库最后更新于30天前,最新版本(0.3.1)于30天前进入注册中心。
哪些应用可以使用它?
支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Python (uv)。
有什么可以替代它?
同一分类中有:Inbox Zero, Agent-Native Mail, Agent-Native Dispatch
替代选择
同一分类中其他作者的服务器,按星标数排序。
如何看卡片:↓ 每周下载量i★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i
Agent-Native Mail
Agent-Native Superhuman - email client with keyboard shortcuts and AI triage
Agent-Native Dispatch
Central Slack/Telegram router with jobs, memory, approvals, and A2A delegation
作者的 README
打开 README
按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。
gmail-agent
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.
| gmail-agent | Claude's Gmail connector | google_workspace_mcp | GongRzhe Gmail-MCP-Server | |
|---|---|---|---|---|
| Setup | Your own OAuth client; gmail-agent setup guides you (about 5 minutes) | One click | Your own OAuth client, by hand | Your own OAuth client, by hand |
| Runs as | CLI and stdio MCP, on your machine | Hosted (web, desktop, mobile) | stdio or HTTP, multi-user | stdio MCP |
| Save attachments to disk | Yes, never overwrites | No | Yes, to its own folder, deleted after an hour | Yes, overwrites files with the same name |
| Every attachment matching a search | Yes | No | No | No |
| Text of PDF attachments | Yes | No | No | No |
| Forward with original attachments | Yes | Not documented | Yes | No forward |
| Drafts | Create, update, send, delete | Yes | Create only | Create only |
| Dry run of every write, with the MIME message | Yes | No, asks before each write instead | No | No |
| Read-only mode | Yes | No, the grant includes sending | Yes | No |
| Tool list follows the granted scope | Yes | No | From server flags | No |
| Permanent delete | Only with --allow-delete and a full login | Not offered | Not offered | Offered without a guard |
| Drive, Calendar, Docs | No, Gmail only | Separate connectors | Yes | No |
| Maintained | Yes | Yes | Yes | Archived in 2025 |
Use something else if:
- You want no setup, or use Claude on the web or your phone. The built-in connector is one click away.
- You need Drive, Calendar and Docs in the same server, or one server for a team over HTTP. google_workspace_mcp covers all of Workspace.
- You need Gmail filters, sending from an alias, your Gmail signature or inline images in outgoing mail. gmail-agent does none of these yet.
- You want a plain CLI for all of Google Workspace. googleworkspace/cli (
gws) is a good one. It dropped its MCP server in version 0.8.0.
Coming from GongRzhe/Gmail-MCP-Server?
That server is archived. Moving takes a few minutes, and you can keep your Google Cloud project.
- Install:
uv tool install gmail-agent - Reuse your OAuth client, not your token. Setup checks the client, installs it and logs you in:
gmail-agent setup --client-file ~/.gmail-mcp/gcp-oauth.keys.json
Do not copy GongRzhe's credentials.json by hand. Despite the name it is your login token, while gmail-agent's credentials.json is the OAuth client, and the token formats differ anyway. gmail-agent needs a Desktop app client. If yours is a Web application client, setup says so; create a Desktop client in the same project and pass that file instead.
- Point your MCP client at gmail-agent. Replace
npx @gongrzhe/server-gmail-autoauth-mcpwithgmail-agent mcp, for exampleclaude mcp add gmail --scope user -- gmail-agent mcp. For Claude Desktop, see MCP server. - Optional cleanup: revoke the old grant at myaccount.google.com/permissions and remove
~/.gmail-mcp.
| GongRzhe tool | gmail-agent tool | Notes |
|---|---|---|
search_emails | search_messages | Adds paging with page_token |
read_email | get_message, get_thread | HTML mail comes back as text |
send_email | send_message, reply_to_message | Replies set the threading headers for you |
draft_email | create_draft, or any send tool with as_draft | Drafts can also be updated and sent |
modify_email, batch_modify_emails | modify_labels, mark_messages | Labels by name or id |
delete_email, batch_delete_emails | trash | Permanent delete needs mcp --allow-delete and a full login |
list_email_labels | list_labels | |
create_label, update_label, delete_label | create_label, rename_label, delete_label | No visibility options |
get_or_create_label | list_labels, then create_label | |
download_attachment | download_attachments | Picks by filename or part id, never overwrites |
download_matching_attachments, read_attachment_text, forward_message | New | |
create_filter and the other filter tools | None | gmail-agent never touches settings, filters or forwarding |
Two behaviours differ on purpose: delete means trash unless you opt in, and the tool list shrinks to what your login allows. If tools seem to be missing, check the level with gmail-agent status.
Google Cloud setup
Gmail has no API keys for personal mail, so you create your own OAuth client in Google Cloud. It is free and you do it once. gmail-agent setup walks you through it and does what Google lets it do for you:
- Project and Gmail API. If gcloud is installed and logged in, setup creates a project called
gmail-agent-plus six random characters (it asks first) and enables the Gmail API. Without gcloud it opens the two console pages and asks for the project ID.--project IDuses a project you already have. - Consent screen and publishing. Google has no API for these, so setup opens the pages and tells you what to click: app name
gmail-agent, audience External, then Publish app so the status is In production. Publishing avoids the 7-day login expiry of Testing mode, and you do not have to add yourself as a test user. Google calls the app unverified, which is expected for your own app and fine for personal use (it is capped at 100 users). - Desktop client. Setup opens the Clients page. Create a client of type Desktop app and click Download JSON (Google shows the secret only then). Setup spots the file in
~/Downloads, checks that it is a Desktop client from the right project, and installs it as~/.config/gmail-agent/credentials.json, readable only by you. You can also pass--client-file PATH, or press Ctrl-C and paste the client ID and secret. - Login. A browser opens; pick your account. Google says "Google hasn't verified this app": click Continue and keep all boxes ticked. Setup checks the account and prints
Set up: logged in as you@example.com with modify access.
Run it again whenever you like; it skips what is already done. Options: --scope LEVEL (see Access levels), --no-gcloud, and --no-browser, which prints the links instead of opening them (the login redirect goes to localhost, so the browser must run on the same machine).
Setting up by hand
The same steps without the wizard:
- Create a project at console.cloud.google.com/projectcreate and make sure it is selected in the top bar.
- Enable the Gmail API on the Gmail API page.
- Configure the consent screen in Google Auth Platform: Get started, app name
gmail-agent, your address as support and contact email, audience External, agree, Create. - Publish the app under Audience (Publish app, status In production). If you would rather stay in Testing mode, add your address under Test users instead, and expect to log in again every 7 days.
- Create a Desktop client under Clients: Create client, application type Desktop app, Create, and download the JSON from the dialog. If you miss the download, create a new client.
- Install it, either with
gmail-agent setup --client-file ~/Downloads/client_secret_*.json, which also logs in, or by hand:
mkdir -p ~/.config/gmail-agent
mv ~/Downloads/client_secret_*.json ~/.config/gmail-agent/credentials.json chmod 600 ~/.config/gmail-agent/credentials.json gmail-agent login # or: gmail-agent login --scope readonly
If something is missing later, the error names the fix: a deleted or expired client points back to gmail-agent setup, a