MCP Connector

Access NASA Data and Analyze Images

An MCP server exposing 7 tools for NASA's APOD, Mars Rover, Near Earth Object, EPIC, and GIBS satellite imagery APIs.

Works with nasa

Maintainer of this project? Claim this page to edit the listing.


91
Spark score
out of 100
Updated 12 months ago
Version 1.0
Models
universal

Add to Favorites

Why it matters

Connect to NASA's vast public APIs to retrieve astronomical images, Mars rover photos, Earth satellite imagery, and near-Earth object data. This asset also includes built-in capabilities for analyzing these images.

Outcomes

What it gets done

01

Retrieve Astronomy Picture of the Day (APOD) with date range support.

02

Access Mars rover photos with camera and date filtering.

03

Obtain Earth satellite imagery and near-Earth object data.

04

Load and analyze images from URLs with automatic processing.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-nasa-image-mcp-server | bash

Capabilities

Tools your agent gets

get_apod

Retrieve Astronomy Picture of the Day with descriptions, supports date ranges and random images

get_mars_image

Access Mars rover photos with various camera options and date filtering

get_neo_feed

Retrieve near-Earth object data and asteroid approach information

get_earth_image_tool

Obtain Earth satellite imagery from NASA's DSCOVR satellite using the EPIC camera

get_gibs_image

Access high-quality Earth satellite imagery from NASA's Global Imagery Browse Services

get_gibs_layers

Retrieve information about all available GIBS image layers and their capabilities

get_image_analyze

Load and analyze images from URLs with automatic processing and base64 conversion for LLM analysis

Overview

NASA Image MCP Server

An MCP server with 7 tools wrapping NASA's public APIs - Astronomy Picture of the Day, Mars Rover images, Near Earth Objects, EPIC Earth imagery, and GIBS satellite imagery. Use to pull NASA astronomy, Mars, asteroid, or satellite imagery data into an MCP client; the image-analysis tool's format currently only works reliably with Claude 4.

What it does

This MCP server exposes seven tools wrapping NASA's public APIs. get_apod retrieves the Astronomy Picture of the Day for a specific date, a date range (start_date/end_date), or a count of random images. get_mars_image fetches Mars rover photos by Earth date or Martian sol (default sol 1000), filterable by camera - FHAZ, RHAZ, MAST, CHEMCAM, MAHLI, MARDI, NAVCAM, PANCAM, or MINITES. get_neo_feed returns Near Earth Object (asteroid) data and close-approach information for a date range capped at 7 days by NASA's own API limit, with a configurable limit_per_day. get_earth_image_tool fetches Earth satellite images from the DSCOVR satellite's EPIC camera, in natural, enhanced, aerosol, or cloud image types. get_gibs_image pulls high-resolution satellite imagery from NASA's Global Imagery Browse Services for a given layer, bounding box, date, resolution (up to a recommended 2048x2048), format, and coordinate projection - popular layers include true-color and false-color MODIS/VIIRS imagery, political boundary/coastline reference layers, aerosol optical depth, and land surface temperature. get_gibs_layers lists all available GIBS layers and their capabilities. get_image_analyze fetches an image from any URL, auto-detects its format (PNG/JPEG/GIF), compresses and resizes it, converts JPEGs to RGB for compatibility, and returns it as base64-encoded MCP imagecontent for LLM analysis - a format currently supported only by Claude 4 as of this writing, so other LLMs may not respond to it.

When to use - and when NOT to

Use this to pull astronomy images, Mars rover photos, asteroid tracking data, or Earth satellite imagery into an MCP-compatible AI assistant, or to have an LLM analyze an arbitrary image fetched from a URL.

The get_image_analyze tool's imagecontent output is only confirmed to work with Claude 4 - other LLMs may not respond to it correctly. NEO feed queries are hard-capped at a 7-day range by NASA's own API, not this server. All tools require a free NASA API key, so requests are subject to NASA's own API rate limits and terms of service for the underlying data.

Inputs and outputs

Each tool takes structured parameters (dates in YYYY-MM-DD format, camera/layer/image-type strings, bounding boxes as "min_lon,min_lat,max_lon,max_lat", pixel dimensions) and returns the corresponding NASA imagery or data, with get_image_analyze additionally returning base64-encoded image content. Requires Python 3.8+, a free NASA API key from the NASA API Portal, and internet access. The server has comprehensive error handling for invalid date formats, network timeouts, invalid API keys, and NASA API-specific errors, and ships a test suite (python test.py, with -v for verbose output) covering all 7 tools, error scenarios, integration workflows, and async functionality.

How to install

Install from PyPI with pip install nasa-mcp-server, or run directly with uvx nasa-mcp-server (recommended for MCP usage). Configure the NASA_API_KEY environment variable in your client's MCP config - both VS Code's mcp.json and Claude Desktop's config use the same command/args/env shape pointing uvx at nasa-mcp-server. This project wraps NASA's public APIs; usage is governed by NASA's own API terms of service rather than a standard open-source license.

