Calendar AutoAuth MCP Server

by GongRzhe
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Enables AI assistants to manage Google Calendar events, including creating, retrieving, updating, and deleting events, as well as listing events within a specified time range.

  • Used for authentication via Google Cloud Project and OAuth 2.0 credentials to access the Google Calendar API.

日历自动认证 MCP 服务器

一个模型上下文协议 (MCP) 服务器,用于将 Google 日历集成到 Cluade Desktop 中,并支持自动身份验证。该服务器使 AI 助手能够通过自然语言交互来管理 Google 日历事件。

特征

  • 创建带有标题、时间、描述和位置的日历事件
  • 通过事件 ID 检索事件详细信息
  • 更新现有事件(标题、时间、描述、地点)
  • 删除事件
  • 列出指定时间范围内的事件
  • 与 Google 日历 API 完全集成
  • 具有自动浏览器启动功能的简单 OAuth2 身份验证流程
  • 支持桌面和 Web 应用程序凭证
  • 全球凭证存储,方便快捷

安装和认证

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装日历自动认证服务器:

npx -y @smithery/cli install @gongrzhe/server-calendar-autoauth-mcp --client claude
  1. 创建 Google Cloud 项目并获取凭据:a.创建 Google Cloud 项目:
    • 前往Google Cloud Console
    • 创建新项目或选择现有项目
    • 为您的项目启用 Google 日历 API

    b.创建 OAuth 2.0 凭证:

    • 前往“API 和服务”>“凭证”
    • 点击“创建凭证”>“OAuth 客户端 ID”
    • 选择“桌面应用程序”或“Web 应用程序”作为应用程序类型
    • 命名并点击“创建”
    • 对于 Web 应用程序,将http://localhost:3000/oauth2callback添加到授权重定向 URI
    • 下载客户端 OAuth 密钥的 JSON 文件
    • 将密钥文件重命名为gcp-oauth.keys.json
  2. 运行身份验证:您可以通过两种方式进行身份验证:a.全局身份验证(推荐):
    # First time: Place gcp-oauth.keys.json in your home directory's .calendar-mcp folder mkdir -p ~/.calendar-mcp mv gcp-oauth.keys.json ~/.calendar-mcp/ # Run authentication from anywhere npx @gongrzhe/server-calendar-autoauth-mcp auth
    b. 本地身份验证:
    # Place gcp-oauth.keys.json in your current directory # The file will be automatically copied to global config npx @gongrzhe/server-calendar-autoauth-mcp auth
    身份验证过程将:
    • 在当前目录或~/.calendar-mcp/中查找gcp-oauth.keys.json
    • 如果在当前目录中找到,则将其复制到~/.calendar-mcp/
    • 打开默认浏览器进行 Google 身份验证
    • 将凭证保存为~/.calendar-mcp/credentials.json

    笔记

    • 身份验证成功后,凭证将全局存储在~/.calendar-mcp/中,可从任何目录使用
    • 支持桌面应用程序和 Web 应用程序凭据
    • 对于 Web 应用程序凭证,请确保将http://localhost:3000/oauth2callback添加到授权重定向 URI
  3. 在 Claude Desktop 中配置:
{ "mcpServers": { "calendar": { "command": "npx", "args": [ "@gongrzhe/server-calendar-autoauth-mcp" ] } } }

Docker 支持

如果您更喜欢使用 Docker:

  1. 验证:
docker run -i --rm \ --mount type=bind,source=/path/to/gcp-oauth.keys.json,target=/gcp-oauth.keys.json \ -v mcp-calendar:/calendar-server \ -e CALENDAR_OAUTH_PATH=/gcp-oauth.keys.json \ -e "CALENDAR_CREDENTIALS_PATH=/calendar-server/credentials.json" \ -p 3000:3000 \ mcp/calendar auth
  1. 用法:
{ "mcpServers": { "calendar": { "command": "docker", "args": [ "run", "-i", "--rm", "-v", "mcp-calendar:/calendar-server", "-e", "CALENDAR_CREDENTIALS_PATH=/calendar-server/credentials.json", "mcp/calendar" ] } } }

使用示例

该服务器提供了几个可以通过 Claude Desktop 使用的工具:

创建活动

{ "summary": "Team Meeting", "start": { "dateTime": "2024-01-20T10:00:00Z" }, "end": { "dateTime": "2024-01-20T11:00:00Z" }, "description": "Weekly team sync", "location": "Conference Room A" }

列出事件

{ "timeMin": "2024-01-01T00:00:00Z", "timeMax": "2024-12-31T23:59:59Z", "maxResults": 10, "orderBy": "startTime" }

更新事件

{ "eventId": "event123", "summary": "Updated Meeting Title", "start": { "dateTime": "2024-01-20T11:00:00Z" }, "end": { "dateTime": "2024-01-20T12:00:00Z" } }

删除事件

{ "eventId": "event123" }

安全说明

  • OAuth 凭证安全地存储在您的本地环境中( ~/.calendar-mcp/
  • 服务器使用离线访问来维持持久身份验证
  • 切勿共享或提交您的凭据以进行版本控制
  • 定期检查并撤销 Google 帐户设置中未使用的访问权限
  • 凭证存储在全局,但只有当前用户才能访问

故障排除

  1. 未找到 OAuth 密钥
    • 确保gcp-oauth.keys.json位于当前目录或~/.calendar-mcp/
    • 检查文件权限
  2. 凭证格式无效
    • 确保您的 OAuth 密钥文件包含webinstalled凭据
    • 对于 Web 应用程序,验证重定向 URI 是否配置正确
  3. 端口已被使用
    • 如果端口 3000 已被使用,请在运行身份验证之前释放它
    • 您可以找到并停止使用该端口的进程

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

执照

该项目已获得 ISC 许可。

作者

共济者

支持

如果您遇到任何问题或有疑问,请在 GitHub 存储库上提交问题。

-
security - not tested
A
license - permissive license
-
quality - not tested

Cluade Desktop 中用于集成 Google 日历的服务器,支持自动身份验证。该服务器使 AI 助手能够通过自然语言交互管理 Google 日历事件。

  1. Features
    1. Installation & Authentication
      1. Installing via Smithery
      2. Docker Support
    2. Usage Examples
      1. Create Event
      2. List Events
      3. Update Event
      4. Delete Event
    3. Security Notes
      1. Troubleshooting
        1. Contributing
          1. License
            1. Author
              1. Support
                ID: ol973azfw7