mcpField
G
google-calendar

google-calendar

github.com/dotneet生产力3450 次安装40 周前更新
代码仓库

关于 google-calendar

用于访问 Google Calendar 和 Tasks 的命令行技能,适合管理日程与任务列表的用户和 Agent。支持事件与任务操作、空闲忙碌查询,以及直接调用 Calendar API。

主要功能

  1. 01列出并搜索日历事件
  2. 02创建、更新和删除事件
  3. 03查询日历空闲忙碌状态
  4. 04管理 Google Tasks 列表和任务
  5. 05调用 Calendar API 端点

适用场景

  1. 01查找指定时间段内的事件
  2. 02安排或修改会议
  3. 03查询多个日历的空闲情况
  4. 04管理任务列表

安装

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

$npx skills add https://github.com/dotneet/claude-code-marketplace --skill google-calendar

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

包含的文件

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

README.md
scripts/
gcal
gcal_api.py
gcal_auth.py
gcal-auth
requirements.txt

详细介绍

Google Calendar + Tasks 访问

快速开始

  • 创建 Google Cloud OAuth 客户端(桌面应用),并将凭据 JSON 保存到 ~/.config/google-calendar/credentials.json。
  • 安装依赖项(建议使用 venv):
    python3 -m venv ~/.config/google-calendar/venv
    ~/.config/google-calendar/venv/bin/pip install -r <skill_dir>/scripts/requirements.txt
    
  • 进行身份验证并保存令牌:
    • 仅限 Calendar:
      • <skill_dir>/scripts/gcal-auth
    • 仅限 Tasks:
      • <skill_dir>/scripts/gcal-auth --scopes https://www.googleapis.com/auth/tasks
    • Calendar + Tasks(共用单个令牌):
      • <skill_dir>/scripts/gcal-auth --scopes https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/tasks
  • 调用 API:
    • <skill_dir>/scripts/gcal list-calendars

凭据和令牌

  • 默认情况下,凭据应位于 ~/.config/google-calendar/credentials.json。
  • 默认情况下,令牌存储在 ~/.config/google-calendar/token.json。
  • 使用 --token 或 GCAL_TOKEN_PATH 切换账号或隔离环境。

日期/时间规则

  • 定时事件使用 RFC3339 格式(例如,2026-01-22T10:00:00-08:00)。
  • 全天事件使用 YYYY-MM-DD,并将 end 设置为次日(不包含)。
  • 如果日期时间没有时区偏移,请设置 --time-zone。

常用命令

  • 列出日历:
    • <skill_dir>/scripts/gcal list-calendars
  • 列出事件:
    • <skill_dir>/scripts/gcal list-events --calendar-id primary --time-min 2026-01-22T00:00:00-08:00 --time-max 2026-01-22T23:59:59-08:00
  • 搜索事件:
    • <skill_dir>/scripts/gcal list-events --calendar-id primary --q "standup" --time-min ... --time-max ...
  • 创建事件(简单):
    • <skill_dir>/scripts/gcal create-event --calendar-id primary --summary "Review" --start 2026-01-22T10:00:00-08:00 --end 2026-01-22T11:00:00-08:00
  • 更新事件(简单):
    • <skill_dir>/scripts/gcal update-event --calendar-id primary --event-id <id> --summary "New title"
  • 删除事件:
    • <skill_dir>/scripts/gcal delete-event --calendar-id primary --event-id <id>
  • 查询空闲/忙碌状态:
    • <skill_dir>/scripts/gcal freebusy --calendars primary,[email protected] --time-min ... --time-max ...
  • 列出任务列表:
    • <skill_dir>/scripts/gcal list-tasklists
  • 列出任务:
    • <skill_dir>/scripts/gcal list-tasks --tasklist <tasklist_id>
  • 创建任务:
    • <skill_dir>/scripts/gcal create-task --tasklist <tasklist_id> --title "Buy milk" --due 2026-01-22T10:00:00-08:00
  • 更新任务:
    • <skill_dir>/scripts/gcal update-task --tasklist <tasklist_id> --task-id <id> --notes "Bring receipt"
  • 删除任务:
    • <skill_dir>/scripts/gcal delete-task --tasklist <tasklist_id> --task-id <id>

高级用法

  • 使用 call 调用任意 Calendar API 端点:
    • <skill_dir>/scripts/gcal call GET /users/me/calendarList
    • <skill_dir>/scripts/gcal call POST /calendars/primary/events --body-file /path/to/event.json
  • 复杂负载(参会者、重复规则、conferenceData)可使用 --body-file 或 --body(JSON 字符串)。
  • 使用不同的令牌文件和 --token 运行多个账号。

安全

  • 创建、更新或删除事件前,请确认操作意图。
  • 请勿将 OAuth 凭据和令牌文件提交到 git。

评论

支持 Markdown