mcpField
G
gmail

gmail

github.com/team-attention生产力82838 次安装27 周前更新
代码仓库

关于 gmail

gmail 是通过 Gmail API 管理邮件的技能,支持多个 Google 账户的读取、搜索、发送和整理。发送流程包含上下文收集、草稿反馈和测试邮件确认。

主要功能

  1. 01管理多个 Google 账户
  2. 02读取和搜索邮件
  3. 03发送邮件并整理标签
  4. 04发送前测试并请求确认
  5. 05令牌过期时自动刷新

适用场景

  1. 01查找未读邮件或历史对话
  2. 02根据背景信息起草邮件
  3. 03测试并确认后向收件人发送邮件

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/team-attention/plugins-for-claude-natives --skill gmail

安装后在 Claude Code 中输入/gmail确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

.gitignore
accounts.yaml.example
pyproject.toml
assets/
accounts.default.yaml
email-templates.md
signatures.md
references/
cli-usage.md
search-queries.md
setup-guide.md
scripts/
gmail_client.py
list_messages.py
manage_labels.py
read_message.py
send_message.py
setup_auth.py
scripts/core/
__init__.py
batch_processor.py
cache_manager.py
quota_manager.py
retry_handler.py

详细介绍

Gmail 技能

通过 Gmail API 管理邮件——跨多个 Google 账号读取、搜索、发送和整理邮件。

账号设置

运行任何命令前,先读取 accounts.yaml 检查已注册的账号。

如果 accounts.yaml 缺失或为空 → 阅读 references/setup-guide.md 进行初始设置

# accounts.yaml example
accounts:
  personal:
    email: [email protected]
    description: Personal Gmail
  work:
    email: [email protected]
    description: Work account

邮件发送工作流(5 个步骤)

发送邮件时,使用 TaskCreate 创建 5 个任务,并按顺序执行:

步骤任务关键操作
1收集上下文并行运行 Explore SubAgents:收件人信息、相关项目、背景信息
2检查之前的对话搜索 --query "to:recipient OR from:recipient newer_than:90d" → 使用 AskUserQuestion 选择邮件会话
3起草邮件撰写草稿 → 使用 AskUserQuestion 征求反馈
4测试发送向用户自己的地址发送 [TEST] 邮件 → 在 Gmail 网页版中打开 → 请求确认
5正式发送发送给收件人 → 报告完成情况

签名:在所有外发邮件末尾附加 ---\nSent with Claude Code

工作流示例:“给 John 发送会议邮件”
1. Create 5 Tasks
2. Step 1: Run parallel Explore SubAgents
   - Search recipient (John) info (partners/, projects/, context.md, etc.)
   - Search meeting context (calendar, recent meeting notes, etc.)
3. Step 2: Search "to:[email protected] OR from:[email protected]"
   → If previous conversation exists, AskUserQuestion (reply/new email)
4. Step 3: Draft email → AskUserQuestion (proceed/revise)
5. Step 4: Test send to my email → Open in Gmail web (`open "https://mail.google.com/mail/u/0/#inbox/{message_id}"`) → Request confirmation
6. Step 5: Actual send → Done

CLI 快速参考

# List messages
uv run python scripts/list_messages.py --account work --query "is:unread" --max 10

# Send email
uv run python scripts/send_message.py --account work --to "[email protected]" --subject "Subject" --body "Content"

# Check profile
uv run python scripts/manage_labels.py --account work profile

CLI 详细用法:references/cli-usage.md 搜索查询参考:references/search-queries.md

在网页版中查看邮件

发送后,使用返回的 Message ID 在 Gmail 网页版中直接查看:

# URL format
https://mail.google.com/mail/u/0/#inbox/{message_id}

# Example: Open in browser after test send
open "https://mail.google.com/mail/u/0/#inbox/19c145bbd47ddd01"

注意:u/0 是第一个登录的账号,u/1 是第二个账号

文件结构

skills/gmail/
├── SKILL.md
├── accounts.yaml           # Account metadata
├── scripts/                # CLI scripts
├── references/
│   ├── setup-guide.md      # Initial setup guide
│   ├── cli-usage.md        # Detailed CLI usage
│   ├── search-queries.md   # Search query reference
│   └── credentials.json    # OAuth Client ID (gitignore)
├── assets/
│   ├── accounts.default.yaml  # Account config template
│   ├── email-templates.md     # Email body templates
│   └── signatures.md          # Signature templates (Plain/HTML)
└── accounts/               # Per-account tokens (gitignore)

错误处理

情况解决方法
accounts.yaml 缺失阅读 references/setup-guide.md 进行初始设置
缺少令牌指引用户运行 setup_auth.py --account <name>
令牌过期自动刷新;如果失败,指引用户重新进行身份验证

评论

支持 Markdown