ether-to-astro 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/.env.example +13 -0
  2. package/.github/pull_request_template.md +16 -0
  3. package/.github/workflows/release.yml +35 -0
  4. package/.github/workflows/test.yml +32 -0
  5. package/AGENTS.md +99 -0
  6. package/LICENSE +18 -0
  7. package/NOTICE.md +45 -0
  8. package/README.md +301 -0
  9. package/SETUP.md +70 -0
  10. package/TESTING_SUMMARY.md +238 -0
  11. package/TEST_SUITE_STATUS.md +218 -0
  12. package/biome.json +48 -0
  13. package/dist/astro-service.d.ts +98 -0
  14. package/dist/astro-service.js +496 -0
  15. package/dist/chart-types.d.ts +52 -0
  16. package/dist/chart-types.js +51 -0
  17. package/dist/charts.d.ts +125 -0
  18. package/dist/charts.js +324 -0
  19. package/dist/cli.d.ts +7 -0
  20. package/dist/cli.js +472 -0
  21. package/dist/constants.d.ts +81 -0
  22. package/dist/constants.js +76 -0
  23. package/dist/eclipses.d.ts +85 -0
  24. package/dist/eclipses.js +184 -0
  25. package/dist/ephemeris.d.ts +120 -0
  26. package/dist/ephemeris.js +379 -0
  27. package/dist/formatter.d.ts +2 -0
  28. package/dist/formatter.js +22 -0
  29. package/dist/houses.d.ts +82 -0
  30. package/dist/houses.js +169 -0
  31. package/dist/index.d.ts +14 -0
  32. package/dist/index.js +150 -0
  33. package/dist/loader.d.ts +2 -0
  34. package/dist/loader.js +31 -0
  35. package/dist/logger.d.ts +25 -0
  36. package/dist/logger.js +73 -0
  37. package/dist/profile-store.d.ts +48 -0
  38. package/dist/profile-store.js +156 -0
  39. package/dist/riseset.d.ts +82 -0
  40. package/dist/riseset.js +185 -0
  41. package/dist/storage.d.ts +10 -0
  42. package/dist/storage.js +40 -0
  43. package/dist/time-utils.d.ts +68 -0
  44. package/dist/time-utils.js +136 -0
  45. package/dist/tool-registry.d.ts +35 -0
  46. package/dist/tool-registry.js +307 -0
  47. package/dist/tool-result.d.ts +175 -0
  48. package/dist/tool-result.js +188 -0
  49. package/dist/transits.d.ts +108 -0
  50. package/dist/transits.js +263 -0
  51. package/dist/types.d.ts +450 -0
  52. package/dist/types.js +161 -0
  53. package/example-usage.md +131 -0
  54. package/natal-chart.json +187 -0
  55. package/package.json +61 -0
  56. package/scripts/download-ephemeris.js +115 -0
  57. package/setup.sh +21 -0
  58. package/src/astro-service.ts +710 -0
  59. package/src/chart-types.ts +125 -0
  60. package/src/charts.ts +399 -0
  61. package/src/cli.ts +694 -0
  62. package/src/constants.ts +89 -0
  63. package/src/eclipses.ts +226 -0
  64. package/src/ephemeris.ts +437 -0
  65. package/src/formatter.ts +25 -0
  66. package/src/houses.ts +202 -0
  67. package/src/index.ts +170 -0
  68. package/src/loader.ts +36 -0
  69. package/src/logger.ts +104 -0
  70. package/src/profile-store.ts +285 -0
  71. package/src/riseset.ts +229 -0
  72. package/src/time-utils.ts +167 -0
  73. package/src/tool-registry.ts +357 -0
  74. package/src/tool-result.ts +283 -0
  75. package/src/transits.ts +352 -0
  76. package/src/types.ts +547 -0
  77. package/tests/README.md +173 -0
  78. package/tests/TESTING_STRATEGY.md +178 -0
  79. package/tests/fixtures/bowen-yang-chart.ts +69 -0
  80. package/tests/fixtures/calculate-expected.ts +81 -0
  81. package/tests/fixtures/expected-results.ts +117 -0
  82. package/tests/fixtures/generate-expected-simple.ts +94 -0
  83. package/tests/helpers/date-fixtures.ts +15 -0
  84. package/tests/helpers/ephem.ts +11 -0
  85. package/tests/helpers/temp.ts +9 -0
  86. package/tests/setup.ts +11 -0
  87. package/tests/unit/astro-service.test.ts +323 -0
  88. package/tests/unit/chart-types.test.ts +18 -0
  89. package/tests/unit/charts-errors.test.ts +42 -0
  90. package/tests/unit/charts.test.ts +157 -0
  91. package/tests/unit/cli-commands.test.ts +82 -0
  92. package/tests/unit/cli-profiles.test.ts +128 -0
  93. package/tests/unit/cli.test.ts +191 -0
  94. package/tests/unit/constants.test.ts +26 -0
  95. package/tests/unit/correctness-critical.test.ts +408 -0
  96. package/tests/unit/eclipses.test.ts +108 -0
  97. package/tests/unit/ephemeris.test.ts +213 -0
  98. package/tests/unit/error-handling.test.ts +116 -0
  99. package/tests/unit/formatter.test.ts +29 -0
  100. package/tests/unit/houses-errors.test.ts +27 -0
  101. package/tests/unit/houses-validation.test.ts +164 -0
  102. package/tests/unit/houses.test.ts +205 -0
  103. package/tests/unit/profile-store.test.ts +163 -0
  104. package/tests/unit/real-user-charts.test.ts +148 -0
  105. package/tests/unit/riseset.test.ts +106 -0
  106. package/tests/unit/solver-edges.test.ts +197 -0
  107. package/tests/unit/time-utils-temporal.test.ts +303 -0
  108. package/tests/unit/time-utils.test.ts +173 -0
  109. package/tests/unit/tool-registry.test.ts +222 -0
  110. package/tests/unit/tool-result.test.ts +45 -0
  111. package/tests/unit/transit-correctness.test.ts +78 -0
  112. package/tests/unit/transits.test.ts +238 -0
  113. package/tests/validation/README.md +32 -0
  114. package/tests/validation/adapters/astrolog.ts +306 -0
  115. package/tests/validation/adapters/internal.ts +184 -0
  116. package/tests/validation/compare/eclipses.ts +47 -0
  117. package/tests/validation/compare/houses.ts +76 -0
  118. package/tests/validation/compare/positions.ts +104 -0
  119. package/tests/validation/compare/riseSet.ts +48 -0
  120. package/tests/validation/compare/roots.ts +90 -0
  121. package/tests/validation/compare/transits.ts +69 -0
  122. package/tests/validation/fixtures/astrolog-parity/core.ts +194 -0
  123. package/tests/validation/fixtures/eclipses/core.ts +14 -0
  124. package/tests/validation/fixtures/houses/core.ts +47 -0
  125. package/tests/validation/fixtures/positions/core.ts +159 -0
  126. package/tests/validation/fixtures/rise-set/core.ts +20 -0
  127. package/tests/validation/fixtures/roots/core.ts +47 -0
  128. package/tests/validation/fixtures/transits/core.ts +61 -0
  129. package/tests/validation/fixtures/transits/dst.ts +21 -0
  130. package/tests/validation/oracle.spec.ts +129 -0
  131. package/tests/validation/utils/denseRootOracle.ts +269 -0
  132. package/tests/validation/utils/fixtureTypes.ts +146 -0
  133. package/tests/validation/utils/report.ts +60 -0
  134. package/tests/validation/utils/tolerances.ts +23 -0
  135. package/tests/validation/validation.spec.ts +836 -0
  136. package/tools/color-picker.html +388 -0
  137. package/tsconfig.json +17 -0
  138. package/vitest.config.ts +31 -0
