Get the FREE Ultimate OpenClaw Setup Guide →

nasa

NASA MCP Server - Comprehensive access to NASA's open APIs including APOD, Mars rovers, asteroids, and Earth imagery

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio jezweb-nasa-mcp-server python nasa_server.py \
  --env PORT="8000" \
  --env API_KEY="your_nasa_api_key_here" \
  --env LOG_LEVEL="INFO" \
  --env TRANSPORT="stdio" \
  --env DEFAULT_COUNT="10" \
  --env CACHE_TTL_IMAGES="1800" \
  --env MAX_HOURLY_CALLS="1000" \
  --env CACHE_TTL_DYNAMIC="600" \
  --env DEMO_HOURLY_LIMIT="30"

How to use

This NASA MCP Server exposes a suite of tools that give you access to NASA open APIs from a single MCP endpoint. It aggregates content across Astronomy Picture of the Day (APOD), Mars Rover Photos, Near Earth Objects (Asteroids), and the NASA Media Library, with caching and rate-limit awareness to improve reliability. You can query today’s APOD, fetch APODs over a date range, retrieve Mars rover images by sol or Earth date, browse asteroid data, and search NASA media assets. The server includes helpers for development and testing, as well as a collection of prompts and usage examples to help you build downstream applications and chat-based interfaces.

How to install

Prerequisites:

  • Python 3.8+
  • A NASA API key (free at api.nasa.gov)
  • Python dependencies listed in requirements.txt

Install and run:

  1. Clone the repository:
git clone https://github.com/jezweb/nasa-mcp-server.git
cd nasa-mcp-server
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment variables:
cp .env.example .env
# Edit .env to include your NASA API key and desired settings
  1. Run the server (STDIO transport by default):
python nasa_server.py
  1. Optional: Run with HTTP transport (if configured):
TRANSPORT=http PORT=8000 python nasa_server.py
  1. For development with FastMCP (if you use it):
fastmcp dev nasa_server.py
  1. Test the server locally:
python nasa_server.py --test

Additional notes

Tips and notes:

  • Ensure your NASA API key is configured in the .env file to avoid request failures.
  • The server caches image data for 30 minutes and dynamic data for 10 minutes to balance freshness and latency.
  • The TRANSPORT and LOG_LEVEL settings can be adjusted to fit your deployment environment (e.g., cloud, container, or local development).
  • If you hit API rate limits, consider using multiple keys or raising the DEMO_HOURLY_LIMIT in your environment as appropriate for testing.
  • The server supports multiple transport modes; default is STDIO, but HTTP transport can be enabled via environment variables.
  • When deploying behind a reverse proxy, ensure the port mapping matches your deployment configuration.

Related MCP Servers

Sponsor this space

Reach thousands of developers