Skip to main content
Glama
DrewCyber

astro-mcp

by DrewCyber

astro-mcp

占星 MCP 服务器 — 为 LLM 代理提供高精度占星工具。

实现了 14 个工具,基于 Swiss Ephemeris(pyswisseph),并可与任何 Model Context Protocol 客户端(如 Claude Desktop 等)集成。

工具

#

名称

描述

1

calculate_natal_chart

完整本命盘:行星、角度、宫位、相位

2

calculate_transits

行运相位对本命盘、月相、朔望和月亮空亡

3

calculate_secondary_progressions

一天代表一年的推进 + 太阳弧

4

calculate_solar_return

年度太阳回归盘

5

calculate_rectification_hints

根据生活事件对候选出生时间进行评分

6

calculate_lunar_return

月度月亮回归盘

7

calculate_synastry

跨盘相位 + 宫位叠加

8

calculate_composite_chart

中点或戴维森组合盘

9

calculate_profections

年度推进——年主星和激活的宫位

10

get_planetary_hours

任意日期/地点的24个行星时

11

calculate_arabic_parts

12个阿拉伯点/宿(福点、精神点、婚姻点等)

12

get_ephemeris

日期范围内的行星位置表

13

find_aspect_exact_dates

查找特定相位的精确日期

14

calculate_antiscia

映点和反映点,可选行运接触

Related MCP server: auseklis

安装

# 1. Clone
git clone https://github.com/DrewCyber/astro-mcp
cd astro-mcp

# 2. Create virtual environment
python3.11 -m venv .venv
source .venv/bin/activate

# 3. Install package + dev dependencies
pip install -e ".[dev]"

# 4. Download Swiss Ephemeris data files
bash scripts/download_ephe.sh

# 5. Set environment variable
export EPHE_PATH="$(pwd)/ephe"

# 6. Run tests
pytest tests/

Claude Desktop 配置

添加到 ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "astro": {
      "command": "/path/to/astro-mcp/.venv/bin/python",
      "args": ["-m", "astro_mcp"],
      "env": {
        "EPHE_PATH": "/path/to/astro-mcp/ephe",
        "GEOCODING_PROVIDER": "nominatim",
        "GEOCODING_USER_AGENT": "astro-mcp/1.0",
        "LOG_LEVEL": "WARNING"
      }
    }
  }
}

环境变量

变量

默认值

描述

EPHE_PATH

./ephe

Swiss Ephemeris .se1 数据文件的路径

GEOCODING_PROVIDER

nominatim

nominatimopencage

OPENCAGE_API_KEY

如果 GEOCODING_PROVIDER=opencage 则为必填

GEOCODING_USER_AGENT

astro-mcp/1.0

Nominatim 用户代理

GEOCODE_CACHE_SIZE

512

地理编码结果的 LRU 缓存大小

GEOCODE_CACHE_PATH

~/.cache/astro-mcp/geocode.json

持久化地理编码缓存,使查询在重启后仍然有效。仅存储城市 → 纬度/经度/时区。设置为空以禁用

DEFAULT_HOUSE_SYSTEM

P

P=普拉西度制,W=整宫制,K=科赫制

DEFAULT_ORB_FACTOR

1.0

全局容许度乘数(0.1–3.0)

NODE_TYPE

true

true=真实交点,mean=平均交点(在所有工具中一致应用)

LOG_LEVEL

WARNING

Python 日志级别

架构

src/astro_mcp/
├── server.py              # MCP server — tool registration and dispatch
├── schemas.py             # Pydantic input models (source of the JSON schemas)
├── config.py              # Settings from environment variables
├── core/
│   ├── models.py          # Data models and astrological constants
│   ├── errors.py          # AstroError and the structured error codes
│   ├── ephemeris_provider.py  # Swiss Ephemeris wrapper (pyswisseph)
│   ├── geocoding.py       # City → lat/lon/tz (geopy + timezonefinder)
│   ├── moon.py            # Lunar phase, lunations and void-of-course
│   └── formatters.py      # LLM-optimized serialization
└── tools/
    ├── natal.py           # Tool 1
    ├── transits.py        # Tool 2
    ├── progressions.py    # Tool 3
    ├── returns.py         # Tools 4 + 6
    ├── rectification.py   # Tool 5
    ├── synastry.py        # Tools 7 + 8
    ├── profections.py     # Tool 9
    ├── planetary_hours.py # Tool 10
    ├── arabic_parts.py    # Tool 11
    ├── ephemeris.py       # Tools 12 + 13
    └── antiscia.py        # Tool 14

输出格式

所有工具返回紧凑的 JSON,不带空白,以最小化 LLM 上下文令牌(比冗长 JSON 小约 75%)。行星代码缩写(SuMoMe 等),相位使用 3 字母代码(CnjTriSqu),并且当行星顺行时省略逆行标志("R":true)以节省额外令牌。

失败也使用相同的契约,因此客户端无需解析散文:

{"error":true,"code":"INPUT_ERROR","message":"Invalid arguments for 'calculate_natal_chart'.","hint":"birth_location.lat: Input should be less than or equal to 90"}

行星代码

各工具支持的代码:

  • Su 太阳

  • Mo 月亮

  • Me 水星

  • Ve 金星

  • Ma 火星

  • Ju 木星

  • Sa 土星

  • Ur 天王星

  • Ne 海王星

  • Pl 冥王星

  • Ch 凯龙星

  • Li 暗月莉莉丝(平均远地点)

  • NN 北交点(默认为真实交点;当 NODE_TYPE=mean 时为平均交点)

  • SN 南交点

  • 小行星(支持 include_asteroids 时):Ce 谷神星,Pa 智神星,Jun 婚神星,Ves 灶神星

API 说明

  • get_ephemeris 接受单个 planet 或行星列表。

  • get_ephemeris.step 支持 1h2h3h6h12h1d7d30d

  • get_ephemeris 现在返回 timezone 字段,并以 output_tz 格式化 dt

  • find_aspect_exact_dates.mode 支持:

    • transit-to-transit 用于两个移动天体

    • transit-to-natal 用于行运到本命行星/角度

    • auto(默认)根据是否存在 birth_* 推断模式

测试

pytest tests/ -v --cov=src/astro_mcp --cov-report=term-missing

黄金图表回归测试内联在测试套件中(tests/test_audit_regressions.py),并已针对 Astro.com 和 Solar Fire 进行验证。

许可证

MIT

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    A
    maintenance
    Multi-tradition astrology engine that computes real birth charts, transits, and synastry for AI agents via MCP tools.
    3
  • A
    license
    A
    quality
    A
    maintenance
    Astrology MCP server that computes natal charts, transits, synastry, progressions, returns, eclipses, retrogrades, and moon phases from a real ephemeris, enabling AI agents to provide accurate astrological calculations without hallucination.
    12
    74
    1
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Precision-audited astrology MCP for natal charts, transits, synastry and moon phases. No API key.
    10
    124
    MIT

View all related MCP servers

Related MCP Connectors

  • Sub-arcsecond ephemeris and astrology on NASA JPL DE440: natal, transits, eclipses, Human Design.

  • Zi Wei Dou Shu for AI agents: free natal charts, six transit levels, and optional readings.

  • 60+ units, live FX, timezones, and date arithmetic for AI agents.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DrewCyber/astro-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server