MCP谷歌日历服务器
用于创建Google日历事件的模型上下文协议(MCP)服务器。
设置
- 安装依赖项:
npm install- 获取Google日历API凭据:
- 首选 谷歌云控制台 - 创建新项目或选择现有项目 - 启用Google日历API - 创建凭据(OAuth 2.0客户端ID) - 下载凭据并另存为 credentials.json 在项目根中
- 身份验证:
- 运行服务器并使用 authenticate_google_calendar 获取身份验证URL的工具 - 访问URL,授予权限,并获取授权码 - 创建一个 token.json 将您的凭据归档
- 配置克劳德代码:
添加到MCP设置中:
{
"mcpServers": {
"google-calendar": {
"command": "node",
"args": ["/Users/krilet/mcp-google-calendar-server/src/index.js"]
}
}
}用法
服务器提供两个工具:
authenticate_google_calendar
为Google日历访问生成身份验证URL。
create_calendar_event
在Google日历中创建新事件。
参数:
summary(必填):活动标题startDateTime(必填):ISO格式的开始时间endDateTime(必填):ISO格式的结束时间description(可选):事件描述location(可选):活动地点timeZone(可选):时区(默认为UTC)attendees(可选):电子邮件地址数组
例子:
{
"summary": "Team Meeting",
"startDateTime": "2024-12-25T10:00:00-08:00",
"endDateTime": "2024-12-25T11:00:00-08:00",
"description": "Weekly team sync",
"location": "Conference Room A",
"attendees": ["colleague@example.com"]
}