Skip to main content

A comprehensive Chinese Lunar Calendar MCP server providing traditional Chinese lunar calendar information, auspicious date checking, and festival data

Project description

๐ŸŒ™ Lunar Calendar MCP Server

Traditional Chinese Lunar Calendar for AI Applications

Python Version License: MIT MCP Compatible CI codecov Tests PyPI version

20 Tools | BaZi (ๅ…ซๅญ—) | Chinese Zodiac | Five Elements | Moon Phases | Festivals | Auspicious Dates


๐Ÿ“– Overview

A comprehensive Model Context Protocol (MCP) server providing traditional Chinese lunar calendar information, auspicious date checking, and festival data based on Chinese cultural traditions.

Perfect for integrating ancient Chinese wisdom into modern AI applications through the Model Context Protocol.

โœจ Features

  • ๐ŸŽฏ Auspicious Date Analysis - Check favorable dates, find good dates, daily fortune, zodiac compatibility
  • ๐ŸŽŠ Festival Information - Chinese festivals, next festival, festival details, annual calendars
  • ๐ŸŒ™ Moon Phase Analysis - Accurate moon phases, location-aware, activity influence, monthly calendars
  • ๐Ÿ“… Calendar Conversions - Solar-lunar conversion, zodiac information, cultural integration
  • ๐Ÿ”ฎ BaZi (ๅ…ซๅญ—) Four Pillars - Birth chart analysis, destiny calculation, compatibility reading
  • โšก Advanced Tools - Batch checking, date comparison, lucky hours

๐Ÿ“š Complete Features List โ†’

๐Ÿš€ Quick Start in 30 Seconds

One-Line Installation

The fastest way to get started - no Python installation required:

# Install and run with uvx (recommended)
uvx lunar-mcp-server

Try It Out

Once running, you can immediately ask questions like:

  • "Is today a good day for a wedding?"
  • "When is the next Chinese festival?"
  • "What's my Chinese zodiac sign if I was born in 1990?"
  • "Find me 3 auspicious dates for moving house in March 2024"
  • "Calculate my BaZi (ๅ…ซๅญ—) for 1990-05-15 14:30"
  • "Check our BaZi compatibility for marriage"

Claude Desktop Integration

Add to your Claude Desktop configuration (claude_desktop_config.json):

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

Then restart Claude Desktop and start asking about lunar calendar information!

Alternative Installation Methods

# Using pip
pip install lunar-mcp-server
lunar-mcp-server

# Using uv
uv tool install lunar-mcp-server
lunar-mcp-server

# From source (for development)
git clone https://github.com/AngusHsu/lunar-mcp-server.git
cd lunar-mcp-server
uv sync
uv run lunar-mcp-server

๐Ÿ“– Detailed Usage Guide โ†’

๐Ÿ› ๏ธ Available Tools

๐ŸŽฏ Auspicious Date Tools (4)

  • check_auspicious_date - Check if date is favorable
  • find_good_dates - Find optimal dates
  • get_daily_fortune - Daily fortune info
  • check_zodiac_compatibility - Zodiac compatibility

๐ŸŽŠ Festival Tools (4)

  • get_lunar_festivals - Festivals on date
  • get_next_festival - Next upcoming festival
  • get_festival_details - Festival information
  • get_annual_festivals - Annual calendar

๐ŸŒ™ Moon Phase Tools (4)

  • get_moon_phase - Moon phase info
  • get_moon_calendar - Monthly calendar
  • get_moon_influence - Activity influence
  • predict_moon_phases - Phase predictions

๐Ÿ“… Calendar Conversion Tools (3)

  • solar_to_lunar - Solar to lunar conversion
  • lunar_to_solar - Lunar to solar conversion
  • get_zodiac_info - Zodiac information

๐Ÿ”ฎ BaZi (ๅ…ซๅญ—) Tools (2)

  • calculate_bazi - Calculate Four Pillars of Destiny
  • calculate_bazi_compatibility - BaZi compatibility analysis

