Google Calendar MCP Server

Google Calendar MCP Server

site icon
2025.04.15 0
TypeScript日历管理日程自动化日程管理
Google Calendar MCP Server 是一个基于 Model Context Protocol (MCP) 的服务,提供与 Google Calendar API 交互的工具。通过该服务,用户可以编程方式管理日历事件,包括创建、更新、删除和查询事件等功能。
View on GitHub

Overview

基本能力

产品定位

Google Calendar MCP Server 是一个用于管理 Google 日历事件的工具,通过 MCP 接口提供编程方式的日历事件管理能力。

核心功能

  1. 日历工具
  2. list_events: 列出即将到来的日历事件,支持日期范围过滤
  3. create_event: 创建新的日历事件,支持添加参与者
  4. update_event: 更新现有的日历事件
  5. delete_event: 删除日历事件

适用场景

  • 团队日程管理
  • 个人日程自动化
  • 会议安排和提醒

工具列表

  1. list_events: 列出日历事件
  2. create_event: 创建日历事件
  3. update_event: 更新日历事件
  4. delete_event: 删除日历事件

常见问题解答

  1. 如何获取 OAuth 2.0 凭证?
  2. 在 Google Cloud Console 中创建项目并启用 Google Calendar API
  3. 设置 OAuth 2.0 凭证,包括 Client ID 和 Client Secret

  4. 如何获取刷新令牌?

  5. 运行 node get-refresh-token.js 脚本
  6. 通过浏览器完成 Google OAuth 认证

使用教程

使用依赖

  1. Node.js: 安装 Node.js 14 或更高版本 bash # 安装 Node.js # 具体命令取决于您的操作系统

  2. Google Cloud Console 设置

  3. 访问 Google Cloud Console
  4. 创建或选择现有项目
  5. 启用 Google Calendar API
  6. 设置 OAuth 2.0 凭证

安装教程

  1. 克隆并安装 bash git clone https://github.com/yourusername/google-calendar-mcp-server.git cd google-calendar-mcp-server npm install

  2. 创建 OAuth 凭证 在根目录创建 credentials.json 文件 json { "web": { "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", "redirect_uris": ["http://localhost:3000/code"], "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token" } }

  3. 获取刷新令牌 bash node get-refresh-token.js

  4. 配置 MCP 设置 将服务器配置添加到 MCP 设置文件中 json { "mcpServers": { "google-calendar": { "command": "node", "args": ["/path/to/google-calendar-server/build/index.js"], "env": { "GOOGLE_ACCESS_TOKEN": "your_access_token", } } } }

  5. 构建并运行 bash npm run build

调试方式

  1. 列出事件 json { "maxResults": 10, "timeMin": "2024-01-01T00:00:00Z", "timeMax": "2024-12-31T23:59:59Z" }

  2. 创建事件 json { "summary": "Team Meeting", "location": "Conference Room", "description": "Weekly sync-up", "start": "2024-01-24T10:00:00Z", "end": "2024-01-24T11:00:00Z", "attendees": ["[email protected]"] }

  3. 更新事件 json { "eventId": "event_id", "summary": "Updated Meeting", "location": "Virtual", "description": "Rescheduled weekly sync-up", "start": "2024-01-25T10:00:00Z", "end": "2024-01-25T11:00:00Z" }

  4. 删除事件 json { "eventId": "event_id" }

许可证

该项目遵循 MIT 开源许可条款,请参阅 MIT 了解完整条款。