吠陀占星计算服务

一个基于Model Context Protocol (MCP)的服务,提供吠陀占星计算工具,包括出生图、行星位置、达沙周期等,适用于占星师和开发者。

  • by adeshmukh
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 adeshmukh/jyotishganit-mcp

使用说明

jyotishganit mcp

MCP(模型上下文协议)服务器,公开 消灭 吠陀占星术计算作为Cursor和其他MCP客户的工具。所有工具共享一个LRU缓存,因此具有相同出生详细信息的重复调用是即时的。

安装

pip install jyotishganit-mcp

工具

工具 说明
计算出生图 计算一个完整的吠陀出生图,并将其作为JSON-LD返回。
get_panchanga 回到潘昌加(蒂蒂、纳克沙特拉、瑜伽、卡拉纳、瓦拉)的出生时刻。
get_planetary_positions 返回D1行星位置:身体、星座、度数、nakshatra、房子、尊严。
get_dashas 返回Vimshottari dasha时期:当前和即将到来的Mahadasha。
get_video_chart 返回分区图(例如d9 Navamsa、d10 Dasamsa)。图表代码:d2-d60。

所有工具都包含出生详细信息:birth_year、birth_month、birth_day、birth_hour、birth_minute、birth _second、纬度、经度、时区偏移以及可选名称location_name。get_video_chart还需要chart_code(例如d9)。

使用游标

将服务器添加到MCP配置中(例如~/.cursor/MCP.json):

{
  "mcpServers": {
    "jyotishganit": {
      "command": "jyotishganit-mcp"
    }
  }
}

或者使用python-m:

{
  "mcpServers": {
    "jyotishganit": {
      "command": "python",
      "args": ["-m", "jyotishganit_mcp"]
    }
  }
}

命令行界面

通过stdio运行服务器(供MCP客户端使用):

jyotishganit-mcp

或者:

python -m jyotishganit_mcp

示例

示例工具调用(出生日期:1996年7月4日上午9:10,印度卡玛拉;IST+5:30):

  • 带有上述出生信息的get_panchanga返回例如tithi:Krishna Chaturthi,nakshatra:Dhanishta,vaara:Thursday。
  • calculate_birth_chart返回完整的JSON-LD出生图(人、ayanamsa、panchanga、D1图、分区图、ashtakavarga、dashas)。

发展

git clone <repo-url>
cd jyotishganit-mcp
pip install -e ".[dev]"
  • 棉绒和格式: ruff检查src测试&&ruff格式src测试
  • 类型检查: mypy src/
  • 测验: pytest(首次运行可能会下载星历数据)

离线/本地Hipparcos数据

出生图和潘昌加计算需要Hipparcos星表(hip_main.dat).默认情况下,jyotishganit(通过Skyfield)会尝试从CDS下载它。如果你已经有了 hip_main.dat 在磁盘上(例如在此仓库中),并希望避免在没有网络访问的情况下下载或运行,请设置:

export JYOTISHGANIT_HIP_MAIN_DAT=/path/to/hip_main.dat

然后使用此环境变量集启动MCP服务器(或运行脚本)。对于Cursor,您可以使用以下命令在MCP服务器配置中设置它 env:

{
  "mcpServers": {
    "jyotishganit": {
      "command": "jyotishganit-mcp",
      "env": {
        "JYOTISHGANIT_HIP_MAIN_DAT": "/absolute/path/to/hip_main.dat"
      }
    }
  }
}

看 消灭 底层计算库的文档。