astro-mcp

astro-mcp

High-precision astrology tools for LLM agents, including natal charts, transits, progressions, synastry, and more, backed by Swiss Ephemeris.

Category
访问服务器

README

astro-mcp

Astrological MCP Server — high-precision astrology tools for LLM agents.

Implements 14 tools backed by Swiss Ephemeris (pyswisseph) and integrates with any Model Context Protocol client (Claude Desktop, etc.).

Tools

# Name Description
1 calculate_natal_chart Full natal chart: planets, angles, houses, aspects
2 calculate_transits Transit aspects to natal chart
3 calculate_secondary_progressions Day-for-a-year progressions + Solar Arc
4 calculate_solar_return Annual solar return chart
5 calculate_rectification_hints Score candidate birth times against life events
6 calculate_lunar_return Monthly lunar return chart(s)
7 calculate_synastry Cross-chart aspects + house overlays
8 calculate_composite_chart Midpoint or Davison composite chart
9 calculate_profections Annual profection — year lord and activated houses
10 get_planetary_hours 24 planetary hours for any day/location
11 calculate_arabic_parts 7 Arabic Parts (Fortune, Spirit, Marriage, etc.)
12 get_ephemeris Planet position table over a date range
13 find_aspect_exact_dates Find exact dates of a specific aspect
14 calculate_antiscia Antiscia and contra-antiscia points

Installation

# 1. Clone
git clone https://github.com/your-org/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 configuration

Add to ~/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"
      }
    }
  }
}

Environment Variables

Variable Default Description
EPHE_PATH ./ephe Path to Swiss Ephemeris .se1 data files
GEOCODING_PROVIDER nominatim nominatim or opencage
OPENCAGE_API_KEY Required if GEOCODING_PROVIDER=opencage
GEOCODING_USER_AGENT astro-mcp/1.0 Nominatim user-agent
GEOCODE_CACHE_SIZE 512 LRU cache size for geocoding results
DEFAULT_HOUSE_SYSTEM P P=Placidus, W=Whole Sign, K=Koch
DEFAULT_ORB_FACTOR 1.0 Global orb multiplier (0.5–1.5)
LOG_LEVEL WARNING Python logging level

Architecture

src/astro_mcp/
├── server.py              # MCP server — tool registration and dispatch
├── config.py              # Settings from environment variables
├── core/
│   ├── models.py          # Data models and astrological constants
│   ├── ephemeris_provider.py  # Swiss Ephemeris wrapper (pyswisseph)
│   ├── geocoding.py       # City → lat/lon/tz (geopy + timezonefinder)
│   └── 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

Output Format

All tools return compact JSON without whitespace to minimise LLM context tokens (~75% smaller than verbose JSON). Planet codes are abbreviated (Su, Mo, Me, etc.), aspects use 3-letter codes (Cnj, Tri, Squ), and the retrograde flag ("R":true) is omitted when direct to save additional tokens.

Planet Codes

Supported codes across tools:

  • Su Sun
  • Mo Moon
  • Me Mercury
  • Ve Venus
  • Ma Mars
  • Ju Jupiter
  • Sa Saturn
  • Ur Uranus
  • Ne Neptune
  • Pl Pluto
  • Ch Chiron
  • Li Black Moon Lilith (Mean Apogee)
  • NN North Node (True Node)
  • SN South Node

API Notes

  • get_ephemeris accepts either a single planet or a list of planets.
  • get_ephemeris.step supports 1h, 2h, 3h, 6h, 12h, 1d, 7d, 30d.
  • get_ephemeris now returns a timezone field and formats dt in output_tz.
  • find_aspect_exact_dates.mode supports:
    • transit-to-transit for two moving bodies
    • transit-to-natal for transit to a natal planet/angle
    • auto (default) infers mode from presence of birth_*

Testing

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

Reference charts (tests/reference_data/) are verified against Astro.com and Solar Fire.

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选