Gmail AutoAuth MCP Server
这是一个用于Claude Desktop中Gmail集成的模型上下文协议(MCP)服务器,支持自动认证。该服务器使AI助手能够通过自然语言交互来管理Gmail。
Gmail AutoAuth MCP 快速使用指南
简介
Gmail AutoAuth MCP 是一个服务器,使 Claude Desktop 能够通过自然语言交互来管理您的 Gmail。
主要功能
- 发送和起草电子邮件(支持附件、国际字符)
- 搜索、阅读和管理电子邮件
- 标记、移动和删除邮件
- 管理 Gmail 标签
安装步骤
方法 1: 通过 Smithery 安装(推荐)
npx -y @smithery/cli install @gongrzhe/server-gmail-autoauth-mcp --client claude
方法 2: 手动安装
-
创建 Google Cloud 项目与 OAuth 凭据
- 访问 Google Cloud Console
- 创建项目并启用 Gmail API
- 创建 OAuth 客户端 ID(桌面或网页应用)
- 下载凭据并重命名为
gcp-oauth.keys.json
-
认证
# 全局认证(推荐) mkdir -p ~/.gmail-mcp mv gcp-oauth.keys.json ~/.gmail-mcp/ npx @gongrzhe/server-gmail-autoauth-mcp auth # 或本地认证 npx @gongrzhe/server-gmail-autoauth-mcp auth
-
在 Claude Desktop 中配置
{ "mcpServers": { "gmail": { "command": "npx", "args": [ "@gongrzhe/server-gmail-autoauth-mcp" ] } } }
可用工具
发送电子邮件
{
"to": ["recipient@example.com"],
"subject": "会议提醒",
"body": "您好,\n\n提醒您明天的会议。\n\n此致",
"cc": ["cc@example.com"],
"bcc": ["bcc@example.com"]
}
搜索电子邮件
{
"query": "from:sender@example.com after:2024/01/01 has:attachment",
"maxResults": 10
}
读取电子邮件
{
"messageId": "182ab45cd67ef"
}
其他工具
draft_email
: 创建草稿modify_email
: 修改标签/移动邮件delete_email
: 删除邮件list_email_labels
: 列出所有标签
搜索语法
Gmail 搜索支持多种运算符:
from:
- 特定发件人to:
- 特定收件人subject:
- 主题关键词has:attachment
- 带附件after:/before:
- 日期范围is:unread
- 未读状态label:
- 特定标签
可组合多个条件:from:boss@company.com after:2024/01/01 has:attachment
Docker 支持
详细的 Docker 配置请参考完整文档。