Token导航 LogoToken导航TokenDH.com
cal2prompt MCP logo
搜索检索HTTP官方级别未说明来源级核验

cal2prompt MCP

MCP Server

✨ Fetches your schedule (Google Calendar) and outputs it as a single LLM prompt, with an optional MCP server mode.

工具数

0

提示词数

0

GitHub Stars

15

资源数

0
日程管理命令行工具RustClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

shuntaka9576

提供方

shuntaka9576

最后核验

2026/5/18 03:29

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

*⚠️ 这个项目仍处于试验阶段。功能可能会更改,恕不另行通知。小心使用! ⚠️*

cal2prompt

cal2prompt是一个命令行工具,可以获取您的日程安排(例如,从谷歌日历),并通过模板引擎将其转换为自定义提示或文本片段。它可以直接输出到stdout,也可以作为实验性的MCP(模型上下文协议)服务器运行。

cal2prompt使用 谷歌日历API第3版.

*CLI示例* img

*模型上下文协议(MCP)示例(实验)* img

特性

  • 🚀 谷歌日历集成\

利用 谷歌日历API v3 获取您的日程安排。

  • 📄 使用模板引擎进行灵活的LLM提示定制\

使用自定义生成的提示 Jinja2 模板引擎。

  • ⚡️ 快速燃烧\

Rust生态系统支持的高速处理。

  • 🔧 实验MCP模式\

运行cal2prompt作为 模型上下文协议 服务器。

安装

Brew(MacOS)

brew install shuntaka9576/tap/cal2prompt

货物(吉)

git clone https://github.com/shuntaka9576/cal2prompt
cd cal2prompt
cargo install --path .

用法

$ cal2prompt --help
✨ Fetches your schedule (e.g., from Google Calendar) and converts it into a single LLM prompt. It can also run as an MCP (Model Context Protocol) server.

Usage: cal2prompt [OPTIONS] [COMMAND]

Commands:
  mcp   Launch cal2prompt as an MCP server (experimental).
  help  Print this message or the help of the given subcommand(s)

Options:
      --since   Start date (YYYY-MM-DD). Requires --until.
      --until   End date (YYYY-MM-DD). Requires --since.
      --today         Fetch events for today only.
      --this-week     Fetch events for the current week (Mon-Sun).
      --this-month    Fetch events for the current month (1st - end).
      --next-week     Fetch events for the upcoming week (Mon-Sun).
  -h, --help          Print help
  -V, --version       Print version

初始设置

1.设置谷歌OAuth2.0客户端

我们使用OAuth2对您的Google帐户进行身份验证。身份验证后,生成的令牌将存储在 oauth 位于平台数据目录中的文件(例如。, ~/.local/share/cal2prompt/oauth 在Linux上)。当您首次启动cal2prompt时,身份验证过程将自动开始——只需按照屏幕上的说明进行操作。

目前,您必须使用自己的日历API令牌。日历API令牌只授予有限数量的用户,需要谷歌的批准。即使我作为项目所有者提供谷歌批准的客户,也不可避免地会存在安全风险。因此,您需要创建和管理自己的令牌。

请按照以下步骤操作 docs/setup oauth 创建自己的Google“项目”并获得OAuth令牌。

2.设置配置

配置是用Lua编写的。下面是一个配置示例。如果你愿意,你可以将公共和私人信息分开到单独的文件中——只需对其进行自定义以满足你的需求。

创建 ~/.config/cal2prompt/secrets.lua 并添加以下内容。文件名可以是任何名称,只要它与后面提到的config.lua中的require语句匹配。

请指定您之前创建的clientID、clientSecret和日历ID。您可以在Google日历web UI中找到日历ID。

local M = {}

M.google = {
  clientID = "***.apps.googleusercontent.com",
  clientSecret = "***",
  calendarIDs = {
    "example@gmail.com"
  },
}

return M

创建 ~/.config/cal2prompt/config.lua 并增加以下内容:

local cal2prompt = require("cal2prompt") -- builtin module
local os = require("os") -- stdlib
local secrets = require("secrets")

