@agentcomms/gmail-mcp

中文文档
0.37.0发布于 2026/10/29MITES Module构建来源已验证近 30 天下载 4782

The Gmail MCP server for coding agents: search, read, analyse and draft across inboxes, with sending gated by approval.

原始使用文档
文档目录6 节
  1. Set up mailboxes first
  2. Connecting a mailbox from the agent instead
  3. How a change is approved
  4. Options
  5. Sending
  6. Licence

@agentcomms/gmail-mcp

The Gmail MCP server for coding agents, as its own command — so a client configuration can pin it:

{
  "mcpServers": {
    "gmail": { "command": "npx", "args": ["-y", "@agentcomms/[email protected]"] }
  }
}

It is one call into @agentcomms/gmail, which is where the server and the agent-gmail command live. Part of agent-communications.

Set up mailboxes first

This package serves mailboxes; connecting them is @agentcomms/gmail, and one command does all of it — the Google Cloud steps, the client, the first mailbox, and registering this server with your agent:

npx @agentcomms/gmail setup

To register it separately, or to move an existing registration to a new version:

npx @agentcomms/gmail mcp install --client claude-code --launcher npx

It shows what it will register and asks you to type yes; run by an agent, it exits 10 with the preview and an approval id, and registers when run again with --approval <id> once you have agreed.

Connecting a mailbox from the agent instead

An agent asked to "set up Gmail" need not send you to a terminal: gmail_setup says what is missing and, when given profile, adds that organisation profile through its own orgApproval; otherwise it changes nothing. gmail_client_add registers the OAuth client from the path of the JSON you downloaded, gmail_inbox_add returns a sign-in link and stops, and gmail_inbox_finish completes it once Google returns the grant. The grant is still yours to approve in your own browser — this server does not open one and cannot grant it. The client JSON is read from its path on your machine, never pasted into the conversation, and no tool returns its secret.

Everything else agent-gmail does to an account is a tool too, each the same operation as its command:

ToolCommand
gmail_inbox_show, gmail_inboxes_listinbox show, inbox list
gmail_inbox_renameinbox rename
gmail_inbox_policy — the send policy and the change policyinbox policy --send --change
gmail_inbox_reauth, then gmail_inbox_finishinbox reauth --start, then --finish
gmail_inbox_importinbox import
gmail_inbox_removeinbox remove
gmail_clients_list, gmail_client_add, gmail_client_removeclient list|add|remove
gmail_confirm_clients, gmail_confirm_client_add, gmail_confirm_client_removeconfirm-clients list|add|remove

To move an existing mailbox onto an organisation profile's active client, read the generation name from comms_org_show, then call gmail_inbox_reauth with that client (the terminal form is agent-gmail inbox reauth <name> --client <organisation>-1 --start) and finish it normally.

How a change is approved

A change that loosens a safety setting or cannot be taken back — a looser policy, a wider grant, an OAuth client added or removed, a mailbox imported or removed, a client trusted to show approval forms — does not happen on the first call. The tool returns approvalRequired, a preview of exactly what would change and an approvalId; the agent shows you the preview and asks. Under the chat change policy (the default) your yes is the approval, and the agent calls again with the id. Under confirm you run the approve command the result gives, exactly as given, in your own terminal and type the code it shows first; the agent learns that you have with gmail_send_wait, and calls again. An approval is for the change it previewed, once: it waits ten minutes for a yes in the chat, thirty for your terminal, and holds 24 hours once you approved it there. If anything is different by the time it is claimed, it is refused and the change is prepared again; if you say no, the agent revokes it. Tightening needs nobody. The same approval can be claimed from the command line with --approval <id>, and the other way round.

The writers are withheld from a server started --read-only. One pinned to a single mailbox with --inbox offers, of the tools above, the ones that read, gmail_inbox_policy for its own mailbox, and gmail_confirm_client_remove, since trusting fewer clients needs nobody; it does not rename, re-authorise, import, remove, add or remove an OAuth client, or add a trusted client.

Options

OptionEffect
--inbox <alias>serve only that mailbox; the inbox argument becomes optional
--read-onlyregister only the tools that cannot change anything

Sending

No tool here sends mail on its own. A send is prepared, shown to the user in full, and transmitted only after they approve that exact content — the same message, the same recipients, within a short window, once. Every Gmail permission that allows drafting also allows sending, so that rule lives in code rather than in the grant.

Licence

MIT

版本与发布记录

@agentcomms/gmail-mcp 共发布 59 个版本,首次发布于 2026/09/20;过去 12 个月发布了 59 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.37.0latest2026/10/299 天前
0.36.02026/10/2810 天前
0.35.02026/10/2811 天前
0.34.02026/10/2711 天前
0.33.02026/10/2712 天前
0.32.02026/10/2612 天前

关于 @agentcomms/gmail-mcp 的常见问题

@agentcomms/gmail-mcp 是什么?

The Gmail MCP server for coding agents: search, read, analyse and draft across inboxes, with sending gated by approval.

如何安装 @agentcomms/gmail-mcp?

在项目目录运行 npm install @agentcomms/gmail-mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 agent-gmail-mcp,可以用 npx agent-gmail-mcp 直接运行。

@agentcomms/gmail-mcp 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/agentcomms__gmail-mcp 是否存在。

@agentcomms/gmail-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@agentcomms/gmail-mcp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.12.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@agentcomms/gmail-mcp 可以商用吗?

@agentcomms/gmail-mcp 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@agentcomms/gmail-mcp 的下载量有多少?

根据 npm 官方下载统计,@agentcomms/gmail-mcp 在 2026/10/05 – 2026/11/03 这 30 天内被下载 4,782 次,日均约 159 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@agentcomms/gmail-mcp 还在维护吗?

最新版本 0.37.0 发布于 2026/10/29(9 天前);至今共发布 59 个版本,其中过去 12 个月发布了 59 个;首次发布于 2026/09/20。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。