这是一个与 Google 日历 API 集成的模型上下文协议(MCP)服务器,允许AI助手管理日历、创建和更新事件、查找可用时间槽等。
git clone https://github.com/daemonX10/Google-Calendar-MCP-Server.git
cd Google-Calendar-MCP-Server
npm install
.env文件(您可以从.env.example复制):
GOOGLE_CLIENT_ID=your_client_id
GOOGLE_CLIENT_SECRET=your_client_secret
GOOGLE_REDIRECT_URI=http://localhost:3000/auth/callback
git clone https://github.com/daemonX10/Google-Calendar-MCP-Server.git
cd Google-Calendar-MCP-Server
cp .env.example .env
.env文件docker-compose up -d
http://localhost:3000/auth/callback作为授权重定向URI.env文件中https://www.googleapis.com/auth/calendar 和 https https://www.googleapis.com/auth/calendar.events)npx ts-node src/index.ts
npx ts-node src/auth-helper.ts "YOUR_AUTH_CODE"
这将自动将刷新令牌保存到您的.env文件中,并测试连接。如果您遇到认证问题:
npm run dev
npm run build
npm start
# 构建并启动容器
docker-compose up -d
# 查看日志
docker-compose logs -f
# 停止容器
docker-compose down
您也可以使用我们预构建的Docker镜像:
# 拉取镜像
docker pull daemonx10/google-calendar-mcp:latest
# 运行容器(先创建一个.env文件)
docker run -d -p 3000:3000 --name google-calendar-mcp --env-file ./.env daemonx10/google-calendar-mcp:latest
{
"mcp": {
"servers": {
"google-calendar": {
"command": "node",
"args": ["/绝对路径/to/mcp-google-calendar/dist/index.js"],
"env": {
"GOOGLE_CLIENT_ID": "your_client_id",
"GOOGLE_CLIENT_SECRET": "your_client_secret",
"GOOGLE_REDIRECT_URI": "http://localhost:3000/auth/callback",
"GOOGLE_REFRESH_TOKEN": "your_refresh_token"
}
}
}
}
}
对于Claude Desktop,您需要首先使用npm run build构建项目。
对于Claude.ai Web,您需要:
对于支持模型上下文协议的其他AI助手:
http://localhost:3000用于Google日历MCP服务器一旦与您选择的AI助手集成,您可以使用自然语言命令与您的Google日历互动。例如:
列出所有可用的日历。
按过滤选项列出日历中的事件。 参数:
calendarId(可选):日历ID(默认:'primary')maxResults(可选):返回的最大事件数timeMin(可选):开始时间,ISO格式(默认:现在)timeMax(可选):结束时间,ISO格式q(可选):搜索词以查找事件在日历中创建新的事件。 参数:
calendarId(可选):日历ID(默认:'primary')summary:事件标题description(可选):事件描述location(可选):事件地点start:开始时间,ISO格式end:结束时间,ISO格式attendees(可选):参会者的电子邮件地址列表reminders(可选):事件提醒配置recurrence(可选):重复事件的重复规则获取特定事件的详细信息。 参数:
calendarId(可选):日历ID(默认:'primary')eventId:事件ID更新日历中的现有事件。 参数:
calendarId(可选):日历ID(默认:'primary')eventId:事件IDsummary(可选):事件标题description(可选):事件描述location(可选):事件地点start(可选):开始时间,ISO格式end(可选):结束时间,ISO格式attendees(可选):参会者的电子邮件地址列表reminders(可选):事件提醒配置从日历中删除事件。 参数:
calendarId(可选):日历ID(默认:'primary')eventId:事件ID在日历中查找可用的时间槽。 参数:
calendarId(可选):日历ID(默认:'primary')timeMin(可选):开始时间,ISO格式(默认:现在)timeMax (可选):结束时间,ISO格式duration(可选):时长,分钟workingHoursStart(可选):工作时间开始时间(例如:"09:00")workingHoursEnd(可选):工作时间结束时间(例如:"17:00")获取今天或特定日期的即将到来的会议。 参数:
calendarId(可选):日历ID(默认:'primary')date(可选):日期,ISO格式(默认:今天).env文件中,请确保安全npm install验证所有依赖项是否已安装.env文件具有正确的凭证npx tsc --noEmit检查TypeScript错误.env文件中的内容匹配npm run build构建了项目MIT