Skip to main content
Glama
BACH-AI-Tools

Lunar Calendar MCP Server

Lunar Calendar MCP Server

GitHub Repository PyPI version License: MIT Python 3.12+ MCP Server

äø­ę–‡ | English

A Model Context Protocol (MCP) server for Chinese traditional calendar functions, built with Python 3.12 and lunar-python.

One-Command Launch with UVX

uvx bach-lunar-mcp

That's it! No installation, no virtual environment setup, no dependencies to manage. UVX will automatically download and run the server.

Configure in Your MCP Client

Cursor IDE

{
  "mcpServers": {
    "lunar-calendar": {
      "command": "uvx",
      "args": ["bach-lunar-mcp"]
    }
  }
}

Claude Desktop

{
  "mcpServers": {
    "lunar-calendar": {
      "command": "uvx",
      "args": ["bach-lunar-mcp"]
    }
  }
}

Cherry Studio

{
  "mcpServers": {
    "lunar-calendar": {
      "command": "uvx",
      "args": ["bach-lunar-mcp"]
    }
  }
}

šŸ“¦ PyPI Package: https://pypi.org/project/bach-lunar-mcp/
šŸ“– Quick Start Guide: QUICKSTART_UVX.md


Related MCP server: Bazi MCP

Features

šŸŽ‹ BaZi Calculation - Calculate eight characters for fortune telling
šŸ“… Calendar Conversion - Convert between solar and lunar calendars
šŸŒ™ Huangli Query - Chinese almanac with daily recommendations
šŸ”® Daily Fortune - Daily fortune and recommendations
⭐ Solar Terms - Query 24 solar terms for any year
🧮 Wu Xing Analysis - Five elements analysis from birth info

Installation

Prerequisites

  • Python 3.12+

  • uv package manager

Setup

  1. Clone the repository:

git clone <repository-url>
cd lunar-mcp-server
  1. Install uv (if not already installed):

curl -LsSf https://astral.sh/uv/install.sh | sh
  1. Install project with dependencies:

uv sync

This will automatically:

  • Create a virtual environment with Python 3.12

  • Install all dependencies from pyproject.toml

  • Generate uv.lock for reproducible builds

Usage

As MCP Server

Configure in your MCP client (e.g., Claude Desktop):

{
  "mcpServers": {
    "lunar-calendar": {
      "command": "uv",
      "args": ["run", "python", "-m", "src.server"],
      "cwd": "/path/to/lunar-mcp-server"
    }
  }
}

Direct Usage

You can also use the helper functions directly:

# Run with uv
uv run python -c "
from src.utils import LunarHelper
result = LunarHelper.solar_to_lunar(2024, 1, 1)
print(result['lunar_date_chinese'])  # äŗŒć€‡äŗŒäø‰å¹“å†¬ęœˆäŗŒå
"

# Calculate BaZi
uv run python -c "
from src.utils import LunarHelper
result = LunarHelper.get_bazi(1990, 1, 1, 8, 30)
print(result['bazi_string'])  # 己巳 丙子 丙寅 壬辰
"

Available Tools

1. bazi_calculate

Calculate BaZi (Eight Characters) for fortune telling.

Parameters:

  • birth_date: Birth date in YYYY-MM-DD format

  • birth_time: Birth time in HH:MM format

Example:

{
  "birth_date": "1990-01-01",
  "birth_time": "08:30"
}

2. calendar_convert

Convert between solar and lunar calendars.

Parameters:

  • date: Date in YYYY-MM-DD format

  • convert_to: "lunar" or "solar"

  • is_leap: Is leap month (optional)

Example:

{
  "date": "2024-01-01",
  "convert_to": "lunar"
}

3. huangli_query

Query Chinese almanac information for a specific date.

Parameters:

  • date: Date in YYYY-MM-DD format

Example:

{
  "date": "2024-01-01"
}

4. fortune_daily

Get daily fortune and recommendations.

Parameters:

  • date: Date in YYYY-MM-DD format

Example:

{
  "date": "2024-01-01"
}

5. jieqi_query

Query 24 solar terms for a specific year.

Parameters:

  • year: Year to query

Example:

{
  "year": 2024
}

6. wuxing_analyze

Analyze Wu Xing (Five Elements) from birth information.

Parameters:

  • birth_date: Birth date in YYYY-MM-DD format

  • birth_time: Birth time in HH:MM format

Example:

{
  "birth_date": "1990-01-01",
  "birth_time": "08:30"
}

Development

Running Tests

# Quick functionality test
uv run python quick_test.py

# Run MCP server
uv run python run_server.py

# Test specific functionality
uv run python -c "from src.utils import LunarHelper; print('āœ… Import works!')"

# Install dev dependencies (optional)
uv add --dev pytest black mypy

Code Formatting

# Format code
black src/
isort src/

# Type checking
mypy src/

Dependencies

  • mcp: Model Context Protocol implementation

  • lunar-python: Chinese lunar calendar library

  • pydantic: Data validation and settings management

Contributing

  1. Fork the repository

  2. Create your feature branch

  3. Commit your changes

  4. Push to the branch

  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • lunar-python - Excellent Chinese lunar calendar library

  • MCP - Model Context Protocol specification


Note: This is a traditional calendar tool for educational and entertainment purposes. Please use responsibly.

A
license - permissive license
-
quality - not tested
D
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
    D
    maintenance
    Enables traditional Chinese fortune-telling through BaZi (Four Pillars) analysis, including solar/lunar date conversion, Five Element balance calculations, Ten Gods deduction, and destiny interpretation for metaphysics applications.
    18
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    Provides accurate Chinese Bazi (八字) fortune-telling calculations including birth chart analysis, destiny forecasting, and Chinese calendar information. Addresses inaccuracies in existing AI fortune-telling tools by delivering precise Bazi data for personality analysis and metaphysical insights.
    224
    ISC
  • A
    license
    -
    quality
    B
    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
    A
    maintenance
    Provides traditional Chinese lunar calendar information including auspicious date checking, BaZi (八字) Four Pillars analysis, festival data, moon phases, zodiac compatibility, and calendar conversions based on Chinese cultural traditions.
    20
    2
    MIT

View all related MCP servers

Related MCP Connectors

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

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

  • BaZi (Chinese Four Pillars) chart calculator. Structured chart data only, no predictions.

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/BACH-AI-Tools/lunar_mcp_server'

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