日历数据服务

一个提供Google日历数据访问的Model Context Protocol (MCP)服务器,支持列出日历、查找可用时间段和获取即将发生的事件。

  • by masa1023
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 masa1023/google-calendar-mcp-server

使用说明

谷歌日历MCP服务器

提供对Google日历数据访问的模型上下文协议(MCP)服务器。

特性

  • 列出可用的谷歌日历
  • 在日历中查找可用的时间段
  • 从日历中获取即将发生的事件

先决条件

  • Python 3.9+
  • 启用日历API的谷歌云项目
  • OAuth2凭据

设置

  1. 安装依赖项:

    pip install -r requirements.txt
    
  2. 设置Google日历API凭据:

    python setup_credentials.py
    

    按照提示向Google进行身份验证。

  3. 运行服务器:

    python google_calendar_server.py
    

与Claude Desktop一起使用

通过编辑配置文件配置Claude Desktop以使用此服务器:

{
  "mcpServers": {
    "google-calendar": {
      "command": "python",
      "args": ["/full/path/to/google_calendar_server.py"],
      "env": {
        "GOOGLE_TOKEN_FILE": "/path/to/token/file.json"
      }
    }
  }
}

可用工具

列表_日历

列出所有可用的谷歌日历。

获取可用地块

查找日历中的可用时间段。

参数:

  • calendar_id:要检查的日历的ID
  • days_ahead:提前检查的天数(默认值:7)
  • slot_duration_minutes:每个插槽的持续时间(分钟)(默认值:30)
  • start_hour:以24小时格式开始一天中的小时(默认值:9)
  • end_hour:以24小时格式结束一天中的小时(默认值:17)

get_upcoming_events

从日历中获取即将发生的事件。

参数:

  • calendar_id:要检查的日历的ID
  • days_ahead:提前检查的天数(默认值:7)
  • max_events:要返回的最大事件数(默认值:10)