Gmail MCP
通过标准化的界面轻松管理您的电子邮件,该界面可用于起草、发送、检索和组织邮件。 通过完整的 Gmail API 覆盖范围(包括标签和线程管理)简化您的电子邮件工作流程。
Tools
list_forwarding_addresses
Lists the forwarding addresses for the specified account
delete_send_as
Deletes the specified send-as alias
remove_delegate
Removes the specified delegate
get_send_as
Gets the specified send-as alias
list_send_as
Lists the send-as aliases for the specified account
get_delegate
Gets the specified delegate
list_delegates
Lists the delegates for the specified account
create_send_as
Creates a custom send-as alias
update_pop
Updates POP settings
get_thread
Get a specific thread by ID
create_draft
Create a draft email in Gmail. Note the mechanics of the raw parameter.
delete_draft
Delete a draft
get_draft
Get a specific draft by ID
list_drafts
List drafts in the user's mailbox
send_draft
Send an existing draft
update_draft
Replace a draft's content. Note the mechanics of the threadId and raw parameters.
create_label
Create a new label
delete_label
Delete a label
get_label
Get a specific label by ID
list_labels
List all labels in the user's mailbox
patch_label
Patch an existing label (partial update)
delete_forwarding_address
Deletes the specified forwarding address
update_label
Update an existing label
batch_delete_messages
Delete multiple messages
batch_modify_messages
Modify the labels on multiple messages
delete_message
Immediately and permanently delete a message
get_message
Get a specific message by ID with format options
list_messages
List messages in the user's mailbox with optional filtering
modify_message
Modify the labels on a message
update_vacation
Update vacation responder settings
send_message
Send an email message to specified recipients. Note the mechanics of the raw parameter.
trash_message
Move a message to the trash
untrash_message
Remove a message from the trash
get_attachment
Get a message attachment
delete_thread
Delete a thread
get_forwarding_address
Gets the specified forwarding address
list_threads
List threads in the user's mailbox
modify_thread
Modify the labels applied to a thread
trash_thread
Move a thread to the trash
untrash_thread
Remove a thread from the trash
get_auto_forwarding
Gets auto-forwarding settings
get_imap
Gets IMAP settings
get_language
Gets language settings
get_pop
Gets POP settings
get_vacation
Get vacation responder settings
update_auto_forwarding
Updates automatic forwarding settings
update_imap
Updates IMAP settings
update_language
Updates language settings
add_delegate
Adds a delegate to the specified account
create_filter
Creates a filter
delete_filter
Deletes a filter
get_filter
Gets a filter
list_filters
Lists the message filters of a Gmail user
create_forwarding_address
Creates a forwarding address
patch_send_as
Patches the specified send-as alias
update_send_as
Updates a send-as alias
verify_send_as
Sends a verification email to the specified send-as alias
delete_smime_info
Deletes the specified S/MIME config for the specified send-as alias
get_smime_info
Gets the specified S/MIME config for the specified send-as alias
insert_smime_info
Insert (upload) the given S/MIME config for the specified send-as alias
list_smime_info
Lists S/MIME configs for the specified send-as alias
set_default_smime_info
Sets the default S/MIME config for the specified send-as alias
get_profile
Get the current user's Gmail profile
watch_mailbox
Watch for changes to the user's mailbox
stop_mail_watch
Stop receiving push notifications for the given user mailbox
README
Gmail MCP
一个为 Gmail API 实现的 模型上下文协议 (MCP),提供了一个用于电子邮件管理、发送和检索的标准化接口。
特性
- 完整的 Gmail API 覆盖,包括消息、线程、标签、草稿和设置
- 支持发送、起草和管理电子邮件
- 标签管理,具有可自定义的颜色和可见性设置
- 用于会话管理的线程操作
- 设置管理,包括休假回复、IMAP/POP 和语言设置
- 用于邮箱更改的历史记录跟踪
- 使用您的 Google Cloud 凭据进行安全的 OAuth2 身份验证
安装
⚠️ 注意: 由于此服务器上提供了大量的端点,建议您安装并设置 Heimdall 以限制暴露给您的客户端应用程序的端点数量。
要使用此 MCP,您需要设置 Gmail 的身份验证:
- 转到 Google Cloud Console
- 创建一个新项目或选择一个现有项目
- 为您的项目启用 Gmail API
- 转到“凭据”并创建一个 OAuth 2.0 客户端 ID
- 选择“桌面应用”作为应用程序类型(警告:如果您不选择此类型,服务器将无法解析 JSON 文件中的密钥)
- 下载客户端凭据 JSON 文件
- 将下载的凭据文件保存到
~/.gmail-mcp/gcp-oauth.keys.json
NPX (推荐)
将以下内容添加到您的 MCP 客户端 config.json 中(如果使用 Heimdall,则为 ~/.heimdall/config.json):
{
"mcpServers": {
"gmail": {
"command": "npx",
"args": [
"@shinzolabs/gmail-mcp"
]
}
}
}
手动下载
- 下载仓库:
git clone https://github.com/shinzo-labs/gmail-mcp.git
- 安装包并构建(在克隆的仓库中):
pnpm i && pnpm run build
- 将以下内容添加到您的 MCP 客户端
config.json中(如果使用 Heimdall,则为~/.heimdall/config.json):
{
"mcpServers": {
"gmail": {
"command": "node",
"args": [
"/path/to/gmail-mcp/dist/index.js"
]
}
}
}
Smithery
要通过 Smithery 为 Claude Desktop 自动安装:
npx -y @smithery/cli install @shinzo-labs/gmail-mcp --client claude
身份验证
自动 (推荐)
此 MCP 提供自动身份验证流程:
-
首先,获取 OAuth 凭据并下载 JSON 文件。
-
将 JSON 文件重命名为
gcp-oauth.keys.json并将其复制到$HOME/.gmail-mcp/,或者您在MCP_CONFIG_DIR中设置的任何位置。 -
运行身份验证命令:
# 如果使用 npx
npx @shinzolabs/gmail-mcp auth
# 如果在项目目录中
pnpm i && pnpm run build && pnpm run auth
- 将自动打开一个浏览器窗口,显示 Google OAuth 同意屏幕
- 授予访问权限后,您可以关闭浏览器窗口
- 令牌将自动保存到
$HOME/.gmail-mcp/credentials.json
MCP 将自动执行以下操作:
- 管理令牌刷新
- 将凭据保存到磁盘
- 处理 OAuth 回调
- 在您的默认浏览器中打开身份验证 URL
注意:默认情况下,此服务器使用端口 3000 来侦听 OAuth 响应。 如果您在 3000 上运行其他服务,则可以将 AUTH_SERVER_PORT 设置为其他值。
您可以通过在运行命令之前设置 MCP_CONFIG_DIR 来自定义配置位置(可选):
export MCP_CONFIG_DIR=/custom/path/to/directory/
手动 (建议用于 Docker 使用)
如果您愿意,您也可以直接通过环境变量提供凭据:
export CLIENT_ID=your-id
export CLIENT_SECRET=your-secret
export REFRESH_TOKEN=your-refresh-token
支持的端点
用户管理
get_profile: 获取当前用户的 Gmail 个人资料stop_mail_watch: 停止接收推送通知watch_mailbox: 设置邮箱更改的推送通知
消息管理
管理消息
list_messages: 列出消息,带有可选的过滤get_message: 获取特定消息get_attachment: 获取消息附件modify_message: 修改消息标签send_message: 向指定收件人发送电子邮件delete_message: 永久删除消息trash_message: 将消息移动到垃圾箱untrash_message: 从垃圾箱中删除消息batch_modify_messages: 修改多个消息batch_delete_messages: 删除多个消息
标签管理
list_labels: 列出所有标签get_label: 获取特定标签create_label: 创建新标签update_label: 更新标签patch_label: 部分更新标签delete_label: 删除标签
线程管理
list_threads: 列出电子邮件线程get_thread: 获取特定线程modify_thread: 修改线程标签trash_thread: 将线程移动到垃圾箱untrash_thread: 从垃圾箱中删除线程delete_thread: 删除线程
草稿管理
list_drafts: 列出用户邮箱中的草稿get_draft: 按 ID 获取特定草稿create_draft: 在 Gmail 中创建草稿电子邮件update_draft: 替换草稿的内容delete_draft: 删除草稿send_draft: 发送现有草稿
设置管理
自动转发
get_auto_forwarding: 获取自动转发设置update_auto_forwarding: 更新自动转发设置
IMAP 设置
get_imap: 获取 IMAP 设置update_imap: 更新 IMAP 设置
POP 设置
get_pop: 获取 POP 设置update_pop: 更新 POP 设置
休假回复
get_vacation: 获取休假回复设置update_vacation: 更新休假回复
语言设置
get_language: 获取语言设置update_language: 更新语言设置
委托
list_delegates: 列出帐户委托get_delegate: 获取特定委托add_delegate: 添加委托remove_delegate: 删除委托
过滤器
list_filters: 列出电子邮件过滤器get_filter: 获取特定过滤器create_filter: 创建新过滤器delete_filter: 删除过滤器
转发地址
list_forwarding_addresses: 列出转发地址get_forwarding_address: 获取特定转发地址create_forwarding_address: 创建转发地址delete_forwarding_address: 删除转发地址
以...身份发送设置
list_send_as: 列出以...身份发送的别名get_send_as: 获取特定的以...身份发送的别名create_send_as: 创建以...身份发送的别名update_send_as: 更新以...身份发送的别名patch_send_as: 部分更新以...身份发送的别名verify_send_as: 发送验证电子邮件delete_send_as: 删除以...身份发送的别名
S/MIME 设置
list_smime_info: 列出 S/MIME 配置get_smime_info: 获取特定的 S/MIME 配置insert_smime_info: 上传新的 S/MIME 配置set_default_smime_info: 设置默认 S/MIME 配置delete_smime_info: 删除 S/MIME 配置
贡献
欢迎并鼓励贡献。如有任何问题、意见或疑虑,请联系 austin@shinzolabs.com。
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。