Who it's for

Developers and hobbyists building AI assistants or tools around astronomy, Mars exploration, asteroid tracking, or Earth satellite imagery data.

{
  "mcpServers": {
    "nasa-mcp": {
      "command": "uvx",
      "args": ["nasa-mcp-server"],
      "env": {
        "NASA_API_KEY": "YOUR_NASA_API_KEY_HERE"
      }
    }
  }
}
Source README

NASA MCP Server

A Model Context Protocol (MCP) server that provides access to NASA's public APIs, including Astronomy Picture of the Day (APOD), Mars Rover Images, and Near Earth Objects (NEO) data.

Features

  • Astronomy Picture of the Day (APOD): Get daily astronomy images with descriptions
  • Mars Rover Images: Access photos from Mars rovers with various camera options
  • Near Earth Objects (NEO): Retrieve asteroid data and close approach information
  • Earth Images (EPIC): Get satellite images of Earth from NASA's DSCOVR satellite
  • GIBS Satellite Imagery: Access high-resolution Earth imagery from NASA's Global Imagery Browse Services
  • GIBS Layers Information: Get details about available satellite imagery layers
  • Image Analysis Tool: Fetch and analyze images from URLs with automatic processing and base64 conversion

Installation

Install the package from PyPI:

pip install nasa-mcp-server

Or using uvx (recommended for MCP usage):

uvx nasa-mcp-server

Setup

Get NASA API Key

  1. Visit NASA API Portal
  2. Generate your free API key
  3. Keep the API key handy for configuration

VS Code Configuration

Add the following to your VS Code mcp.json configuration file:

{
  "servers": {
    "nasa-mcp": {
      "command": "uvx",
      "args": ["nasa-mcp-server"],
      "env": {
        "NASA_API_KEY": "YOUR_NASA_API_KEY_HERE"
      }
    }
  }
}

Replace YOUR_NASA_API_KEY_HERE with your actual NASA API key.

Claude Desktop Configuration

Add the following to your Claude Desktop configuration:

Windows: %APPDATA%/Claude/claude_desktop_config.json
macOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "nasa-mcp": {
      "command": "uvx",
      "args": ["nasa-mcp-server"],
      "env": {
        "NASA_API_KEY": "YOUR_NASA_API_KEY_HERE"
      }
    }
  }
}

Replace YOUR_NASA_API_KEY_HERE with your actual NASA API key.

Available Tools

1. get_apod - Astronomy Picture of the Day

Get stunning astronomy images with detailed descriptions from NASA's APOD service.

Parameters:

  • date (YYYY-MM-DD): Specific date for APOD image (default: today)
  • start_date (YYYY-MM-DD): Start date for date range (cannot be used with date)
  • end_date (YYYY-MM-DD): End date for date range (default: today)
  • count (int): Number of random images to retrieve (cannot be used with date parameters)

Example Usage:

  • Get today's APOD: get_apod()
  • Get APOD for specific date: get_apod(date="2024-01-15")
  • Get APOD for date range: get_apod(start_date="2024-01-01", end_date="2024-01-07")
  • Get 5 random APODs: get_apod(count=5)

2. get_mars_image - Mars Rover Images

Access photos taken by Mars rovers with various camera perspectives.

Parameters:

  • earth_date (YYYY-MM-DD): Earth date when photo was taken (default: today)
  • sol (int): Martian sol (day) of the rover's mission (default: 1000)
  • camera (string): Camera type to use

Available Cameras:

  • FHAZ: Front Hazard Avoidance Camera
  • RHAZ: Rear Hazard Avoidance Camera
  • MAST: Mast Camera
  • CHEMCAM: Chemistry and Camera Complex
  • MAHLI: Mars Hand Lens Imager
  • MARDI: Mars Descent Imager
  • NAVCAM: Navigation Camera
  • PANCAM: Panoramic Camera
  • MINITES: Miniature Thermal Emission Spectrometer (Mini-TES)

Example Usage:

  • Get images from today: get_mars_image()
  • Get images from specific Earth date: get_mars_image(earth_date="2024-01-15")
  • Get images from specific sol: get_mars_image(sol=500)
  • Get images from specific camera: get_mars_image(camera="MAST")

3. get_neo_feed - Near Earth Objects

Retrieve information about asteroids and their close approaches to Earth.

Parameters:

  • start_date (YYYY-MM-DD): Start date for asteroid search (default: today)
  • end_date (YYYY-MM-DD): End date for asteroid search (default: 7 days after start_date)
  • limit_per_day (int): Maximum number of asteroids to show per day (default: 2)

Note: Maximum date range is 7 days as per NASA API limitations.

Example Usage:

  • Get next 7 days of NEO data: get_neo_feed()
  • Get NEO data for specific date range: get_neo_feed(start_date="2024-01-15", end_date="2024-01-20")
  • Limit results per day: get_neo_feed(limit_per_day=5)

