Skip to content
Back to search

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.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/programcomputer--nasa-mcp-server/badge.svg)](/listings/programcomputer--nasa-mcp-server)

HTML

<a href="/listings/programcomputer--nasa-mcp-server"><img src="/api/listings/programcomputer--nasa-mcp-server/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

You don't start an MCP server yourself. Your AI app (Claude, Cursor, VS Code, Codex and others) launches it in the background, so installing it means adding an entry to that app's MCP configuration. The only prerequisite is [Node.js](https://nodejs.org/) 22 or newer; `npx` downloads the server the first time the app starts it.

Most tools need no API key. `NASA_API_KEY` (free at <https://api.nasa.gov/>; `DEMO_KEY` works for light use) is only used by `nasa_neo`, `nasa_insight_weather` and `nasa_mars_rover`, and `FIRMS_MAP_KEY` only by `nasa_firms`. Leave out the `env` block if you don't need them.

**Using an AI coding agent (Claude Code, Codex, Cursor, VS Code agent mode)?** Paste this into it:

Install the NASA MCP server from https://github.com/ProgramComputer/NASA-MCP-server
for the app you're running in. Follow that app's section under Installation in the
README, add it for all projects, and don't add an API key. Tell me exactly what you
changed and whether I need to restart.

Standard config

Most clients use this JSON shape:

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

If the file already has an `mcpServers` object, add the `"nasa"` entry inside it instead of pasting a second `mcpServers`.

<details> <summary>Claude Desktop</summary>

Open **Settings → Developer → Edit Config**. This opens `claude_desktop_config.json`:

* macOS: `~/Library/Application Support/Claude/claude_desktop_config.json` * Windows: `%APPDATA%\Claude\claude_desktop_config.json`

Paste the standard config, save, then fully quit and reopen Claude Desktop.

</details>

<details> <summary>Claude Code</summary>

claude mcp add --env NASA_API_KEY=YOUR_API_KEY --scope user nasa -- npx -y @programcomputer/nasa-mcp-server@latest

`--scope user` makes the server available in every project; leave it out to add it to the current project only. On native Windows, replace `npx` with `cmd /c npx`.

</details>

<details> <summary>Cursor</summary>

[<img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor">](https://cursor.com/install-mcp?name=nasa&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBwcm9ncmFtY29tcHV0ZXIvbmFzYS1tY3Atc2VydmVyQGxhdGVzdCJdfQ%3D%3D)

The button installs the server without an API key. To install by hand, or to add a key, paste the standard config into `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project).

</details>

<details> <summary>VS Code (GitHub Copilot)</summary>

[<img src="https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522nasa%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540programcomputer%252Fnasa-mcp-server%2540latest%2522%255D%257D) [<img src="https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square" alt="Install in VS Code Insiders">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522nasa%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540programcomputer%252Fnasa-mcp-server%2540latest%2522%255D%257D)

The buttons install the server without an API key. VS Code uses a top-level `servers` key instead of `mcpServers`. To install by hand, add this to `.vscode/mcp.json` in your workspace, or run **MCP: Open User Configuration** from the Command Palette for all workspaces. VS Code asks for the key the first time the server starts and stores it securely; leave it blank to skip it.

{
  "inputs": [
    {
      "type": "promptString",
      "id": "nasa-api-key",
      "description": "NASA API key (optional)",
      "password": true
    }
  ],
  "servers": {

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 551 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. [![NPM Version](https://img.shields.io/npm/v/%40programcomputer%2Fnasa-mcp-server?link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40programcomputer%2Fnasa-mcp-server)](https://www.npmjs.com/package/@programcomputer/nasa-mcp-server)
  2. # NASA MCP Server
  3. 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.
  4. Big thanks to the MCP community for their support and guidance!
  5. ## Features
  6. * Access to 20+ NASA data sources through a single, consistent interface
  7. * Standardized data formats optimized for AI consumption
  8. * Automatic parameter validation and error handling
  9. * Rate limit management for NASA API keys
  10. * Comprehensive documentation and examples
  11. * Support for various NASA imagery formats
  12. * Data conversion and formatting for LLM compatibility
  13. * Cross-platform support (Windows, macOS, Linux)
  14. ## Example prompts
  15. Ask your MCP client things like:
  16. * "Show me today's Astronomy Picture of the Day and explain what it shows."
  17. * "Were there any solar storms in September 2026: strong flares, Earth-directed CMEs or geomagnetic storms?"
  18. * "Which asteroids fly past Earth today, and which one comes closest?"
  19. * "Will any asteroid pass closer to Earth than the Moon in the next 90 days?"
  20. * "What are the odds that Bennu hits Earth, according to JPL Sentry?"
  21. * "Find NASA photos of the Apollo 11 lunar module taken in 1969."
  22. * "Which tropical storms and hurricanes are active right now?"
  23. * "Show me a detailed satellite view of the Nile Delta and the Sinai on 2025-07-15."
  24. * "Find cloud-hosted sea ice concentration datasets in NASA Earthdata."
  25. * "What were the daily highs, lows and solar energy in Denver during the first week of July 2025?"
  26. * "List the nearest roughly Earth-sized, temperate exoplanets discovered since 2020."
  27. * "Where was the ISS over the Earth between 00:00 and 00:10 UTC on 2026-09-29?"
  28. * "Get the latest two-line orbital elements for the ISS."
  29. * "Show me a Mars Trek map tile of Olympus Mons."
  30. * "What was the weather like at NASA's InSight lander during its last reported week on Mars?"
  31. * "Which near-Earth asteroids need the least delta-v for a mission launched in 2030?"
  32. * "Which NASA technology projects have worked on solar sails?"
  33. * "Find NASA patents about solar panels that companies can license."
  34. * "Which TESS sectors observed Pi Mensae, and where can I download its 2-minute light curves?"
  35. * "Has JWST observed TRAPPIST-1, and with which instruments?"
  36. ## Disclaimer
  37. **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.
  38. ## Installation
  39. You don't start an MCP server yourself. Your AI app (Claude, Cursor, VS Code, Codex and others) launches it in the background, so installing it means adding an entry to that app's MCP configuration. The only prerequisite is [Node.js](https://nodejs.org/) 22 or newer; `npx` downloads the server the first time the app starts it.
  40. Most tools need no API key. `NASA_API_KEY` (free at <https://api.nasa.gov/>; `DEMO_KEY` works for light use) is only used by `nasa_neo`, `nasa_insight_weather` and `nasa_mars_rover`, and `FIRMS_MAP_KEY` only by `nasa_firms`. Leave out the `env` block if you don't need them.
  41. **Using an AI coding agent (Claude Code, Codex, Cursor, VS Code agent mode)?** Paste this into it:
  42. ```text
  43. Install the NASA MCP server from https://github.com/ProgramComputer/NASA-MCP-server
  44. for the app you're running in. Follow that app's section under Installation in the
  45. README, add it for all projects, and don't add an API key. Tell me exactly what you
  46. changed and whether I need to restart.
  47. ```
  48. ### Standard config
  49. Most clients use this JSON shape:
  50. ```json
  51. {
  52. "mcpServers": {
  53. "nasa": {
  54. "command": "npx",
  55. "args": ["-y", "@programcomputer/nasa-mcp-server@latest"],
  56. "env": {
  57. "NASA_API_KEY": "YOUR_API_KEY"
  58. }
  59. }
  60. }
  61. }
  62. ```
  63. If the file already has an `mcpServers` object, add the `"nasa"` entry inside it instead of pasting a second `mcpServers`.
  64. <details>
  65. <summary>Claude Desktop</summary>
  66. Open **Settings → Developer → Edit Config**. This opens `claude_desktop_config.json`:
  67. * macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
  68. * Windows: `%APPDATA%\Claude\claude_desktop_config.json`
  69. Paste the standard config, save, then fully quit and reopen Claude Desktop.
  70. </details>
  71. <details>
  72. <summary>Claude Code</summary>
  73. ```bash
  74. claude mcp add --env NASA_API_KEY=YOUR_API_KEY --scope user nasa -- npx -y @programcomputer/nasa-mcp-server@latest
  75. ```
  76. `--scope user` makes the server available in every project; leave it out to add it to the current project only. On native Windows, replace `npx` with `cmd /c npx`.
  77. </details>
  78. <details>
  79. <summary>Cursor</summary>
  80. [<img src="https://cursor.com/deeplink/mcp-install-dark.svg" alt="Install in Cursor">](https://cursor.com/install-mcp?name=nasa&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBwcm9ncmFtY29tcHV0ZXIvbmFzYS1tY3Atc2VydmVyQGxhdGVzdCJdfQ%3D%3D)
  81. The button installs the server without an API key. To install by hand, or to add a key, paste the standard config into `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project).
  82. </details>
  83. <details>
  84. <summary>VS Code (GitHub Copilot)</summary>
  85. [<img src="https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522nasa%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540programcomputer%252Fnasa-mcp-server%2540latest%2522%255D%257D) [<img src="https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square" alt="Install in VS Code Insiders">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522nasa%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540programcomputer%252Fnasa-mcp-server%2540latest%2522%255D%257D)
  86. The buttons install the server without an API key. VS Code uses a top-level `servers` key instead of `mcpServers`. To install by hand, add this to `.vscode/mcp.json` in your workspace, or run **MCP: Open User Configuration** from the Command Palette for all workspaces. VS Code asks for the key the first time the server starts and stores it securely; leave it blank to skip it.
  87. ```json
  88. {
  89. "inputs": [
  90. {
  91. "type": "promptString",
  92. "id": "nasa-api-key",
  93. "description": "NASA API key (optional)",
  94. "password": true
  95. }
  96. ],
  97. "servers": {
  98. "nasa": {
  99. "type": "stdio",
  100. "command": "npx",
  101. "args": ["-y", "@programcomputer/nasa-mcp-server@latest"],
  102. "env": {
  103. "NASA_API_KEY": "${input:nasa-api-key}"
  104. }
  105. }
  106. }
  107. }
  108. ```
  109. </details>
  110. <details>
  111. <summary>Codex</summary>
  112. ```bash
  113. codex mcp add nasa --env NASA_API_KEY=YOUR_API_KEY -- npx -y @programcomputer/nasa-mcp-server@latest
  114. ```
  115. This writes the following to `~/.codex/config.toml`, which the Codex CLI, IDE extension and desktop app share. You can also add it by hand:
  116. ```toml
  117. [mcp_servers.nasa]
  118. command = "npx"
  119. args = ["-y", "@programcomputer/nasa-mcp-server@latest"]
  120. [mcp_servers.nasa.env]
  121. NASA_API_KEY = "YOUR_API_KEY"
  122. ```
  123. </details>
  124. <details>
  125. <summary>Gemini CLI</summary>
  126. Paste the standard config into `~/.gemini/settings.json` (all projects) or `.gemini/settings.json` (one project).
  127. </details>
  128. <details>
  129. <summary>Other clients</summary>
  130. Most other MCP clients accept the standard config. If a client asks for the command and arguments separately, the command is `npx` and the arguments are `-y @programcomputer/nasa-mcp-server@latest`.
  131. To run a local clone instead of the npm package (see [Manual Installation](#manual-installation)), use `"command": "node"` with `"args": ["/absolute/path/to/NASA-MCP-server/dist/index.js"]`.
  132. </details>
  133. ### Checking that it works
  134. Restart or reload your client and check that a server named `nasa` appears in its MCP or tools list. Then ask something like "What's today's Astronomy Picture of the Day?"
  135. If the server doesn't appear:
  136. * Run `node --version` and make sure it prints v22 or newer.
  137. * Check the config file for JSON mistakes such as a trailing comma or a second `mcpServers` object.
  138. * Run the server from a terminal (below) to see any errors. If it prints nothing and waits, it is working; press Ctrl+C to stop it.
  139. * On Windows, if the client reports that `npx` can't be found, use `"command": "cmd"` with `"args": ["/c", "npx", "-y", "@programcomputer/nasa-mcp-server@latest"]`.
  140. ### Running from a terminal
  141. You only need this for testing; your MCP client starts the server for you.
  142. ```bash
  143. env NASA_API_KEY=YOUR_API_KEY npx -y @programcomputer/nasa-mcp-server@latest
  144. ```
  145. You can also pass the API key as a command line argument:
  146. ```bash
  147. npx -y @programcomputer/nasa-mcp-server@latest --nasa-api-key=YOUR_API_KEY
  148. ```
  149. ### Manual Installation
  150. ```bash
  151. # Clone the repository
  152. git clone https://github.com/ProgramComputer/NASA-MCP-server.git
  153. # Install dependencies
  154. cd NASA-MCP-server
  155. npm install
  156. # Build
  157. npm run build
  158. # Run with your API key
  159. NASA_API_KEY=YOUR_API_KEY npm start
  160. ```
  161. Replace YOUR_API_KEY with your NASA API key from <https://api.nasa.gov/>. Requires Node.js 22 or newer.
  162. ## Environment Variables
  163. The server can be configured with the following environment variables:
  164. | Variable | Description |
  165. |----------|-------------|
  166. | `NASA_API_KEY` | Your NASA API key (get at api.nasa.gov); used by NEO and InSight weather |
  167. | `FIRMS_MAP_KEY` | Your FIRMS MAP_KEY for fire data (get at firms.modaps.eosdis.nasa.gov/api/map_key); separate from `NASA_API_KEY` |
  168. | `NASA_MCP_CMR_URL` | Optional CMR search URL (default: `https://cmr.earthdata.nasa.gov/search`) |
  169. | `MCP_TRANSPORT` | Transport mode: `stdio` (default) or `http` for Streamable HTTP |
  170. | `MCP_HTTP_HOST` | Host for Streamable HTTP mode (default: `127.0.0.1`) |
  171. | `MCP_HTTP_PORT` | Port for Streamable HTTP mode (default: `3000`) |
  172. | `MCP_HTTP_PATH` | MCP endpoint path for Streamable HTTP mode (default: `/mcp`) |
  173. ## Transport Modes
  174. By default, the server runs over stdio for local MCP clients such as Cursor.
  175. To run the optional Streamable HTTP transport:
  176. ```bash
  177. MCP_TRANSPORT=http MCP_HTTP_PORT=3000 NASA_API_KEY=YOUR_API_KEY npm start
  178. ```
  179. The Streamable HTTP endpoint will be available at:
  180. ```text
  181. http://127.0.0.1:3000/mcp
  182. ```
  183. ## Included NASA APIs
  184. This MCP server integrates the following NASA APIs:
  185. 1. **NASA Open API** (api.nasa.gov, needs `NASA_API_KEY`):
  186. - NEO (Near Earth Object Web Service)
  187. - InSight Mars Weather Service (historical: the feed stopped updating in October 2020)
  188. 2. **Other NASA APIs** (no key needed):
  189. - APOD (Astronomy Picture of the Day), from the NASA Science APOD API (science.nasa.gov)
  190. - DONKI (Space Weather Database Of Notifications, Knowledge, Information), from NASA CCMC (ccmc.gsfc.nasa.gov)
  191. - EONET (Earth Observatory Natural Event Tracker)
  192. - TLE (Two-Line Element sets from CelesTrak, via tle.ivanstanojevic.me)
  193. - Satellite Situation Center (spacecraft locations)
  194. - TechPort (NASA technology projects)
  195. - Technology Transfer (patents, software and spinoffs)
  196. - Mars, Moon and Vesta Trek (WMTS map layers and tiles)
  197. - NASA Image and Video Library
  198. - Exoplanet Archive
  199. - MAST (Mikulski Archive for Space Telescopes): TESS, Hubble, JWST, Kepler/K2 and other observations, their data products, and TESS full-frame image cutouts (TESSCut). The tools return download links to the FITS files rather than the files themselves, so your client can find data but not analyze it.
  200. - Open Science Data Repository (OSDR) files
  201. - POWER (Prediction Of Worldwide Energy Resources)
  202. 3. **JPL Solar System Dynamics API** (ssd-api.jpl.nasa.gov):
  203. - SBDB (Small-Body DataBase)
  204. - SBDB Close-Approach Data
  205. - Fireball Data
  206. - Sentry (impact risk)
  207. - Scout (NEO Confirmation Page orbits)
  208. - NHATS (human-accessible NEOs)
  209. - Small-Body Mission Design
  210. - Horizons ephemerides
  211. - Periodic Orbits
  212. - Julian date converter
  213. 4. **Earth Data APIs**:
  214. - GIBS (Global Imagery Browse Services)
  215. - CMR (Common Metadata Repository) - Enhanced with advanced search capabilities
  216. - EPIC (Earth Polychromatic Imaging Camera)
  217. - FIRMS (Fire Information for Resource Management System)
  218. ## API Methods
  219. Each NASA API is exposed through standardized MCP methods:
  220. ### APOD (Astronomy Picture of the Day)
  221. ```json
  222. {
  223. "method": "nasa/apod",
  224. "params": {
  225. "date": "2023-01-01", // Optional: YYYY-MM-DD (1995-06-16 or later); defaults to the latest picture
  226. "max_images": 1 // Optional: how many pictures to embed (0-5)
  227. }
  228. }
  229. ```
  230. For a range, send `start_date` and `end_date` (up to 100 days) instead of `date`. APOD now comes from the NASA Science APOD API, which needs no key and has no random `count` or `thumbs` option.
  231. ### Near Earth Objects
  232. ```json
  233. {
  234. "method": "nasa/neo",
  235. "params": {
  236. "start_date": "2023-01-01", // Required: YYYY-MM-DD format
  237. "end_date": "2023-01-07" // Required: YYYY-MM-DD format (max 7 days from start)
  238. }
  239. }
  240. ```
  241. ### GIBS (Global Imagery Browse Services)
  242. ```json
  243. {
  244. "method": "nasa/gibs",
  245. "params": {
  246. "layer": "MODIS_Terra_CorrectedReflectance_TrueColor", // Required: Layer ID
  247. "date": "2023-01-01", // Required: YYYY-MM-DD format
  248. "format": "png" // Optional: "png" or "jpg"
  249. }
  250. }
  251. ```
  252. ### POWER (Prediction Of Worldwide Energy Resources)
  253. ```json
  254. {
  255. "method": "nasa/power",
  256. "params": {
  257. "parameters": "T2M,PRECTOTCORR,WS10M", // Required: Comma-separated list
  258. "community": "re", // Required: Community identifier
  259. "latitude": 40.7128, // Required: Latitude
  260. "longitude": -74.0060, // Required: Longitude
  261. "start": "20220101", // Required: Start date (YYYYMMDD)
  262. "end": "20220107" // Required: End date (YYYYMMDD)
  263. }
  264. }
  265. ```
  266. ### CMR (Common Metadata Repository)
  267. ```json
  268. {
  269. "method": "nasa/cmr",
  270. "params": {
  271. "keyword": "sea surface temperature", // Optional: Collections only
  272. "search_type": "collections", // Optional: "collections" (default) or "granules"
  273. "bounding_box": "-100,10,-60,40", // Optional: west,south,east,north ("bbox" also works)
  274. "temporal": "2024-06-01T00:00:00Z,2024-09-30T23:59:59Z", // Optional: start,end
  275. "limit": 5 // Optional: 1-100, default 10
  276. }
  277. }
  278. ```
  279. Results come back in a compact format by default (`"response_mode": "raw"` returns CMR's own metadata, and `fields` picks which fields to return). To get the next page, send back only the `next_cursor` from the response:
  280. ```json
  281. {
  282. "method": "nasa/cmr",
  283. "params": {
  284. "cursor": "cmr1..." // Required: next_cursor from the previous response
  285. }
  286. }
  287. ```
  288. ### FIRMS (Fire Information for Resource Management System)
  289. ```json
  290. {
  291. "method": "nasa/firms",
  292. "params": {
  293. "bbox": "-125,32,-114,42", // Required: west,south,east,north (or latitude, longitude and radius_km)
  294. "days": 1, // Optional: 1-5
  295. "source": "VIIRS_SNPP_NRT" // Optional: FIRMS data source
  296. }
  297. }
  298. ```
  299. For complete documentation of all available methods and parameters, see the API reference in the `/docs` directory.
  300. ## Logging System
  301. The server includes comprehensive logging:
  302. * Operation status and progress
  303. * Performance metrics
  304. * Rate limit tracking
  305. * Error conditions
  306. * Request validation
  307. Example log messages:
  308. ```
  309. [INFO] NASA MCP Server initialized successfully
  310. [INFO] Processing APOD request for date: 2023-01-01
  311. [WARNING] Rate limit threshold reached (80%)
  312. [ERROR] Invalid parameter: 'date' must be in YYYY-MM-DD format
  313. ```
  314. ## Security Considerations
  315. This MCP server implements security best practices following the Model Context Protocol specifications:
  316. * Input validation and sanitization using Zod schemas
  317. * No execution of arbitrary code
  318. * Protection against command injection
  319. * Proper error handling to prevent information leakage
  320. * Rate limiting and timeout controls for API requests
  321. * No persistent state that could be exploited across sessions
  322. ## Development
  323. ```bash
  324. # Clone the repository
  325. git clone https://github.com/ProgramComputer/NASA-MCP-server.git
  326. # Install dependencies
  327. npm install
  328. # Copy the example environment file and update with your API keys
  329. cp .env.example .env
  330. # Build the TypeScript code
  331. npm run build
  332. # Start the server
  333. npm start
  334. # Run tests
  335. npm test
  336. ```
  337. ## Testing with MCP Inspector
  338. To test the tools interactively, build the project and start the official [MCP Inspector](https://github.com/modelcontextprotocol/inspector) with the server:
  339. ```bash
  340. npm run build
  341. npx @modelcontextprotocol/inspector node dist/index.js
  342. ```
  343. The server reads `NASA_API_KEY` and `FIRMS_MAP_KEY` from a `.env` file in the working directory (see Development above). The Inspector prints a local URL; open it to list and call the tools.
  344. ### Example Test Requests
  345. The repository includes example test requests for each API that you can copy and paste into the MCP Inspector:
  346. ```bash
  347. # View the example test requests
  348. cat docs/inspector-test-examples.md
  349. ```
  350. For detailed examples, see the [Inspector Test Examples](docs/inspector-test-examples.md) document.
  351. ## MCP Client Usage
  352. This server follows the official Model Context Protocol. For local clients, use the stdio configuration in [Installation](#installation). For Streamable HTTP mode, start the server with `MCP_TRANSPORT=http`, then connect with the MCP SDK:
  353. ```typescript
  354. import { Client } from "@modelcontextprotocol/sdk/client/index.js";
  355. import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
  356. import { CallToolResultSchema } from "@modelcontextprotocol/sdk/types.js";
  357. const transport = new StreamableHTTPClientTransport(
  358. new URL("http://127.0.0.1:3000/mcp")
  359. );
  360. const client = new Client({
  361. name: "mcp-client",
  362. version: "1.0.0",
  363. });
  364. await client.connect(transport);
  365. // Example: Get today's Astronomy Picture of the Day
  366. const apodResult = await client.request({
  367. method: "tools/call",
  368. params: {
  369. name: "nasa/apod",
  370. arguments: {}
  371. }
  372. }, CallToolResultSchema);
  373. // Example: Search for Near Earth Objects
  374. const neoResults = await client.request({
  375. method: "tools/call",
  376. params: {
  377. name: "nasa/neo",
  378. arguments: {
  379. start_date: "2023-01-01",
  380. end_date: "2023-01-07"
  381. }
  382. }
  383. }, CallToolResultSchema);
  384. // Example: Get satellite imagery from GIBS
  385. const satelliteImage = await client.request({
  386. method: "tools/call",
  387. params: {
  388. name: "nasa/gibs",
  389. arguments: {
  390. layer: "MODIS_Terra_CorrectedReflectance_TrueColor",
  391. date: "2023-01-01"
  392. }
  393. }
  394. }, CallToolResultSchema);
  395. // Example: Use the new POWER API
  396. const powerData = await client.request({
  397. method: "tools/call",
  398. params: {
  399. name: "nasa/power",
  400. arguments: {
  401. parameters: "T2M,PRECTOTCORR,WS10M",
  402. community: "re",
  403. latitude: 40.7128,
  404. longitude: -74.0060,
  405. start: "20220101",
  406. end: "20220107"
  407. }
  408. }
  409. }, CallToolResultSchema);
  410. ```
  411. ## Contributing
  412. 1. Fork the repository
  413. 2. Create your feature branch
  414. 3. Run tests: `npm test`
  415. 4. Submit a pull request
  416. ## License
  417. ISC License - see LICENSE file for details

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.