Skip to main content
Glama
Zojekin

tyme-bazi-mcp

by Zojekin

tyme-bazi-mcp

English | 繁體中文

English

tyme-bazi-mcp is a Windows-local stdio MCP server for Chinese calendar and Four Pillars calculations, powered by Tyme4py.

It provides deterministic calendar and Four Pillars calculations through the official Python MCP SDK's FastMCP. The server uses the stdio transport and does not implement HTTP.

This project calculates calendar and Four Pillars data only. It does not provide fortune-telling interpretations, life predictions, date-selection recommendations, auspiciousness explanations, or diary writing.

Related MCP server: shunshi-bazi-mcp

Requirements

  • Python >=3.10

  • uv

  • An MCP client that supports stdio servers

The project dependencies are pinned by uv.lock:

  • tyme4py==1.5.0

  • mcp==1.26.0

Installation

Clone the repository and synchronize the environment with uv:

git clone https://github.com/Zojekin/tyme-bazi-mcp.git
cd tyme-bazi-mcp
uv sync

uv sync creates or updates the project environment according to pyproject.toml and uv.lock.

Running the server

Start the stdio MCP server with:

uv run python server.py

The process communicates through standard input and standard output. Do not treat its stdout as a human-readable command-line interface; an MCP client should manage the protocol connection.

MCP client configuration

Configure your MCP client as a local stdio server. The exact configuration format depends on the client, but the command and arguments are:

  • Command: uv

  • Arguments: run --directory <absolute-path-to-repository> python server.py

For example, the equivalent command is:

uv run --directory C:\path\to\tyme-bazi-mcp python server.py

If the client requires separate fields, place uv in the command field and each item in run, --directory, the repository path, python, and server.py in the arguments list. Follow the configuration syntax documented by your MCP client; this README intentionally does not assume a client-specific schema.

Tools

The server exposes four MCP tools:

get_day_pillars

Returns the date-level year, month, and day pillars. This is a three-pillar result and does not generate a time pillar.

get_four_pillars

Calculates the year, month, day, and time pillars, as well as the complete Four Pillars result, from an exact local civil time. It also returns contextual information around the relevant solar-term boundary.

get_calendar_context

Returns date-level calendar context, including:

  • Solar terms

  • The previous, current, and next solar terms

  • Solar-term times

  • Solar-term day sequence information

  • is_jie and is_qi

  • Jianchu Twelve Officers (建除十二值神)

This tool does not provide date-selection recommendations, auspiciousness judgments, or explanations of what is suitable or unsuitable for a date.

get_natural_calendar_context

Returns natural-calendar context including:

  • The 72 pentads

  • Moon phases

  • The Three Fu periods

  • The Nine Nine period

Items that do not apply to the requested date return a structured inactive status rather than being silently omitted.

Calculation rules and input formats

The server currently applies these fixed rules:

  • Only timezone=Asia/Shanghai is accepted.

  • Only time_mode=civil is accepted.

  • True solar time is not used.

  • The day pillar changes at 23:00:00, with times from 23:00:00 treated according to the next day for day-pillar calculation.

  • A date-level solar-term label must not be used as a substitute for precise-time Four Pillars boundary evaluation.

  • Date input uses YYYY-MM-DD.

  • Local date-time input uses YYYY-MM-DDTHH:mm:ss.

  • Invalid input is not silently corrected.

  • The server does not automatically add a missing time or seconds.

Results include engine-version, rule, and semantic-layer information so that consumers can distinguish date-level context from precise-time Four Pillars calculations.

Testing

Run the test suite with:

uv run pytest

Run the stdio smoke test with:

uv run python tests/stdio_smoke.py

Optional Windows deployment

If you want to use the included Windows PowerShell publishing script, run:

powershell -ExecutionPolicy Bypass -File .\publish.ps1

The script runs pre-release and post-release tests together with the stdio smoke test. If a publishing step fails, it rolls back the changes made by the script.

Project scope

This project is limited to deterministic Chinese calendar and Four Pillars calculations. It does not perform:

  • Fortune-telling interpretations

  • Life or personality predictions

  • Date-selection recommendations

  • Auspiciousness explanations or judgments

  • Diary or note writing

Attribution and license

This project depends on Tyme4py, an independent MIT-licensed project by 6tail:

This project uses Tyme4py as a dependency and does not copy its source code.

This project is licensed under the MIT License. See LICENSE.

Copyright (c) 2026 Zojekin


繁體中文

tyme-bazi-mcp 是一個運行於 Windows 本機的 stdio MCP 服務,用於執行中國曆法和四柱計算,底層由 Tyme4py 提供支援。

項目使用官方 Python MCP SDK 的 FastMCP 實現 MCP 服務,通過 stdio 傳輸與客戶端通信,不實現 HTTP 服務。

本項目只進行曆法和四柱的確定性計算,不提供命理斷語、人生預測、擇日宜忌、吉凶解釋或日記寫入功能。

