Lunar Calendar MCP Server
This server provides comprehensive traditional Chinese lunar calendar functionality for AI applications, offering 20 tools across 6 categories.
🎯 Auspicious Date Analysis
Check if a date is auspicious for specific activities (weddings, business openings, travel, etc.) with a 0–10 score and detailed recommendations
Find the best dates in a date range for a given activity, ranked by auspiciousness
Get daily fortune based on the traditional Chinese almanac (通胜/黄历), including lucky directions, colors, and activity guidance
Check zodiac compatibility between two dates based on Chinese zodiac animals and five elements
🎊 Festival Information
Look up festivals occurring on a specific date (Spring Festival, Mid-Autumn, Dragon Boat, etc.)
Find the next upcoming festival from any reference date
Get in-depth details about a specific festival (history, customs, foods, significance)
Generate a full-year festival calendar with all traditional celebrations
🌙 Moon Phase Analysis
Get moon phase details for any date (phase name, illumination %, rise/set times), with location-aware calculations
View a monthly moon calendar showing daily phases and key lunar events
Analyze how the moon phase influences specific activities based on traditional lunar wisdom
Predict upcoming moon phase transitions (new moons, full moons, quarters) over a date range
📅 Calendar Conversions
Convert solar (Gregorian) dates to lunar calendar dates, including zodiac animal and heavenly stem/earthly branch info
Convert lunar dates back to solar dates, handling leap months correctly
Get Chinese zodiac information for any date (animal, element, traits, lucky numbers/colors)
🔮 BaZi (八字) Four Pillars of Destiny
Calculate a full BaZi chart from a birth date and time, including the eight characters, day master element, five elements balance, personality insights, and career suggestions
Analyze BaZi compatibility between two people for relationships or partnerships, with a compatibility score and element relationship analysis
⚡ Advanced / Utility Tools
Batch check multiple dates (up to 30) for auspiciousness in a single request, identifying the best and worst options
Compare multiple dates (up to 10) side-by-side across auspiciousness, moon phase, festivals, and zodiac dimensions
Get lucky hours for a specific day based on traditional Chinese 12 two-hour time periods, with activity-specific recommendations
All tools are accessible via MCP protocol, with Python API and CLI support, and can be easily integrated into AI applications like Claude Desktop.
Integrated with Codecov for tracking test coverage of the lunar calendar MCP server codebase.
Source code hosted on GitHub with CI/CD workflows for testing and code coverage tracking.
Distributed as a Python package on PyPI, allowing installation and usage of the lunar calendar MCP server via pip.
Uses Pytest for running unit tests and test coverage of the lunar calendar functionality.
Python-based MCP server providing lunar calendar calculations, auspicious date checking, BaZi analysis, and Chinese cultural tradition tools through a Python API.
Uses Ruff for code quality checking and linting during development.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Lunar Calendar MCP Server is tomorrow a good day to sign a contract?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🌙 Lunar Calendar MCP Server
Traditional Chinese Lunar Calendar for AI Applications
20 Tools | BaZi (八字) | Chinese Zodiac | Five Elements | Moon Phases | Festivals | Auspicious Dates
Standard CPython 3.11, 3.12, 3.13, and 3.14 are supported and tested. Python 3.14 free-threaded builds are not part of the v1.2.1 support guarantee.
📖 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.
Related MCP server: Bazi MCP
✨ 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
🚀 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-serverTry 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!
MCP compatibility
MCP Python SDK:
>=1.28.1,<2(the lockfile records the exact tested v1 release)Primary protocol:
2025-11-25Backward-compatible initialization:
2024-11-05Production transport: STDIO
MCP SDK v2, the prerelease 2026 protocol, and remote production transports are not part of the v1.2.1 compatibility contract.
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🛠️ Available Tools
🎯 Auspicious Date Tools (4)
check_auspicious_date- Check if date is favorablefind_good_dates- Find optimal datesget_daily_fortune- Daily fortune infocheck_zodiac_compatibility- Zodiac compatibility
🎊 Festival Tools (4)
get_lunar_festivals- Festivals on dateget_next_festival- Next upcoming festivalget_festival_details- Festival informationget_annual_festivals- Annual calendar
🌙 Moon Phase Tools (4)
get_moon_phase- Moon phase infoget_moon_calendar- Monthly calendarget_moon_influence- Activity influencepredict_moon_phases- Phase predictions
📅 Calendar Conversion Tools (3)
solar_to_lunar- Solar to lunar conversionlunar_to_solar- Lunar to solar conversionget_zodiac_info- Zodiac information
🔮 BaZi (八字) Tools (2)
calculate_bazi- Calculate Four Pillars of Destinycalculate_bazi_compatibility- BaZi compatibility analysis
⚡ Advanced Tools (3)
batch_check_dates- Check multiple datescompare_dates- Compare datesget_lucky_hours- Lucky hours of day
🔮 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 relationshipUnderstanding 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.
🏮 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
📝 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"]
}🧪 Testing
# Run comprehensive MCP server tests
./scripts/test_mcp_final.sh
# Run unit tests
uv run pytest --cov📦 Publishing
This server is published to:
PyPI:
pip install lunar-mcp-serverSmithery.ai:
npx @smithery/cli install lunar-mcp-server(coming soon)
🛠️ 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/📚 Documentation
📖 Usage Examples - Practical examples and integration guides
📖 Tools Reference - Complete API documentation
📖 Cultural Traditions - Understanding Chinese calendar systems
📖 Testing Guide - Running and writing tests
📖 Development Guide - Contributing to the project
📖 Smithery Publishing - Publishing to MCP registry
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
Built with dedication for preserving and sharing traditional calendar wisdom.
Available Tools
20 toolsbatch_check_datesA
Efficiently analyzes multiple dates simultaneously for a specific activity's auspiciousness. Processes up to 30 dates in a single request, returning scores and levels for each date. Also identifies and highlights the best and worst dates in the batch. This bulk analysis tool is perfect for quickly evaluating several potential dates for an event, comparing options across a non-continuous date range, or conducting comparative analysis of multiple candidates.
Inputs: dates (required), activity (required), culture.
calculate_baziA
Calculates BaZi (八字, Eight Characters) or Four Pillars of Destiny based on birth date and time. BaZi is a traditional Chinese fortune-telling method that analyzes the cosmic energies present at birth through four pillars (year, month, day, hour), each with a heavenly stem and earthly branch. Returns comprehensive analysis including: the eight characters, day master element, elemental balance, personality insights, life stage influences, favorable colors/directions, and career suggestions. Essential for understanding one's destiny, personality, and life path in Chinese metaphysics.
Inputs: birth_datetime (required), timezone_offset.
calculate_bazi_compatibilityA
Analyzes compatibility between two people based on their BaZi (Eight Characters) charts. Compares the four pillars and elemental compositions of both individuals to assess relationship harmony, strengths, and challenges. Returns compatibility score (0-10), compatibility level (Excellent/Good/Fair/Challenging), element relationship analysis, and detailed insights about how the two destinies interact. Traditionally used for marriage compatibility, business partnerships, or understanding relationship dynamics in Chinese culture.
Inputs: birth_datetime1 (required), birth_datetime2 (required), timezone_offset.
check_auspicious_dateA
Analyzes whether a specific date is favorable for particular activities based on traditional Chinese calendar principles, including zodiac signs, five elements, lunar mansions, and other cultural factors. Returns a comprehensive score (0-10), auspiciousness level (very_good/good/neutral/poor/very_poor), and detailed analysis including what the date is good for and what to avoid.
Inputs: date (required), activity (required), culture.
check_zodiac_compatibilityA
Analyzes the compatibility between two dates based on their Chinese zodiac animals and five elements. This is traditionally used for checking compatibility between birth dates for relationships, partnerships, or selecting compatible dates for joint ventures. Returns compatibility score, detailed analysis of how the zodiac signs interact, and recommendations.
Inputs: date1 (required), date2 (required), culture.
compare_datesA
Performs comprehensive side-by-side comparison of multiple dates (up to 10) across various dimensions. For each date, returns auspiciousness analysis (if activity specified), moon phase details, festivals occurring, and zodiac information. Presents all information in an organized comparative format, making it easy to see differences and similarities. If an activity is specified, also provides a recommendation for which date is most suitable. Ideal for final decision-making between several good options.
Inputs: dates (required), culture, activity.
find_good_datesA
Searches through a specified date range to identify the most auspicious dates for a particular activity. This tool evaluates each date in the range using traditional Chinese calendar methods and returns the top favorable dates ranked by their auspiciousness score. Ideal for planning important events like weddings, business openings, or travel. You can limit the number of results to get only the best options.
Inputs: activity (required), end_date (required), start_date (required), limit, +1 more.
get_annual_festivalsA
Generates a complete calendar of all traditional festivals for an entire year. Returns a chronologically ordered list of all cultural celebrations including their dates (both solar and lunar), names, and brief descriptions. Excellent for creating cultural event calendars, planning year-round celebrations, or understanding the annual rhythm of traditional observances.
Inputs: year (required), culture.
get_daily_fortuneA
Provides comprehensive daily fortune analysis based on traditional Chinese almanac (通胜/黄历). Returns detailed information about the day's general energy, lucky directions, favorable colors, what activities are suitable, what to avoid, and overall fortune predictions. This gives a holistic view of the day's auspiciousness beyond specific activities.
Inputs: date (required), culture.
get_festival_detailsA
Provides in-depth information about a specific traditional festival including its historical origins, cultural significance, traditional customs and practices, symbolic meanings, typical foods, activities, and how it's celebrated. Perfect for learning about cultural traditions or planning authentic festival celebrations.
Inputs: festival_name (required), culture.
get_lucky_hoursA
Identifies the most auspicious hours within a specific day based on traditional Chinese time divisions (12 two-hour periods corresponding to the 12 zodiac animals). Each period is analyzed and scored for general favorability and activity-specific suitability. Returns detailed information for each time period including its Chinese name, zodiac animal, auspiciousness score, suitable activities, and recommendations. Perfect for timing important activities, meetings, ceremonies, or decisions within a chosen date for maximum favorable energy.
Inputs: date (required), culture, activity.
get_lunar_festivalsA
Retrieves all traditional festivals and cultural celebrations occurring on a specific date. For Chinese culture, this includes major festivals like Spring Festival (Chinese New Year), Mid-Autumn Festival, Dragon Boat Festival, and many others. Returns festival names, significance, traditional customs, and cultural importance of each celebration.
Inputs: date (required), culture.
get_moon_calendarA
Creates a comprehensive monthly calendar showing moon phases for each day of the month. Displays daily moon phase names, illumination percentages, and highlights important lunar events (new moons, full moons, quarters). Perfect for gardening, fishing, photography planning, or any activities influenced by lunar cycles. Provides both visual and detailed numerical moon data.
Inputs: year (required), month (required), location.
get_moon_influenceA
Analyzes how the moon's phase on a specific date influences various activities based on traditional beliefs and lunar wisdom. Different moon phases are believed to affect activities differently - e.g., new moons for new beginnings, full moons for completion, waxing moons for growth activities. Returns recommendations on whether the lunar phase supports or hinders the specified activity, with detailed explanations of the lunar influence.
Inputs: date (required), activity (required).
get_moon_phaseB
Calculates precise moon phase information for a specific date and location using astronomical algorithms. Returns the moon phase name (new moon, waxing crescent, first quarter, waxing gibbous, full moon, waning gibbous, last quarter, waning crescent), illumination percentage, moon age in days, rise/set times, and position data. Location-aware calculations provide accurate local times.
Inputs: date (required), location.
get_next_festivalA
Finds the next upcoming traditional festival after a given reference date. Useful for planning ahead and understanding which cultural celebration is approaching. Returns the festival name, exact date when it occurs, days remaining until the festival, and brief information about its significance and traditions.
Inputs: date (required), culture.
get_zodiac_infoA
Retrieves comprehensive zodiac information for a specific date. For Chinese zodiac, returns the zodiac animal (one of 12: Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey, Rooster, Dog, Pig), associated element (Wood, Fire, Earth, Metal, Water), personality traits, compatible signs, lucky numbers, colors, and cultural significance. Provides both yearly and daily zodiac information based on the heavenly stems and earthly branches system.
Inputs: date (required), culture.
lunar_to_solarA
Converts traditional lunar calendar dates to Gregorian (solar) calendar dates. Accurately handles leap months and provides the exact solar date equivalent. Useful for determining when lunar-based festivals occur on the solar calendar, converting lunar birth dates to solar dates, or scheduling events based on lunar calendar information. Includes validation for proper lunar date formats.
Inputs: lunar_date (required), culture.
predict_moon_phasesA
Predicts and lists all major moon phase transitions (new moons, first quarters, full moons, last quarters) within a specified date range. Provides exact dates and times for each lunar phase event. Useful for planning activities around specific moon phases, scheduling lunar observations, or understanding the lunar cycle progression over time. Includes astronomical accuracy for reliable predictions.
Inputs: end_date (required), start_date (required).
solar_to_lunarA
Converts Gregorian (solar) calendar dates to traditional lunar calendar dates. Returns the corresponding lunar year, month, day, and leap month information if applicable. For Chinese calendar, also includes the year's zodiac animal, heavenly stem and earthly branch designations. Essential for finding lunar dates for traditional festivals, birth dates, or cultural events that follow the lunar calendar.
Inputs: solar_date (required), culture.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Each tool has a clearly distinct purpose: auspiciousness checks, festival lookups, moon phase calculations, calendar conversions, zodiac info, and BaZi analysis are all separate concerns. Even overlapping tools like check_auspicious_date vs find_good_dates differ by single-date vs range, and batch_check_dates vs compare_dates differ by single-dimension vs multi-dimension comparison.
Most tools follow a clear verb_noun snake_case pattern (check_, get_, find_, predict_, calculate_, compare_, batch_). The two conversion tools, solar_to_lunar and lunar_to_solar, deviate from the verb-first pattern but still maintain a consistent noun_to_noun style that is intuitive and unambiguous.
With 20 tools, the server covers a broad domain (conversion, festivals, moon phases, auspiciousness, zodiac, BaZi). While the count is heavy and might be better split into focused servers, each tool addresses a distinct need and none are redundant. The scope justifies the number, but it sits at the upper edge of reasonable.
The tool surface covers the core operations of a lunar calendar server: bidirectional date conversion, festival retrieval (single, next, annual, details), moon phase data (single, monthly, predictive, influence), auspiciousness analysis (single, range, batch, comparison), zodiac info, lucky hours, and BaZi (calculation and compatibility). Minor gaps include solar terms and holiday details beyond festivals, but these are not critical for the primary use cases.
Maintenance
Related MCP Connectors
Chinese almanac: lunar calendar, BaZi 八字, daily 宜忌, lucky-day picker, public holidays.
BaZi four pillars, Chinese zodiac, lunisolar calendar and almanac days for AI agents.
The Chinese almanac, lunar dates, Four Pillars, solar terms and the sky, calculated from astronomy.
China holidays and lunar calendar lookup, solar-to-lunar conversion and yearly schedule.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables 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.22 npmMIT
- AlicenseNot gradedqualityDmaintenanceProvides 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.172 npmISC
- AlicenseNot gradedqualityCmaintenanceProvides 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.3Apache 2.0
- AlicenseNot gradedqualityBmaintenanceProvides Chinese traditional calendar functions including BaZi calculation, solar-lunar calendar conversion, Huangli almanac queries, daily fortune readings, 24 solar terms, and Wu Xing (Five Elements) analysis.MIT