
Google Calendar MCP Server

2025.04.17
17
TypeScript日历服务AI助手集成日程管理
Google Calendar MCP Server 是一个基于 Model Context Protocol (MCP) 的服务实现,用于集成 Google Calendar 和 Claude Desktop。该服务通过自然语言交互,使用户能够查看、创建、更新和删除 Google 日历中的事件。
View on GitHub
Overview
基本能力
产品定位
Google Calendar MCP Server 是一个连接 Google Calendar 和 Claude Desktop 的桥梁,通过 MCP 协议实现 AI 助手与日历服务的交互。
核心功能
- Google Calendar 集成:与 Google Calendar API 无缝对接
- MCP 实现:遵循 Model Context Protocol 规范
- OAuth2 认证:安全的 Google API 认证流程
- 事件管理:支持日历事件的获取、创建、更新和删除
- 颜色支持:可设置和更新事件颜色
- STDIO 传输:使用标准输入/输出与 Claude Desktop 通信
适用场景
- 通过自然语言管理 Google 日历事件
- 在 Claude Desktop 中集成日历功能
- 自动化日程安排和管理
工具列表
- getEvents:检索日历事件,支持多种过滤选项
- createEvent:创建新日历事件
- updateEvent:更新现有日历事件
- deleteEvent:删除日历事件
常见问题解答
- JSON 解析错误:更新到最新版本可解决
- 认证错误:检查 Google OAuth 凭证是否正确配置
- 连接错误:确保只有一个服务实例在运行
- 断开连接问题:确保正确处理 MCP 消息
使用教程
使用依赖
- 创建 Google Cloud 项目并启用 Google Calendar API
- 在 Google Cloud Console 中配置 OAuth2 凭证
安装教程
npx @takumi0706/[email protected]
环境变量配置
# 创建 .env 文件
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_REDIRECT_URI=http://localhost:4153/oauth2callback
TOKEN_ENCRYPTION_KEY=32-byte-hex-key
AUTH_PORT=4153
AUTH_HOST=localhost
PORT=3000
HOST=localhost
Claude Desktop 配置
在 claude_desktop_config.json
中添加:
{
"mcpServers": {
"google-calendar": {
"command": "npx",
"args": [
"-y",
"@takumi0706/google-calendar-mcp"
],
"env": {
"GOOGLE_CLIENT_ID": "your_client_id",
"GOOGLE_CLIENT_SECRET": "your_client_secret",
"GOOGLE_REDIRECT_URI": "http://localhost:4153/oauth2callback"
}
}
}
}
调试方式
- 检查日志:
~/.google-calendar-mcp/logs/
- 确保 Google OAuth 凭证正确配置
- 验证 Google Calendar API 访问权限
- 检查 Claude Desktop 配置是否正确
开发指南
# 克隆仓库
git clone https://github.com/takumi0706/google-calendar-mcp.git
cd google-calendar-mcp
# 安装依赖
npm install
# 开发模式运行
npm run dev
# 运行测试
npm test
# 运行测试并生成覆盖率报告
npm test -- --coverage