โšก Advanced Tools (3)

  • batch_check_dates - Check multiple dates
  • compare_dates - Compare dates
  • get_lucky_hours - Lucky hours of day

๐Ÿ“– Complete API Reference โ†’

๐Ÿ”ฎ BaZi (ๅ…ซๅญ—) - Four Pillars of Destiny

The BaZi feature provides authentic traditional Chinese fortune-telling based on birth date and time.

What is BaZi?

BaZi (ๅ…ซๅญ—), also known as "Four Pillars of Destiny" or "Eight Characters," is a traditional Chinese astrological system that analyzes a person's destiny and characteristics based on the cosmic energies present at their birth. Each person has four pillars (year, month, day, hour), and each pillar consists of two characters (a Heavenly Stem and an Earthly Branch), totaling eight characters.

Features

  • Complete Four Pillars Analysis: Year (ๅนดๆŸฑ), Month (ๆœˆๆŸฑ), Day (ๆ—ฅๆŸฑ), Hour (ๆ—ถๆŸฑ)
  • Heavenly Stems & Earthly Branches: All 10 stems (ๅคฉๅนฒ) and 12 branches (ๅœฐๆ”ฏ)
  • Five Elements Analysis: Wood, Fire, Earth, Metal, Water distribution and balance
  • Day Master (ๆ—ฅไธป): Your core element and personality traits
  • Life Stage Insights: How each pillar influences different life periods
  • Element Recommendations: Favorable colors, directions, and career paths
  • Compatibility Analysis: Relationship harmony based on element interactions
  • Timezone Support: Accurate calculations for any timezone

Example Usage

from lunar_mcp_server.bazi import BaZiCalculator

calculator = BaZiCalculator()

# Calculate BaZi chart
result = await calculator.calculate_bazi("1990-05-15 14:30", timezone_offset=8)

print(f"Eight Characters: {result['eight_characters']}")
# Output: ๅบšๅˆไน™ๅทณไธ™ๅญไน™ๆœช

print(f"Day Master: {result['day_master']['element']} {result['day_master']['polarity']}")
# Output: Day Master: Fire Yang

# Check compatibility
compat = await calculator.get_compatibility(
    "1990-05-15 14:30",
    "1992-08-20 10:00",
    timezone_offset=8
)

print(f"Compatibility: {compat['compatibility_score']}/10 - {compat['compatibility_level']}")
# Output: Compatibility: 8/10 - Excellent
print(f"Relationship: {compat['element_relationship']}")
# Output: Wood generates Fire - supportive relationship

Understanding Your BaZi Chart

Each pillar represents different aspects of your life:

  • Year Pillar (ๅนดๆŸฑ): Ancestors, early life (0-15 years), inherited characteristics
  • Month Pillar (ๆœˆๆŸฑ): Parents, youth (16-30 years), career development
  • Day Pillar (ๆ—ฅๆŸฑ): Self, spouse, middle age (31-45 years), marriage
  • Hour Pillar (ๆ—ถๆŸฑ): Children, later life (46+ years), legacy