4. get_earth_image_tool - Earth Images (EPIC)

Get satellite images of Earth from NASA's DSCOVR satellite using the Earth Polychromatic Imaging Camera (EPIC).

Parameters:

  • earth_date (YYYY-MM-DD): Date when the photo was taken (default: latest available)
  • type (string): Type of image to retrieve
  • limit (int): Number of images to retrieve (default: 1, max recommended: 10)

Available Image Types:

  • natural: Natural color images (default)
  • enhanced: Enhanced color images
  • aerosol: Aerosol images
  • cloud: Cloud images

Example Usage:

  • Get latest Earth images: get_earth_image_tool()
  • Get images for specific date: get_earth_image_tool(earth_date="2024-01-15")
  • Get enhanced color images: get_earth_image_tool(type="enhanced")
  • Get multiple images: get_earth_image_tool(limit=5)

5. get_gibs_image - GIBS Satellite Imagery

Access high-resolution satellite imagery of Earth from NASA's Global Imagery Browse Services (GIBS).

Parameters:

  • layer (string): The imagery layer to fetch (default: "MODIS_Terra_CorrectedReflectance_TrueColor")
  • bbox (string): Bounding box as "min_lon,min_lat,max_lon,max_lat" (default: "-180,-90,180,90")
  • date (YYYY-MM-DD): Date for the imagery (default: most recent available)
  • width (int): Image width in pixels (default: 512, max recommended: 2048)
  • height (int): Image height in pixels (default: 512, max recommended: 2048)
  • format (string): Image format - "image/png" or "image/jpeg" (default: "image/png")
  • projection (string): Coordinate system - "epsg4326" or "epsg3857" (default: "epsg4326")

Popular Imagery Layers:

  • MODIS_Terra_CorrectedReflectance_TrueColor: Terra satellite true color (default)
  • MODIS_Aqua_CorrectedReflectance_TrueColor: Aqua satellite true color
  • VIIRS_SNPP_CorrectedReflectance_TrueColor: VIIRS satellite true color
  • MODIS_Terra_CorrectedReflectance_Bands721: Terra false color
  • MODIS_Aqua_CorrectedReflectance_Bands721: Aqua false color
  • Reference_Labels_15m: Political boundaries and labels
  • Reference_Features_15m: Coastlines and water bodies
  • MODIS_Terra_Aerosol: Aerosol optical depth
  • MODIS_Terra_Land_Surface_Temp_Day: Land surface temperature

Example Bounding Boxes:

  • World: "-180,-90,180,90"
  • USA: "-125,25,-65,50"
  • Europe: "0,40,40,70"

Example Usage:

  • Get world imagery: get_gibs_image()
  • Get USA true color imagery: get_gibs_image(bbox="-125,25,-65,50")
  • Get false color imagery: get_gibs_image(layer="MODIS_Terra_CorrectedReflectance_Bands721")
  • Get high-resolution imagery: get_gibs_image(width=1024, height=1024)
  • Get imagery for specific date: get_gibs_image(date="2024-01-15")

6. get_gibs_layers - Available GIBS Layers

Get information about all available GIBS layers and their capabilities.

Parameters: None

Example Usage:

  • Get all available layers: get_gibs_layers()

7. get_image_analyze - Image Analysis Tool

Fetch an image from a URL and convert it to base64 format for LLM analysis. This tool downloads images from any URL and processes them for analysis.

Parameters:

  • image_url (string): The URL of the image to analyze (required)

Example Usage:

  • Analyze an image from URL: get_image_analyze(image_url="https://example.com/image.jpg")
  • Analyze NASA image: get_image_analyze(image_url="https://apod.nasa.gov/apod/image/2401/example.jpg")

Features:

  • Automatic image format detection (PNG, JPEG, GIF)
  • Image compression and resizing for optimal processing
  • Base64 conversion for LLM analysis
  • Support for various image formats and URLs
  • Automatic RGB conversion for JPEG compatibility

** NOTE **
This tool returns a imagecontent. This is supported in only ** Claud 4 ** as of now. Other LLMs may not respond for image analysis.

Error Handling

The server includes comprehensive error handling for:

  • Invalid date formats
  • Network timeouts
  • Invalid API keys
  • NASA API-specific errors

Testing

The project includes a comprehensive test suite to ensure all MCP tools function correctly.

Quick Testing

# Run all tests
python test.py

# Run with verbose output
python test.py -v

# Setup test environment
python tests/setup_tests.py

Test Coverage

The test suite covers:

  • All 7 MCP tools with various parameter combinations
  • Error handling scenarios
  • Integration workflows
  • Async functionality

For detailed testing information, see tests/README.md.

Requirements

  • Python 3.8+
  • NASA API key (free from NASA API Portal)
  • Internet connection for API access

Links

Developper

I am Adithya. I developped this package as part of the MIE internship project. Wanted to talk more, shoot me an email at adithyasn7@gmail.com

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.