astronomy-mcp-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@astronomy-mcp-serverWhat is the phase of the moon today?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Public Hosted Server: https://astronomy.caseyjhand.com/mcp
Overview
Observational astronomy computed in-process from astronomy-engine — sky positions, rise/set and twilight times, moon phases, and eclipse/conjunction/opposition events for any place and time, plus two optional network-backed extensions for small-body ephemerides and satellite passes. List what's visible right now, plan a dark-sky window, or search forward for the next sky event — deterministic and keyless for the five core tools, given the same body, time, and observer. Runs as a stdio process, a local Streamable HTTP server, or the public hosted endpoint above.
Tools
Tool | Description |
| Apparent position of one body or named star for an observer and instant — equatorial (RA/Dec), horizontal (alt/az), ecliptic, plus distance, magnitude, angular diameter, phase, angular distance from the Sun, and constellation. |
| Rise, set, and culmination times for a body at a location, with maximum altitude at transit. For the Sun, also the three twilight pairs (civil/nautical/astronomical). |
| Moon phase for an instant: illuminated fraction, phase name, synodic age, phase longitude, and the next four quarter phases with timestamps. |
| Forward search for the next occurrences of one sky-event class: eclipses, equinoxes, solstices, moon quarters, oppositions, conjunctions, greatest elongations, and apsides. |
| 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. |
| (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. |
| (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. |
Resources
Resource | Description |
| Static reference card for a solar-system body — canonical name, type, mean radius (km), and naked-eye visibility. |
Also reachable via tools — astronomy_get_sky_position returns the same body metadata inline — so tool-only clients lose nothing.
Prompts
Prompt | Description |
| Structures a "plan tonight's stargazing from <place>" workflow, chaining the tools in order and naming the cross-server geocoding and weather steps. |
Design reference: docs/design.md.
Related MCP server: Precision astronomical ephemeris and planetary positions via the Swiss Ephemeris.
Capability reference
astronomy_get_sky_position tool
Target one solar-system body (
body) or a named bright star (star, takes precedence overbody) — one of the two is requiredstardraws on a bundled 32-star catalog (about 30 of the brightest stars plus Polaris) by common name or Bayer designation, with the Greek letter spelled out or as a symbol and the constellation as genitive or IAU abbreviation —Alpha Canis Majoris,Alpha CMa, andα CMaall resolve to Sirius; a miss lists every catalog starReturns equatorial (RA/Dec), refraction-corrected horizontal (alt/az), and ecliptic coordinates plus distance, magnitude, angular diameter, phase angle, illuminated fraction,
sun_elongation_degrees(angular distance from the Sun), and constellation in one callFor a solar-system body, also inlines its
astronomy://body/{body}reference card (type, mean radius, naked-eye visibility) — absent for a star, which has no cardmagnitude,angular_diameter_arcsec,phase_angle_degrees, andilluminated_fractionarenull, never fabricated, where the engine can't compute themDefault elevation 0 m, default time now; pass
timezonefor observer-local output alongside UTC
astronomy_get_rise_set tool
Searches forward from
start(default now) and returns the nextcountcycles — default 1, max 31For
body: "sun", each cycle also carries the three twilight pairs (civil −6°, nautical −12°, astronomical −18°), each covering the night after that cycle's set:duskthat evening,dawnthe following morning — so the dawn listed beside a sunrise is the next day's, and the dawn before it is in the previous cycleCircumpolar or never-rises situations return
nullrise/set fields with an explanatorynote, not an errorWhen the body is already up at
start, that cycle'sriseisnull(it precedes the search) so asetis never reported earlier than its pairedriseDefault elevation 0 m; pass
timezonefor observer-local times alongside UTC
astronomy_get_moon_phase tool
Geocentric — no observer location needed
Returns illuminated fraction, phase name, synodic age in days, and the next four quarter phases (new/first/full/last) in one call
phase_longitude_degreesis the Moon–Sun ecliptic-longitude difference (0 new, 90 first quarter, 180 full, 270 last quarter) — not the Sun–body–observerphase_angle_degreesofastronomy_get_sky_position, which reads 0 at full moontimedefaults to now; passtimezonefor observer-local timestamps alongside UTC
astronomy_find_events tool
One
eventenum covers nine classes:solar_eclipse,lunar_eclipse,equinox,solstice,moon_quarter,opposition,conjunction,max_elongation,perigee_apogeeBoth eclipse classes take an optional observer (
latitudeandlongitudetogether — one alone is rejected):solar_eclipsewithout one returns global eclipses, with the peak'speak_latitude_degrees/peak_longitude_degreesfor total and annular eclipses; with one it returns only eclipses visible from that point, with local contact timeslunar_eclipsecontact times are geocentric either way; an observer adds local circumstancesLocal circumstances are
local_visible(the eclipsed body above the horizon at any contact) andcontact_altitudes_degrees(its altitude at each contact), so a sunrise or sunset eclipse reads differently from a midday one
Every other class is geocentric and ignores a location
Body-relative events require
body, gated to which bodies each applies to:oppositionto mars through pluto,conjunctionto any planet,max_elongationto mercury or venus,perigee_apogeeto the moon, earth, or a planetReturns the next
countoccurrences, default 1, max 20; searches stop at the end of 2100, and a notice says so when that returns fewer thancountperigee_apogeeon earth returns perihelion/aphelion;conjunctionon mercury or venus returns both the inferior and superior pass, labelled byconjunction_kind
astronomy_list_visible tool
One call for every naked-eye solar-system body (plus, with
include_stars, the bundled bright stars) above the horizon, ranked brightest-and-highest firstEach body carries a deterministic
visibility_notecomputed from real magnitude and altitude, plus itssun_elongation_degreesThe note states when conditions hide or dim a body — daylight, civil twilight, or within 15° of the Sun (lost in glare); the Sun, the Moon, and a negative-magnitude Venus take no daylight or twilight caveat
Returns the whole-sky
sky_condition(daylight/civil_twilight/nautical_twilight/astronomical_twilight/dark) and the Sun's altitude alongside the listtimeis a single evaluation instant, not a window;min_altitude(default 0) filters out bodies grazing the horizonDefault elevation 0 m; pass
timezonefor observer-local times per body
astronomy_get_ephemeris tool
Registered only when
ASTRONOMY_ENABLE_HORIZONSis set; off by defaultTime-series ephemeris for a small body or spacecraft via JPL Horizons — RA/Dec, distance, magnitude, and optional alt/az when observer
latitude/longitudeare both supplied (one alone is rejected)designationshould resolve to a single Horizons record: numbered asteroid as"433;", periodic comet as"DES=1P;CAP", spacecraft as a negative SPK-ID — a bare name matching nothing or several records is rejected, and one matching a single object can land on the wrong one ("Eros"resolves to Kerberos), so the result carriestarget_name, the object Horizons resolvedstart/stopaccept aZor numeric UTC offset (a value with neither is read as UTC); Horizons receives the resolved UTC instantNo 1900–2100 limit applies, but a span outside the target's own Horizons data is rejected as
time_out_of_range, and the message gives the bound Horizons reports (e.g. Mars ends after A.D. 2599-DEC-31); an unknown designation isbody_not_foundstepis a count plus unit (m/h/d/mo/y, e.g."1h");stopmust be afterstart(defaults to a 24h span from now)Truncates inline at 200 rows; the truncation notice names the exact
startto resume from, one step past the last row returned
astronomy_get_satellite_passes tool
Registered only when
ASTRONOMY_ENABLE_SATELLITESis set; off by defaultIdentify the satellite by exactly one of
norad_idorname— both or neither is rejectednameresolves the common names ISS / International Space Station (25544), Hubble / Hubble Space Telescope / HST (20580), and Tiangong / CSS / Chinese Space Station (48274) directly; any other name is a case-insensitive substring match against CelesTrak's catalogFetches the current GP element set from CelesTrak and propagates it with SGP4 in-process; only naked-eye-plausible passes (sunlit at peak, observer sky dark) are returned
A pass must rise inside the window: one already up at
startis omitted, one still up when the window ends is reported through its setstartmust be within about a month of the element set's epoch — older elements no longer describe the orbit, and an element set that won't propagate inside that window is rejected as a reentrySearches the next
daysahead, default 7, max 10; passtimezonefor observer-local pass times
astronomy://body/{body} resource
Static reference card as
application/json: canonical name, type (star/planet/moon/dwarf), mean radius in km, naked-eye visibility{body}is one ofsun,moon,mercury…pluto; supports name completionAlso returned inline by
astronomy_get_sky_positionfor solar-system bodies, so tool-only clients lose nothing
astronomy_stargazing_plan prompt
Arguments:
locationrequired;dateoptional (YYYY-MM-DD), defaults to tonightReturns one user message chaining the five core tools in order — sunset/dusk, moon phase and moon rise/set, then the ranked visible list with
include_starsonNames the cross-server geocoding and weather steps this server doesn't cover, and anchors every step to the observer's local night rather than UTC midnight
Features
Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.
Astronomy-specific:
Keyless, offline, deterministic core —
astronomy-engineis the source of truth for positional astronomy; no network, no rate limit, no API key for the five core tools, and the keyless core is pure JS with no native depsPositions are accurate to sub-arcminute precision within the engine's ≈1900–2100 span; a
time/startoutside that range is rejected astime_out_of_rangeBoth UTC and observer-local time on every output when a
timezoneis supplied; the server never guesses a timezone from coordinatesBundled bright-star catalog so
astronomy_list_visibleandastronomy_get_sky_positionanswer for named starsTwo gated extensions (off by default) reach beyond the major-body set — JPL Horizons small bodies and CelesTrak satellite passes — each with its own timeout/retry boundary; they degrade loudly and never silently fall back to the core
Does not geocode — resolve a place name to coordinates upstream (e.g. via an OpenStreetMap server) and pass an IANA
timezonefor observer-local output
Agent-friendly output:
Preserves uncertainty — magnitude, angular diameter, phase, and illuminated fraction are
null(never fabricated or zeroed) where the engine can't compute them, andformat()renders "unavailable" rather than inventing a valueDeterministic visibility notes —
astronomy_list_visible's plain-language headline is computed from real magnitude, altitude, sky condition, and distance from the Sun, never a synthetic confidence scoreTyped error contracts with recovery hints — out-of-range time, missing observer/body, unresolved designation — so callers can correct and retry
Rounded-plus-exact dual values —
format()pairs a rounded display figure with its exact counterpart in brackets (e.g.RA 4.4116 h [4.411597993526305]), dropped only when the rounding already round-trips, so acontent[]-only client never needs a second call to recover full precision
Getting started
Public Hosted Instance
A public instance is available at https://astronomy.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:
{
"mcpServers": {
"astronomy-mcp-server": {
"type": "streamable-http",
"url": "https://astronomy.caseyjhand.com/mcp"
}
}
}Self-Hosted / Local
Add the following to your MCP client configuration file. The five core tools need no configuration; set ASTRONOMY_ENABLE_HORIZONS and/or ASTRONOMY_ENABLE_SATELLITES to true to register the gated extensions.
{
"mcpServers": {
"astronomy-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/astronomy-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with npx (no Bun required):
{
"mcpServers": {
"astronomy-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/astronomy-mcp-server@latest"],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}Or with Docker:
{
"mcpServers": {
"astronomy-mcp-server": {
"type": "stdio",
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/astronomy-mcp-server:latest"]
}
}
}For Streamable HTTP, set the transport and start the server:
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
# Server listens at http://localhost:3010/mcpPrerequisites
Bun v1.4.0 or higher (or Node.js v24+).
No API key required — both the offline core and the two keyless extensions (JPL Horizons, CelesTrak) need no credentials.
Installation
Clone the repository:
git clone https://github.com/cyanheads/astronomy-mcp-server.gitNavigate into the directory:
cd astronomy-mcp-serverInstall dependencies:
bun installConfigure environment (optional):
cp .env.example .env
# edit .env only to enable the gated extensions or override a defaultConfiguration
All configuration is optional and validated at startup via Zod schemas in src/config/server-config.ts. The core runs with no configuration at all.
Variable | Description | Default |
| Register the |
|
| Register the |
|
| Override the JPL Horizons API endpoint. |
|
| Override the CelesTrak GP endpoint. |
|
| Fallback IANA timezone when a tool call omits | none |
| HTTP timeout (ms) for Horizons and CelesTrak requests. |
|
| In-process element-set cache TTL (ms) — respects CelesTrak's refetch guidance (~once/2h). |
|
| Transport: |
|
| Port for the HTTP server. |
|
| Auth mode: |
|
| Log level (RFC 5424). |
|
| Directory for log files (Node.js only). |
|
| Storage backend. |
|
| Enable OpenTelemetry instrumentation. |
|
See .env.example for the full list of optional overrides.
Running the server
Local development
Build and run:
# One-time build bun run rebuild # Run the built server bun run start:stdio # or bun run start:httpRun checks and tests:
bun run devcheck # Lint, format, typecheck, security bun run test # Vitest test suite bun run lint:mcp # Validate MCP definitions against spec
Docker
docker build -t astronomy-mcp-server .
docker run --rm -e MCP_TRANSPORT_TYPE=stdio astronomy-mcp-serverThe Dockerfile defaults to HTTP transport, stateless session mode, and logs to /var/log/astronomy-mcp-server. OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.
Project structure
Directory | Purpose |
|
|
| Server-specific environment variable parsing and validation with Zod. |
| Tool definitions ( |
| Resource definitions ( |
| Prompt definitions ( |
| The offline compute core — |
| JPL Horizons HTTP client (gated extension). |
| CelesTrak GP/OMM fetch + SGP4 propagation (gated extension). |
| Unit and integration tests mirroring |
Development guide
See CLAUDE.md for development guidelines and architectural rules. The short version:
Handlers throw, framework catches — no
try/catchin tool logicUse
ctx.logfor request-scoped logging,ctx.statefor tenant-scoped storageRegister new tools and resources in the
createApp()arrays insrc/index.tsNormalize raw engine/API values to the domain type; preserve uncertainty as
nulland never fabricate missing fields
Contributing
Issues are welcome. Run checks and tests before submitting:
bun run devcheck
bun run testLicense
Apache-2.0 — see LICENSE for details.
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for aerospace calculations: orbital mechanics, ephemeris, DSN operations, ...
Sun, Moon, planet and eclipse calculations for any place and date: rise and set times, twilight, moon phases, precise positions, dark-sky windows and planet events. Read-only. Works without a key up to 50 calls a day; a free RapidAPI key raises the limit.
Official Divine API MCP for Western Astrology: Natal, Synastry, Transit, Composite, Progressions.
Official Divine API MCP for Indian/Vedic Astrology: Panchang, Kundli, Dasha, KP, Lal Kitab.
Related MCP Servers
- AlicenseAqualityCmaintenanceProvides authoritative astronomical data including moon phases, solar eclipses, and sun/moon rise and set times using the US Navy API or offline Skyfield calculations. It enables users to query Earth's seasons and celestial events for any location and date.81Apache 2.0
- AlicenseNot gradedqualityCmaintenanceA self-contained MCP server that gives AI agents the ability to calculate high-precision astronomical data. It provides tropical zodiac coordinates, planetary speeds, retrograde detection, and house cusps using the trusted Swiss Ephemeris engine. 100%4AGPL 3.0
- AlicenseAqualityCmaintenanceAstrology MCP server that computes natal charts, transits, synastry, progressions, returns, eclipses, retrogrades, and moon phases from a real ephemeris, enabling AI agents to provide accurate astrological calculations without hallucination.1271 npm1MIT
- AlicenseAqualityAmaintenancePrecision-audited astrology MCP for natal charts, transits, synastry and moon phases. No API key.1058 npmMIT