環境要求

  • Python >=3.10

  • uv

  • 支援 stdio 服務的 MCP 客戶端

項目依賴由 uv.lock 鎖定:

  • tyme4py==1.5.0

  • mcp==1.26.0

安裝

克隆倉庫,並使用 uv 同步項目環境:

git clone https://github.com/Zojekin/tyme-bazi-mcp.git
cd tyme-bazi-mcp
uv sync

uv sync 會根據 pyproject.tomluv.lock 創建或更新項目環境。

啟動服務

使用以下命令啟動 stdio MCP 服務:

uv run python server.py

進程通過標準輸入和標準輸出進行 MCP 協議通信。不要把 stdout 當作面向使用者的命令行界面;應由 MCP 客戶端管理協議連接。

MCP 客戶端配置

請將本項目配置為本地 stdio 服務。具體配置格式取決於客戶端,但命令和參數如下:

  • 命令:uv

  • 參數:run --directory <倉庫絕對路徑> python server.py

對應的命令示例:

uv run --directory C:\path\to\tyme-bazi-mcp python server.py

如果客戶端要求分別填寫 command 和 args 欄位,請將 uv 填入 command,並按順序將 run--directory、倉庫路徑、pythonserver.py 填入參數列表。請遵循所用 MCP 客戶端的配置語法;本文檔不假定某個客戶端的專用配置格式。

MCP 工具

服務提供以下四個 MCP 工具:

get_day_pillars

返回日期級的年柱、月柱和日柱。這是三柱結果,不生成時柱。

get_four_pillars

根據精確的本地民用時間計算年柱、月柱、日柱、時柱和完整八字,並返回相關節氣邊界的上下文信息。

get_calendar_context

返回日期級曆法上下文,包括:

  • 節氣

  • 前一個、當前和後一個節氣

  • 節氣時間

  • 節氣日序信息

  • is_jieis_qi

  • 建除十二值神

該工具不提供擇日建議、吉凶判斷,也不解釋某個日期宜做或不宜做什麼。

get_natural_calendar_context

返回自然曆法上下文,包括:

  • 七十二候

  • 月相

  • 三伏天

  • 數九

對於不適用於請求日期的項目,結果會返回結構化的 inactive 狀態,而不是靜默省略該項目。

計算規則和輸入格式

服務目前採用以下固定規則:

  • 只接受 timezone=Asia/Shanghai

  • 只接受 time_mode=civil

  • 不使用真太陽時。

  • 日柱在 23:00:00 起切換;進行日柱計算時,23:00:00 及之後的時間按下一天處理。

  • 日期級節氣標籤不能替代精確時刻的四柱邊界判斷。

  • 日期輸入格式為 YYYY-MM-DD

  • 本地日期時間輸入格式為 YYYY-MM-DDTHH:mm:ss

  • 不會靜默修正非法輸入。

  • 不會自動補充缺失的時間或秒數。

結果會包含引擎版本、計算規則和語義層級信息,便於調用方區分日期級上下文與精確時刻四柱計算。

測試

運行測試套件:

uv run pytest

運行 stdio smoke test:

uv run python tests/stdio_smoke.py

可選的 Windows 部署

如需使用隨附的 Windows PowerShell 發布腳本,請運行:

powershell -ExecutionPolicy Bypass -File .\publish.ps1

該腳本會執行發布前測試、發布後測試以及 stdio smoke test。若發布步驟失敗,腳本會回滾其所作的更改。

項目範圍

本項目僅用於中國曆法和四柱的確定性計算,不執行以下工作:

  • 命理斷語或其他命理解釋

  • 人生或性格預測

  • 擇日宜忌建議

  • 吉凶解釋或判斷

  • 日記或筆記寫入

歸屬與許可證

本項目依賴由 6tail 獨立開發的 MIT 許可證項目 Tyme4py:

本項目將 Tyme4py 作為依賴使用,不複製其源代碼。

本項目採用 MIT 許可證,詳見 LICENSE

Copyright (c) 2026 Zojekin

Install Server
A
license - permissive license
B
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    C
    maintenance
    Provides professional Chinese astrology calculations including Four Pillars, Five Elements, zodiac signs, and lunar calendar details. It allows users to perform accurate Bazi analysis with global timezone support directly within MCP-compatible clients.
    Last updated
    16
    10
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Bazi (Four Pillars) charting MCP server with true solar time correction and multilingual output in Chinese, English, Japanese, and Korean.
    Last updated
    1
    9
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    MCP server for accurate Bazi calculations, enabling personality analysis, destiny forecasting, and Chinese calendar queries via AI agents.
    Last updated
    184
    ISC

View all related MCP servers

Related MCP Connectors

  • Generate BaZi charts from birth details. Explore Four Pillars, solar terms, and Luck Pillars for d…

  • Chinese almanac: lunar calendar, BaZi 八字, daily 宜忌, lucky-day picker, public holidays.

  • Chinese metaphysics (bazi, qimen, 5-element) as decision-support tools for AI agents.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Zojekin/tyme-bazi-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server