🌙 农历MCP服务器
人工智能应用中的中国农历
](https://www.python.org/downloads/)      ](https://pypi.org/project/lunar-mcp-server/)
20工具 | BaZi (八字) | 生肖 | 五行 | 月相 | 节日 | 吉祥日期
______________________________________________________________________
📖 概述
一个全面的模型上下文协议(MCP)服务器,提供基于中国文化传统的中国传统农历信息、吉祥日期检查和节日数据。
非常适合通过模型上下文协议将中国古代智慧整合到现代人工智能应用中。
✨ 特性
- 🎯 吉日分析 -检查有利日期,找到好日期,每日财富,生肖兼容性
- 🎊 节日信息 -中国节日、下一个节日、节日详情、年历
- 🌙 月相分析 -精确的月相、位置感知、活动影响、月历
- 📅 日历转换 -日月转换、生肖信息、文化融合
- 🔮 BaZi (八字) Four Pillars -出生图分析、命运计算、兼容性阅读
- ⚡ 高级工具 -批量检查、日期比较、幸运小时
🚀 30秒内快速启动
单线安装
最快的入门方法-无需安装Python:
# Install and run with uvx (recommended)
uvx lunar-mcp-server试试看
跑步后,您可以立即提出以下问题:
- “今天是举行婚礼的好日子吗?”
- “下一个中国节日是什么时候?”
- “如果我出生在1990年,我的生肖是什么?”
- “为我找到2024年3月搬家的3个吉祥日期”
- “计算我1990年05月15日14:30的八字”
- “检查我们的BaZi婚姻兼容性”
Claude桌面集成
添加到您的Claude Desktop配置(claude_desktop_config.json):
{
"mcpServers": {
"lunar-calendar": {
"command": "uvx",
"args": ["lunar-mcp-server"]
}
}
}然后重启克劳德桌面,开始询问农历信息!
其他安装方法
# 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🛠️ 可用工具
🎯 吉祥日期工具(4)
check_auspicious_date-检查日期是否合适find_good_dates-找到最佳日期get_daily_fortune-每日财富信息check_zodiac_compatibility-十二生肖兼容性
🎊 节日工具(4)
get_lunar_festivals-节日日期get_next_festival-下一个即将到来的节日get_festival_details-节日信息get_annual_festivals-年度日历
🌙 月相工具(4)
get_moon_phase-月相信息get_moon_calendar-月历get_moon_influence-活动影响predict_moon_phases-相位预测
📅 日历转换工具(3)
solar_to_lunar-太阳到月球的转换lunar_to_solar-月球到太阳的转换get_zodiac_info-十二生肖信息
🔮 BaZi (八字) Tools (2)
calculate_bazi-计算命运的四大支柱calculate_bazi_compatibility-八子兼容性分析
⚡ 高级工具(3)
batch_check_dates-检查多个日期compare_dates-比较日期get_lucky_hours-一天中的幸运时刻
🔮 BaZi (八字) - Four Pillars of Destiny
八卦特色提供了基于出生日期和时间的正宗中国传统算命。
巴子是什么?
八字,也被称为“四柱”或“八字”,是中国传统的占星术体系,根据一个人出生时的宇宙能量来分析他的命运和特征。每个人有四根柱子(年、月、日、时),每根柱子由两个字(天干和地支)组成,共八个字。
特性
- 完成四大支柱分析: Year (年柱), Month (月柱), Day (日柱), Hour (时柱)
- 天干地支: All 10 stems (天干) and 12 branches (地支)
- 五要素分析:木材、火、土、金属、配水和平衡
- Day Master (日主):你的核心要素和个性特征
- 人生阶段洞察:每个支柱如何影响不同的生命周期
- 要素建议:有利的颜色、方向和职业道路
- 兼容性分析:基于元素交互的关系和谐
- 时区支持:任何时区的精确计算
示例用法
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了解你的八字图
每个支柱代表你生活的不同方面:
- Year Pillar (年柱):祖先,早年(0-15岁),遗传特征
- 月柱:父母、青年(16-30岁)、职业发展
- Day Pillar (日柱):自我、配偶、中年(31-45岁)、婚姻
- Hour Pillar (时柱):儿童、晚年(46岁以上)、遗产
这 日间大师 (你的天柱)代表了你的核心自我,是八卦分析中最重要的元素。
元素关系
BaZi使用两个关键周期:
- 发电周期(生):木材→ Fire → 地球→ 金属→ 水→ Wood
- Control Cycle (克):木材→ 地球→ 水→ Fire → 金属→ Wood
这些关系决定了图表中的兼容性和元素平衡。
🏮 文化传统
基于中国传统历法:
- 农历 -传统阴阳历
- 十二生肖动物 -老鼠、牛、老虎、兔子、龙、蛇、马、山羊、猴子、鸡、狗、猪
- 五行 -木头、火、土、金属、水
- 28个月宫 -传统恒星划分
- 传统节日 -春节、中秋节、端午节等
📝 示例用法
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())输出示例
以下是您在查看吉祥日期时可以期待的内容:
{
"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"]
}🧪 测试
# Run comprehensive MCP server tests
./scripts/test_mcp_final.sh
# Run unit tests
uv run pytest --cov📦 出版
此服务器发布到:
- PyPI:
pip install lunar-mcp-server - Smithery.ai:
npx @smithery/cli install lunar-mcp-server*(即将推出)*
🛠️ 发展
# 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/📚 文档
- 📖 使用示例 -实例和集成指南
- 📖 工具参考 -完整的API文件
- 📖 文化传统 -了解中国历法系统
- 📖 测试指导 -运行和编写测试
- 📖 开发指南 -为项目做出贡献
- 📖 Smithery出版社 -发布到MCP注册表
📄 许可证
MIT许可证-请参阅 许可证 文件以获取详细信息。
🙏 致谢
致力于保存和分享传统日历智慧。
______________________________________________________________________