return {
  settings = {
    -- see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
    -- TZ = "Etc/UTC",
    TZ = "Asia/Tokyo",
    -- TZ = "America/Los_Angeles"
    -- TZ - "Asia/Shanghai"
  },
  source = {
    google = {
      oauth2 = {
        clientID = secrets.google.clientID,
        clientSecret = secrets.google.clientSecret,
      },
      calendar = {
        getEvents = {
          calendarIDs = secrets.google.calendarIDs,
        },
      },
    },
  },
  output = {
    -- template = cal2prompt.template.google.standard
    template = [[
Here is your schedule summary. Please find the details below:
{% for day in days %}
## Date: {{ day.date }}
--------------------------------------

### All-Day Events:
{% if day.all_day_events|length == 0 %}
  (No all-day events)
{% else %}
  {% for ev in day.all_day_events %}
  - {{ ev.summary }}
    - (All Day)
    - Location: {{ ev.location or "N/A" }}
    - Description: {{ ev.description or "No description." }}
    - Attendees:
      {% if ev.attendees|length > 0 %}
        {% for a in ev.attendees %}
        - {{ a }}
        {% endfor %}
      {% else %}
      - (No attendees)
      {% endif %}
  {% endfor %}
{% endif %}

### Timed Events:
{% if day.timed_events|length == 0 %}
  (No timed events)
{% else %}
  {% for ev in day.timed_events %}
  - {{ ev.summary }}
    - Start: {{ ev.start }}
    - End:   {{ ev.end }}
    - Location: {{ ev.location or "N/A" }}
    - Description: {{ ev.description or "No description." }}
    - Attendees:
      {% if ev.attendees|length > 0 %}
        {% for a in ev.attendees %}
        - {{ a }}
        {% endfor %}
      {% else %}
      - (No attendees)
      {% endif %}
  {% endfor %}
{% endif %}
{% endfor %}
]],
  },
}

3.CLI身份验证

cal2prompt执行OAuth 2.0流以获取身份验证凭据。有关详细的分步流程说明,请参阅 docs/setup-cli-auth

cal2prompt

将Claude Desktop与MCP集成

请将以下配置添加到 ~/Library/Application\ Support/Claude/claude_desktop_config.json:

  • 对于 mcpServers.cal2prompt.command:您必须指定通过运行以下命令获得的完整路径 which cal2prompt.
  • 对于 mcpServers.cal2prompt.env.HOME:由于Claude Desktop可能不会继承HOME环境变量,因此需要显式设置。
{
  "mcpServers": {
    "cal2prompt": {
      "command": "/Users/username/.cargo/bin/cal2prompt",
      "args": ["mcp"],
      "env": {
        "HOME": "/Users/username"
      }
    }
  }
}

配置

配置选项

变量名称必填描述默认值
settings.TZ真的安娜 时区格式。(例如。 America/Los_Angeles Asia/Tokyo)UTC
settings.oauthFilePathfalse临时存储OAuth2.0令牌的路径。通常,除非用户有自定义设置,否则不需要更改此设置~/.local/share/cal2prompt/oauth
source.google.oauth2.clientIDtrue用于使用Google日历API进行身份验证的Google OAuth2客户端ID。*(无默认值;必须指定)*
source.google.oauth2.clientSecrettrue用于使用Google日历API进行身份验证的Google OAuth2客户端机密。*(无默认值;必须指定)*
source.google.oauth2.scopesfalse授予Google OAuth 2.0客户端的范围。请参考 这里 对于范围的类型。\[https://www.googleapis.com/auth/calendar.events\]
source.google.oauth2.redirectURLfalse谷歌将向其发送响应的OAuth2回调URL"http://127.0.0.1:9004"
source.google.calendar.getEvents.calendarIDstrue一个或多个谷歌日历ID的列表,cal2prompt将从中获取事件。每个ID通常都可以在您的Google日历设置中找到。如果提供了多个ID,则将按时间顺序提取和组合每个日历中的事件。*(无默认值;必须指定)*
output.templatetrue一个字符串,定义获取的日历数据应如何格式化/输出。*(无默认值;必须指定)*
experimental.mcp.insertCalendarEvent.calendarIDfalse使用实验性MCP功能时将插入新事件的Google日历的ID。没有

环境

变量名称描述默认值
CAL2_PROMPT_CONFIG_FILE_PATH如果不想使用默认值,则指向自定义Lua配置文件的路径。~/.config/cal2prompt/config.lua

目录标签

目录标签

日程管理命令行工具RustClauderesearch-and-data本地部署GoogleCalendar集成模板引擎Rust开发

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

HTTP

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

HTTPnone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP