Vedic Astro MCP
by indiser
README.md
# Vedic Astro MCP
**A production-oriented Model Context Protocol server for sidereal Vedic astrology.**
[](https://www.python.org/)
[](https://gofastmcp.com/)
[](https://www.astro.com/swisseph/)
[](https://modelcontextprotocol.io/)
`vedic-astro-mcp` exposes deterministic astronomical calculations and a daily horoscope lookup through an MCP server. It combines the Swiss Ephemeris, the Lahiri ayanamsa, IANA timezone-aware birth conversion, Vedic dignity/aspect enrichment, Vimshottari dasha timelines, and natal-to-current transit houses in a single tool interface for MCP-compatible clients.
---
## Capabilities
| Tool | Purpose |
|---|---|
| `get_birth_chart` | Computes a Lahiri sidereal whole-sign chart, graha positions, lagna, nakshatra/pada, dignity, sign lords, house lords, drishti targets, and navamsa signs |
| `get_dasha` | Builds the Vimshottari Mahadasha and Antardasha timeline and identifies periods active at a chosen date |
| `get_transits` | Calculates current graha positions and measures each planet's 1–12 house position from the natal Moon and natal Lagna |
| `get_horoscope` | Resolves the natal Moon sign and returns a cached daily horoscope for that Vedic rashi |
---
## Architecture
```text
MCP Host / AI Client
│ JSON-RPC over stdio
▼
main.py
FastMCP("vedic-astro-mcp")
│
├── utilities/timeutil.py ── ZoneInfo + DST validation ──► UTC
├── utilities/chart.py ──── Swiss Ephemeris + Lahiri ────► Sidereal chart
│ ├── lagna / houses
│ ├── Sun, Moon, Mars, Mercury, Jupiter, Venus, Saturn
│ └── Rahu + mean-node Ketu
├── utilities/enrich.py ──── Dignity, lords, aspects, navamsa
├── utilities/dasha.py ───── Vimshottari Mahadasha / Antardasha
└── utilities/horoscope.py ─ httpx + per-sign/daily cache
```
### Calculation profile
- **Ephemeris:** Swiss Ephemeris in sidereal mode
- **Ayanamsa:** Lahiri (`swe.SIDM_LAHIRI`)
- **Zodiac:** Sidereal; whole-sign house measurement
- **Lagna:** Ascendant returned in degrees, sign, nakshatra, and pada
- **Nodes:** Mean Rahu and point-opposite mean Ketu
- **Graha retrogression:** Swiss Ephemeris speed for regular planets; Rahu and Ketu marked retrograde
- **Dasha system:** Vimshottari, 120-year cycle
- **Nakshatra division:** 13°20′ per nakshatra, 4 pada per nakshatra
- **House lords:** Sign lord mapping from the Lagna sign
---
## Quick Start
### Prerequisites
- Python 3.14 or newer
- [`uv`](https://docs.astral.sh/uv/) for the reproducible environment
- Internet access only for `get_horoscope`
### Install
```powershell
cd C:\path\to\vedic-astro-mcp
# Create and synchronize the locked environment
uv sync
# Direct stdio server
uv run python main.py
```
The server waits for MCP messages on stdin/stdout. Do not interact with it through a normal terminal prompt.
### Alternative installation
```powershell
py -3.14 -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
python main.py
```
---
## MCP Client Configuration
Configure the server in an MCP-compatible host using the absolute project path.
```json
{
"mcpServers": {
"vedic-astro": {
"command": "uv",
"args": [
"--directory",
"C:\\Users\\your-name\\path\\to\\vedic-astro-mcp",
"run",
"python",
"main.py"
]
}
}
}
```
If `uv` is not on `PATH`, set `command` to the full `uv.exe` path.
### Inspect the server
```powershell
uv run fastmcp inspect main.py:mcp
```
To run with the FastMCP CLI:
```powershell
uv run fastmcp run main.py:mcp --transport stdio
```
---
## Tool Reference
All local birth date/time values describe the location's wall clock time. Convert them by supplying an IANA timezone such as `Asia/Kolkata`, `America/New_York`, or `Europe/London`.
### `get_birth_chart`
```json
{
"date": "2000-01-01",
"time": "12:00",
"lat": 28.6139,
"lon": 77.209,
"tz": "Asia/Kolkata"
}
```
**Notable response fields**
- `ayanamsa` — Lahiri ayanamsa for the Julian day
- `lagna` — longitude, sign, sign index, degree in sign, nakshatra, and pada
- `grahas` — per-planet longitude, sign, sign index, house, nakshatra, pada, retrograde status, dignity, lords, and navamsa
- `house_lords` — lord of each Lagna-derived house
- `input` — normalized UTC and original location/timezone parameters
### `get_dasha`
```json
{
"date": "2000-01-01",
"time": "12:00",
"lat": 28.6139,
"lon": 77.209,
"tz": "Asia/Kolkata",
"as_of": "2026-11-26T09:51:21+05:30"
}
```
`as_of` is optional. If omitted, the server uses the current UTC time. ISO strings without an offset are interpreted as UTC.
**Response highlights**
- `birth_lord` — Vimshottari nakshatra lord at birth
- `balance_years` — estimated remaining years of the birth Mahadasha
- `mahadashas` — ordered 120-year periods
- `current_maha` — Mahadasha containing `as_of`
- `antardashas` — nine subperiods inside the current Mahadasha
- `current_antar` — Antardasha containing `as_of`
### `get_transits`
```json
{
"date": "2000-01-01",
"time": "12:00",
"lat": 28.6139,
"lon": 77.209,
"tz": "Asia/Kolkata",
"as_of": "2026-11-26T09:51:21+05:30"
}
```
Each current graha includes:
- `lon`, `sign`, `sign_idx`, and `deg_in_sign`
- `nakshatra` and `pada`
- `retro`
- `house_from_moon`
- `house_from_lagna`
### `get_horoscope`
```json
{
"date": "2000-01-01",
"time": "12:00",
"lat": 28.6139,
"lon": 77.209,
"tz": "Asia/Kolkata"
}
```
The result identifies the natal Moon sign and returns the third-party API payload under `horoscope`. Successful responses are cached in memory per `(sign, UTC date)`. API/network failures produce:
```text
horoscope API unavailable. try later.
```
---
## Time and Location Handling
### Birth date and time
Use the documented formats exactly:
- `date`: `YYYY-MM-DD`
- `time`: `HH:MM`
- `tz`: IANA timezone name
Examples:
```json
{"date": "1994-06-18", "time": "06:35", "tz": "Asia/Kolkata"}
{"date": "1988-11-09", "time": "18:20", "tz": "America/New_York"}
```
### DST safety
The time utility detects DST edge cases instead of silently guessing:
- **DST gap:** a nonexistent local wall time raises `TimeError`
- **DST fold:** an ambiguous repeated wall time raises `TimeError`
- **Normal time:** converted to an aware UTC `datetime`
### Coordinates
`lat` is north-positive; `lon` is east-positive.
```text
New Delhi : 28.6139, 77.2090
New York : 40.7128, -74.0060
London : 51.5074, -0.1278
Sydney : -33.8688, 151.2093
```
---
## Response Model Example
```json
{
"ayanamsa": 23.8561,
"lagna": {
"lon": 29.12,
"sign": "Taurus",
"sign_idx": 1,
"deg_in_sign": 29.12,
"nakshatra": "Mrigashira",
"pada": 3
},
"grahas": {
"Moon": {
"lon": 41.24,
"sign": "Taurus",
"sign_idx": 1,
"house": 1,
"retro": false,
"dignity": "exalted",
"sign_lord": "Venus",
"nak_lord": "Sun",
"navamsa_sign": 0
}
}
}
```
Exact values depend on birth data, ephemeris data availability, and the selected chart engine state.
---
## Planetary Enrichment
### Dignity
The server reports a compact dignity label:
- `exalted`
- `debilitated`
- `own`
- `neutral`
The implemented exaltation/sign pairs are Sun 0, Moon 1, Mars 9, Mercury 5, Jupiter 3, Venus 11, and Saturn 6.
### Classical drishti
| Graha | Additional special aspects |
|---|---|
| Mars | 4th, 7th, 8th |
| Jupiter | 5th, 7th, 9th |
| Saturn | 3rd, 7th, 10th |
| Sun, Moon, Mercury, Venus, Rahu, Ketu | 7th |
Aspect houses are returned relative to the planet's computed whole-sign house.
---
## Vimshottari Cycle
The built-in Mahadasha sequence begins from the Moon's Nakshatra lord and proceeds clockwise through:
```text
Ketu 7 years
Venus 20 years
Sun 6 years
Moon 10 years
Mars 7 years
Rahu 18 years
Jupiter 16 years
Saturn 19 years
Mercury 17 years
```
The cycle is 120 years. Dates are calculated using 365.25 days per tropical year.
---
## Project Layout
```text
vedic-astro-mcp/
├── main.py # FastMCP registration and public tool schemas
├── utilities/
│ ├── chart.py # Swiss Ephemeris chart engine
│ ├── dasha.py # Vimshottari Mahadasha / Antardasha engine
│ ├── enrich.py # Dignity, lords, aspects, and navamsa enrichment
│ ├── horoscope.py # Horoscope API adapter and memory cache
│ └── timeutil.py # IANA timezone and DST conversion
├── pyproject.toml # Package metadata and dependencies
├── requirements.txt # Plain pip dependency list
├── uv.lock # Reproducible uv dependency resolution
└── .python-version # Required interpreter pin
```
---
## Development
### Run the server
```powershell
uv run python main.py
```
### Run an interactive calculation
```powershell
uv run python -c "from main import get_birth_chart; import json; print(json.dumps(get_birth_chart('2000-01-01','12:00',28.6139,77.2090,'Asia/Kolkata'), indent=2))"
```
### Test dependencies
The project declares `pytest` and `pytest-asyncio` as development dependencies, but currently contains no test suite.
```powershell
uv run --group dev pytest
```
---
## Dependencies
| Dependency | Role |
|---|---|
| `pysweph` | Python bindings for Swiss Ephemeris |
| `fastmcp` | MCP server framework and stdio transport |
| `tzdata` | Cross-platform IANA timezone database |
| `timezonefinder` | Location/timezone companion dependency |
| `httpx` | Horoscope HTTP client |
| `curl-cffi` | curl-compatible HTTP dependency available to the environment |
---
## Reliability and Limitations
- Birth-place coordinates must be accurate; longitude directly affects the Lagna.
- The chart currently uses mean Rahu and point-opposite Ketu.
- House numbers are derived from sign separation from Lagna/Moon rather than cusp degree occupancy.
- `get_horoscope` depends on an external third-party service and may be unavailable.
- The in-memory horoscope cache is process-local and resets on restart.
- No authentication or network listener is configured; the server uses MCP stdio.
- Swiss Ephemeris and these Vedic interpretation rules should be reviewed for production astrological or clinical use.
---
## External Service
Daily horoscope content is requested from:
```text
https://horoscope-api-alpha.vercel.app/horoscope/{rashi}
```
A call is allowed once per process per sign per local calendar date via the in-memory cache.
---
## License
No license file is currently included. Until a license is added, the repository should be considered unlicensed and its reuse terms should be clarified with the maintainer.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues