NASA Image MCP Server — Mars, EPIC, APOD Analysis
Access NASA visual data via MCP server: Mars Rover, EPIC/GIBS, APOD with image analysis, auto format detection, compression and base64 for LLMs
Overview
This MCP (Model Context Protocol) server exposes NASA visual datasets (Mars Rover imagery, EPIC/GIBS, and APOD) in a format designed for consumption by LLMs and other AI systems. It wraps NASA API endpoints into structured MCP payloads that include media metadata and the media itself (optionally compressed and base64-encoded), plus lightweight image analysis to make visual content accessible as model context.
The server is useful when you need to feed high-quality scientific imagery into a language model without dealing with raw binary transport, format detection, or manual encoding. It handles format detection, optional compression, and base64 encoding so downstream models or tools can reliably ingest images as part of an MCP stream.
Features
- Unified access to multiple NASA image sources:
- Mars Rover photos (Curiosity, Perseverance, etc.)
- EPIC natural-color Earth imagery and GIBS tiles
- APOD (Astronomy Picture of the Day)
- Returns MCP-compatible payloads that pair media + metadata for LLMs
- Automatic image format detection (JPEG, PNG, TIFF, etc.)
- Optional compression (gzip) to reduce payload size
- Built-in base64 encoding for safe JSON transport to LLMs
- Lightweight image analysis (basic metadata extraction, color/size heuristics)
- Simple HTTP API designed for programmatic access and integration
Installation / Configuration
Clone the repository, set a NASA API key, then run locally or in Docker. The project contains typical Node/Python/Docker entrypoints; choose the one that matches your environment.
Clone the repo:
Node/npm (example):
# install dependencies
# set environment variables (example)
# start the server
Python/pip (example):
Docker (example):
# build
# run
Important environment variables:
| Variable | Purpose |
|---|---|
| NASA_API_KEY | Required for NASA web APIs (APOD, Mars Rover, EPIC) |
| PORT | HTTP port to listen on (default: 8080) |
| LOG_LEVEL | Optional log verbosity (info, debug, warn, error) |
Available Resources
The server groups NASA imagery into a small set of resources optimized for MCP-style responses.
| Resource | What it provides |
|---|---|
| Mars Rover | Photos by rover, filter by sol/date/camera |
| EPIC / GIBS | Earth natural-color EPIC images and GIBS tiles |
| APOD | Astronomy Picture of the Day (image + explanation) |
| Image analysis | Lightweight metadata and heuristics (dimensions, dominant color, format) |
| MCP endpoint | Returns structured MCP payloads combining the above |
Typical endpoints (example names — check the server’s API for exact paths):
- GET /mcp?resource=apod
- GET /mcp?resource=mars&rover=Curiosity&date=2021-06-01
- GET /mcp?resource=epic&date=2022-01-01
- GET /health
Response features:
- JSON MCP payload with metadata block
- media block containing either a URL or a base64-encoded compressed image (if requested)
- analysis block with simple attributes for quick model use
Using the server — examples
- Fetch a basic MCP payload for APOD:
|
- Request base64-encoded and gzip-compressed image suitable for embedding in LLM context:
|
- The payload will include a base64 string like data:application/octet-stream;base64,<…>
- To decode and decompress locally:
# save base64 to file (strip prefix)
| |
3