NASA MCP Server
Provides access to 20+ NASA data sources including Astronomy Picture of the Day (APOD), Mars Rover photos, Near Earth Objects (NEO), Earth imagery (GIBS, EPIC), space weather data (DONKI), exoplanet information, and energy resource predictions (POWER) through a standardized interface for querying NASA's public APIs.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@NASA MCP Server show me today's astronomy picture"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
NASA MCP Server
A Model Context Protocol (MCP) server for NASA APIs, providing a standardized interface for AI models to interact with NASA's vast array of data sources. This server implements the official Model Context Protocol specification.
Big thanks to the MCP community for their support and guidance!
基于原项目: 此项目基于 NASA-MCP-server 修改而来
Features
Access to 20+ NASA data sources through a single, consistent interface
Standardized data formats optimized for AI consumption
Automatic parameter validation and error handling
Rate limit management for NASA API keys
Comprehensive documentation and examples
Support for various NASA imagery formats
Data conversion and formatting for LLM compatibility
Cross-platform support (Windows, macOS, Linux)
Related MCP server: NASA MCP Service
Disclaimer
This project is not affiliated with, endorsed by, or related to NASA (National Aeronautics and Space Administration) or any of its subsidiaries or its affiliates. It is an independent implementation that accesses NASA's publicly available APIs. All NASA data used is publicly available and subject to NASA's data usage policies.
Installation
Running with npx
env NASA_API_KEY=YOUR_API_KEY npx -y @bachstudio/nasa-mcp-server@latestYou can also pass the API key as a command line argument:
npx -y @bachstudio/nasa-mcp-server@latest --nasa-api-key=YOUR_API_KEYUsing SuperGateway for Server-Sent Events (SSE)
You can use SuperGateway for Server-Sent Events (SSE).
The developers of NASA-MCP-server DO NOT ENDORSE the SuperGateway repository. This information is provided for those who wish to implement SSE functionality at their own discretion.
Manual Installation
# Clone the repository
git clone https://github.com/BACH-AI-Tools/NASA-MCP-server.git
# Install dependencies
cd NASA-MCP-server
npm install
# Run with your API key
NASA_API_KEY=YOUR_API_KEY npm startRunning on Cursor
Configuring Cursor 🖥️ Note: Requires Cursor version 0.45.6+
To configure NASA MCP Server in Cursor:
Create or edit an mcp.json file in your Cursor configuration directory with the following content:
{
"mcpServers": {
"nasa-mcp": {
"command": "npx",
"args": ["-y", "@bachstudio/nasa-mcp-server@latest"],
"env": {
"NASA_API_KEY": "your-api-key"
}
}
}
}Replace your-api-key with your NASA API key from https://api.nasa.gov/.
After adding the configuration, restart Cursor to see the new NASA tools. The Composer Agent will automatically use NASA MCP when appropriate for space-related queries.
Environment Variables
The server can be configured with the following environment variables:
Variable | Description |
| Your NASA API key (get at api.nasa.gov) |
Included NASA APIs
This MCP server integrates the following NASA APIs:
NASA Open API (api.nasa.gov):
APOD (Astronomy Picture of the Day)
EPIC (Earth Polychromatic Imaging Camera)
DONKI (Space Weather Database Of Notifications, Knowledge, Information)
Insight (Mars Weather Service)
Mars Rover Photos
NEO (Near Earth Object Web Service)
EONET (Earth Observatory Natural Event Tracker)
TLE (Two-Line Element)
NASA Image and Video Library
Exoplanet Archive
NASA Sounds API (Beta)
POWER (Prediction Of Worldwide Energy Resources)
JPL Solar System Dynamics API (ssd-api.jpl.nasa.gov):
SBDB (Small-Body DataBase)
SBDB Close-Approach Data
Fireball Data
Scout API
Earth Data APIs:
GIBS (Global Imagery Browse Services)
CMR (Common Metadata Repository) - Enhanced with advanced search capabilities
EPIC (Earth Polychromatic Imaging Camera)
FIRMS (Fire Information for Resource Management System)
API Methods
Each NASA API is exposed through standardized MCP methods:
APOD (Astronomy Picture of the Day)
{
"method": "nasa/apod",
"params": {
"date": "2023-01-01", // Optional: YYYY-MM-DD format
"count": 5, // Optional: Return a specified number of random images
"thumbs": true // Optional: Return URL of video thumbnail
}
}Mars Rover Photos
{
"method": "nasa/mars-rover",
"params": {
"rover": "curiosity", // Required: "curiosity", "opportunity", or "spirit"
"sol": 1000, // Either sol or earth_date is required
"earth_date": "2023-01-01", // YYYY-MM-DD format
"camera": "FHAZ" // Optional: Filter by camera type
}
}Near Earth Objects
{
"method": "nasa/neo",
"params": {
"start_date": "2023-01-01", // Required: YYYY-MM-DD format
"end_date": "2023-01-07" // Required: YYYY-MM-DD format (max 7 days from start)
}
}GIBS (Global Imagery Browse Services)
{
"method": "nasa/gibs",
"params": {
"layer": "MODIS_Terra_CorrectedReflectance_TrueColor", // Required: Layer ID
"date": "2023-01-01", // Required: YYYY-MM-DD format
"format": "png" // Optional: "png" or "jpg"
}
}POWER (Prediction Of Worldwide Energy Resources)
{
"method": "nasa/power",
"params": {
"parameters": "T2M,PRECTOTCORR,WS10M", // Required: Comma-separated list
"community": "re", // Required: Community identifier
"latitude": 40.7128, // Required: Latitude
"longitude": -74.0060, // Required: Longitude
"start": "20220101", // Required: Start date (YYYYMMDD)
"end": "20220107" // Required: End date (YYYYMMDD)
}
}For complete documentation of all available methods and parameters, see the API reference in the /docs directory.
Logging System
The server includes comprehensive logging:
Operation status and progress
Performance metrics
Rate limit tracking
Error conditions
Request validation
Example log messages:
[INFO] NASA MCP Server initialized successfully
[INFO] Processing APOD request for date: 2023-01-01
[INFO] Fetching Mars Rover data for Curiosity, sol 1000
[WARNING] Rate limit threshold reached (80%)
[ERROR] Invalid parameter: 'date' must be in YYYY-MM-DD formatSecurity Considerations
This MCP server implements security best practices following the Model Context Protocol specifications:
Input validation and sanitization using Zod schemas
No execution of arbitrary code
Protection against command injection
Proper error handling to prevent information leakage
Rate limiting and timeout controls for API requests
No persistent state that could be exploited across sessions
Development
# Clone the repository
git clone https://github.com/BACH-AI-Tools/NASA-MCP-server.git
# Install dependencies
npm install
# Copy the example environment file and update with your API keys
cp .env.example .env
# Build the TypeScript code
npm run build
# Start the development server
npm run dev
# Run tests
npm testTesting with MCP Inspector
The NASA MCP Server includes a script to help you test the APIs using the MCP Inspector:
# Run the provided test script
./scripts/test-with-inspector.shThis will:
Build the project to ensure the latest changes are included
Start the MCP Inspector with the NASA MCP server running
Allow you to interactively test all the NASA APIs
Example Test Requests
The repository includes example test requests for each API that you can copy and paste into the MCP Inspector:
# View the example test requests
cat docs/inspector-test-examples.mdFor detailed examples, see the Inspector Test Examples document.
MCP Client Usage
This server follows the official Model Context Protocol. Here's an example of how to use it with the MCP SDK:
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { HttpClientTransport } from "@modelcontextprotocol/sdk/client/http.js";
const transport = new HttpClientTransport({
url: "http://localhost:3000",
});
const client = new Client({
name: "mcp-client",
version: "1.0.0",
});
await client.connect(transport);
// Example: Get today's Astronomy Picture of the Day
const apodResult = await client.request({
method: "nasa/apod",
params: {}
});
// Example: Get Mars Rover photos
const marsRoverResult = await client.request({
method: "nasa/mars-rover",
params: { rover: "curiosity", sol: 1000 }
});
// Example: Search for Near Earth Objects
const neoResults = await client.request({
method: "nasa/neo",
params: {
start_date: '2023-01-01',
end_date: '2023-01-07'
}
});
// Example: Get satellite imagery from GIBS
const satelliteImage = await client.request({
method: "nasa/gibs",
params: {
layer: 'MODIS_Terra_CorrectedReflectance_TrueColor',
date: '2023-01-01'
}
});
// Example: Use the new POWER API
const powerData = await client.request({
method: "nasa/power",
params: {
parameters: "T2M,PRECTOTCORR,WS10M",
community: "re",
latitude: 40.7128,
longitude: -74.0060,
start: "20220101",
end: "20220107"
}
});Contributing
Fork the repository
Create your feature branch
Run tests:
npm testSubmit a pull request
License
ISC License - see LICENSE file for details
Available Tools
23 toolsjpl_cadC
Asteroid and comet close approaches to the planets in the past and future
Inputs: dist_max, dist_min, date_min, date_max, +6 more.
jpl_fireballC
Fireball data - atmospheric impact events
Inputs: limit, date_min, date_max.
jpl_horizonsC
JPL Horizons - Solar system objects ephemeris data
Inputs: COMMAND (required), format, OBJ_DATA, MAKE_EPHEM, +7 more.
jpl_horizons_fileC
JPL Horizons - Solar system objects ephemeris data (File Input)
Inputs: COMMAND (required), format, OBJ_DATA, MAKE_EPHEM, +7 more.
jpl_jd_calC
Julian Day number to/from calendar date/time converter
Inputs: jd, cd.
jpl_nhatsC
Human-accessible NEOs (Near-Earth Objects) data
Inputs: dv, dur, stay, launch, +5 more.
jpl_periodic_orbitsD
JPL Three-Body Periodic Orbits Database
Inputs: sys (required), family (required), libr, branch, +7 more.
jpl_sbdbC
Small-Body Database (SBDB) - asteroid and comet data
Inputs: sstr (required), cad.
jpl_scoutB
Scout - NEOCP orbits, ephemerides, and impact risk data
Inputs: tdes, orbit_id, limit, file, +2 more.
jpl_sentryC
JPL Sentry - NEO Earth impact risk assessment data
Inputs: limit, date_min, date_max, des, +6 more.
nasa_apodC
Fetch NASA's Astronomy Picture of the Day
Inputs: date (required), count, start_date, end_date, +1 more.
nasa_cmrC
NASA Common Metadata Repository - search for NASA data collections
Inputs: keyword (required), search_type (required), format (required), limit, +2 more.
nasa_donkiD
Space Weather Database Of Notifications, Knowledge, Information
Inputs: type (required), startDate, endDate.
nasa_eonetC
Earth Observatory Natural Event Tracker - natural events data
Inputs: category, days, source, status, +1 more.
nasa_epicC
Earth Polychromatic Imaging Camera - views of Earth
Inputs: collection, date.
nasa_exoplanetC
NASA Exoplanet Archive - data about planets beyond our solar system
Inputs: table (required), select, where, order, +1 more.
nasa_firmsD
NASA Fire Information for Resource Management System - fire data
Inputs: latitude (required), longitude (required), days.
nasa_gibsC
Global Imagery Browse Services - satellite imagery
Inputs: layer (required), date (required), format, resolution.
nasa_imagesC
NASA Image and Video Library - search NASA's media archive
Inputs: q (required), media_type, year_start, year_end, +1 more.
nasa_mars_roverC
NASA Mars Rover Photos - images from Mars rovers
Inputs: rover (required), sol, earth_date, camera, +1 more.
nasa_neoC
Near Earth Object Web Service - information about asteroids
Inputs: start_date (required), end_date (required), asteroid_id.
nasa_osdr_filesC
NASA OSDR - Get data files for an OSD study
Inputs: accession_number (required).
nasa_powerD
Prediction of Worldwide Energy Resources - meteorological data
Inputs: parameters (required), community (required), longitude (required), latitude (required), +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 23 tools
Each tool has a clearly distinct purpose targeting specific NASA data sources or services, with no overlap in functionality. For example, jpl_sbdb provides asteroid/comet data, while nasa_apod fetches daily astronomy images, and nasa_firms offers fire data—all serve unique roles.
Tool names follow a highly consistent pattern with a clear prefix (jpl_ or nasa_) indicating the source, followed by a descriptive identifier (e.g., cad, fireball, apod). This structured naming makes it easy to identify and categorize tools by domain and origin.
With 23 tools, the count is slightly high but reasonable given the broad scope of NASA's diverse data services. It covers multiple domains like astronomy, Earth science, and space weather without being excessive, though it may feel heavy for some use cases.
The tool set provides comprehensive coverage across NASA's data offerings, including astronomy (apod, exoplanet), Earth observation (eonet, epic, firms), solar system objects (jpl tools), and specialized services (donki, power). No obvious gaps exist for accessing NASA's public data resources.
Maintenance
Related MCP Connectors
Live space data for AI agents - rocket launches, ISS passes, launch news. Free, no auth.
NASA data: near-Earth objects, space weather, and astronomy pictures
NASA astronomy photo of the day + imagery. $0.01/query. Be born in one call — free testnet funds.
NASA MCP — wraps NASA Open APIs (api.nasa.gov)
Related MCP Servers
- AlicenseBqualityBmaintenanceA Model Context Protocol server that provides a standardized interface for AI models to interact with NASA's vast array of data sources including APOD, Mars Rover photos, satellite imagery, and space weather data.3295 npm94ISC
- AlicenseNot gradedqualityDmaintenanceA feature-rich NASA data query tool that supports various NASA API services including astronomy pictures, Mars rover photos, Earth satellite images, near-Earth objects data, and space weather information through natural language queries.4 npm2MIT
- AlicenseAqualityFmaintenanceProvides seamless integration with NASA's public APIs, enabling AI assistants to access space and astronomy data including APOD, Mars rover photos, Near-Earth Objects, space weather events, and Earth imagery.522 npmMIT
- AlicenseNot gradedqualityDmaintenanceProvides 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.24 PyPI5MIT