Model Context Protocol for Nutrition, Meals, and Scheduling
NutriLens MCP is an AI context engine that combines nutrition data, restaurant search, calendar availability, and weather to help users make informed meal and exercise decisions. It fetches live data from multiple APIs and returns concise, actionable context.
- MacroAnalyzer: Nutrition data lookup from USDA, Open Food Facts, and Edamam
- MealPlanner: Find nearby restaurants with menu analysis that match macro targets
- TimeAdvisor: Schedule recommendations based on calendar and weather
- SummaryEngine: Intelligent summarization using OpenRouter or Gemini
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Create .env file and add API keys (see below)
cp .env.example .envRequired:
GOOGLE_MAPS_API_KEY- Get from Google Cloud ConsoleOPENWEATHERMAP_API_KEY- Get from OpenWeatherMap
Optional:
OPENROUTER_API_KEYorGEMINI_API_KEY- For better summariesUSDA_API_KEY- For enhanced nutrition dataGOOGLE_CALENDAR_CLIENT_ID/SECRET/REFRESH_TOKEN- For calendar integration
# Terminal 1: Start server
python server.py
# Terminal 2: Start Streamlit app
streamlit run streamlit_app.pyVisit http://localhost:8501 to use the interface.
"I have 40g protein and <20g fat left. What should I eat for lunch near me today?"
Combines: macros + location + meal planning + time
"Plan tomorrow's meals around my gym schedule. I need 150g protein total and want to exercise when the weather is good."
Combines: calendar + weather + macros + meal planning
"I'm at a restaurant in San Francisco. What dish here fits my remaining macros (30g protein, <15g fat) and when should I eat it based on my calendar?"
Combines: location + restaurant search + macros + calendar
"Find me 3 restaurants near me that serve high-protein, low-carb meals. Show me specific dishes and their macros."
Shows: restaurant exploration + menu analysis + nutrition matching
"I'm in New York and need lunch. I have 40g protein left, want to stay under 600 calories, and prefer to eat when it's not raining. What are my options?"
Combines: location + macros + weather + meal planning
- Intent Detection: Analyzes query to determine which modules to call
- Parallel Execution: Fetches data from multiple APIs simultaneously
- Data Aggregation: Combines results into unified context
- Intelligent Summarization: Compresses to concise, actionable response
- USDA FoodData Central: Official nutrition database
- Open Food Facts: Community nutrition data
- Google Maps Places: Restaurant search and menu data
- Google Calendar: Personal schedule (optional)
- OpenWeatherMap: Weather forecasts
- OpenRouter/Gemini: LLM summarization
- Error Handling: Graceful degradation when APIs fail
- Caching: Reduces API calls (nutrition: 2h, restaurants: 30min, weather: 30min)
- Validation: Input sanitization and data validation
- Retry Logic: Exponential backoff for transient failures
Health_mcp/
├── mcp/
│ ├── macro_analyzer.py # Nutrition lookup
│ ├── meal_planner.py # Restaurant search & menu analysis
│ ├── time_advisor.py # Scheduling with calendar & weather
│ ├── summary_engine.py # LLM summarization
│ ├── query_processor.py # Intent detection
│ ├── context_builder.py # Orchestration
│ └── utils.py # Utilities
├── server.py # FastAPI server
├── streamlit_app.py # Web interface
└── requirements.txt # Dependencies
When the server is running, visit http://localhost:8000/docs for interactive API documentation.
Built with: FastAPI, Streamlit, Google APIs, OpenWeatherMap, USDA FoodData Central