PyJHora MCP服务器
特点——22个MCP工具
| 类别 | 工具 |
|---|---|
| 🗓️ 潘昌加 | get_panchanga, get_sunrise_sunset, get_rahu_kala, get_muhurtha, get_planet_positions, get_festivals |
| 🌟 星座运势 | get_rasi_chart, get_divisional_chart, get_special_lagnas, get_ashtakavarga, get_bhava_chart |
| 📅 达莎 | get_vimsottari_dasha, get_yogini_dasha, get_ashtottari_dasha, get_narayana_dasha |
| 💑 兼容性 | get_compatibility |
| 🔯 瑜伽和多沙 | get_yogas, get_doshas, get_raja_yogas |
| 💪 力量 | get_shadbala, get_bhava_bala, get_vimsopaka_bala |
先决条件
- Python 3.12+
- 紫外线 包管理器
- 星历数据文件 (见下文——关键!)
⚠️ 星历数据设置(必填)
PyJHora v3.6.6+版本 非 捆 .se1 PyPI包中的瑞士星历数据文件。没有它们,所有的计算都会失败。
下载并安装:
# 1. Clone PyJHora temporarily to get the ephe files
git clone --depth 1 https://github.com/naturalstupid/pyjhora.git /tmp/pyjhora
# 2. Find where PyJHora was installed in your venv
python -c "import jhora; import os; print(os.path.dirname(jhora.__file__))"
# Example output: C:\Users\admin\Desktop\projects\pyjhora-mcp\.venv\Lib\site-packages\jhora
# 3. Copy ephemeris files into the package (Windows example)
xcopy /E /I /Y /tmp/pyjhora/src/jhora/data/ephe ".venv\Lib\site-packages\jhora\data\ephe"
# 4. Clean up
rm -rf /tmp/pyjhora或者,只下载 ephe/ 文件夹直接来自 .
安装
# Clone this repo and enter the project
git clone
cd pyjhora-mcp
# Create virtual environment
uv venv
.venv\Scripts\activate # Windows
# source .venv/bin/activate # Linux/macOS
# Install the package and all dependencies
uv pip install -e ".[dev]"Windows注释: pyswisseph 需要C++编译器。安装 Visual Studio 生成工具 如果遇到编译错误。运行服务器
# stdio transport (default — for Claude Desktop, Cursor, etc.)
fastmcp run src/pyjhora_mcp/server.py
# HTTP transport (for debugging / browser testing)
fastmcp run src/pyjhora_mcp/server.py --transport http --port 8000
# Or using the installed script
pyjhora-mcpVPS服务安装(systemd+Cady)
此存储库包含一个可以安装和卸载的自我管理安装程序脚本:
- Python运行时依赖关系
- systemd服务(
pyjhora-mcp.service) - 带有反向代理的球童
pyjhora-mcp.lairfrost.dev
从项目根目录在您的VPS上运行:
chmod +x deploy-service.sh
sudo bash ./deploy-service.sh install有用的命令:
sudo bash ./deploy-service.sh status
sudo bash ./deploy-service.sh logs
sudo bash ./deploy-service.sh uninstall可选覆盖:
sudo DOMAIN=pyjhora-mcp.lairfrost.dev APP_PORT=8000 bash ./deploy-service.sh installCaddy代码片段模板也包含在 deploy/pyjhora-mcp.Caddyfile.
VPS上的身份验证(渲染奇偶校验)
您现有的身份验证流仍然适用于VPS:
- 客户端发送
Authorization: Bearer - 服务器验证
API_KEY从环境 - Caddy反向代理转发
Authorization默认情况下为页眉
此部署不需要Python dotenv包。
在安装程序创建的托管env文件中设置API密钥:
sudo nano /etc/pyjhora-mcp/pyjhora-mcp.env
# set API_KEY=your_real_secret
sudo systemctl restart pyjhora-mcp.serviceClaude桌面集成
添加 claude_desktop_config.json:
{
"mcpServers": {
"pyjhora": {
"command": "uv",
"args": [
"run",
"--project",
"C:/path/to/pyjhora-mcp",
"fastmcp",
"run",
"src/pyjhora_mcp/server.py"
]
}
}
}运行测试
# Run all tests (requires ephemeris files)
uv run pytest tests/ -v
# With coverage
uv run pytest tests/ --cov=src/pyjhora_mcp --cov-report=term-missing码头工人
# 1. Download ephe files first
mkdir ephe
# Copy .se1 files from PyJHora GitHub into ./ephe/
# 2. Build image
docker build -t pyjhora-mcp:latest .
# 3. Run (HTTP mode)
docker run --rm -p 8000:8000 pyjhora-mcp:latest fastmcp run src/pyjhora_mcp/server.py --transport http --port 8000
# 4. Or use docker-compose
docker-compose up工具示例
获取每日Panchanga
{
"tool": "get_panchanga",
"arguments": {
"birth_data": {
"place": {"name": "Chennai,IN", "latitude": 13.0878, "longitude": 80.2785, "timezone": 5.5},
"date_time": {"year": 2024, "month": 1, "day": 15, "hour": 10, "minute": 30, "second": 0},
"ayanamsa": "LAHIRI"
}
}
}获取出生图(Rasi D1)
{
"tool": "get_rasi_chart",
"arguments": {
"birth_data": {
"place": {"name": "Mumbai,IN", "latitude": 19.076, "longitude": 72.8777, "timezone": 5.5},
"date_time": {"year": 1990, "month": 6, "day": 15, "hour": 8, "minute": 0, "second": 0},
"ayanamsa": "LAHIRI"
}
}
}获取Vimsottari Dasha
{
"tool": "get_vimsottari_dasha",
"arguments": {
"birth_data": { "...": "..." },
"include_antara": true,
"include_pratyantara": false
}
}绫波模式
| 模式 | 描述 |
|---|---|
LAHIRI | 最广泛使用的标准印度政府ayanamsa |
TRUE_PUSHYA | JHora v4.7.0中的默认设置,与Jagannatha Hora软件匹配 |
KP | 克系统 |
RAMAN | BV拉曼的ayanamsa |
项目结构
pyjhora-mcp/
├── src/pyjhora_mcp/
│ ├── server.py # FastMCP server entry point
│ ├── models/schemas.py # Pydantic input/output models
│ ├── utils/converters.py # Date/place/name helpers
│ └── tools/
│ ├── panchanga.py # 6 panchanga tools
│ ├── horoscope.py # 5 chart tools
│ ├── dasha.py # 4 dasha tools
│ ├── compatibility.py # 1 compatibility tool
│ ├── yoga.py # 3 yoga/dosha tools
│ └── strength.py # 3 strength tools
├── tests/
│ ├── conftest.py
│ ├── test_panchanga.py
│ ├── test_horoscope.py
│ ├── test_dasha.py
│ └── test_compatibility.py
├── Dockerfile
├── docker-compose.yml
└── pyproject.toml