Skip to main content
Glama
mcp-chinese-holiday

mcp-chinese-holiday

by kyrenbo

🗓️ mcp-chinese-holiday

CI Python License MCP

中国法定节假日与调休查询 MCP Server

Chinese statutory holidays & adjusted workdays query server for the Model Context Protocol.

让 AI 助手准确回答"下周五是工作日吗""春节放几天""请 2 天假能连休几天"这类问题——内置官方调休数据,自动处理周末补班日。

功能 · 快速开始 · 工具列表 · English


✨ 功能

  • 6 个查询工具:单日判定、工作日判断、假期倒计时、下一工作日、全年假期、区间工作日统计

  • 官方数据:收录国务院办公厅年度通知的完整放假调休安排(2024-2026),逐条对照原文录入

  • 懂调休:全国独有痛点——春节后的周六要上班、清明节借的周日要还,统统算对

  • 容错输入:2026-01-01、2026/1/1、20260101、今天、明天 均可解析

  • 数据校验:40+ 单元测试含「调休总账平衡」校验(周内放假日数 − 补班日数必须等于法定假日总数),录入错误直接测试失败

  • 纯本地:无外部 API 依赖,无网络请求,数据内置

Related MCP server: Lunar Calendar MCP Server

🚀 快速开始

安装

# 从源码安装(推荐,发布 PyPI 后可用 uvx / pipx)
git clone https://github.com/kyrenbo/mcp-chinese-holiday.git
cd mcp-chinese-holiday
pip install .

MCP 客户端配置

编辑配置文件(macOS: ~/Library/Application Support/Claude/claude_desktop_config.json;Windows: %APPDATA%\Claude\claude_desktop_config.json):

{
  "mcpServers": {
    "chinese-holiday": {
      "command": "python",
      "args": ["-m", "chinese_holiday_mcp.server"]
    }
  }
}
{
  "mcpServers": {
    "chinese-holiday": {
      "command": "python",
      "args": ["-m", "chinese_holiday_mcp.server"]
    }
  }
}

命令行直接运行

chinese-holiday-mcp --version   # 或 python -m chinese_holiday_mcp.server

🛠️ 工具列表

工具

说明

示例提问

check_date

单日类型判定(工作日/周末/节假日/调休上班日)

"2026-02-28 是什么日子?"

is_workday

是否需要上班

"下周五要上班吗?"

next_holiday

距下一个假期还有几天

"离春节还有多少天?"

next_workday

下一个工作日

"春节后哪天上班?"

get_holidays

全年假期安排

"2026 年春节放几天?"

count_workdays

区间实际工作日统计

"请 3 天假能连休几天?"

对话示例

用户:2026 年春节后第一个周六要不要上班?

AI(调用 is_workday):要上班。2026-02-28 是周六,但属于「春节调休上班日」——2026 年春节假期为 2 月 15 日至 23 日共 9 天,需在 2 月 14 日和 2 月 28 日两个周六补班。

📊 数据来源与更新

年份

依据

状态

2024

国办发明电〔2023〕7 号

✅ 已收录

2025

国办发明电〔2024〕7 号

✅ 已收录

2026

国办发明电〔2025〕7 号

✅ 已收录

  • 国务院办公厅通常于每年 10-11 月发布次年安排(中国政府网)

  • 更新数据只需修改 src/chinese_holiday_mcp/data.py(结构说明见文件头注释),测试套件中的「调休总账」校验会自动检查录入是否自洽

  • 欢迎提交 PR 帮助补充新年份数据

🧪 开发与测试

git clone https://github.com/kyrenbo/mcp-chinese-holiday.git
cd mcp-chinese-holiday
pip install -e .[dev]

pytest        # 40+ 测试,含数据完整性与调休平衡校验
ruff check .  # 代码检查

🔄 版本历史

详见 CHANGELOG.md。

📄 许可证

MIT


English

mcp-chinese-holiday is a Model Context Protocol server that answers Chinese statutory holiday and adjusted-workday questions, so AI assistants can correctly handle China's unique "swap weekends for longer holidays" (调休) system.

