mcp-nasa
v1.0.0
Published
Model Context Protocol server for NASA public APIs - Access space data, Mars rovers, asteroids, and more
Readme
NASA MCP Server
A comprehensive Model Context Protocol (MCP) server for NASA's public APIs, providing access to space data, imagery, and scientific information.
Features
This MCP server provides access to 22+ NASA API endpoints including:
- Astronomy Picture of the Day (APOD) - Daily space imagery with scientific explanations
- Near-Earth Objects (NEO) - Asteroid tracking and approach data
- Mars Rover Photos - Images from Curiosity, Opportunity, Spirit, and Perseverance
- EPIC - Full Earth images from space
- EONET - Natural event tracking (wildfires, storms, volcanoes)
- Space Weather (DONKI) - Solar flares, CMEs, and particle events
- Exoplanet Archive - Data on planets outside our solar system
- NASA Image Library - Searchable media assets
- TechPort - NASA technology projects
- GeneLab - Space biology and omics data
- Satellite TLE - Two-line element data for tracking
- Patents - NASA technology transfer patents
Installation
Using NPM
npm install -g mcp-nasaUsing Docker
docker pull ghcr.io/jezweb/mcp-nasa:latestFrom Source
git clone https://github.com/jezweb/mcp-nasa.git
cd mcp-nasa
npm install
npm run buildConfiguration
Create a .env file based on .env.example:
NASA_API_KEY=your_api_key_here
NASA_API_BASE_URL=https://api.nasa.gov
MCP_SERVER_PORT=3000
LOG_LEVEL=info
RATE_LIMIT_REQUESTS_PER_HOUR=1000Get your NASA API key at: https://api.nasa.gov
Usage
Running the Server
Standard Mode
mcp-nasaWith Docker
docker run -it --env-file .env ghcr.io/jezweb/mcp-nasa:latestDevelopment Mode
npm run devAvailable Tools
| Tool Name | Description | Required Parameters |
|-----------|-------------|-------------------|
| nasa_apod | Get Astronomy Picture of the Day | None |
| nasa_apod_range | Get APOD images for date range | start_date, end_date |
| nasa_neo_feed | Get Near-Earth Objects by date | start_date |
| nasa_neo_lookup | Get specific asteroid details | asteroid_id |
| nasa_neo_browse | Browse NEO dataset | None |
| nasa_mars_rover_photos | Get Mars rover photos | rover |
| nasa_mars_rover_manifests | Get rover mission manifest | rover |
| nasa_epic_images | Get EPIC Earth images | None |
| nasa_epic_dates | Get available EPIC dates | None |
| nasa_eonet_events | Get natural events | None |
| nasa_eonet_categories | Get event categories | None |
| nasa_donki_cme | Get Coronal Mass Ejections | None |
| nasa_donki_flr | Get Solar Flares | None |
| nasa_donki_sep | Get Solar Particle Events | None |
| nasa_exoplanet_query | Query exoplanet database | query |
| nasa_techport_search | Search technology projects | searchTerm |
| nasa_techport_project | Get project details | projectId |
| nasa_imagery_search | Search NASA images/videos | None |
| nasa_imagery_asset | Get media asset details | nasa_id |
| nasa_patents_search | Search NASA patents | query |
| nasa_genelab_search | Search GeneLab data | term |
| nasa_satellite_tle | Get satellite TLE data | None |
Example Usage
Get Today's APOD
{
"tool": "nasa_apod",
"arguments": {}
}Search for Mars Rover Photos
{
"tool": "nasa_mars_rover_photos",
"arguments": {
"rover": "perseverance",
"sol": 100,
"camera": "NAVCAM"
}
}Track Near-Earth Asteroids
{
"tool": "nasa_neo_feed",
"arguments": {
"start_date": "2024-01-01",
"end_date": "2024-01-07"
}
}Search NASA Image Library
{
"tool": "nasa_imagery_search",
"arguments": {
"q": "apollo 11",
"media_type": "image",
"year_start": "1969"
}
}API Rate Limits
- DEMO_KEY: 30 requests/hour, 50 requests/day
- Registered Key: 1000 requests/hour
The server includes built-in rate limiting to prevent exceeding NASA's limits.
Development
Project Structure
nasa-mcp-server/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── nasa-client.ts # NASA API client
│ └── tools/
│ └── index.ts # Tool definitions
├── tests/ # Test files
├── docs/ # Documentation
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose setup
└── package.json # DependenciesRunning Tests
npm test # Run all tests
npm test -- --coverage # Run with coverage
npm run test:watch # Watch modeLinting & Type Checking
npm run lint # Run ESLint
npm run typecheck # TypeScript type checkingBuilding
npm run build # Build for productionDocker Deployment
Build Image
docker build -t nasa-mcp-server .Run Container
docker run -it --env-file .env nasa-mcp-serverUsing Docker Compose
docker-compose upCI/CD
The project includes GitHub Actions workflows for:
- Automated testing on PRs
- Docker image building and pushing
- Deployment to Google Cloud Run
- NPM package publishing on releases
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
MIT License - see LICENSE file for details
Acknowledgments
- NASA for providing public API access
- MCP SDK developers
- Open-source community
Support
- Issues: https://github.com/yourusername/nasa-mcp-server/issues
- NASA API Support: https://api.nasa.gov/support
