astronomy-mcp-server
Click on "Install 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.
Tools
Seven tools — five form the keyless, offline, deterministic core (always registered); two are network-backed extensions that register only when their config gate is enabled.
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, 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 angle, 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 ID) over an observer, from a CelesTrak TLE propagated with SGP4 in-process. Off by default. |
This server computes geometry — where a body is, when an event happens — not astrophysics. The core wraps astronomy-engine (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.
astronomy_get_sky_position
Apparent topocentric position of one solar-system body or a named bright star.
Equatorial (RA/Dec), refraction-corrected horizontal (altitude/azimuth), and ecliptic coordinates in one call
Distance, apparent magnitude, angular diameter, phase angle, illuminated fraction, and the constellation the body falls in
Parallax- and aberration-corrected for the observer; default elevation 0 m, default time now
Supply
star(e.g."Sirius","Polaris") instead ofbodyto target a catalog star;startakes precedence overbodynullmagnitude / angular diameter / phase fields where the engine cannot compute them — never fabricated
astronomy_get_rise_set
Rise, set, and culmination times, with twilight for the Sun.
Searches forward from
startand returns the nextcountcycles (default 1, max 31)For
body: "sun", bundles the three twilight pairs (civil −6°, nautical −12°, astronomical −18°) so a single call answers "when does the sun set and when is it truly dark"Circumpolar / never-rises situations are reported as
nullrise/set fields with an explanatorynoterather than an error — the fact is the answerOptional observer-local times when an IANA
timezoneis supplied
astronomy_find_events
Forward search across nine event classes under one event enum.
solar_eclipse,lunar_eclipse,equinox,solstice,moon_quarter,opposition,conjunction,max_elongation,perigee_apogeeSolar eclipses require an observer (
latitude/longitude) and report local visibility and contact times; lunar eclipses are geocentric and need no locationThe body-relative events (
opposition,conjunction,max_elongation,perigee_apogee) require abody, gated to the bodies each event exists for:oppositionto the superior planets (mars through pluto),conjunctionto any planet,max_elongationto mercury and venus,perigee_apogeeto the moon, earth, or a planetperigee_apogeeonearthreturns its perihelion and aphelion;conjunctionon mercury or venus returns both the inferior and superior passes, labelled byconjunction_kindReturns the next
countoccurrences (default 1, max 20)
astronomy_list_visible
The workflow flagship — one call returns a ranked, condition-gated "what's up" list.
Iterates every naked-eye solar-system body (and, with
include_stars, the bundled bright stars), keeps those above the horizon, and ranks them brightest-and-highest firstAttaches a plain-language
visibility_noteto each body, computed from real magnitude and altitude — no synthetic scoreReturns the whole-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 — for "tonight" pass a time after astronomical dusk (useastronomy_get_rise_seton the Sun to find it)Use
min_altitudeto skip objects grazing the horizon
astronomy_get_ephemeris (gated extension)
Time-series ephemeris for a small body or spacecraft via the keyless JPL Horizons API. Registered only when ASTRONOMY_ENABLE_HORIZONS is set.
Covers asteroids, comets, and spacecraft the in-process major-body engine cannot see
The designation is passed to Horizons verbatim and must resolve to a single record:
Numbered asteroid — trailing-semicolon record lookup:
"433;"(Eros),"1;"(Ceres)Periodic comet — DES + closest-apparition flag:
"DES=1P;CAP"(Halley),"DES=2P;CAP"(Encke)Spacecraft — negative SPK-ID:
"-48"(Hubble)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.
start/stopare ISO 8601 UTC andstopmust be afterstart;stepis a positive count plus a unit ofm,h,d,mo, ory("10m","1h","1d")Supplying observer
latitude/longitudeyields topocentric coordinates and adds alt/az — pass both or neither; one alone is rejected rather than silently downgraded to a geocentric queryLarge spans truncate inline at 200 rows, and the disclosure carries the instant the returned rows end at. Re-call with
startat that instant, or split the range into smaller adjacent spans — keep the samestepand repeat untiltruncatedisfalse, which reconstructs every sample. Widening the step discards samples the original range asked for
astronomy_get_satellite_passes (gated extension)
Visible passes of a satellite over an observer. Registered only when ASTRONOMY_ENABLE_SATELLITES is set.
Fetches the current TLE from CelesTrak by NORAD catalog number (e.g.
25544for the ISS) and propagates it with SGP4 in-processReturns each pass's rise, peak, and set times with azimuths and the peak elevation
Only naked-eye-plausible passes are returned — the satellite must be sunlit at peak while the observer's sky is dark
Every returned pass rises inside the requested window. A pass already underway at
startis omitted rather than reported withstartas itsrise_utc; movestartearlier to see it. A pass rising exactly atstartis kept, so feeding a reportedrise_utcback asstartnever loses itAn element set that will not propagate to the window is rejected by name — as a reentry when the window sits near the element set's epoch, otherwise as a
starttoo far from it — so an emptypasseslist means only "no visible passes in this window"startmust be within about a month of today: an element set describes the orbit for weeks around its epoch, and CelesTrak publishes only current onesNORAD catalog numbers are found at celestrak.org or heavens-above.com
Searches the next
days(default 7, max 10); optional observer-local pass times
Related MCP server: Precision astronomical ephemeris and planetary positions via the Swiss Ephemeris.
Resources and prompts
Type | Name | Description |
Resource |
| Static reference card for a solar-system body — canonical name, type, mean radius (km), and naked-eye visibility. |
Prompt |
| Structures a "plan tonight's stargazing from <place>" workflow, chaining the tools in order and naming the cross-server geocoding and weather steps. |
All resource data is also reachable via tools — astronomy_get_sky_position returns the same body metadata inline — so tool-only clients lose nothing. Design reference: docs/design.md.
Features
Built on @cyanheads/mcp-ts-core:
Declarative tool, resource, and prompt definitions — single file per primitive, framework handles registration and validation
Unified error handling — handlers throw, framework catches, classifies, and formats
Pluggable auth:
none,jwt,oauthSwappable storage backends:
in-memory,filesystem,Supabase,Cloudflare KV/R2/D1Structured logging with optional OpenTelemetry tracing
STDIO and Streamable HTTP transports; the keyless core is Cloudflare Workers-portable (pure JS, no native deps)
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 toolsBoth 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
Agent-friendly output:
Preserves uncertainty — magnitude, angular diameter, phase, and illumination are
null(not 0, not omitted) when unavailable, andformat()renders "unavailable" rather than inventing a valueServer-computed visibility notes are deterministic prose from real magnitude and altitude — no synthetic confidence scores
Typed error contracts with recovery hints (out-of-range time, missing observer/body, unresolved designation) so callers can correct and retry
format()is content-complete on every tool —content[]-only clients see the same fields asstructuredContentclients, and the same numbers: a value reads as a rounded display figure followed by its exact counterpart in brackets, e.g.RA 4.4116 h [4.411597993526305], dropped when the rounding already round-trips.astronomy_list_visibleis the one scan surface, so its per-body line keeps only the distance's exact tail;astronomy_get_sky_positiontakes any body listed there and returns the same field set with every exact value
Getting started
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.3.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 installConfiguration
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/TLE endpoint. |
|
| Fallback IANA timezone when a tool call omits | none |
| HTTP timeout (ms) for Horizons and CelesTrak requests. |
|
| In-process TLE 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 TLE 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 and pull requests 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 installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
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.Last updated81Apache 2.0
- Alicense-qualityCmaintenanceA 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%Last updated2AGPL 3.0
- AlicenseAqualityAmaintenanceAstrology 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.Last updated12921MIT
- FlicenseAqualityDmaintenanceProvides astronomical calculations using the Swiss Ephemeris library, including planetary positions, houses, chart points, and asteroids for any date and location.Last updated48
Related MCP Connectors
Horoscope MCP — wraps the keyless Horoscope App API.
Islamic prayer times & calendar MCP (Aladhan API). Keyless.
OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyanheads/astronomy-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server