MCP server providing access to NASA's visual data APIs including Mars Rover photos, Earth satellite imagery (EPIC/GIBS), and Astronomy picture of the day. Features built-in image analysis tools with automatic format detection, compression, and base64 conv
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.
Install the package from PyPI:
pip install nasa-mcp-server
Or using uvx (recommended for MCP usage):
uvx nasa-mcp-server
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.
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.
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_apod()
get_apod(date="2024-01-15")
get_apod(start_date="2024-01-01", end_date="2024-01-07")
get_apod(count=5)
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 useAvailable Cameras:
FHAZ
: Front Hazard Avoidance CameraRHAZ
: Rear Hazard Avoidance CameraMAST
: Mast CameraCHEMCAM
: Chemistry and Camera ComplexMAHLI
: Mars Hand Lens ImagerMARDI
: Mars Descent ImagerNAVCAM
: Navigation CameraPANCAM
: Panoramic CameraMINITES
: Miniature Thermal Emission Spectrometer (Mini-TES)Example Usage:
get_mars_image()
get_mars_image(earth_date="2024-01-15")
get_mars_image(sol=500)
get_mars_image(camera="MAST")
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_neo_feed()
get_neo_feed(start_date="2024-01-15", end_date="2024-01-20")
get_neo_feed(limit_per_day=5)
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 retrievelimit
(int): Number of images to retrieve (default: 1, max recommended: 10)Available Image Types:
natural
: Natural color images (default)enhanced
: Enhanced color imagesaerosol
: Aerosol imagescloud
: Cloud imagesExample Usage:
get_earth_image_tool()
get_earth_image_tool(earth_date="2024-01-15")
get_earth_image_tool(type="enhanced")
get_earth_image_tool(limit=5)
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 colorVIIRS_SNPP_CorrectedReflectance_TrueColor
: VIIRS satellite true colorMODIS_Terra_CorrectedReflectance_Bands721
: Terra false colorMODIS_Aqua_CorrectedReflectance_Bands721
: Aqua false colorReference_Labels_15m
: Political boundaries and labelsReference_Features_15m
: Coastlines and water bodiesMODIS_Terra_Aerosol
: Aerosol optical depthMODIS_Terra_Land_Surface_Temp_Day
: Land surface temperatureExample Bounding Boxes:
"-180,-90,180,90"
"-125,25,-65,50"
"0,40,40,70"
Example Usage:
get_gibs_image()
get_gibs_image(bbox="-125,25,-65,50")
get_gibs_image(layer="MODIS_Terra_CorrectedReflectance_Bands721")
get_gibs_image(width=1024, height=1024)
get_gibs_image(date="2024-01-15")
Get information about all available GIBS layers and their capabilities.
Parameters: None
Example Usage:
get_gibs_layers()
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:
get_image_analyze(image_url="https://example.com/image.jpg")
get_image_analyze(image_url="https://apod.nasa.gov/apod/image/2401/example.jpg")
Features:
** NOTE ** This tool returns a imagecontent. This is supported in only ** Claud 4 ** as of now. Other LLMs may not respond for image analysis.
The server includes comprehensive error handling for:
The project includes a comprehensive test suite to ensure all MCP tools function correctly.
# Run all tests
python test.py
# Run with verbose output
python test.py -v
# Setup test environment
python tests/setup_tests.py
The test suite covers:
For detailed testing information, see tests/README.md
.
For issues and support, please visit the package repository or NASA API documentation for API-related questions.
This project uses NASA's public APIs. Please refer to NASA's API terms of service for usage guidelines.
I am Adithya. I developped this package as part of the MIE internship project. Wanted to talk more, shoot me an email at [email protected]