package/.env.example ADDED
@@ -0,0 +1,13 @@
1
+ # Ephemeris Version Configuration
2
+ # Controls which Swiss Ephemeris data files to download
3
+ #
4
+ # Options:
5
+ # short - 600 years (1800-2400 AD), ~2MB total
6
+ # long - 6000 years (3000 BC - 3000 AD), ~5MB total (DEFAULT)
7
+ # moshier - No downloads, use built-in Moshier approximation (lower precision)
8
+ #
9
+ EPHEMERIS_VERSION=long
10
+
11
+ # Logging Level
12
+ # Options: DEBUG, INFO, WARN, ERROR
13
+ LOG_LEVEL=INFO
@@ -0,0 +1,16 @@
1
+ ## Summary
2
+
3
+ - What changed:
4
+ - Why:
5
+
6
+ ## Verification
7
+
8
+ - [ ] `npm run build`
9
+ - [ ] `npm run lint`
10
+ - [ ] `npm test -- --run`
11
+
12
+ ## Checklist
13
+
14
+ - [ ] Scope is focused and avoids unrelated churn
15
+ - [ ] Tests were added or updated when behavior changed
16
+ - [ ] Docs were updated when workflow or interfaces changed
@@ -0,0 +1,35 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+ id-token: write
10
+
11
+ jobs:
12
+ publish:
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Use Node.js 20
19
+ uses: actions/setup-node@v4
20
+ with:
21
+ node-version: 20
22
+ cache: npm
23
+ registry-url: https://registry.npmjs.org
24
+
25
+ - name: Install dependencies
26
+ run: npm ci
27
+
28
+ - name: Build
29
+ run: npm run build
30
+
31
+ - name: Unit tests
32
+ run: npm test -- --run
33
+
34
+ - name: Publish to npm
35
+ run: npm publish --access public --provenance
@@ -0,0 +1,32 @@
1
+ name: Quality Gate
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ quality:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Use Node.js 20
17
+ uses: actions/setup-node@v4
18
+ with:
19
+ node-version: 20
20
+ cache: npm
21
+
22
+ - name: Install dependencies
23
+ run: npm ci
24
+
25
+ - name: Build
26
+ run: npm run build
27
+
28
+ - name: Lint
29
+ run: npm run lint
30
+
31
+ - name: Unit tests
32
+ run: npm test -- --run
package/AGENTS.md ADDED
@@ -0,0 +1,99 @@
1
+ # AGENTS.md
2
+
3
+ ## Purpose
4
+ This file is for coding agents working in `astro-mcp`. It documents the real architecture and safe change workflow so edits stay correct and low-risk.
5
+
6
+ ## Current Runtime Facts
7
+ - Engine is native Node binding: `sweph` (not WASM/WASI).
8
+ - `sweph` is version-pinned in `package.json` to keep numeric baselines stable for fixtures/validation.
9
+ - MCP entrypoint is `src/loader.ts` -> `src/index.ts`.
10
+ - CLI entrypoint is `src/cli.ts` (`e2a` bin), designed for single-shot stateless usage.
11
+ - CLI profiles are read from `.astro.json` via `src/profile-store.ts` (read-only in v1).
12
+ - Ephemeris files are expected under `data/ephemeris` and configured via `set_ephe_path()`.
13
+ - Server state is process-local and in-memory: one mutable `natalChart` in `src/index.ts`.
14
+
15
+ ## Fast Commands
16
+ - Install: `npm install`
17
+ - Build: `npm run build`
18
+ - CLI: `npm run start:cli -- --help`
19
+ - Unit/integration tests: `npm test -- --run`
20
+ - Routine quality gate: `npm run quality:gate`
21
+ - Validation harness: `npm run validate:astro`
22
+ - Strict dead-code check: `npm run build -- --noUnusedLocals --noUnusedParameters`
23
+ - Lint: `npm run lint`
24
+
25
+ ## Code Map
26
+ - `src/astro-service.ts`: shared business logic used by both MCP and CLI.
27
+ - `src/index.ts`: MCP tool schemas + request handling + stateful orchestration.
28
+ - `src/cli.ts`: commander-based single-shot CLI surface.
29
+ - `src/profile-store.ts`: `.astro.json` profile resolution + schema validation for CLI.
30
+ - `src/ephemeris.ts`: low-level ephemeris adapter, JD/date conversion, position calc, exact root solver.
31
+ - `src/transits.ts`: transit detection, exact-time policy, applying/separating selection, dedupe.
32
+ - `src/houses.ts`: house cusps + polar fallback behavior.
33
+ - `src/riseset.ts`: rise/set/meridian event semantics.
34
+ - `src/eclipses.ts`: next solar/lunar eclipse lookup.
35
+ - `src/time-utils.ts`: Temporal-based timezone/DST conversions.
36
+ - `src/charts.ts`: AstroChart SVG rendering and image conversion.
37
+
38
+ ## Validation Harness Map
39
+ - `tests/validation/validation.spec.ts`: end-to-end validation suite.
40
+ - `tests/validation/utils/denseRootOracle.ts`: independent dense-scan oracle for root finding.
41
+ - `tests/validation/compare/*`: subsystem comparators and mismatch severity.
42
+ - `tests/validation/adapters/internal.ts`: normalized adapter over production code.
43
+ - `tests/validation/adapters/astrolog.ts`: optional external CLI parity.
44
+ - Report output: `/tmp/astro-validation-report.json`.
45
+
46
+ ## Non-Negotiable Behavior Invariants
47
+ - Root solver and oracle must stay logically independent.
48
+ - Root count mismatches are hard failures (not warnings).
49
+ - Transit exact-time status semantics must remain explicit:
50
+ - `within_preview`
51
+ - `outside_preview`
52
+ - `not_found`
53
+ - `unsupported_body`
54
+ - `undefined` means exact-time was not attempted because orb is too wide.
55
+ - Rise/set semantics are “next event after anchor instant”, not “civil-day bucket”.
56
+ - DST ambiguity/nonexistent local times for birth data must honor disambiguation policy.
57
+
58
+ ## Tolerances (Validation)
59
+ Defined in `tests/validation/utils/tolerances.ts`:
60
+ - Position longitude/latitude/speed: `0.0001`
61
+ - Houses: `0.01°`
62
+ - Root timing preferred: `2 min`
63
+ - Root timing hard fail: `10 min`
64
+ - Rise/set and eclipse timing (same-engine refs): `1 min`
65
+ - Root dedupe epsilon: `1 min`
66
+
67
+ ## High-Risk Areas (Change Carefully)
68
+ - `EphemerisCalculator.findExactTransitTimes()` in `src/ephemeris.ts`.
69
+ - Transit root-selection policy in `src/transits.ts`.
70
+ - Time conversion/disambiguation in `src/time-utils.ts`.
71
+ - Capability checks and comparator severity in validation harness.
72
+
73
+ ## Safe Change Workflow
74
+ 1. Make focused edits (avoid broad refactors).
75
+ 2. Run `npm run quality:gate` for normal changes.
76
+ 3. Run `npm run validate:astro` for high-risk astro engine changes.
77
+ 4. If root mismatches appear, inspect `/tmp/astro-validation-report.json` details:
78
+ - production roots
79
+ - oracle roots
80
+ - residuals
81
+ - sampled trace
82
+ - crossing metadata
83
+ 5. Only relax fixtures/tolerances with explicit justification.
84
+
85
+ ## Repo Contract
86
+ - Routine merge gate is `npm run build`, `npm run lint`, and `npm test -- --run`.
87
+ - `npm run validate:astro` is targeted validation, not the default gate for every change.
88
+ - Biome is the source of truth for formatting, import order, and linting.
89
+ - Preferred commit types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `build`, `ci`.
90
+ - Keep commits scoped to one coherent change whenever possible.
91
+
92
+ ## Known Gotchas
93
+ - `sweph` has process-wide settings (e.g., ephemeris path); avoid per-request mutation.
94
+
95
+ ## Agent Style for This Repo
96
+ - Prefer minimal, typed, fixture-driven changes.
97
+ - Keep adapter normalization stable when comparing outputs.
98
+ - Do not mask solver regressions with broad dedupe/tolerance changes.
99
+ - Keep external CLI parity optional and auto-skippable.
package/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ GNU Affero General Public License v3.0 or later
2
+
3
+ Copyright (c) 2026 Ether-to-Astro MCP Server
4
+
5
+ This project is distributed under the terms of the GNU Affero General Public
6
+ License, version 3 or (at your option) any later version.
7
+
8
+ You should have received a copy of the GNU Affero General Public License along
9
+ with this project. If not, see https://www.gnu.org/licenses/agpl-3.0.html
10
+
11
+ Licensing note:
12
+
13
+ - This repository uses the `sweph` package as a core runtime dependency.
14
+ - `sweph` declares licensing as `(AGPL-3.0-or-later OR LGPL-3.0-or-later)`.
15
+ - The LGPL path is available only under the conditions stated by `sweph`
16
+ and Swiss Ephemeris licensing terms.
17
+ - This repository adopts the AGPL-3.0-or-later path so the published package
18
+ and source distribution remain honest and internally consistent.
package/NOTICE.md ADDED
@@ -0,0 +1,45 @@
1
+ # Third-Party Notices
2
+
3
+ This software incorporates components from the following projects:
4
+
5
+ ## Swiss Ephemeris
6
+
7
+ **License**: AGPL-3.0 / Commercial (dual-licensed)
8
+ **Copyright**: Copyright (c) 1997-2021 Astrodienst AG, Switzerland
9
+ **Source**: https://www.astro.com/swisseph/
10
+
11
+ Swiss Ephemeris is the high-precision ephemeris developed by Astrodienst AG.
12
+ It is dual-licensed under AGPL-3.0 for non-commercial use and requires a
13
+ commercial license for commercial applications.
14
+
15
+ **Important**: If you use this software commercially, you must obtain a
16
+ commercial license from Astrodienst AG.
17
+
18
+ ## AstroChart
19
+
20
+ **License**: MIT
21
+ **Copyright**: Copyright (c) Radek Krejčík
22
+ **Source**: https://github.com/Kibo/AstroChart
23
+
24
+ AstroChart is a JavaScript library for generating astrological charts.
25
+
26
+ ## Sharp
27
+
28
+ **License**: Apache-2.0
29
+ **Copyright**: Copyright 2013 Lovell Fuller and contributors
30
+ **Source**: https://github.com/lovell/sharp
31
+
32
+ Sharp is a high-performance Node.js image processing library.
33
+
34
+ ## Model Context Protocol SDK
35
+
36
+ **License**: MIT
37
+ **Copyright**: Copyright (c) Anthropic
38
+ **Source**: https://github.com/modelcontextprotocol/typescript-sdk
39
+
40
+ The official TypeScript SDK for the Model Context Protocol.
41
+
42
+ ---
43
+
44
+ For complete license texts, see the LICENSE file and the respective
45
+ node_modules directories.
package/README.md ADDED
@@ -0,0 +1,301 @@
1
+ # ether-to-astro
2
+
3
+ ```
4
+ ███████╗██████╗ █████╗
5
+ ██╔════╝╚════██╗██╔══██╗
6
+ █████╗ █████╔╝███████║
7
+ ██╔══╝ ██╔═══╝ ██╔══██║
8
+ ███████╗███████╗██║ ██║
9
+ ╚══════╝╚══════╝╚═╝ ╚═╝
10
+ ether-to-astro
11
+ ```
12
+
13
+ Astrology tooling for agent workflows.
14
+
15
+ `ether-to-astro` is a local-first astrology toolkit with two surfaces: `e2a`, a CLI, and `e2a-mcp`, an MCP server.
16
+
17
+ This started as a side project because my wife is the real user, and I wasn’t impressed with the tooling around her astrology fascination. I’ve worked on plenty of AI tools and have a pretty high bar for them. Most of what I found in this space felt flimsy, closed-off, or not designed for serious agent workflows.
18
+
19
+ So I built the version I wanted to exist: local-first, scriptable, tested, and structured to work well both from the command line and through MCP. I’m the builder. She’s the user. That turned out to be a pretty good way to make the product better.
20
+
21
+ ## Features
22
+
23
+ Your wife can ask her AI agent about:
24
+
25
+ ### Transits
26
+ - **Daily mundane transits** - Current planetary positions
27
+ - **Moon transits** - Fast-moving Moon aspects to natal planets
28
+ - **Personal planet transits** - Sun, Mercury, Venus, Mars aspects to natal chart
29
+ - **Outer planet transits** - Jupiter, Saturn, Uranus, Neptune, Pluto aspects
30
+ - **Exact transit times** - Precise timing when transits become exact (0° orb)
31
+ - **Upcoming transits** - Multi-day forecast for transits approaching within 2°
32
+
33
+ ### Advanced Features
34
+ - **House cusps** - Ascendant, Midheaven, and all 12 houses (multiple systems)
35
+ - **Retrograde status** - Which planets are currently retrograde
36
+ - **Rise/Set times** - Sunrise, sunset, moonrise, moonset
37
+ - **Asteroids & Nodes** - Chiron, Ceres, Pallas, Juno, Vesta, North Node
38
+ - **Eclipses** - Next solar and lunar eclipse dates
39
+ - **Visual Charts** - Generate SVG natal and transit chart wheels with aspects
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ ./setup.sh
45
+ ```
46
+
47
+ ### Ephemeris Data Configuration
48
+
49
+ The server downloads Swiss Ephemeris data files during installation. You can control which version using the `EPHEMERIS_VERSION` environment variable:
50
+
51
+ **Options:**
52
+ - `long` (default) - 6000 years (3000 BC - 3000 AD), ~5MB, recommended for professional use
53
+ - `short` - 600 years (1800-2400 AD), ~2MB, sufficient for modern charts
54
+ - `moshier` - No downloads, uses built-in Moshier approximation (lower precision)
55
+
56
+ **Examples:**
57
+ ```bash
58
+ # Default (long version)
59
+ npm install
60
+
61
+ # Short version
62
+ EPHEMERIS_VERSION=short npm install
63
+
64
+ # Moshier only (no downloads)
65
+ EPHEMERIS_VERSION=moshier npm install
66
+ ```
67
+
68
+ Or manually:
69
+ ```bash
70
+ npm install
71
+ npm run build
72
+ ```
73
+
74
+ ## Engineering Contract
75
+
76
+ This repo uses a lightweight, agent-friendly operating contract:
77
+
78
+ - Keep changes focused and avoid unrelated churn in the same diff.
79
+ - Treat Biome as the source of truth for formatting, import order, and linting.
80
+ - Use conventional commit messages: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `build`, `ci`.
81
+ - Keep PR descriptions short and explicit about what changed and how it was verified.
82
+
83
+ Required routine quality gate:
84
+
85
+ ```bash
86
+ npm run quality:gate
87
+ ```
88
+
89
+ This runs:
90
+
91
+ - `npm run build`
92
+ - `npm run lint`
93
+ - `npm test -- --run`
94
+
95
+ Use `npm run validate:astro` for high-risk astrology engine work such as ephemeris/root-solver/transit-timing changes. It is intentionally not part of the default routine gate.
96
+
97
+ Commit examples:
98
+
99
+ ```text
100
+ fix(cli): resolve injected cwd for relative profile paths
101
+ test(profiles): cover default profile precedence
102
+ refactor(transits): simplify exact-time formatting
103
+ docs(readme): document remote-ready repo contract
104
+ ```
105
+
106
+ Pull request checklist:
107
+
108
+ - Scope is focused and coherent.
109
+ - `npm run quality:gate` passed locally.
110
+ - Tests were added or updated when behavior changed.
111
+ - Docs were updated when workflow or interfaces changed.
112
+ - PR description includes:
113
+ - What changed
114
+ - How it was verified
115
+
116
+ ## Setup
117
+
118
+ 1. Run setup script or install manually (see above)
119
+
120
+ 2. Build:
121
+
122
+ ```bash
123
+ npm run build
124
+ ```
125
+
126
+ 3. Add MCP to your MCP settings (e.g., Claude Desktop config):
127
+
128
+ ```json
129
+ {
130
+ "mcpServers": {
131
+ "astro": {
132
+ "command": "e2a-mcp"
133
+ }
134
+ }
135
+ }
136
+ ```
137
+
138
+ Package/binary names:
139
+ - Package: `ether-to-astro`
140
+ - CLI command: `e2a`
141
+ - MCP command: `e2a-mcp`
142
+
143
+ ## Runtime Surfaces
144
+
145
+ ### MCP server (stateful per process)
146
+
147
+ ### In-Memory Storage
148
+ The MCP server uses **in-memory storage** for natal chart data:
149
+ - Each client connection gets its own Node.js process instance
150
+ - Natal chart is stored in RAM for the duration of the connection
151
+ - When you disconnect, the process exits and memory is automatically freed
152
+ - No files are created or persisted to disk
153
+ - Simply call `set_natal_chart` again when reconnecting
154
+
155
+ This design is **MCP-compliant** for stdio transport and ensures complete isolation between different clients.
156
+
157
+ ### CLI (single-shot, stateless)
158
+
159
+ `e2a` is JSON-first for agent usage and supports `--pretty` for human-readable output.
160
+
161
+ Examples:
162
+
163
+ ```bash
164
+ # Help
165
+ npx e2a --help
166
+
167
+ # Set natal chart and print JSON
168
+ npx e2a set-natal-chart --name "Test" --year 1990 --month 1 --day 1 --hour 12 --minute 0 --latitude 40.7 --longitude -74.0 --timezone America/New_York
169
+
170
+ # Human-readable transit output
171
+ npx e2a get-transits --natal-file ./natal.json --date 2026-03-27 --pretty
172
+ ```
173
+
174
+ ### CLI Profiles (`.astro.json`)
175
+
176
+ The CLI supports profile-based natal input for one-shot commands.
177
+
178
+ - `--profile <name>`: profile to use
179
+ - `--profile-file <path>`: explicit profile file path
180
+ - `ASTRO_PROFILE`, `ASTRO_PROFILE_FILE`: env var equivalents
181
+
182
+ Profile file resolution order:
183
+ 1. `--profile-file`
184
+ 2. `ASTRO_PROFILE_FILE`
185
+ 3. `./.astro.json`
186
+ 4. `~/.astro.json`
187
+
188
+ Profile name resolution order:
189
+ 1. `--profile`
190
+ 2. `ASTRO_PROFILE`
191
+ 3. `defaultProfile` in the profile file
192
+
193
+ Read-only helper commands:
194
+
195
+ ```bash
196
+ npx e2a profiles list
197
+ npx e2a profiles show --profile elwyn
198
+ npx e2a profiles validate
199
+ ```
200
+
201
+ Recommended: add project-local `.astro.json` to `.gitignore` because it contains birth data.
202
+
203
+ ### Time Handling
204
+ The server accepts **local birth time** (not UTC):
205
+ - Provide birth time in local time at the birth location
206
+ - Specify the IANA timezone (e.g., `America/New_York`, `Europe/London`)
207
+ - The server automatically converts to UTC and handles DST correctly
208
+ - Verification feedback shows both local and UTC times for confirmation
209
+
210
+ **Example:** Born October 17, 1977 at 1:06 PM in Beaver Falls, PA:
211
+ - Input: `hour: 13, minute: 6, timezone: 'America/New_York'`
212
+ - Server converts: 1:06 PM EDT → 5:06 PM UTC
213
+ - Calculates correct Moon sign (0° Capricorn) and Ascendant (0° Capricorn)
214
+
215
+ ### House Systems
216
+ Supports multiple house systems:
217
+ - **Placidus** (default) - Most common in modern Western astrology
218
+ - **Whole Sign** - Traditional system, works at all latitudes
219
+ - **Koch** - Popular in Europe
220
+ - **Equal** - Simple 30° divisions
221
+
222
+ The server automatically uses Whole Sign for polar latitudes (>66°) where Placidus fails mathematically. You can specify your preferred system with the `house_system` parameter.
223
+
224
+ ## Usage
225
+
226
+ ### 1. Set Natal Chart (First Time)
227
+
228
+ ```
229
+ Use the set_natal_chart tool with:
230
+ - name: "Your Name"
231
+ - year, month, day, hour, minute (birth time in LOCAL time)
232
+ - latitude, longitude (birth location)
233
+ - timezone (e.g., "America/New_York", "Europe/London")
234
+ - house_system (optional): "P" (Placidus), "W" (Whole Sign), "K" (Koch), "E" (Equal)
235
+ ```
236
+
237
+ ### 2. Query Transits
238
+
239
+ Ask your AI agent:
240
+ - "What are today's transits?"
241
+ - "Show me Moon transits"
242
+ - "What outer planet transits are active?"
243
+ - "When will this transit be exact?"
244
+ - "What transits are coming up this week?"
245
+
246
+ ## MCP Tools Available
247
+
248
+ ### Setup
249
+ - `set_natal_chart` - Store birth chart data
250
+
251
+ ### Transits
252
+ - `get_transits` - Category-filtered transits with optional exact-time data
253
+
254
+ ### Advanced Tools
255
+ - `get_houses` - House cusps, Ascendant, Midheaven (Placidus, Koch, Whole Sign, Equal)
256
+ - `get_retrograde_planets` - Show which planets are retrograde
257
+ - `get_rise_set_times` - Sunrise, sunset, moonrise, moonset
258
+ - `get_asteroid_positions` - Chiron, Ceres, Pallas, Juno, Vesta, Nodes
259
+ - `get_next_eclipses` - Next solar and lunar eclipses
260
+
261
+ ### Visual Charts
262
+ - `generate_natal_chart` - Natal chart wheel (SVG/PNG/WebP)
263
+ - `generate_transit_chart` - Transit overlay chart (SVG/PNG/WebP)
264
+
265
+ ## CLI Commands Available
266
+
267
+ - `set-natal-chart`
268
+ - `get-transits`
269
+ - `get-houses`
270
+ - `get-retrograde-planets`
271
+ - `get-rise-set-times`
272
+ - `get-asteroid-positions`
273
+ - `get-next-eclipses`
274
+ - `generate-natal-chart`
275
+ - `generate-transit-chart`
276
+
277
+ ## Technical Details
278
+
279
+ - **Engine**: Native Swiss Ephemeris via Node `sweph` bindings
280
+ - **Dependency policy**: `sweph` is pinned to an exact version to keep validation fixtures and numerical baselines stable across installs
281
+ - **Accuracy**:
282
+ - Primary mode: Swiss Ephemeris data files (`SEFLG_SWIEPH`) for highest precision
283
+ - Fallback mode: Moshier (`EPHEMERIS_VERSION=moshier` or missing ephemeris files), lower precision but fully functional
284
+ - **Chart Rendering**: @astrodraw/astrochart with JSDOM for server-side SVG generation
285
+ - **Orb settings**:
286
+ - Conjunction/Opposition: 8°
287
+ - Square: 7°
288
+ - Trine: 7°
289
+ - Sextile: 6°
290
+ - **Aspects tracked**: Conjunction (0°), Opposition (180°), Square (90°), Trine (120°), Sextile (60°)
291
+ - **Supported bodies**: All planets, Chiron, Ceres, Pallas, Juno, Vesta, North Node
292
+ - **Exact time calculation**: Uses binary search interpolation for precision
293
+ - **Advance warnings**: Shows transits within 2° orb
294
+
295
+ ## License
296
+
297
+ AGPL-3.0-or-later
298
+
299
+ This package adopts the AGPL path because it depends on `sweph`, which declares
300
+ `(AGPL-3.0-or-later OR LGPL-3.0-or-later)` and reserves the LGPL path for the
301
+ conditions described by the Swiss Ephemeris licensing terms.
package/SETUP.md ADDED
@@ -0,0 +1,70 @@
1
+ # Quick Setup Guide
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ ./setup.sh
7
+ ```
8
+
9
+ This will:
10
+ 1. Install npm dependencies (including WebAssembly Swiss Ephemeris)
11
+ 2. Build TypeScript to JavaScript
12
+
13
+ ## Add to Claude Desktop
14
+
15
+ Edit your Claude Desktop config file:
16
+ - **Mac**: `~/Library/Application Support/Claude/claude_desktop_config.json`
17
+ - **Linux**: `~/.config/Claude/claude_desktop_config.json`
18
+
19
+ Add this MCP server:
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "astro": {
25
+ "command": "node",
26
+ "args": ["/path/to/ether-to-astro-mcp/dist/index.js"]
27
+ }
28
+ }
29
+ }
30
+ ```
31
+
32
+ **Important**: Replace `/path/to/ether-to-astro-mcp` with your actual path!
33
+
34
+ ## First Use
35
+
36
+ 1. Restart Claude Desktop
37
+ 2. Set your wife's natal chart:
38
+
39
+ ```
40
+ Please set my natal chart:
41
+ - Name: [Name]
42
+ - Birth: [Month] [Day], [Year] at [Hour]:[Minute]
43
+ - Location: [City] ([Latitude], [Longitude])
44
+ - Timezone: [e.g., America/Los_Angeles]
45
+ ```
46
+
47
+ 3. Query transits:
48
+
49
+ ```
50
+ What are my transits today?
51
+ Show me upcoming transits this week
52
+ When will the Moon conjunct my Venus be exact?
53
+ ```
54
+
55
+ ## MCP Tools Available
56
+
57
+ - `set_natal_chart` - Store birth data
58
+ - `get_daily_transits` - Current planetary positions
59
+ - `get_moon_transits` - Moon aspects to natal planets
60
+ - `get_personal_planet_transits` - Sun/Mercury/Venus/Mars aspects
61
+ - `get_outer_planet_transits` - Jupiter/Saturn/Uranus/Neptune/Pluto aspects
62
+ - `get_exact_transit_times` - Calculate exact times for current transits
63
+ - `get_upcoming_transits` - Multi-day forecast (default 7 days)
64
+
65
+ ## Technical Notes
66
+
67
+ - Uses WebAssembly Swiss Ephemeris (no native compilation!)
68
+ - Moshier mode provides ~1 arcsecond precision
69
+ - No ephemeris data files needed
70
+ - Works on Mac/Linux (Node.js required)