伦菲尔德mcp日历
用于日历访问的统一MCP服务器--连接 交易所(EWS), 谷歌日历,以及 CalDAV (Nextcloud、ownCloud、Radical)通过单一 模型上下文协议 界面。
特性
- 多日历 --通过YAML配置多个日历帐户,单独或一次性查询它们
- 跨日历合并 —
list_events如果没有日历参数,则返回按时间顺序排序的所有日历中的事件 - 三个后端 -Exchange Web服务(EWS)、Google日历API、CalDAV
- 配置中没有密码 --通过环境变量名引用的凭据
- 延迟连接 --后端客户端在首次使用时初始化,而不是在启动时初始化
- 异步就绪 --所有阻塞I/O都用
asyncio.run_in_executor - 谷歌OAuth2助手 --内置
--auth googleCLI用于初始令牌设置
安装
pip install renfield-mcp-calendar或者直接从GitHub:
pip install "renfield-mcp-calendar @ https://github.com/ebongard/renfield-mcp-calendar/archive/refs/heads/main.tar.gz"配置
集 CALENDAR_CONFIG 指向您的YAML配置文件(默认值: /config/calendar_accounts.yaml).
示例 calendar_accounts.yaml
calendars:
# Exchange 2019 (on-premise, direct EWS endpoint)
- name: work
label: "Work Calendar"
type: ews
ews_url: "https://exchange.example.com/EWS/Exchange.asmx"
username_env: CALENDAR_WORK_USERNAME
password_env: CALENDAR_WORK_PASSWORD
# Google Calendar (OAuth2 Desktop Flow)
- name: family
label: "Family Calendar"
type: google
calendar_id: "primary"
credentials_file: "/config/google_calendar_credentials.json"
token_file: "/data/google_calendar_token.json"
# Nextcloud / CalDAV
- name: club
label: "Club Calendar"
type: caldav
url: "https://nextcloud.example.com/remote.php/dav/calendars/user/club/"
username_env: CALENDAR_CLUB_USERNAME
password_env: CALENDAR_CLUB_PASSWORD安全: 密码和令牌是 从不 存储在YAML文件中--使用 *_env 引用环境变量名的字段。
后端特定注意事项
| 后端 | 库 | 身份验证 | 注释 |
|---|---|---|---|
| 早期预警系统 | 交换库 | NTLM/基本 | 直接EWS URL,无需自动发现 |
| 谷歌 | googleapi-python客户端 | OAuth2桌面流 | 令牌自动刷新,一次性浏览器身份验证 |
| CalDAV | 卡尔达夫 | 基本授权 | 适用于Nextcloud、ownCloud、Radical等。 |
谷歌日历设置(一次性)
- Google 云控制台 → 创建项目→ 启用 谷歌日历API
- 创建 OAuth2凭据 (桌面应用程序)→ 下载
credentials.json - 地点为
google_calendar_credentials.json在您的配置目录中 - 运行身份验证流:
python -m renfield_mcp_calendar --auth google --calendar family- 完成基于浏览器的授权——令牌会自动保存
MCP工具
| 工具 | 参数 | 说明 |
|---|---|---|
list_calendars | -- | 列出所有已配置的日历帐户 |
list_events | calendar?, start, end | 一个或所有日历中的事件。空 calendar =从所有中合并。 |
create_event | calendar, title, start, end, description?, location? | 创建新事件 |
update_event | calendar, event_id, title?, start?, end?, ... | 更新事件的特定字段 |
delete_event | calendar, event_id | 删除事件 |
get_event | calendar, event_id | 获取一个包含完整细节的单一活动 |
示例查询(通过LLM)
- *“今天怎么样?”* →
list_events()(所有日历,今天) - *“本周公司日历上有什么?”* →
list_events(calendar="work", start="...", end="...") - *“明天下午2点做一个家庭约会:牙医”* →
create_event(calendar="family", ...) - *“明天下午我有空吗?”* →
list_events(start="...", end="...")
用法
# Run as MCP server (stdio transport)
python -m renfield_mcp_calendar
# Or via entry point
renfield-mcp-calendar
# Google OAuth2 setup (one-time)
python -m renfield_mcp_calendar --auth google --calendar family克劳德桌面/MCP客户端配置
{
"mcpServers": {
"calendar": {
"command": "python",
"args": ["-m", "renfield_mcp_calendar"],
"env": {
"CALENDAR_CONFIG": "/path/to/calendar_accounts.yaml",
"CALENDAR_WORK_USERNAME": "user@example.com",
"CALENDAR_WORK_PASSWORD": "secret"
}
}
}
}发展
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests (29 tests)
pytest tests/ -v许可证
麻省理工学院
