nasa-mcp-example
Example NASA MCP Server with pctx
pinned to #b728c2cupdated yesterday
Ask your AI client: “install mcps/nasa-mcp-example”.
Requires the metahub MCP server installed in your client. Set up MCP.
mh install mcps/nasa-mcp-examplemetahub onboarded this repo on the author's behalf.
If you own github.com/portofcontext/pctx on GitHub, claim the listing to take over publishing. Your claim preserves the existing eval history and badges; only the curator label is replaced with verified-publisher on your next publish.
Stars
273
Last commit
yesterday
Latest release
published
- #ai-agents
- #api
- #infrastructure
- #local-development
- #mcp
- #mcp-server
- #open-source
Evaluation report
WarningsAutomated checks the publisher passed at publish time — structure, docs, safety, and whether the artifact behaves as claimed.b728c2c· yesterday
Documentation
6 passed3 warningsDescription qualitywarn
Only 6 words · 33 chars — more detail helps discovery
Tell consumers what this artifact does in a full sentence.
Description is substantivewarn
Description is 6 words — thinner than the 8-word floor.
Say what it does AND when to use it. A model choosing between tools has only this text to go on.
Homepage or repository declaredwarn
No homepage or repository declared.
Add a "homepage" or "repository" field to package.json.
README is present and substantial
6,519 chars · 12 sections · 7 code blocks
Tags / topics declared
7 total — ai-agents, api, infrastructure, local-development, mcp, mcp-server (+1)
README has usage / example sections
no labeled section but 7 code blocks document usage
Homepage / docs URL declared
https://portofcontext.com
Documentation present and substantive
Documentation present (README.md, 621 words).
Documentation shows usage
Documentation includes 19 code examples.
Release history
1- releasecurrentb728c2cwarnyesterday
Contents
NASA MCP Server with pctx
This example demonstrates a custom MCP (Model Context Protocol) server built with the official @modelcontextprotocol/sdk that provides access to NASA APIs, deployed with pctx.
Features
The NASA MCP server provides 5 tools for accessing NASA data:
Asteroid Tools (NeoWs API)
- search_asteroids - Search for Near Earth Objects based on their closest approach date
- lookup_asteroid - Get detailed information about a specific asteroid by ID
- browse_asteroids - Browse the overall NEO dataset with pagination
Satellite Tools (TLE API)
- search_satellites - Search for satellites by name and get TLE data
- lookup_satellite - Get TLE data for a specific satellite by catalog number
Architecture
- NASA MCP Server (port 3000): Custom MCP server that wraps NASA APIs
- pctx (port 8080): Exposes the NASA MCP server to AI models
Setup
1. Get a NASA API Key
Get your free API key at https://api.nasa.gov/
2. Install Dependencies
npm install
3. Configure Environment
Copy .env.example to .env and add your NASA API key:
cp .env.example .env
Edit .env:
NASA_API_KEY=your_key_here
Running Locally
Option 1: Using npm (with installed pctx)
npm start
This will:
- Start the NASA MCP server on port 3000
- Capture the auth token automatically
- Start pctx on port 8080
Option 2: Using local cargo build
npm start -- --local
This uses cargo run to build and run pctx from source.
Option 3: Manual setup
Start the NASA MCP server:
node nasa-mcp-server.js
In another terminal, start pctx:
pctx start --port 8080 --config pctx.json
Testing
Test the NASA MCP server directly:
# List available tools
curl -X POST http://127.0.0.1:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{"jsonrpc":"2.0","method":"tools/list","params":{},"id":1}'
# Search for asteroids
curl -X POST http://127.0.0.1:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"search_asteroids","arguments":{"start_date":"2024-01-01"}},"id":2}'
# Search for satellites
curl -X POST http://127.0.0.1:3000/mcp \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"search_satellites","arguments":{"search":"ISS"}},"id":3}'
Test pctx:
curl -X POST http://127.0.0.1:8080/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","method":"initialize","params":{},"id":1}'
Deployment
Docker Compose
docker-compose up
Fly.io
-
Install the Fly CLI: https://fly.io/docs/hands-on/install-flyctl/
-
Login to Fly:
fly auth login
- Set your NASA API key as a secret:
fly secrets set NASA_API_KEY=your_key_here
- Deploy:
fly deploy
Your server will be available at https://nasa-pctx-example.fly.dev/mcp
API Documentation
NASA NeoWs API
- Documentation: https://api.nasa.gov/
- Rate limits: 1000 requests per hour with API key
TLE API
- Documentation: http://tle.ivanstanojevic.me
- No authentication required
- Data updated daily from CelesTrak
Example Tool Calls
Search Asteroids
{
"name": "search_asteroids",
"arguments": {
"start_date": "2024-01-01",
"end_date": "2024-01-02"
}
}
Lookup Asteroid
{
"name": "lookup_asteroid",
"arguments": {
"asteroid_id": "3542519"
}
}
Browse Asteroids
{
"name": "browse_asteroids",
"arguments": {
"page": 0,
"size": 20
}
}
Search Satellites
{
"name": "search_satellites",
"arguments": {
"search": "ISS"
}
}
Lookup Satellite
{
"name": "lookup_satellite",
"arguments": {
"satellite_id": "25544"
}
}
Troubleshooting
Port Already in Use
If ports 3000 or 8080 are already in use, you can change them:
NASA_MCP_PORT=3001 PCTX_PORT=8081 npm start
Connection Issues
Make sure both servers are running and the auth token is properly captured. Check the logs for any errors.
API Rate Limits
The NASA API has rate limits. If you're getting 429 errors, wait a bit or use your own API key instead of DEMO_KEY.
License
This example is provided as-is for demonstration purposes.
Reviews
No reviews yet. Be the first.
Related
Github Mcp Server
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Context7
Up-to-date code docs for any prompt
Playwright Mcp
Playwright Tools for MCP
mh install mcps/nasa-mcp-example