This directory contains the Gradio-based web interface for interacting with the NASA Planetary Data System (PDS) MCP server for exploring NASA planetary data through an AI agent powered by HuggingFace's smolagents library and the OpenAI SDK.
This implementation serves as an example of a custom MCP Host, showing that this MCP server can go beyond 3rd party clients, and it can be integrated and configured for downstream applications.
Ex: There is a suggested instructions prompt here for the PDS MCP Server. This needs to be configured on the MCP client side.
A simplified Gradio application specifically configured for the NASA PDS MCP server:
- MCP Integration: Direct integration with the PDS MCP server using smolagent's
MCPClient - Tool Discovery: Automatically discovers and loads available PDS tools
- OpenAI Integration: Uses OpenAI's GPT-4.1 model for agent reasoning
- Streaming Support: Real-time response streaming for better user experience
-
Install required dependencies from
requirements.txt -
Set up environment variables in a
.envfile:
PYTHON_PATH=/path/to/your/python
MCP_SERVER_PATH=/path/to/pds_mcp_server.py
OPENAI_API_KEY=your_openai_api_key_herepython pds-mcp-client.pyThe pds-mcp-client.py file can be customized to:
- Change the model provider (modify
model_idinOpenAIServerModel) - Adjust agent parameters (max_steps, streaming options) or type (
ToolCallingAgentorCodeAgent) - Modify prompt templates for different use cases and instructions
The GradioUI is originally a pre-built smolagents component. It has already been altered here in gradio_smolagents_ui.py. Feel free to alter it more for your use case.
- Frontend: Gradio web interface with real-time updates (customized from HuggingFace's GradioUI component)
- Backend: smolagents framework with MCP client integration
- Data Source: NASA PDS Registry API via MCP server
- Model: OpenAI GPT-4.1 (can be configured to any model provider HuggingFace supports)
-
API Key Not Working
- Ensure the API key is valid and has sufficient credits
- Check that the key is properly entered in the UI
- Verify the key has access to the required model
-
MCP Server Connection Issues
- Verify the MCP server path in environment variables
- Ensure the MCP server is running and accessible
- Check Python path configuration

