返回市场
谷歌日历MCP

谷歌日历MCP

作者:Avik-creator2 星标更新:2025-05-16

项目介绍

Google 日历集成项目

smithery 徽章

该项目提供了与 Google 日历 API 的集成,以便通过编程方式管理和交互日历事件。

预备条件

  • Python 3.8 或更高版本
  • Google Cloud Platform 账户
  • 启用 Google 日历 API
  • 配置 OAuth 2.0 凭据

安装说明

通过 Smithery 安装

要通过 Smithery 自动安装 Google 日历集成项目到 Claude Desktop:

npx -y smithery install @Avik-creator/googlecalendarMCP --client claude

手动安装

  1. 克隆仓库

    git clone https://github.com/Avik-creator/googlecalendarMCP
    cd googlecalendarMCP
    
  2. 设置虚拟环境

    python -m venv venv
    source venv/bin/activate  # 在 Windows 上使用 `venv\Scripts\activate`
    
  3. 安装依赖项

    pip install -r requirements.txt
    
  4. Google Cloud Platform 设置

    a. 访问 Google Cloud 控制台 b. 创建新项目或选择现有项目 c. 启用 Google 日历 API d. 创建 OAuth 2.0 凭据:

    • 前往 APIs & Services > 凭据
    • 点击 "创建凭据" > "OAuth 客户端 ID"
    • 选择 "桌面应用"
    • 下载凭据 JSON 文件
    • 将其重命名为 credentials.json 并放置在项目根目录中
  5. 环境变量

    在项目根目录中创建一个 .env 文件,包含以下变量:

    GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
    CALENDAR_ID=your_calendar_id@group.calendar.google.com
    

使用方法

  1. 首次认证

    python auth.py
    

    这将打开浏览器窗口进行 OAuth 认证。按照提示授权应用程序。

  2. 运行应用程序

    python main.py
    

功能

  • 创建、读取、更新和删除日历事件
  • 设置重复事件
  • 管理事件参与者
  • 处理事件通知和提醒

项目结构

googlecalendarMCP/
├── auth.py              # 认证处理
├── main.py             # 主应用程序入口点
├── requirements.txt    # 项目依赖项
├── .env               # 环境变量
├── credentials.json   # Google OAuth 凭据
└── token.json        # 生成的 OAuth 令牌

依赖项

该项目使用以下主要依赖项:

  • google-auth-oauthlib
  • google-auth-httplib2
  • google-api-python-client
  • python-dotenv

部署配置:

{
  "mcpServers": {
    "google_calendar_mcp": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://mcp-google-calendar.avikm744.workers.dev/sse"
      ]
    }
  }
}

安全注意事项

  • 切勿将 credentials.jsontoken.json.env 文件提交到版本控制
  • 保护好您的 OAuth 凭据
  • 定期轮换您的凭据和令牌

贡献

  1. 分叉仓库
  2. 创建功能分支
  3. 提交更改
  4. 推送到分支
  5. 创建拉取请求

许可证

本项目采用 MIT 许可证 - 详情见 LICENSE 文件。