Tools

check_date · is_workday · next_holiday · next_workday · get_holidays · count_workdays

Why

China's holiday schedule shifts weekends around holidays (e.g., working on a Saturday after Spring Festival). Generic calendar answers are wrong; this server embeds the official annual schedules published by the State Council (2024-2026) and handles all edge cases.

Data quality

Unit tests enforce an annual balance invariant: (weekdays off inside holiday periods) − (compensating weekend workdays) must equal the statutory paid-holiday total (13 days since 2025, 11 before). Data entry mistakes break the build.

Install

git clone https://github.com/kyrenbo/mcp-chinese-holiday.git
cd mcp-chinese-holiday && pip install .

Then register in your MCP client config:

{ "mcpServers": { "chinese-holiday": { "command": "python", "args": ["-m", "chinese_holiday_mcp.server"] } } }

Licensed under MIT.

Available Tools

6 tools
check_dateA

查询某一天是工作日、周末、法定节假日还是调休上班日。

Args: date_str: 日期,支持 2026-01-01 / 2026/1/1 / 20260101 / 今天 / 明天

Returns: JSON:日期、星期、类型、所属假期、是否休息

Inputs: date_str (required). Returns: result

count_workdaysB

统计日期区间内的实际工作日天数(自动排除节假日、计入调休补班日)。

Args: start_date: 开始日期(含) end_date: 结束日期(含)

Returns: JSON:区间工作日/休息日天数统计

Inputs: end_date (required), start_date (required). Returns: result

get_holidaysA

获取某一年全部法定假期安排(含调休补班日)。

Args: year: 年份,如 2026

Returns: JSON:全年假期列表

Inputs: year (required). Returns: result

is_workdayA

判断某一天是否需要上班/上学(考虑节假日与调休)。

Args: date_str: 日期,支持多种写法与"今天/明天"

Returns: JSON:is_workday 布尔结果及判定依据

Inputs: date_str (required). Returns: result

next_holidayB

查询距离下一个法定假期还有多少天。如果当天正在假期中,返回当前假期本身。

Args: date_str: 起算日期,默认"今天"

Returns: JSON:假期名称、起止日期、天数、距离

Inputs: date_str. Returns: result

next_workdayB

查询从某天开始(含当天)的下一个需要上班的日期。

Args: date_str: 日期

Returns: JSON:下一个工作日及星期

Inputs: date_str (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 6 tools

    Disambiguation3/5

    Most tools target clearly different questions (next holiday, next workday, yearly holiday list, workday counting), but check_date and is_workday overlap heavily: both answer 'what is this date / do I work'. The descriptions differentiate them (full classification vs boolean), but an agent asking 'is 2026-05-01 a workday?' could reasonably pick either.

    Naming Consistency4/5

    All names are snake_case and follow a verb/qualifier + noun pattern (next_holiday, get_holidays, count_workdays, check_date, is_workday). The mix of get_/count_/check_/is_/next_ is a minor deviation but remains readable and predictable.

    Tool Count4/5

    Six tools is a well-scoped size for a holiday-calendar domain, covering lookup, counting, and navigation. One slot (is_workday) is arguably a thinner restatement of check_date, so the set is slightly padded rather than minimal.

    Completeness4/5

    Core workflows are covered: yearly holiday data, date classification, workday counting, and forward navigation to the next holiday/workday. Minor gaps exist, such as listing holidays within an arbitrary date range or looking up a holiday by name, but agents can derive these from get_holidays and count_workdays.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides Chinese holiday information, lunar calendar conversion, traditional festivals, 24 solar terms, and BaZi (Eight Characters) calculations for AI assistants to accurately handle Chinese calendar queries and date conversions.
      3
      Apache 2.0
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to perform Japanese business calendar calculations including holiday detection, business day arithmetic, payment date settlement, and deadline management using local data.
      6
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to query China's statutory public holidays and makeup-workday schedules, and convert solar dates to lunar dates with zodiac and ganzhi details.
      MIT