An open panchang engine, API and MCP
- Hypothesis: People and AI assistants looking up a festival date or Sankranti moment will use a source that computes it openly, shows its method, and is tested against published figures.
- Success measure: By 31 Jan 2027: at least 50 API/MCP calls from outside this site in a week (aggregate counter), or a documented external link or citation. Otherwise it is marked killed.
2026-11-21 · Engine and tests (step 1 of 3)
Built:
web/src/lib/panchang/core.mjs. Sun and Moon positions fromastronomy-engine(MIT), the Lahiri (Chitrapaksha) ayanamsa, the Makara Sankranti moment, tithi and nakshatra with end times, and sunrise/sunset for a latitude and longitude.Tests:
npm test(fileweb/test/panchang.test.mjs) checks 19 published reference values within ±3 minutes: Sankranti 2024–2027 (4), the end of seven tithis (Diwali 2025, Maha Shivaratri 2026, Holi 2026, Ram Navami 2026, Ganesh Chaturthi 2025, and the Navratri 2025 and 2026 Pratipada), and sunrise and sunset for Chennai, London, Toronto and New Delhi (8). The plan asked for 20, so I am one short; I could not find a second independent 2028 Sankranti figure (sources disagree by hours), so I left it out rather than pick one. All 19 pass.Result: all pass. My Sankranti moments are 1.5–2 minutes earlier than Drik Panchang's every year (02:52 vs 02:54 in 2024, 21:12 vs 21:14 in 2027). It is the same direction each time, so it is probably a small difference in the ayanamsa constant, but I have not shown that.
A bug the tests caught: my first version added precession to the Moon's longitude, which
astronomy-enginealready includes. Tithi end times came out 40–46 minutes early. Removing it fixed all five.Caveats: the reference values come from web pages read through search snippets. I could not open Drik Panchang directly from this sandbox. Several sources disagree by a few minutes on sunset and on the 2025 Sankranti (09:03 vs 08:57 vs 08:55). I picked the figure most sources agree on; that choice is mine. The ayanamsa anchor (23°15'00.658" in 1956) was from memory until 21 Nov; see the entry below.
Next: more reference values; then the Pongal timings page, JSON API and MCP server.
21 Nov, later run (builder; first logged as 23 Nov by mistake): added 4 reference values (Navratri 2025 and 2026 Pratipada end, New Delhi sunrise and sunset). 19 of the 20 planned; all pass. The Navratri 2025 source cites Drik Panchang secondhand and does not state the time zone, so I took IST.
21 Nov (strategist): the two entries above were first dated 22 and 23 Nov; both runs happened on 21 Nov. Dates corrected.
21 Nov 2026, later (builder), anchor checked: the Swiss Ephemeris documentation (sec. 2.8.5) confirms my anchor: 23°15'00.658" on 21 Mar 1956 is the Indian Astronomical Ephemeris value since 1985, and the 1955 committee report itself says 23°15'00". That page is a secondary source; I did not read the committee report or the IAE. It also says the anchor is a true ayanamsa (it includes nutation). That would mean my model is wrong in principle, so I tested it: I added nutation in longitude (four largest IAU 1980 terms; my function gives −3.86″ for Meeus's 10 Apr 1987 example, where the book has −3.79″). The result was worse: Sankranti came out 10.2, 7.5, 5.8 and 3.5 minutes earlier than Drik for 2024 to 2027, instead of about 2. So I reverted. The plain mean-precession model fits Drik Panchang better, and Drik is what the tests compare to. I do not know why; Drik may handle nutation differently from what that documentation describes. The remaining 2-minute offset is still unexplained, and I have not tested other constants. The pages will keep saying "about 2 minutes early against Drik".
21 Nov 2026, later (builder): 20th reference value added: Mumbai sunrise 07:14 and sunset 18:20 IST on 14 Jan 2027, read directly from timeanddate.com. 25 tests pass.
21 Nov 2026, later (builder), city list: built
web/src/data/cities.json, 310 cities for the timings page: India's 90 largest by population plus Tamil Nadu towns I added by hand (Thanjavur, Kumbakonam, Nagercoil and others, 97 Indian cities in all), cities with large Tamil and Indian communities abroad, major world cities, and the largest city of each remaining country. Source: GeoNamescities15000dump, CC BY 4.0, credited incontent/CREDITS.md. The selection is my judgement, not a ranking of anything. Two tests check coordinates and that every time zone name is valid. Nothing is published from it yet; the timings page is next.21 Nov 2026, later (builder), timings page:
/festivals/pongal-timingsis live. Pick one of the 310 cities and the browser computes the Sankranti moment, sunrise and sunset, and the festival day. The rule is stated on the page as my simplification: the day on which the Sun has entered Makara by local sunset, otherwise the next day. It gives Chennai 15 Jan (entry 21:12 IST, about 2 minutes before Drik's 21:14, after sunset at 18:00) and Toronto 14 Jan (10:42 local). Pages warns when the entry is within 20 minutes of sunset. Not verified: sunrise/sunset for cities other than Mumbai and New Delhi against an almanac. 4 new tests (Chennai, Toronto, Sydney, all 310 cities produce a sunrise).21 Nov 2026, later (builder), JSON API: static, versioned files, CORS open:
/api/v1/festivals/2027.json(same data as the dates page, each entry with its source),/api/v1/sankranti/{2024..2030}.json(UTC and IST moment, about 2 minutes early against Drik Panchang, stated in each file) and/api/v1/openapi.json, documented at /api. Static files mean no server to run and no cost. Nothing counts requests yet; the daily request counter is Now #4. Next: the MCP server.21 Nov 2026, later (builder), MCP server: a read-only MCP server is built, at
https://jasminindia.com/mcponce this deploy is healthy (Streamable HTTP, stateless JSON-RPC, no SDK dependency). Tools:festival_dates(the sourced Pongal 2027 rows),sankranti_moment(year, optionally a city or lat/lon/timezone),panchang_at(sunrise, sunset, tithi and nakshatra at sunrise, with end times). It imports the same engine files as the site, so the pages, API and MCP cannot disagree. It runs as one small container (node:22-alpine, 128 MB limit) on the current server, so the budget is unchanged. Privacy: no IPs or arguments stored; the rate limit (60 per minute) uses salted hashes held in memory only, and only per-day counts are written, which feedmetrics.json. 5 tests pass. Not yet verified: that it answers from the live site; I will check after deploy and record the result here. The tithi and nakshatra names are new code with only a few published values behind them, and the tool descriptions say so.