
Gmail
com.pulsemcp由 pulsemcp.com 发布v0.4.12更新于 Oct 24, 2026
MCP server for Gmail with OAuth2 (personal) and service account (Workspace) support.
概览
一个本地 MCP 服务器,把 AI 助手连接到 Gmail,使其能列出、搜索、读取、加标签、起草和发送邮件。
- 可以做什么
- 列出、读取和搜索邮件会话与草稿,支持标签、日期筛选和 Gmail 查询语法。更改邮件状态和标签:标记已读或未读、加星、归档、添加或移除标签。创建、更新和删除草稿邮件,包括回复已有会话。直接发送新邮件或回复,也可发送已有草稿。
- 适用场景
- 适合让助手整理收件箱、按发件人或主题查找邮件、准备草稿或发送回复,而无需切换到邮件客户端。适用于个人 Gmail 账户,或可授予所需权限的 Google Workspace 组织。
- 运行要求
- 通过 npx 在本地运行,需要 Node.js。需要个人账户的 OAuth2 凭据(GMAIL_OAUTH_CLIENT_ID、GMAIL_OAUTH_CLIENT_SECRET、GMAIL_OAUTH_REFRESH_TOKEN,通过一次性浏览器设置获取),或具备全域委派的 Workspace 服务账号(GMAIL_SERVICE_ACCOUNT_CLIENT_EMAIL、GMAIL_SERVICE_ACCOUNT_PRIVATE_KEY、GMAIL_IMPERSONATE_EMAIL)。需在 Google Cloud 中启用 Gmail API。
安装
在 SourceWeft 中
- 打开 控制台中的 Gmail,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
Gmail Workspace MCP Server
An MCP (Model Context Protocol) server that provides Gmail integration for AI assistants. Supports both personal Gmail accounts (via OAuth2) and Google Workspace accounts (via service account with domain-wide delegation).
Features
- List Email Conversations: Retrieve emails with label filtering
- Get Email Details: Fetch full email content including body and attachments info
- Search Emails: Search using Gmail's powerful query syntax
- Manage Emails: Mark as read/unread, star/unstar, archive, apply labels
- Create Drafts: Compose draft emails with reply support
- Send Emails: Send new emails or replies, directly or from drafts
- Two Auth Methods: OAuth2 for personal accounts, Service Account for Google Workspace
Installation
Or run directly with npx:
Authentication
This server supports two authentication modes. Choose the one that matches your account type.
Option 1: OAuth2 (Personal Gmail Accounts)
Use this for personal @gmail.com accounts or any Google account without Workspace admin access.
Prerequisites
- Go to Google Cloud Console
- Create or select a project
- Enable the Gmail API
- Configure the OAuth consent screen:
- Choose External user type
- Add yourself as a test user
- Publish the app (click "Publish" on the consent screen) to prevent refresh tokens from expiring every 7 days. No full Google verification is needed for personal use.
- Create OAuth 2.0 credentials:
- Choose Desktop app as the application type
- Important: Create new credentials after publishing the app
- Copy the Client ID and Client Secret
Getting a Refresh Token
Run the built-in setup command:
You can also pass credentials via environment variables:
Port conflict? If port 3000 is already in use, specify a different port:
Desktop app credentials automatically allow http://localhost redirects on any port, so no additional Google Cloud Console configuration is needed.
This will open your browser for Google sign-in and print the refresh token. You only need to do this once — the refresh token does not expire (as long as the OAuth consent screen is published).
Environment Variables (OAuth2)
Claude Desktop Configuration (OAuth2)
Option 2: Service Account (Google Workspace)
Use this for Google Workspace organizations where a domain admin can grant domain-wide delegation.
Prerequisites
- Go to Google Cloud Console
- Create or select a project
- Enable the Gmail API
- Create a service account with domain-wide delegation enabled
- In Google Workspace Admin Console, grant the service account access to the following scopes:
https://www.googleapis.com/auth/gmail.readonly(read emails)https://www.googleapis.com/auth/gmail.modify(modify labels)https://www.googleapis.com/auth/gmail.compose(create drafts)https://www.googleapis.com/auth/gmail.send(send emails)
- Download the JSON key file
Environment Variables (Service Account)
You can find the client_email and private_key values in your service account JSON key file.
Claude Desktop Configuration (Service Account)
Note: For the private key, you can either:
- Use the key directly with
\nfor newlines (as shown above) - Set the environment variable from a shell that preserves newlines
Tool Groups
The server supports three tool groups for permission-based access control:
By default, all tool groups are enabled. To restrict access, set the GMAIL_ENABLED_TOOLGROUPS environment variable:
Security Note: The send_email tool is in a separate readwrite_external group because it can send emails externally, which carries higher risk than internal operations like modifying labels or creating drafts.
Available Tools
list_email_conversations
List email conversations from Gmail with optional filtering.
Parameters:
count(number, optional): Number of emails to return (default: 10, max: 100)labels(string, optional): Comma-separated label IDs to filter by (default: "INBOX")sort_by(string, optional): Sort order - "recent" (newest first) or "oldest" (default: recent)after(string, optional): Only return emails after this datetime, exclusive (ISO 8601 UTC, e.g., "2024-01-15T14:30:00Z")before(string, optional): Only return emails before this datetime, exclusive (ISO 8601 UTC, e.g., "2024-01-15T14:30:00Z")
Example:
get_email_conversation
Retrieve the full content of a specific email by its ID.
Parameters:
email_id(string, required): The unique identifier of the email
Example:
search_email_conversations
Search emails using Gmail's powerful query syntax.
Parameters:
query(string, required): Gmail search query (e.g., "from:[email protected]", "is:unread", "subject:meeting")count(number, optional): Maximum results to return (default: 10, max: 100)
Example:
change_email_conversation
Modify email labels and status (read/unread, starred, archived).
Parameters:
email_id(string, required): The email ID to modifystatus(string, optional): "read", "unread", or "archived"is_starred(boolean, optional): Star or unstar the emaillabels(string, optional): Comma-separated labels to addremove_labels(string, optional): Comma-separated labels to remove
Example:
list_draft_emails
List draft emails from Gmail with optional thread filtering.
Parameters:
count(number, optional): Maximum number of drafts to return (default: 10, max: 100)thread_id(string, optional): Filter drafts by conversation thread ID
Example:
upsert_draft_email
Create, update, or delete a draft email. Optionally as a reply to an existing conversation.
Parameters:
draft_id(string, optional): ID of an existing draft to update or delete (omit to create a new draft)delete(boolean, optional): Set totrueto delete the draft specified bydraft_id. All other parameters are ignored when deletingto(string, required for create/update): Recipient email addresssubject(string, required for create/update): Email subjectplaintext_body(string): Plain text body content (at least one of plaintext_body or html_body required for create/update)html_body(string): HTML body content for rich text formatting (at least one of plaintext_body or html_body required for create/update)cc(string, optional): CC recipientsbcc(string, optional): BCC recipientsthread_id(string, optional): Thread ID for repliesreply_to_email_id(string, optional): Email ID to reply to (sets References/In-Reply-To headers)
For create/update: at least one of plaintext_body or html_body must be provided. If both are provided, a multipart email is sent with both versions.
Example (create new draft):
Example (update existing draft):
Example (delete a draft):
send_email
Send an email directly or from an existing draft.
Parameters:
to(string, conditional): Recipient email (required unless sending from draft)subject(string, conditional): Email subject (required unless sending from draft)plaintext_body(string): Plain text body content (at least one of plaintext_body or html_body required, unless sending a draft)html_body(string): HTML body content for rich text formatting (at least one of plaintext_body or html_body required, unless sending a draft)cc(string, optional): CC recipientsbcc(string, optional): BCC recipientsfrom_draft_id(string, optional): Send an existing draft by IDthread_id(string, optional): Thread ID for repliesreply_to_email_id(string, optional): Email ID to reply to
Example (plain text email):
Example (HTML email):
Example (send draft):
Development
Setup
Testing
License
MIT
来源:experimental/gmail/README.md,提交 0ed34de
工具
0版本历史
1- v0.4.12最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分