NA

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:

git clone https://github.com/adithya1012/NASA-MCP-Server.git
cd NASA-MCP-Server

Node/npm (example):

# install dependencies
npm install

# set environment variables (example)
export NASA_API_KEY="YOUR_NASA_API_KEY"
export PORT=8080

# start the server
npm start

Python/pip (example):

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

export NASA_API_KEY="YOUR_NASA_API_KEY"
python app.py

Docker (example):

# build
docker build -t nasa-mcp-server .

# run
docker run -p 8080:8080 \
  -e NASA_API_KEY=YOUR_NASA_API_KEY \
  -e PORT=8080 \
  nasa-mcp-server

Important environment variables:

VariablePurpose
NASA_API_KEYRequired for NASA web APIs (APOD, Mars Rover, EPIC)
PORTHTTP port to listen on (default: 8080)
LOG_LEVELOptional log verbosity (info, debug, warn, error)

Available Resources

The server groups NASA imagery into a small set of resources optimized for MCP-style responses.

ResourceWhat it provides
Mars RoverPhotos by rover, filter by sol/date/camera
EPIC / GIBSEarth natural-color EPIC images and GIBS tiles
APODAstronomy Picture of the Day (image + explanation)
Image analysisLightweight metadata and heuristics (dimensions, dominant color, format)
MCP endpointReturns 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

  1. Fetch a basic MCP payload for APOD:
curl "http://localhost:8080/mcp?resource=apod" -s | jq .
  1. Request base64-encoded and gzip-compressed image suitable for embedding in LLM context:
curl "http://localhost:8080/mcp?resource=apod&encode=base64&compress=gzip" -s | jq .
  • The payload will include a base64 string like data:application/octet-stream;base64,<…>
  • To decode and decompress locally:
# save base64 to file (strip prefix)
echo "<BASE64_CONTENT>" | base64 --decode | gzip -d > apod.jpg

3