@cyanheads/astronomy-mcp-server 0.2.4 → 0.2.6
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.
- package/AGENTS.md +1 -1
- package/CLAUDE.md +1 -1
- package/README.md +13 -11
- package/changelog/0.2.x/0.2.5.md +19 -0
- package/changelog/0.2.x/0.2.6.md +13 -0
- package/dist/config/server-config.js +3 -3
- package/dist/config/server-config.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-ephemeris.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-ephemeris.tool.js +67 -10
- package/dist/mcp-server/tools/definitions/get-ephemeris.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.d.ts +29 -5
- package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.js +83 -13
- package/dist/mcp-server/tools/definitions/get-satellite-passes.tool.js.map +1 -1
- package/dist/services/horizons/horizons-service.d.ts.map +1 -1
- package/dist/services/horizons/horizons-service.js +7 -0
- package/dist/services/horizons/horizons-service.js.map +1 -1
- package/dist/services/horizons/types.d.ts +6 -1
- package/dist/services/horizons/types.d.ts.map +1 -1
- package/dist/services/satellite/satellite-service.d.ts +87 -33
- package/dist/services/satellite/satellite-service.d.ts.map +1 -1
- package/dist/services/satellite/satellite-service.js +266 -103
- package/dist/services/satellite/satellite-service.js.map +1 -1
- package/dist/services/satellite/types.d.ts +60 -7
- package/dist/services/satellite/types.d.ts.map +1 -1
- package/dist/services/satellite/types.js +36 -2
- package/dist/services/satellite/types.js.map +1 -1
- package/package.json +1 -1
- package/server.json +5 -5
package/AGENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** astronomy-mcp-server
|
|
4
|
-
**Version:** 0.2.
|
|
4
|
+
**Version:** 0.2.6
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.5`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
|
package/CLAUDE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Developer Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** astronomy-mcp-server
|
|
4
|
-
**Version:** 0.2.
|
|
4
|
+
**Version:** 0.2.6
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.11.5`
|
|
6
6
|
**Engines:** Bun ≥1.3.0, Node ≥24.0.0
|
|
7
7
|
**MCP SDK:** `@modelcontextprotocol/sdk` ^1.30.0
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](./CHANGELOG.md) [](./LICENSE) [](https://github.com/users/cyanheads/packages/container/package/astronomy-mcp-server) [](https://modelcontextprotocol.io/) [](https://www.npmjs.com/package/@cyanheads/astronomy-mcp-server) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
11
|
|
|
12
12
|
</div>
|
|
13
13
|
|
|
@@ -39,7 +39,7 @@ Seven tools — five form the keyless, offline, deterministic core (always regis
|
|
|
39
39
|
| `astronomy_find_events` | Forward search for the next occurrences of one sky-event class: eclipses, equinoxes, solstices, moon quarters, oppositions, conjunctions, greatest elongations, and apsides. |
|
|
40
40
|
| `astronomy_list_visible` | The one-call "what's up right now" answer: every naked-eye body (and optional bright stars) above the horizon, ranked, annotated, and gated by the Sun's altitude into daylight/twilight/dark. |
|
|
41
41
|
| `astronomy_get_ephemeris` | *(gated extension)* Time-series ephemeris for a small body (asteroid/comet) or spacecraft via JPL Horizons — covers what the in-process major-body set cannot. Off by default. |
|
|
42
|
-
| `astronomy_get_satellite_passes` | *(gated extension)* Visible passes of a satellite (by NORAD
|
|
42
|
+
| `astronomy_get_satellite_passes` | *(gated extension)* Visible passes of a satellite (by NORAD catalog number, or by a name resolved against the catalog) over an observer, from a CelesTrak GP element set propagated with SGP4 in-process. Off by default. |
|
|
43
43
|
|
|
44
44
|
This server computes geometry — where a body is, when an event happens — not astrophysics. The core wraps [`astronomy-engine`](https://github.com/cosinekitty/astronomy) (sub-arcminute accuracy, ≈1900–2100), so given the same `(body, time, observer)` every core tool returns identical output with no network, no rate limit, and no API key. It does not geocode: resolve a place name to latitude/longitude upstream (e.g. via an OpenStreetMap server) and pass an IANA `timezone` to receive observer-local times alongside UTC.
|
|
45
45
|
|
|
@@ -101,8 +101,8 @@ Time-series ephemeris for a small body or spacecraft via the keyless JPL Horizon
|
|
|
101
101
|
- **Spacecraft** — negative SPK-ID: `"-48"` (Hubble)
|
|
102
102
|
- A bare name like `"433 Eros"` or `"1P/Halley"` returns no match or an ambiguous record list and is rejected. Look up designations at [ssd.jpl.nasa.gov/tools/sbdb_lookup.html](https://ssd.jpl.nasa.gov/tools/sbdb_lookup.html).
|
|
103
103
|
- `start`/`stop` are ISO 8601 UTC and `stop` must be after `start`; `step` is a positive count plus a unit of `m`, `h`, `d`, `mo`, or `y` (`"10m"`, `"1h"`, `"1d"`)
|
|
104
|
-
- Supplying observer `latitude`/`longitude` yields topocentric coordinates and adds alt/az — pass both or neither; one alone is rejected rather than silently downgraded to a geocentric query
|
|
105
|
-
- Large spans truncate inline at 200 rows
|
|
104
|
+
- Supplying observer `latitude`/`longitude` yields topocentric coordinates and adds alt/az — pass both or neither; one alone is rejected rather than silently downgraded to a geocentric query. Horizons is asked for refracted elevation on a topocentric request, so `altitude_degrees` carries the same refraction correction the offline core tools report
|
|
105
|
+
- Large spans truncate inline at 200 rows. The disclosure names the instant the returned rows end at and the `start` to resume from — one step past it, because Horizons includes the start instant in its output, so resuming at the last row returned repeats it. Re-call with that `start`, or split the range into smaller adjacent spans — keep the same `step` and repeat until `truncated` is `false`, which concatenates back into the original series with no repeated sample. Widening the step discards samples the original range asked for
|
|
106
106
|
|
|
107
107
|
---
|
|
108
108
|
|
|
@@ -110,13 +110,15 @@ Time-series ephemeris for a small body or spacecraft via the keyless JPL Horizon
|
|
|
110
110
|
|
|
111
111
|
Visible passes of a satellite over an observer. Registered only when `ASTRONOMY_ENABLE_SATELLITES` is set.
|
|
112
112
|
|
|
113
|
-
-
|
|
113
|
+
- Identify the satellite by exactly one of `norad_id` (e.g. `25544` for the ISS) or `name` — both, or neither, is rejected before any request goes out
|
|
114
|
+
- Fetches the object's current GP element set from CelesTrak as OMM JSON and propagates it with SGP4 in-process. JSON rather than TLE because the legacy format cannot encode a catalog number above 99999, and CelesTrak already assigns six-digit numbers
|
|
115
|
+
- `name` is matched as a case-insensitive substring of the catalog name, so it resolves only when it picks out a single object — either the sole match, or the one match carrying that name outright. A broader query is rejected with the matching objects and their catalog numbers to choose from, capped at 20 and stating the full match count. The result echoes the query that resolved it as `resolved_from_name`
|
|
114
116
|
- Returns each pass's rise, peak, and set times with azimuths and the peak elevation
|
|
115
117
|
- Only naked-eye-plausible passes are returned — the satellite must be sunlit at peak while the observer's sky is dark
|
|
116
118
|
- Every returned pass rises inside the requested window. A pass already underway at `start` is omitted rather than reported with `start` as its `rise_utc`; move `start` earlier to see it. A pass rising exactly at `start` is kept, so feeding a reported `rise_utc` back as `start` never loses it
|
|
117
|
-
-
|
|
118
|
-
- `start` must be within about a month of
|
|
119
|
-
- NORAD catalog numbers are found at [celestrak.org](https://celestrak.org) or [heavens-above.com](https://heavens-above.com)
|
|
119
|
+
- A `start` further from the element set's epoch than the horizon below is rejected as out of range on that distance alone, and an element set that will not propagate to a window inside the horizon is rejected as a reentry — so an empty `passes` list means only "no visible passes in this window"
|
|
120
|
+
- `start` must be within about a month of the element set's epoch, which for a tracked object is hours old — so in practice within about a month of today. Past that the mean elements no longer describe the orbit, and SGP4 keeps returning positions built from them, which is why the horizon is enforced on the epoch distance rather than on whether the propagation succeeds
|
|
121
|
+
- NORAD catalog numbers and catalog names are found at [celestrak.org](https://celestrak.org) or [heavens-above.com](https://heavens-above.com)
|
|
120
122
|
- Searches the next `days` (default 7, max 10); optional observer-local pass times
|
|
121
123
|
|
|
122
124
|
## Resources and prompts
|
|
@@ -263,10 +265,10 @@ All configuration is optional and validated at startup via Zod schemas in `src/c
|
|
|
263
265
|
| `ASTRONOMY_ENABLE_HORIZONS` | Register the `astronomy_get_ephemeris` tool (JPL Horizons). | `false` |
|
|
264
266
|
| `ASTRONOMY_ENABLE_SATELLITES` | Register the `astronomy_get_satellite_passes` tool (CelesTrak + SGP4). | `false` |
|
|
265
267
|
| `ASTRONOMY_HORIZONS_BASE_URL` | Override the JPL Horizons API endpoint. | `https://ssd.jpl.nasa.gov/api/horizons.api` |
|
|
266
|
-
| `ASTRONOMY_CELESTRAK_BASE_URL` | Override the CelesTrak GP
|
|
268
|
+
| `ASTRONOMY_CELESTRAK_BASE_URL` | Override the CelesTrak GP endpoint. | `https://celestrak.org/NORAD/elements/gp.php` |
|
|
267
269
|
| `ASTRONOMY_DEFAULT_TIMEZONE` | Fallback IANA timezone when a tool call omits `timezone`. Unset = UTC-only output. | none |
|
|
268
270
|
| `ASTRONOMY_REQUEST_TIMEOUT_MS` | HTTP timeout (ms) for Horizons and CelesTrak requests. | `15000` |
|
|
269
|
-
| `ASTRONOMY_TLE_CACHE_TTL_MS` | In-process
|
|
271
|
+
| `ASTRONOMY_TLE_CACHE_TTL_MS` | In-process element-set cache TTL (ms) — respects CelesTrak's refetch guidance (~once/2h). | `7200000` |
|
|
270
272
|
| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |
|
|
271
273
|
| `MCP_HTTP_PORT` | Port for the HTTP server. | `3010` |
|
|
272
274
|
| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |
|
|
@@ -321,7 +323,7 @@ The Dockerfile defaults to HTTP transport, stateless session mode, and logs to `
|
|
|
321
323
|
| `src/mcp-server/prompts` | Prompt definitions (`*.prompt.ts`). Stargazing plan. |
|
|
322
324
|
| `src/services/ephemeris` | The offline compute core — `astronomy-engine` wrapper, body-radius table, and bundled bright-star catalog. |
|
|
323
325
|
| `src/services/horizons` | JPL Horizons HTTP client (gated extension). |
|
|
324
|
-
| `src/services/satellite` | CelesTrak
|
|
326
|
+
| `src/services/satellite` | CelesTrak GP/OMM fetch + SGP4 propagation (gated extension). |
|
|
325
327
|
| `tests/` | Unit and integration tests mirroring `src/`. |
|
|
326
328
|
|
|
327
329
|
## Development guide
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "astronomy_get_satellite_passes now fetches CelesTrak element sets as OMM JSON instead of legacy TLE — reaching six-digit catalog numbers — and resolves an optional `name` input to a catalog ID; a malformed GP record is now distinguished from a retryable CelesTrak outage."
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.2.5 — 2026-08-18
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **`name` input** on `astronomy_get_satellite_passes` resolves a satellite name to a catalog ID against CelesTrak's `NAME=` query, mutually exclusive with `norad_id`. An ambiguous match returns `ambiguous_satellite_name` with up to 20 candidates ordered by catalog number, `match_count`/`shown`/`truncated` fields, and a hint that leads with narrowing when the list is capped; a new `resolved_from_name` output field echoes the query that resolved it. ([#19](https://github.com/cyanheads/astronomy-mcp-server/issues/19))
|
|
12
|
+
|
|
13
|
+
## Changed
|
|
14
|
+
|
|
15
|
+
- **`astronomy_get_satellite_passes`** now fetches CelesTrak's GP data as `FORMAT=JSON` (OMM) instead of `FORMAT=TLE`, propagated via `satellite.js`'s `json2satrec`. TLE cannot encode catalog numbers above 99999, so six-digit objects — over a hundred current Starlink satellites among them — were previously unreachable and misreported as `tle_not_found`. ([#25](https://github.com/cyanheads/astronomy-mcp-server/issues/25))
|
|
16
|
+
|
|
17
|
+
## Fixed
|
|
18
|
+
|
|
19
|
+
- **`astronomy_get_satellite_passes`** — a GP record that parses as JSON but fails OMM validation now throws a new, non-retryable `malformed_element_set` reason instead of being reported as the retryable `celestrak_unavailable` outage. ([#28](https://github.com/cyanheads/astronomy-mcp-server/issues/28))
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "astronomy_get_ephemeris now advertises an exclusive resume instant and requests refracted elevation on topocentric queries; astronomy_get_satellite_passes enforces its epoch horizon independently of the SGP4 probe."
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.2.6 — 2026-08-18
|
|
8
|
+
|
|
9
|
+
## Fixed
|
|
10
|
+
|
|
11
|
+
- **`astronomy_get_ephemeris`** — the truncation notice advertised an inclusive resume instant: JPL Horizons' `START_TIME` is inclusive of the first output row, so re-calling at the last returned row duplicated it. The notice now advertises the instant one step past the last row, computed from the parsed `step` (fixed-duration for `m`/`h`/`d`, calendar-stepping for `mo`/`y`). ([#11](https://github.com/cyanheads/astronomy-mcp-server/issues/11))
|
|
12
|
+
- **`astronomy_get_ephemeris`** — `HorizonsService.buildUrl()` now sets `APPARENT=REFRACTED` on a topocentric request. `APPARENT` defaults to `AIRLESS`, so `altitude_degrees` was geometric rather than the refraction-corrected value the field already advertised — a gap of up to ~0.5° near the horizon, matching the core sky-position tools. ([#21](https://github.com/cyanheads/astronomy-mcp-server/issues/21))
|
|
13
|
+
- **`astronomy_get_satellite_passes`** — the documented `MAX_EPOCH_DISTANCE_DAYS` (30) horizon was only enforced when SGP4's own propagation probe happened to refuse a `start` instant; past the horizon SGP4 often keeps returning well-formed positions from mean elements that no longer describe the orbit. `predictPasses()` now checks the epoch distance independently, before probing propagation, and rejects an out-of-range `start` with `time_out_of_range` regardless of what the probe would have returned. ([#27](https://github.com/cyanheads/astronomy-mcp-server/issues/27))
|
|
@@ -10,17 +10,17 @@ import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
|
10
10
|
const ServerConfigSchema = z.object({
|
|
11
11
|
/** Gate the astronomy_get_ephemeris tool (JPL Horizons). Off by default. */
|
|
12
12
|
enableHorizons: z.stringbool().default(false),
|
|
13
|
-
/** Gate the astronomy_get_satellite_passes tool (CelesTrak
|
|
13
|
+
/** Gate the astronomy_get_satellite_passes tool (CelesTrak GP/OMM + SGP4). Off by default. */
|
|
14
14
|
enableSatellites: z.stringbool().default(false),
|
|
15
15
|
/** JPL Horizons API endpoint. */
|
|
16
16
|
horizonsBaseUrl: z.string().default('https://ssd.jpl.nasa.gov/api/horizons.api'),
|
|
17
|
-
/** CelesTrak GP
|
|
17
|
+
/** CelesTrak GP endpoint. */
|
|
18
18
|
celestrakBaseUrl: z.string().default('https://celestrak.org/NORAD/elements/gp.php'),
|
|
19
19
|
/** Optional fallback IANA timezone when a tool call omits `timezone`. Unset = UTC-only output. */
|
|
20
20
|
defaultTimezone: z.string().optional(),
|
|
21
21
|
/** HTTP timeout (ms) for Horizons and CelesTrak requests. */
|
|
22
22
|
requestTimeoutMs: z.coerce.number().default(15000),
|
|
23
|
-
/** In-process
|
|
23
|
+
/** In-process element-set cache TTL (ms). Default 2h — respects CelesTrak's refetch guidance. */
|
|
24
24
|
tleCacheTtlMs: z.coerce.number().default(7200000),
|
|
25
25
|
});
|
|
26
26
|
let _config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,4EAA4E;IAC5E,cAAc,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC7C,
|
|
1
|
+
{"version":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O,CAAC;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-ephemeris.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-ephemeris.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"get-ephemeris.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-ephemeris.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAyEjE,eAAO,MAAM,eAAe;;;;;;;;;;;iBA8B1B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuP3B,CAAC"}
|
|
@@ -12,15 +12,64 @@ import { getHorizonsService } from '../../../services/horizons/horizons-service.
|
|
|
12
12
|
/** Inline ephemeris-row cap disclosed via enrichment — mirrors HorizonsService MAX_ROWS. */
|
|
13
13
|
const INLINE_ROW_CAP = 200;
|
|
14
14
|
/**
|
|
15
|
-
* Accepted `step` shape: a positive count followed by one of Horizons'
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Accepted `step` shape: a positive count followed by one of Horizons' step units —
|
|
16
|
+
* m (minutes), h (hours), d (days), mo (months), y (years). `mo` precedes `m` in the
|
|
17
|
+
* alternation so "1mo" reads as months rather than a minute step with a stray
|
|
18
18
|
* character. An optional single space is tolerated because Horizons itself writes
|
|
19
19
|
* "1 d". Anything else — a bare number, an unsupported unit, or free text — is a
|
|
20
20
|
* caller mistake that would otherwise be spent on an upstream request and come back
|
|
21
|
-
* mislabelled as a Horizons outage.
|
|
21
|
+
* mislabelled as a Horizons outage. The count and unit are captured because the
|
|
22
|
+
* truncation notice has to advance the last returned instant by exactly one step.
|
|
22
23
|
*/
|
|
23
|
-
const STEP_PATTERN = /^[1-9]\d* ?(
|
|
24
|
+
const STEP_PATTERN = /^([1-9]\d*) ?(mo|[mhdy])$/i;
|
|
25
|
+
/** Milliseconds in one unit of each fixed-duration step. */
|
|
26
|
+
const FIXED_STEP_MS = { m: 60_000, h: 3_600_000, d: 86_400_000 };
|
|
27
|
+
/**
|
|
28
|
+
* How many whole steps to try before giving up on a calendar advance. Horizons skips a
|
|
29
|
+
* calendar period that has no such day of the month rather than rolling into the next
|
|
30
|
+
* one, so a series on the 31st passes over several periods in a row, and a Feb-29 year
|
|
31
|
+
* series passes over three — seven when a non-leap century year falls in the run.
|
|
32
|
+
*/
|
|
33
|
+
const MAX_CALENDAR_STEPS = 48;
|
|
34
|
+
/** Split a `step` into its count and unit, or undefined when it is not one this tool accepts. */
|
|
35
|
+
function parseStep(step) {
|
|
36
|
+
const match = STEP_PATTERN.exec(step);
|
|
37
|
+
if (!match?.[1] || !match[2])
|
|
38
|
+
return undefined;
|
|
39
|
+
return { count: Number(match[1]), unit: match[2].toLowerCase() };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The instant exactly one `step` after `instant`.
|
|
43
|
+
*
|
|
44
|
+
* Minute, hour, and day steps are fixed durations. Month and year steps are calendar
|
|
45
|
+
* stepping: per Horizons' API documentation the output "will follow the calendar based
|
|
46
|
+
* on the starting date", and a period that does not carry that day of the month
|
|
47
|
+
* produces no row at all — "if a start date on the 31st is requested, output will only
|
|
48
|
+
* occur for months having 31 days". A plain field increment is wrong there twice over,
|
|
49
|
+
* because JavaScript rolls Jan 31 forward into Mar 3: an instant Horizons would never
|
|
50
|
+
* print, and one that shifts every later row off the series the caller asked for.
|
|
51
|
+
* Advancing by whole steps until the day of the month survives applies Horizons' own
|
|
52
|
+
* rule, so the continuation lands on the next row of the same series.
|
|
53
|
+
*/
|
|
54
|
+
function nextStepInstant(instant, step) {
|
|
55
|
+
const from = new Date(instant);
|
|
56
|
+
if (Number.isNaN(from.getTime()))
|
|
57
|
+
return undefined;
|
|
58
|
+
if (step.unit === 'm' || step.unit === 'h' || step.unit === 'd') {
|
|
59
|
+
return new Date(from.getTime() + step.count * FIXED_STEP_MS[step.unit]).toISOString();
|
|
60
|
+
}
|
|
61
|
+
const dayOfMonth = from.getUTCDate();
|
|
62
|
+
for (let steps = 1; steps <= MAX_CALENDAR_STEPS; steps++) {
|
|
63
|
+
const next = new Date(from.getTime());
|
|
64
|
+
if (step.unit === 'mo')
|
|
65
|
+
next.setUTCMonth(next.getUTCMonth() + step.count * steps);
|
|
66
|
+
else
|
|
67
|
+
next.setUTCFullYear(next.getUTCFullYear() + step.count * steps);
|
|
68
|
+
if (next.getUTCDate() === dayOfMonth)
|
|
69
|
+
return next.toISOString();
|
|
70
|
+
}
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
24
73
|
export const EphemerisOutput = z.object({
|
|
25
74
|
designation: z.string().describe('The body designation echoed from the request.'),
|
|
26
75
|
points: z
|
|
@@ -48,7 +97,7 @@ export const EphemerisOutput = z.object({
|
|
|
48
97
|
});
|
|
49
98
|
export const getEphemerisTool = tool('astronomy_get_ephemeris', {
|
|
50
99
|
title: 'astronomy-mcp-server: get small-body ephemeris',
|
|
51
|
-
description: 'Fetch a time-series ephemeris for a small body (asteroid or comet) or spacecraft from JPL Horizons — RA/Dec, distance, and apparent magnitude over a span, optionally with observer-relative altitude/azimuth. This covers objects the in-process major-body set cannot. The designation is passed to Horizons verbatim, so it must be in a form Horizons resolves to a single record: a numbered asteroid takes a trailing-semicolon record lookup (e.g. "433;" for Eros, "1;" for Ceres), and a periodic comet takes the DES + closest-apparition form (e.g. "DES=1P;CAP" for Halley) — a bare name like "433 Eros" or "1P/Halley" returns no match or an ambiguous record list and is rejected. Spacecraft take their negative SPK-ID. `start` and `stop` are ISO 8601 UTC and `stop` must be after `start`; `step` is a count plus a unit of m, h, d, mo, or y, such as "1d", "1h", or "10m". Supplying observer latitude/longitude yields topocentric coordinates and adds alt/az — supply both or neither. This is a gated, network-backed extension (JPL Horizons is keyless but rate-limited and best-effort); large spans truncate inline at 200 rows, and the truncation notice
|
|
100
|
+
description: 'Fetch a time-series ephemeris for a small body (asteroid or comet) or spacecraft from JPL Horizons — RA/Dec, distance, and apparent magnitude over a span, optionally with observer-relative altitude/azimuth. This covers objects the in-process major-body set cannot. The designation is passed to Horizons verbatim, so it must be in a form Horizons resolves to a single record: a numbered asteroid takes a trailing-semicolon record lookup (e.g. "433;" for Eros, "1;" for Ceres), and a periodic comet takes the DES + closest-apparition form (e.g. "DES=1P;CAP" for Halley) — a bare name like "433 Eros" or "1P/Halley" returns no match or an ambiguous record list and is rejected. Spacecraft take their negative SPK-ID. `start` and `stop` are ISO 8601 UTC and `stop` must be after `start`; `step` is a count plus a unit of m, h, d, mo, or y, such as "1d", "1h", or "10m". Supplying observer latitude/longitude yields topocentric coordinates and adds alt/az — supply both or neither. This is a gated, network-backed extension (JPL Horizons is keyless but rate-limited and best-effort); large spans truncate inline at 200 rows, and the truncation notice names the exact `start` to resume from — one step past the last row returned, because Horizons includes the start instant in its output — so re-calling from there continues the series without repeating a sample. Splitting the range into smaller adjacent spans works too; keep the same step either way so no sample is lost.',
|
|
52
101
|
annotations: { readOnlyHint: true, openWorldHint: true, idempotentHint: true },
|
|
53
102
|
input: z.object({
|
|
54
103
|
designation: z
|
|
@@ -170,7 +219,8 @@ export const getEphemerisTool = tool('astronomy_get_ephemeris', {
|
|
|
170
219
|
if (hasLatitude !== hasLongitude) {
|
|
171
220
|
throw ctx.fail('incomplete_observer', `Observer ${hasLatitude ? 'latitude' : 'longitude'} was supplied without ${hasLatitude ? 'longitude' : 'latitude'}.`, { ...ctx.recoveryFor('incomplete_observer') });
|
|
172
221
|
}
|
|
173
|
-
|
|
222
|
+
const step = parseStep(input.step);
|
|
223
|
+
if (!step) {
|
|
174
224
|
throw ctx.fail('invalid_step', `Invalid step "${input.step}". Expected a positive count plus m, h, d, mo, or y, e.g. "10m".`, { ...ctx.recoveryFor('invalid_step') });
|
|
175
225
|
}
|
|
176
226
|
const observer = input.latitude !== undefined && input.longitude !== undefined
|
|
@@ -195,9 +245,16 @@ export const getEphemerisTool = tool('astronomy_get_ephemeris', {
|
|
|
195
245
|
*/
|
|
196
246
|
const caveats = [];
|
|
197
247
|
if (result.truncated) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
248
|
+
/**
|
|
249
|
+
* A truncated result is a full page, so its last row is where the returned series
|
|
250
|
+
* ends. Horizons' START_TIME is inclusive of the first output row, so a caller who
|
|
251
|
+
* resumes at that last row gets it back a second time and double-counts it when
|
|
252
|
+
* the pages are concatenated. Advertise the instant one step past it instead, so
|
|
253
|
+
* the continuation picks up the next sample of the same series.
|
|
254
|
+
*/
|
|
255
|
+
const endsAt = result.points.at(-1)?.timeUtc;
|
|
256
|
+
const resumeFrom = endsAt === undefined ? undefined : nextStepInstant(endsAt, step);
|
|
257
|
+
caveats.push(`Capped at ${INLINE_ROW_CAP} rows${endsAt ? `, ending at ${endsAt}` : ''}. To retrieve the omitted samples, re-call with start set to ${resumeFrom ?? 'one step past that instant'} — Horizons includes the start instant in its output, so resuming at the last row returned repeats it — or split the requested range into smaller adjacent spans; keep the same step either way and repeat until truncated is false. Widening the step is not equivalent — it discards samples the original range asked for.`);
|
|
201
258
|
}
|
|
202
259
|
if (result.dropped > 0) {
|
|
203
260
|
caveats.push(`Dropped ${result.dropped} of the rows Horizons returned — no usable time, position, or distance — so this series is shorter than the requested step count and has a gap where each dropped row would have been.`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-ephemeris.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-ephemeris.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,4FAA4F;AAC5F,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B
|
|
1
|
+
{"version":3,"file":"get-ephemeris.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-ephemeris.tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,4FAA4F;AAC5F,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;;;;;;;GASG;AACH,MAAM,YAAY,GAAG,4BAA4B,CAAC;AAElD,4DAA4D;AAC5D,MAAM,aAAa,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAW,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAQ9B,iGAAiG;AACjG,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,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D,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview astronomy_get_satellite_passes — gated extension. Visible passes of a
|
|
3
|
-
* satellite (by NORAD
|
|
4
|
-
*
|
|
3
|
+
* satellite (by NORAD catalog number, or by a name resolved against the catalog) over
|
|
4
|
+
* an observer, via a CelesTrak GP element set propagated with SGP4 offline. Registered
|
|
5
|
+
* only when ASTRONOMY_ENABLE_SATELLITES is set.
|
|
5
6
|
* @module mcp-server/tools/definitions/get-satellite-passes.tool
|
|
6
7
|
*/
|
|
7
8
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
@@ -9,6 +10,7 @@ import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
|
9
10
|
export declare const SatellitePassesOutput: z.ZodObject<{
|
|
10
11
|
norad_id: z.ZodNumber;
|
|
11
12
|
satellite_name: z.ZodOptional<z.ZodString>;
|
|
13
|
+
resolved_from_name: z.ZodOptional<z.ZodString>;
|
|
12
14
|
passes: z.ZodArray<z.ZodObject<{
|
|
13
15
|
rise_utc: z.ZodString;
|
|
14
16
|
peak_utc: z.ZodString;
|
|
@@ -26,7 +28,8 @@ export declare const SatellitePassesOutput: z.ZodObject<{
|
|
|
26
28
|
}, z.core.$strip>;
|
|
27
29
|
export type SatellitePassesOutputType = z.infer<typeof SatellitePassesOutput>;
|
|
28
30
|
export declare const getSatellitePassesTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
29
|
-
norad_id: z.ZodNumber
|
|
31
|
+
norad_id: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
name: z.ZodOptional<z.ZodString>;
|
|
30
33
|
latitude: z.ZodNumber;
|
|
31
34
|
longitude: z.ZodNumber;
|
|
32
35
|
elevation: z.ZodDefault<z.ZodNumber>;
|
|
@@ -36,6 +39,7 @@ export declare const getSatellitePassesTool: import("@cyanheads/mcp-ts-core").To
|
|
|
36
39
|
}, z.core.$strip>, z.ZodObject<{
|
|
37
40
|
norad_id: z.ZodNumber;
|
|
38
41
|
satellite_name: z.ZodOptional<z.ZodString>;
|
|
42
|
+
resolved_from_name: z.ZodOptional<z.ZodString>;
|
|
39
43
|
passes: z.ZodArray<z.ZodObject<{
|
|
40
44
|
rise_utc: z.ZodString;
|
|
41
45
|
peak_utc: z.ZodString;
|
|
@@ -58,18 +62,33 @@ export declare const getSatellitePassesTool: import("@cyanheads/mcp-ts-core").To
|
|
|
58
62
|
}, {
|
|
59
63
|
readonly reason: "time_out_of_range";
|
|
60
64
|
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
61
|
-
readonly when: "The start instant is outside the SGP4 high-accuracy span (≈1900–2100), or
|
|
65
|
+
readonly when: "The start instant is outside the SGP4 high-accuracy span (≈1900–2100), or more than about a month from the epoch of the current element set — checked on the epoch distance itself, since SGP4 keeps returning positions well past the point where the mean elements describe the orbit.";
|
|
62
66
|
readonly recovery: "Request a start within about a month of today — element sets only describe the orbit for weeks around their epoch.";
|
|
63
67
|
}, {
|
|
64
68
|
readonly reason: "invalid_timezone";
|
|
65
69
|
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
66
70
|
readonly when: "The `timezone` value is not an IANA zone this runtime knows.";
|
|
67
71
|
readonly recovery: "Pass a valid IANA timezone like America/Los_Angeles or UTC.";
|
|
72
|
+
}, {
|
|
73
|
+
readonly reason: "invalid_target";
|
|
74
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
75
|
+
readonly when: "Neither `norad_id` nor `name` was supplied, or both were.";
|
|
76
|
+
readonly recovery: "Supply exactly one of norad_id or name — norad_id when the catalog number is known, name otherwise.";
|
|
68
77
|
}, {
|
|
69
78
|
readonly reason: "tle_not_found";
|
|
70
79
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
71
80
|
readonly when: "CelesTrak has no current element set for the NORAD ID.";
|
|
72
81
|
readonly recovery: "Verify the catalog number at celestrak.org; the object may have decayed or never been catalogued.";
|
|
82
|
+
}, {
|
|
83
|
+
readonly reason: "satellite_name_not_found";
|
|
84
|
+
readonly code: JsonRpcErrorCode.NotFound;
|
|
85
|
+
readonly when: "No current CelesTrak object has a name containing the `name` value.";
|
|
86
|
+
readonly recovery: "Check the spelling, try a shorter distinctive substring, or look the object up at celestrak.org.";
|
|
87
|
+
}, {
|
|
88
|
+
readonly reason: "ambiguous_satellite_name";
|
|
89
|
+
readonly code: JsonRpcErrorCode.InvalidParams;
|
|
90
|
+
readonly when: "The `name` value matches more than one current object and none of them carries it as their whole name. The error names the match count and lists the matching objects with their catalog numbers, capped when there are more than the list holds. A capped list carries a hint leading with narrowing instead of with the list, since the wanted object need not be among the ones shown.";
|
|
91
|
+
readonly recovery: "Re-call with norad_id set to one of the listed candidates, or supply a longer, more specific name.";
|
|
73
92
|
}, {
|
|
74
93
|
readonly reason: "object_decayed";
|
|
75
94
|
readonly code: JsonRpcErrorCode.NotFound;
|
|
@@ -78,9 +97,14 @@ export declare const getSatellitePassesTool: import("@cyanheads/mcp-ts-core").To
|
|
|
78
97
|
}, {
|
|
79
98
|
readonly reason: "celestrak_unavailable";
|
|
80
99
|
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
81
|
-
readonly when: "The
|
|
100
|
+
readonly when: "The element-set fetch failed after retries, or returned a body that is not JSON at all.";
|
|
82
101
|
readonly retryable: true;
|
|
83
102
|
readonly recovery: "CelesTrak is degraded or timed out; retry in a few minutes.";
|
|
103
|
+
}, {
|
|
104
|
+
readonly reason: "malformed_element_set";
|
|
105
|
+
readonly code: JsonRpcErrorCode.SerializationError;
|
|
106
|
+
readonly when: "CelesTrak answered with parsable JSON whose GP record does not carry the fields an OMM element set requires — a permanent property of that record, not the transient outage celestrak_unavailable covers. The same request returns the same record, so retrying it can only fail again.";
|
|
107
|
+
readonly recovery: "Retrying returns the same record — request a different object, and report the element set to celestrak.org.";
|
|
84
108
|
}], {
|
|
85
109
|
readonly totalCount: z.ZodNumber;
|
|
86
110
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-satellite-passes.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-satellite-passes.tool.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"get-satellite-passes.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/get-satellite-passes.tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMjE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;iBA2DhC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE9E,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyOjC,CAAC"}
|