NASA MCP Server

NASA MCP Server

Provides access to NASA's public APIs including Astronomy Picture of the Day, Mars Rover Images, and Near Earth Objects data, enabling users to query and retrieve space-related information through natural language.

Category
访问服务器

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

  • PyPI Package: https://pypi.org/project/nasa-mcp-server/
  • NASA API Documentation: https://api.nasa.gov/
  • MCP Documentation: https://modelcontextprotocol.io/

Support

For issues and support, please visit the package repository or NASA API documentation for API-related questions.

License

This project uses NASA's public APIs. Please refer to NASA's API terms of service for usage guidelines.

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选