The Day Master (your day pillar's Heavenly Stem) represents your core self and is the most important element in BaZi analysis.

Element Relationships

BaZi uses two key cycles:

  • Generation Cycle (็”Ÿ): Wood โ†’ Fire โ†’ Earth โ†’ Metal โ†’ Water โ†’ Wood
  • Control Cycle (ๅ…‹): Wood โ†’ Earth โ†’ Water โ†’ Fire โ†’ Metal โ†’ Wood

These relationships determine compatibility and element balance in your chart.

๐Ÿ“– Complete API Reference โ†’

๐Ÿฎ Cultural Traditions

Based on traditional Chinese calendar systems:

  • Lunar Calendar - Traditional lunar-solar calendar
  • 12 Zodiac Animals - Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey, Rooster, Dog, Pig
  • Five Elements - Wood, Fire, Earth, Metal, Water
  • 28 Lunar Mansions - Traditional stellar divisions
  • Traditional Festivals - Spring Festival, Mid-Autumn, Dragon Boat, and more

๐Ÿ“– Cultural Traditions Guide โ†’

๐Ÿ“ Example Usage

Python API

import asyncio
from lunar_mcp_server import LunarMCPServer

async def main():
    server = LunarMCPServer()

    # Check if date is auspicious for wedding
    result = await server._check_auspicious_date(
        date="2024-03-15",
        activity="wedding",
        culture="chinese"
    )
    print(f"Auspiciousness: {result['auspicious_level']}")
    print(f"Score: {result['score']}/10")

asyncio.run(main())

Example Output

Here's what you can expect when checking an auspicious date:

{
  "date": "2024-03-15",
  "activity": "wedding",
  "auspicious_level": "Very Auspicious",
  "score": 8.5,
  "lunar_date": {
    "year": 2024,
    "month": 2,
    "day": 6,
    "zodiac": "Dragon",
    "element": "Wood"
  },
  "recommendations": [
    "Excellent day for new beginnings",
    "Dragon day brings good fortune",
    "Wood element supports growth"
  ],
  "lucky_hours": ["7-9 AM", "11 AM-1 PM", "5-7 PM"],
  "favorable_colors": ["red", "gold", "purple"],
  "things_to_do": ["Marriage ceremony", "Important contracts", "Grand openings"],
  "things_to_avoid": ["Funerals", "Moving house", "Starting construction"]
}

๐Ÿ“– More Examples โ†’

๐Ÿงช Testing

# Run comprehensive MCP server tests
./scripts/test_mcp_final.sh

# Run unit tests
uv run pytest --cov

๐Ÿ“– Testing Guide โ†’

๐Ÿ“ฆ Publishing

This server is published to:

  • PyPI: pip install lunar-mcp-server
  • Smithery.ai: npx @smithery/cli install lunar-mcp-server (coming soon)

๐Ÿ“– Publishing Guide โ†’

๐Ÿ› ๏ธ Development

# Clone and setup
git clone https://github.com/AngusHsu/lunar-mcp-server.git
cd lunar-mcp-server
uv sync --dev

# Code quality
uv run black src/ tests/
uv run ruff check src/ tests/
uv run mypy src/

๐Ÿ“– Development Guide โ†’

๐Ÿ“š Documentation

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ™ Acknowledgments

Built with dedication for preserving and sharing traditional calendar wisdom.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lunar_mcp_server-1.2.0.tar.gz (50.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lunar_mcp_server-1.2.0-py3-none-any.whl (54.6 kB view details)

Uploaded Python 3

File details

Details for the file lunar_mcp_server-1.2.0.tar.gz.

File metadata

  • Download URL: lunar_mcp_server-1.2.0.tar.gz
  • Upload date:
  • Size: 50.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lunar_mcp_server-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e23f19e018442bd5a07b1a97dbeae5cf602d95f1f7ca9740b909e3e9f4c1562b
MD5 f65327cadf89bf879fcc525b9c8bbfae
BLAKE2b-256 9fe1c26a1a2a9f572ce2cc33b52b6208de8a4cb1bd47ced8bb628a656430e2b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for lunar_mcp_server-1.2.0.tar.gz:

Publisher: publish.yaml on AngusHsu/lunar-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lunar_mcp_server-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lunar_mcp_server-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ddbf0a9f3b3f7200141ec2f2cb46b2d50ea4a8ae9b5a7365394069d4de466c9
MD5 cde0407be9f94ddedd0eb0e1b2f55403
BLAKE2b-256 80e690ec4d97cddafc6f8d2d7d6a760db4cec70833cef9e417402ee434a40ce7

See more details on using hashes here.

Provenance

The following attestation bundles were made for lunar_mcp_server-1.2.0-py3-none-any.whl:

Publisher: publish.yaml on AngusHsu/lunar-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page