
Google Calendar MCP Server

Overview
基本能力
产品定位
Google Calendar MCP Server 是一个用于管理 Google 日历事件的工具,通过 MCP 接口提供编程方式的日历事件管理能力。
核心功能
- 日历工具
list_events
: 列出即将到来的日历事件,支持日期范围过滤create_event
: 创建新的日历事件,支持添加参与者update_event
: 更新现有的日历事件delete_event
: 删除日历事件
适用场景
- 团队日程管理
- 个人日程自动化
- 会议安排和提醒
工具列表
- list_events: 列出日历事件
- create_event: 创建日历事件
- update_event: 更新日历事件
- delete_event: 删除日历事件
常见问题解答
- 如何获取 OAuth 2.0 凭证?
- 在 Google Cloud Console 中创建项目并启用 Google Calendar API
-
设置 OAuth 2.0 凭证,包括 Client ID 和 Client Secret
-
如何获取刷新令牌?
- 运行
node get-refresh-token.js
脚本 - 通过浏览器完成 Google OAuth 认证
使用教程
使用依赖
-
Node.js: 安装 Node.js 14 或更高版本
bash # 安装 Node.js # 具体命令取决于您的操作系统
-
Google Cloud Console 设置
- 访问 Google Cloud Console
- 创建或选择现有项目
- 启用 Google Calendar API
- 设置 OAuth 2.0 凭证
安装教程
-
克隆并安装
bash git clone https://github.com/yourusername/google-calendar-mcp-server.git cd google-calendar-mcp-server npm install
-
创建 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" } }
-
获取刷新令牌
bash node get-refresh-token.js
-
配置 MCP 设置 将服务器配置添加到 MCP 设置文件中
json { "mcpServers": { "google-calendar": { "command": "node", "args": ["/path/to/google-calendar-server/build/index.js"], "env": { "GOOGLE_ACCESS_TOKEN": "your_access_token", } } } }
-
构建并运行
bash npm run build
调试方式
-
列出事件
json { "maxResults": 10, "timeMin": "2024-01-01T00:00:00Z", "timeMax": "2024-12-31T23:59:59Z" }
-
创建事件
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]"] }
-
更新事件
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" }
-
删除事件
json { "eventId": "event_id" }