TB

thiccboy-blip/calendar-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

0 stars 0 forks 质量 64 趋势 14

MCP服务器允许AI聊天客户端读取并预约日历。

概览

一个MCP服务器,允许AI聊天客户端。它通过标准JSON-RPC暴露了两个工具,所以任何MCP客户端(Opencode、Claude Desktop等)都能从普通聊天中安排会议。 - check_calendar(start_date,end_date,时区=无)——繁忙活动和每天免费30分钟时段- book_slot(人,日期,开始时间,duration_minutes=30,标题=无,时区=无)——预订时段,已有活动 服务器手动实现模型上下文协议,仅使用Python标准库——Windows上的tzdata用于时区支持。状态存在一个普通的JSON文件(calendar.json)。 “绝不重复书”规则是强制执行的,而不是在提示词中。book_slot 执行跨进程锁,重新读取每个事件,拒绝重叠,以原子方式写入(os.replace)——因此异常的模型或并发调用者无法制造冲突。时间是时区识别的(IANA 区),重叠则以绝对瞬时比较(DST 安全)。 客户端以 stdio 进程启动服务器。

概述(AI 翻译)

与客户端注册客户端作为 stdio 进程启动服务器。opencode 的示例opencode.json:

Claude Desktop 在 claude_desktop_config.json 中使用了相同的形状: 重启客户端,然后用正常语言询问:> 预订下周二10:00与Sam的30分钟。\n\n客户端可以拨打check_calendar检查空闲时段,使用find_slot获取跨时区最优列表及解释,然后book_slot预订。## 工具### find_slot(约束感知调度)\n\n|字段 |类型 |笔记 |\n|— |— |— |\n|duration_minutes |整数?|会议时长(默认30)|\n|start_date |字符串?|搜索第一天(默认为今天,组织者tz)|\n|end_date |字符串?|最后搜索日期(默认为+7天)|\n|max_results |整数?|返回多少个排名选项(默认5个)|\n|min_notice_minutes |整数?|最小交货时间(默认0)|\n\n阅读participants.json(包含时区、工作时间、缓冲区、事件、偏好的人员列表)。返回排序选项,包含local_times、score_breakdown和可读的reasons。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

calendar-mcpAn MCP server that lets an AI chat clientread and book a calendar. It exposes three tools over stdio JSON-RPC, so anyMCP client (opencode, Claude Desktop, …) can schedule meetings from a normalchat.- check_calendar(start_date, end_date, timezone=None) — busy events and free 30-minute slots per day; ind_slot ranks multi-person options with explanations- book_slot(person, date, start, duration_minutes=30, title=None, timezone=None) — books a slot, rejecting any overlap with an existing eventThe server implements the Model Context Protocol by hand with only the Pythonstandard library — nothing to install except tzdata on Windows fortimezone support. State lives in a plain JSON file (calendar.json).## Why it’s differentThe never-double-book rule is enforced in code, not in a prompt. book_slottakes a cross-process lock, re-reads every event, and refuses overlaps, writingatomically (os.replace) — so a misbehaving model or a concurrent caller cannotcreate a conflict. Times are timezone-aware (IANA zones), and overlaps arecompared as absolute instants (DST-safe).## Quick startbashpip install tzdata # Windows only; Linux/macOS already have the tz databasepython seed_calendar.py # write a sample calendar.json (dates relative to today)python mcp_server.py # run the MCP server on stdio (usually launched by a client)## Register with a clientThe client launches the server as a stdio process. Example for opencode’sopencode.json:json{ "$schema": "https://opencode.ai/config.json", "mcp": { "calendar-mcp": { "type": "local", "command": ["python", "calendar-mcp/mcp_server.py"], "enabled": true } }}Claude Desktop uses the same shape in claude_desktop_config.json:json{ "mcpServers": { "calendar-mcp": { "command": "python", "args": ["/absolute/path/to/calendar-mcp/mcp_server.py"] } }}Restart the client, then ask in normal language:> Book 30 minutes with Sam next Tuesday at 10:00.\n\nThe client can call check_calendar to inspect free slots, use find_slot to get a cross-timezone optimal list with explanations, and then book_slot to book.## Tools### find_slot (constraint-aware scheduling)\n\n| field | type | notes |\n| — | — | — |\n| duration_minutes | integer? | meeting length (default 30) |\n| start_date | string? | first day to search (defaults to today, organizer tz) |\n| end_date | string? | last day to search (defaults to +7 days) |\n| max_results | integer? | how many ranked options to return (default 5) |\n| min_notice_minutes | integer? | minimum lead time (default 0) |\n\nReads participants.json (list of people with timezones, working hours, buffers, events, preferences). Returns ranked options with local_times, score_breakdown, and human-readable reasons. Hard constraints (work days/hours, busy+buffer, min notice) are enforced; soft preferences (fairness across timezo

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →