NASA APIs MCP server

Integrates with NASA and JPL APIs to provide access to astronomy images, satellite data, space weather information, Mars rover photos, and more through a unified interface built with TypeScript.
Back to servers
Setup instructions
Provider
ProgramComputer
Release date
Mar 06, 2025
Language
TypeScript
Package
Stats
618 downloads
63 stars

The NASA MCP Server provides a standardized interface for AI models to interact with NASA's vast array of data sources, offering access to over 20 NASA APIs through a consistent Model Context Protocol implementation. This server makes NASA's space and Earth science data easily accessible for AI applications.

Installation Options

Quick Start with npx

The easiest way to run the NASA MCP Server is using npx:

env NASA_API_KEY=YOUR_API_KEY npx -y @programcomputer/nasa-mcp-server@latest

Alternatively, you can pass the API key as a command line argument:

npx -y @programcomputer/nasa-mcp-server@latest --nasa-api-key=YOUR_API_KEY

Manual Installation

If you prefer a manual setup:

# Clone the repository
git clone https://github.com/ProgramComputer/NASA-MCP-server.git

# Install dependencies
cd NASA-MCP-server
npm install

# Run with your API key
NASA_API_KEY=YOUR_API_KEY npm start

Configuring in Cursor

For Cursor users (version 0.45.6+), create or edit an mcp.json file in your Cursor configuration directory:

{
  "mcpServers": {
    "nasa-mcp": {
      "command": "npx",
      "args": ["-y", "@programcomputer/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/. Restart Cursor to see the NASA tools.

Available NASA APIs

The server provides access to numerous NASA data sources including:

  • APOD (Astronomy Picture of the Day)
  • Mars Rover Photos
  • EPIC (Earth Polychromatic Imaging Camera)
  • NEO (Near Earth Object Web Service)
  • EONET (Earth Observatory Natural Event Tracker)
  • DONKI (Space Weather Database)
  • NASA Image and Video Library
  • GIBS (Global Imagery Browse Services)
  • POWER (Prediction Of Worldwide Energy Resources)
  • JPL Solar System Dynamics APIs
  • And many more Earth and space science data sources

API Usage Examples

Astronomy Picture of the Day

{
  "method": "nasa/apod",
  "params": {
    "date": "2023-01-01", 
    "count": 5,
    "thumbs": true
  }
}

Mars Rover Photos

{
  "method": "nasa/mars-rover",
  "params": {
    "rover": "curiosity",
    "sol": 1000,
    "camera": "FHAZ"
  }
}

Near Earth Objects

{
  "method": "nasa/neo",
  "params": {
    "start_date": "2023-01-01",
    "end_date": "2023-01-07"
  }
}

Global Imagery Browse Services

{
  "method": "nasa/gibs",
  "params": {
    "layer": "MODIS_Terra_CorrectedReflectance_TrueColor",
    "date": "2023-01-01",
    "format": "png"
  }
}

POWER (Weather Data)

{
  "method": "nasa/power",
  "params": {
    "parameters": "T2M,PRECTOTCORR,WS10M",
    "community": "re",
    "latitude": 40.7128,
    "longitude": -74.0060,
    "start": "20220101",
    "end": "20220107"
  }
}

Client Integration Example

Here's how to use the NASA MCP Server 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'
  }
});

Environment Variables

Configure the server using these environment variables:

Variable Description
NASA_API_KEY Your NASA API key (get at api.nasa.gov)

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "nasa-mcp" '{"command":"npx","args":["-y","@programcomputer/nasa-mcp-server@latest"],"env":{"NASA_API_KEY":"your-api-key"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "nasa-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@programcomputer/nasa-mcp-server@latest"
            ],
            "env": {
                "NASA_API_KEY": "your-api-key"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

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

2. Add this to your configuration file:

{
    "mcpServers": {
        "nasa-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@programcomputer/nasa-mcp-server@latest"
            ],
            "env": {
                "NASA_API_KEY": "your-api-key"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later