Traia-IO/nasa-astronomy-picture-of-the-day-mcp-server
If you are the rightful owner of nasa-astronomy-picture-of-the-day-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This server provides secure access to NASA's Astronomy Picture of the Day API using the Model Context Protocol.
NASA Astronomy Picture of the Day MCP Server
This is an MCP (Model Context Protocol) server that provides with authentication via Bearer tokens access to the NASA Astronomy Picture of the Day API. It enables AI agents and LLMs to interact with NASA Astronomy Picture of the Day through standardized tools.
Features
- 🔧 MCP Protocol: Built on the Model Context Protocol for seamless AI integration
- 🌐 Full API Access: Provides tools for interacting with NASA Astronomy Picture of the Day endpoints
- 🔐 Secure Authentication: Supports API key authentication via Bearer tokens
- 🐳 Docker Support: Easy deployment with Docker and Docker Compose
- ⚡ Async Operations: Built with FastMCP for efficient async handling
API Documentation
- NASA Astronomy Picture of the Day Website: https://api.nasa.gov/planetary/apod
- API Documentation: https://api.nasa.gov/
Available Tools
This server provides the following tools:
example_tool: Placeholder tool (to be implemented)get_api_info: Get information about the API service and authentication status
Note: Replace example_tool with actual NASA Astronomy Picture of the Day API tools based on the documentation.
Installation
Using Docker (Recommended)
-
Clone this repository:
git clone https://github.com/Traia-IO/nasa-astronomy-picture-of-the-day-mcp-server.git cd nasa-astronomy-picture-of-the-day-mcp-server -
Set your API key:
export NASA_ASTRONOMY_PICTURE_OF_THE_DAY_API_KEY="your-api-key-here" -
Run with Docker:
./run_local_docker.sh
Using Docker Compose
- Create a
.envfile with your configuration:
NASA_ASTRONOMY_PICTURE_OF_THE_DAY_API_KEY=your-api-key-here PORT=8000
2. Start the server:
```bash
docker-compose up
Manual Installation
-
Install dependencies using
uv:uv pip install -e . -
Run the server:
NASA_ASTRONOMY_PICTURE_OF_THE_DAY_API_KEY="your-api-key-here" uv run python -m server
## Usage
### Health Check
Test if the server is running:
```bash
python mcp_health_check.py
Using with CrewAI
from traia_iatp.mcp.traia_mcp_adapter import create_mcp_adapter_with_auth
# Connect with authentication
with create_mcp_adapter_with_auth(
url="http://localhost:8000/mcp/",
api_key="your-api-key"
) as tools:
# Use the tools
for tool in tools:
print(f"Available tool: {tool.name}")
# Example usage
result = await tool.example_tool(query="test")
print(result)
Authentication
This server requires API key authentication. Clients must provide their API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
The API key is then used to authenticate requests to the NASA Astronomy Picture of the Day API.
Development
Testing the Server
- Start the server locally
- Run the health check:
python mcp_health_check.py - Test individual tools using the CrewAI adapter
Adding New Tools
To add new tools, edit server.py and:
- Create API client functions for NASA Astronomy Picture of the Day endpoints
- Add
@mcp.tool()decorated functions - Update this README with the new tools
- Update
deployment_params.jsonwith the tool names in the capabilities array
Deployment
Deployment Configuration
The deployment_params.json file contains the deployment configuration for this MCP server:
{
"github_url": "https://github.com/Traia-IO/nasa-astronomy-picture-of-the-day-mcp-server",
"mcp_server": {
"name": "nasa-astronomy-picture-of-the-day-mcp",
"description": "Nasa apod api integration for astronomy data",
"server_type": "streamable-http",
"requires_api_key": true,
"api_key_header": "Authorization",
"capabilities": [
// List all implemented tool names here
"example_tool",
"get_api_info"
]
},
"deployment_method": "cloud_run",
"gcp_project_id": "traia-mcp-servers",
"gcp_region": "us-central1",
"tags": ["nasa astronomy picture of the day", "api"],
"ref": "main"
}
Important: Always update the capabilities array when you add or remove tools!
Google Cloud Run
This server is designed to be deployed on Google Cloud Run. The deployment will:
- Build a container from the Dockerfile
- Deploy to Cloud Run with the specified configuration
- Expose the
/mcpendpoint for client connections
Environment Variables
PORT: Server port (default: 8000)STAGE: Environment stage (default: MAINNET, options: MAINNET, TESTNET)LOG_LEVEL: Logging level (default: INFO)NASA_ASTRONOMY_PICTURE_OF_THE_DAY_API_KEY: Your NASA Astronomy Picture of the Day API key (required)
Troubleshooting
- Server not starting: Check Docker logs with
docker logs <container-id> - Authentication errors: Ensure your API key is correctly set in the environment
- API errors: Verify your API key has the necessary permissions3. Tool errors: Check the server logs for detailed error messages
Contributing
- Fork the repository
- Create a feature branch
- Implement new tools or improvements
- Update the README and deployment_params.json
- Submit a pull request