Mcp.CN.Calendar
0.7.0
The VS Code MCP server configuration entry cannot be generated because the server.json file is invalid. Please refer to the package README and the MCP Configuration Guide for proper setup instructions.
dotnet tool install --global Mcp.CN.Calendar --version 0.7.0
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local Mcp.CN.Calendar --version 0.7.0
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Mcp.CN.Calendar&version=0.7.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package Mcp.CN.Calendar --version 0.7.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CN.Calendar MCP Server
基于CN.Calendar库的Model Context Protocol (MCP) 服务器,为AI助手提供丰富的中国农历、公历日期计算和查询功能。支持完整的中国传统节日、法定假期、二十四节气查询,以及复杂的工作日计算。
✨ 核心特性
🗓️ 基础日期工具 (BasicDateTools)
完整的日期转换和基础信息查询功能
- get_current_date - 获取当前日期详细信息(公历、农历、干支、星期等)
- convert_date - 公历和农历日期双向转换
- get_date_info - 获取指定日期的完整信息(节日、假期、工作日状态等)
- add_days - 日期加减天数计算,支持跨月跨年
💼 工作日查询工具 (WorkdayQueryTools)
精准的工作日和假期判断
- is_workday - 判断是否为工作日(考虑调休)
- is_weekend - 判断是否为周末
- is_holiday - 判断是否为法定节假日
- is_transfer_workday - 判断是否为调休工作日
- get_work_status - 获取完整工作状态信息
🎉 节日查询工具 (FestivalQueryTools)
涵盖传统节日、现代节日和国际节日
- get_festivals_by_date - 获取指定日期的节日信息
- get_festivals_by_month - 获取指定月份的所有节日
- get_festivals_by_year - 获取指定年份的节日概览
- search_festivals_by_name - 按名称智能搜索节日
- get_next_festivals - 获取下一个节日及倒计时
- get_previous_festivals - 获取上一个节日及天数
🏖️ 假期查询工具 (HolidayQueryTools)
中国法定假期完整数据支持
- get_holidays_by_date - 获取指定日期的假期信息
- get_next_holiday - 获取下一个假期及倒计时
- get_previous_holiday - 获取上一个假期
- get_holiday_schedule - 获取年度假期安排
- get_holidays_by_month - 获取月度假期安排
🌱 二十四节气查询工具 (SolarTermQueryTools)
传统农业文化中的重要时节
- get_solar_terms_by_year - 获取年度二十四节气完整列表
- get_next_solar_term - 获取下一个节气及倒计时
- get_solar_term_by_date - 获取指定日期的节气信息
- get_solar_terms_by_season - 获取指定季节的节气
🧮 高级计算工具 (AdvancedCalculationTools)
复杂的日期计算和分析功能
- get_workdays_between - 计算两个日期间的工作日数量
- get_date_range_info - 获取日期范围的详细信息
- countdown_to_date - 倒计时到指定日期,分析工作日和休息日
- find_special_dates - 查找日期范围内的特殊日期
📊 支持的数据类型
节日类型覆盖
- 🏮 传统节日 (traditional) - 春节、元宵节、清明节、端午节、七夕节、中秋节、重阳节等
- 🎄 西方节日 (west) - 圣诞节、情人节、万圣节、感恩节等
- 🚓 国家节日 (national) - 国庆节、劳动节、建军节、青年节等
- 🌍 国际节日 (international) - 国际妇女节、国际儿童节、国际读书日等
- 🌿 二十四节气 (solar_term) - 立春、雨水、惊蛰、春分、清明、谷雨等
假期类型
- 法定节假日:春节、清明节、劳动节、端午节、中秋节、国庆节等
- 调休安排:自动计算调休工作日和补偿休息日
- 周末识别:标准周六日休息日
日期格式支持
- 公历格式:yyyy-MM-dd (如:2025-10-01)
- 农历格式:yyyy-M-d-leap (如:2025-8-15,闰月标记为leap)
- 干支纪年:完整的天干地支年月日表示
- 星期显示:中英文星期表示
🚀 快速开始
环境要求
- .NET 10.0 或更高版本
- Model Context Protocol 支持的AI客户端
MCP客户端配置
在支持MCP的AI客户端中添加以下配置:
{
"mcpServers": {
"cn-calendar": {
"command": "dnx",
"args": ["Mcp.CN.Calendar", "-y"]
}
}
}
🔧 技术架构
核心依赖
- CN.Calendar - 核心日历计算库
- ModelContextProtocol - MCP协议实现
- Microsoft.Extensions.Hosting - 服务托管框架
- Microsoft.Extensions.DependencyInjection - 依赖注入容器
工具类结构
CN.Calendar.Mcp/
├── Tools/
│ ├── BasicDateTools.cs # 基础日期功能
│ ├── WorkdayQueryTools.cs # 工作日查询
│ ├── FestivalQueryTools.cs # 节日查询
│ ├── HolidayQueryTools.cs # 假期查询
│ ├── SolarTermQueryTools.cs # 节气查询
│ └── AdvancedCalculationTools.cs # 高级计算
├── Program.cs # 服务器入口
└── README.md # 项目文档
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.