gmail-read-mcp
gmail-read-mcp
只读的 Gmail MCP 服务器,限定于单个邮箱。通过 stdio 暴露两个工具:
list_emails - 列出在日期范围内收到的电子邮件:元数据 + 摘要,按从旧到新排序(最多 500 封)
read_email - 按 ID 读取一封电子邮件的完整标头和正文文本
没有写入、发送、标记或删除功能。每个结果都包含一个 jump_url 深层链接(rfc822msgid: 搜索),任何登录该邮箱的人都可以打开该电子邮件。默认排除从邮箱本身发送的邮件(团队的回复);垃圾邮件和已删除邮件始终被排除。
Google OAuth 设置
创建一个 Google Cloud 项目(与任何生产项目分开——同意屏幕是按项目划分的)并启用 Gmail API。
将 OAuth 同意屏幕设置为 内部(跳过对
gmail.readonly范围的受限范围验证)。创建类型为 桌面应用 的 OAuth 客户端并下载客户端 JSON。
以目标邮箱身份运行一次性同意流程:
node scripts/gmail-oauth-once.mjs <path-to-client-secret.json>它会打印刷新令牌以及它绑定到的邮箱。
刷新令牌没有过期时间,但当账户密码更改时,Google 会撤销 Gmail 范围的令牌。如果服务器开始出现 invalid_grant 错误,请重新运行步骤 4 并替换 GMAIL_REFRESH_TOKEN。
Related MCP server: Gmail MCP Server
本地设置
cp .env.example .env
# Fill in GMAIL_CLIENT_ID, GMAIL_CLIENT_SECRET, GMAIL_REFRESH_TOKEN
npm install
npm start测试
npm testAvailable Tools
2 toolslist_emailsList emailsA
List emails received in a date range: metadata + snippet, oldest-first, capped at 500 with no truncation flag. Spam and trash are excluded. Mail sent from the mailbox itself (i.e. the team's replies) is excluded unless include_sent is true. Each result has a jump_url deep link that opens the email for anyone signed into the mailbox. Use read_email for the full body.
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Optional Gmail search query to filter by, e.g. 'subject:refund' | |
| end_time | Yes | Inclusive end of the range (ISO 8601, e.g. 2026-08-26T00:00:00Z) | |
| start_time | Yes | Inclusive start of the range (ISO 8601, e.g. 2026-08-25T00:00:00Z) | |
| include_sent | No | Include mail sent from the mailbox itself (default false) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden — and it delivers. It discloses the 500-cap with no truncation flag, ordering (oldest-first), exclusions (spam/trash/sent), the include_sent behavior, and the jump_url deep-link per result. Exceptionally rich behavioral disclosure for an un-annotated tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Five dense sentences, each earning its place: return format/ordering/cap, exclusions, sent behavior, jump_url, and sibling routing. Core function is front-loaded and there is zero fluff or repetition of schema text.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 4-param list tool with no output schema and no annotations, everything an agent needs is covered: return shape (metadata + snippet + jump_url), ordering, cap and absence of pagination, filters, and auth context ('anyone signed into the mailbox'). No material gap remains.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds genuine meaning beyond the schema for include_sent — explaining that team replies are excluded by default and why the flag exists. The start_time/end_time and query semantics rest on the schema, but the include_sent elaboration justifies a modest bump.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('List emails received in a date range') with concrete behavioral detail — metadata + snippet, oldest-first, capped at 500 with no truncation flag. This precise scope distinguishes it from read_email without ambiguity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly routes to the sibling: 'Use read_email for the full body.' It also tells the agent when this tool will NOT capture emails (spam/trash excluded, sent excluded unless include_sent is true), so an agent can predict results before calling.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_emailRead an emailA
Read one email by id (from list_emails): full headers and body text (HTML converted to text, capped at 50k chars).
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The Gmail message id to read |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the burden of behavioral disclosure. It reveals two key behaviors: body text is HTML converted to text, and the output is capped at 50k characters. This is useful context that goes beyond a simple 'read email' and does not contradict any annotations (since there are none).
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, well-structured sentence that front-loads the verb and resource, then adds the key behavioral notes in a parenthetical. Every piece of information earns its place, with no wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with one parameter, a clear sibling relationship, and no output schema, the description covers everything an agent needs: what the tool does, where the id comes from, and what the output looks like (headers, body, HTML conversion, size cap). The simplicity of the tool means the description is sufficiently complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with the parameter 'id' documented, giving a baseline of 3. The description adds meaningful context by stating the id comes from list_emails, which clarifies that the id is not arbitrary and likely a Gmail message identifier. This exceeds the schema's minimal description.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'read', the resource 'one email by id', and adds a pointer to the sibling tool 'list_emails' for obtaining the id. This distinguishes it from the listing operation and leaves no ambiguity about what the tool does.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly mentions that the id comes from list_emails, which tells the agent when this tool is appropriate (after listing emails). It doesn't explicitly exclude alternatives, but the dependency on a prior call makes the usage context clear without being verbose.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v1.0.0- First observed
list_emails - First observed
read_email
TDQS
Scored across 2 tools
The two tools, list_emails and read_email, have clearly distinct purposes—one for enumerating emails and the other for fetching full details of a specific email. There is no overlap or confusion possible.
Both tool names follow the consistent verb_noun pattern: 'list_emails' and 'read_email'. The naming is predictable and aligns with the server's read-only scope.
With only two tools, the server is minimal but well-suited for a read-only Gmail interface. While the count feels thin relative to typical multi-purpose servers, the narrow scope justifies the small surface.
For a read-only mail server, the two tools cover the core workflow: listing emails with metadata and reading a full email by ID. There are no apparent gaps that would impede an agent from retrieving email data.
Maintenance
Related MCP Connectors
Permissioned access to Gmail, Drive and Calendar via the user's own Google account
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Read, send, file and search email in any Gmail, Microsoft 365 or IMAP mailbox, plus its calendar.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables reading, sending, archiving, and managing Gmail emails and labels through Google OAuth authentication, acting as an OAuth proxy to the Gmail API.295 npm12MIT
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to Gmail, enabling email search, unread listing, message and thread retrieval, and draft reply preparation without sending.295 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables programmatic interaction with Gmail using OAuth 2.0 authentication, allowing users to search, read, send, and manage emails through a standardized interface.MIT
- AlicenseNot gradedqualityCmaintenanceEnables searching and reading Gmail messages, listing labels, and creating email drafts without sending or deleting emails.119 npmMIT