日历 MCP 服务器
一个用于Cursor IDE中Google日历集成的模型上下文协议(MCP)服务器,拥有自动认证支持. 这个服务器使AI助手能够通过自然语言互动来管理Google日历事件.
特征
- 创建带有标题、时间、描述和位置的日历事件
- 按事件标识检索事件细节
- 更新现有事件(标题、时间、描述、位置)
- 删除事件
- 列出指定时间范围内的事件
- 与 Google Calendar API 完全整合
- 启用自动浏览器的简单 OAuth2 认证流程
安装认证( A)
-
创建 Google 云项目并获取证书 :
a. 创建谷歌云项目:
- 转到 谷歌云控台
- 创建新工程或选择现有工程
- 为您的工程启用 Google 日历 API
b. 创建 OAuth 2.0 全权证书:
- 转到"AP Is & Services" > "证书"
- 点击“ 创建证书” > “ OAuth 客户端 ID”
- 选择“ Desktop 应用程序”为应用程序类型
- 给出名字并点击"Create"
- 下载客户端 OAuth 密钥的 JSON 文件
- 将密钥文件重命名为
gcp-oauth.keys.json
-
运行认证 :
您可以通过两种方式认证:
a. 全球认证(建议):
# First time: Place gcp-oauth.keys.json in your home directory's .calendar-mcp folder mkdir -p ~/.calendar-mcp mv gcp-oauth.keys.json ~/.calendar-mcp/ # Run authentication from anywhere npx @gongrzhe/server-calendar-autoauth-mcp authb. 本地认证:
# Place gcp-oauth.keys.json in your current directory # The file will be automatically copied to global config npx @gongrzhe/server-calendar-autoauth-mcp auth认证程序将:
- 寻找
gcp-oauth.keys.json当前目录中或~/.calendar-mcp/ - 如果在当前目录中找到, 请复制到
~/.calendar-mcp/ - 打开您的默认浏览器进行 Google 认证
- 证书另存为
~/.calendar-mcp/credentials.json
说明: 认证成功后, 证书被存储在全球
~/.calendar-mcp/,并且可以从任意目录中使用. - 寻找
-
在光标桌面中配置 :
{
"mcpServers": {
"calendar": {
"command": "npx",
"args": [
"@gongrzhe/server-calendar-autoauth-mcp"
]
}
}
}
嵌入支持
如果您喜欢使用 Docker :
- 认证 :
docker run -i --rm \
--mount type=bind,source=/path/to/gcp-oauth.keys.json,target=/gcp-oauth.keys.json \
-v mcp-calendar:/calendar-server \
-e CALENDAR_OAUTH_PATH=/gcp-oauth.keys.json \
-e "CALENDAR_CREDENTIALS_PATH=/calendar-server/credentials.json" \
-p 3000:3000 \
mcp/calendar auth
- 用法 :
{
"mcpServers": {
"calendar": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-v",
"mcp-calendar:/calendar-server",
"-e",
"CALENDAR_CREDENTIALS_PATH=/calendar-server/credentials.json",
"mcp/calendar"
]
}
}
}
用法实例
服务器提供了几种工具,可以通过光标 IDE 使用:
创建事件
{
"summary": "Team Meeting",
"start": {
"dateTime": "2024-01-20T10:00:00Z"
},
"end": {
"dateTime": "2024-01-20T11:00:00Z"
},
"description": "Weekly team sync",
"location": "Conference Room A"
}
列表事件
{
"timeMin": "2024-01-01T00:00:00Z",
"timeMax": "2024-12-31T23:59:59Z",
"maxResults": 10,
"orderBy": "startTime"
}
更新事件
{
"eventId": "event123",
"summary": "Updated Meeting Title",
"start": {
"dateTime": "2024-01-20T11:00:00Z"
},
"end": {
"dateTime": "2024-01-20T12:00:00Z"
}
}
删除事件
{
"eventId": "event123"
}
安全说明
- OAuth 证书在本地环境中安全存储
- 服务器使用离线访问来维护持续认证
- 永远不要共享或承诺您的证书用于版本控制
- 在您的 Google 账户设置中定期审查并取消未使用的访问
捐款
欢迎捐款! 请随意提交拉力请求.
许可证
这个项目根据ICC许可证颁发许可证.
作者
刚格日
支助
如果您遇到任何问题或有问题,请在 GitHub 寄存器上存档 .