这是一个用于在 Claude Desktop 中集成 Google Calendar 并支持自动认证的 Model Context Protocol (MCP) 服务器。该服务器使AI助手能够通过自然语言交互来管理 Google Calendar。
要通过 Smithery 自动安装 Google Calendar 集成服务器到 Claude Desktop:
npx -y @smithery/cli install @falgom4/calendar-mcp --client claude
创建一个 Google Cloud 项目并获取凭证:
a. 创建一个 Google Cloud 项目:
b. 创建 OAuth 2.0 凭证:
http://localhost:3000/oauth2callbackgcp-oauth.keys.json运行认证:
您可以通过两种方式认证:
a. 全局认证(推荐):
# 第一次:将 gcp-oauth.keys.json 放入您家目录的 .calendar-mcp 文件夹中
mkdir -p ~/.calendar-mcp
mv gcp-oauth.keys.json ~/.calendar-mcp/
# 从任何地方运行认证
npx @nchufa/calendar auth
b. 局部认证:
# 将 gcp-oauth.keys.json 放入当前目录
# 文件将被自动复制到全局配置
npx @nchufa/calendar auth
认证过程会:
~/.calendar-mcp/ 查找 gcp-oauth.keys.json~/.calendar-mcp/~/.calendar-mcp/credentials.json注意:
- 成功认证后,凭证将全局存储在
~/.calendar-mcp/中,并可以从任何目录使用- 同时支持桌面应用和网络应用凭证
- 对于网络应用凭证,请确保在授权重定向 URI 中添加
http://localhost:3000/oauth2callback
在 Claude Desktop 中配置:
向您的 Claude Desktop 配置文件添加以下内容:
{
"mcpServers": {
"calendar": {
"command": "npx",
"args": [
"@nchufa/calendar"
]
}
}
}
该服务器提供了以下工具,可通过 Claude Desktop 使用:
create_event)创建新的日历事件。
{
"summary": "团队会议",
"description": "每周团队同步讨论项目进度",
"location": "会议室A",
"start": "2025-04-01T14:00:00",
"end": "2025-04-01T15:00:00",
"attendees": ["同事@example.com", "经理@example.com"],
"reminders": {
"useDefault": false,
"overrides": [
{
"method": "email",
"minutes": 30
},
{
"method": "popup",
"minutes": 10
}
]
}
}
也支持自然语言日期/时间:
{
"summary": "与John喝咖啡",
"location": "市中心星巴克",
"start": "明天下午2:30",
"end": "明天下午3:30"
}
get_event)检索特定日历事件的详细信息。
{
"eventId": "abc123xyz456",
"calendarId": "primary"
}
update_event)更新现有的日历事件。
{
"eventId": "abc123xyz456",
"summary": "更新会议标题",
"location": "新地点",
"start": "2025-04-01T15:00:00",
"end": "2025-04-01T16:00:00"
}
delete_event)删除日历事件。
{
"eventId": "abc123xyz456",
"calendarId": "primary"
}
list_events)列出指定时间范围内的日历事件。
{
"calendarId": "primary",
"timeMin": "2025-04-01T00:00:00",
"timeMax": "2025-04-07T23:59:59",
"maxResults": 10,
"orderBy": "startTime"
}
search_events)按查询搜索匹配的事件。
{
"query": "会议",
"calendarId": "primary",
"timeMin": "2025-04-01T00:00:00",
"maxResults": 5
}
list_calendars)列出所有可用的日历。
{}
该服务器支持多种自然语言格式的日期和时间:
这使得使用自然语言指令创建和更新事件变得容易。
~/.calendar-mcp/)找不到 OAuth 密钥
gcp-oauth.keys.json 在当前目录或 ~/.calendar-mcp/无效的凭证格式
web 或 installed 凭证端口已被占用
欢迎贡献!请随时提交 Pull Request。
MIT
特别感谢 GongRzhe 和他的 Calendar-Autoauth-MCP-Server 项目,该项目为本实现奠定了基础。
如果您遇到任何问题或有疑问,请在 GitHub 存储库上提交问题。