mcp-foodguidecanada
If you are the rightful owner of mcp-foodguidecanada and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This server is a comprehensive nutrition analysis platform that integrates Canada's Food Guide recipes with Health Canada's official nutrition databases through a Model Context Protocol (MCP) server.
🍲 Canada's Food Guide - MCP Server
Example | Video |
---|---|
Find Themed recipes for a week | |
Suggest recipes from an image of your groceries | |
Calculate your estimated macros intake and energy requirements | |
Calculate Macros for a recipe |
📝 Description
This is a comprehensive nutrition analysis platform that integrates Canada's Food Guide recipes with Health Canada's official nutrition databases through a Model Context Protocol (MCP) server.
What makes this powerful:
Instead of LLMs manually parsing multiple government websites and performing complex nutrition calculations, this server provides 42+ specialized tools organized into six major categories:
🍲 Recipe Discovery & Management - Smart search, detailed extraction, favorites storage
🗄️ Database & Session Management - Virtual sessions, persistent storage, bulk operations
🧮 Math & Calculation Tools - Recipe scaling, ingredient calculations, safe arithmetic
🥗 CNF Nutrition Analysis - Canadian Nutrient File integration with LLM-driven unit conversion
⚡ Energy Requirements (EER) - Health Canada energy equation calculations
📊 Dietary Reference Intakes (DRI) - Macronutrient recommendations and adequacy assessment
Built using FastMCP with custom integrations to Health Canada's Canadian Nutrient File (CNF) database, Dietary Reference Intakes (DRI) tables, and EER equations, this server transforms complex nutrition analysis into simple tool calls for AI assistants.
Check IMPLEMENTATIONS.MD if you'd like to contribute or collaborate! Always looking for suggestions!
You can use this google sheet to verify EER and CNF calculations shown in the trailer videos in the current repository.
⚠️ The CNF Database has rate limited macronutrient webrequests to prevent server bloat. If you're fetching maacronutrient information, you migth encounter incomplete bulk_get_macronutrient outputs in the first try. Always try to chunk queries into separate steps to prevent the LLM from overwhelming/being overwhelmed
📑 Table of Contents
- 📝 Description
- ✨ Features
- 📥 Installation
- 🚀 Running the Server using Claude
- 🏗️ Project Structure
- ⚠️ Known Issues
- 📋 Reference
✨ Features
This comprehensive nutrition analysis platform provides 42+ specialized tools organized into six major categories:
🍲 Recipe Discovery & Management (Core Tools)
- Smart Recipe Search - Text queries with advanced filtering by ingredients, meal types, appliances, and collections
- Detailed Recipe Extraction - Complete ingredients, instructions, prep times, tips, and nutritional information
- Filter Discovery - Dynamic exploration of available search filters and categories
- Favorites Management - Persistent storage of user's preferred recipes with SQLite database
🗄️ Database & Session Management
- Virtual Sessions - In-memory storage for temporary recipe analysis (prevents database bloat)
- Recipe Storage & Parsing - Automatic ingredient parsing with amounts, units, and names
- Session Cleanup - Automatic memory management for optimal performance
- Bulk Operations - Process multiple recipes efficiently with reduced tool calls
🧮 Math & Calculation Tools
- Recipe Scaling - Scale entire recipes or individual ingredients using parsed data
- Serving Size Adjustments - Calculate ingredients for different serving counts
- Bulk Calculations - Process multiple calculations in one operation (3x-10x efficiency gain)
- Simple Calculator - Safe arithmetic evaluation with string variables for any calculations
- Recipe Comparisons - Compare recipes by servings, complexity, or nutritional content
🥗 CNF Nutrition Analysis (Canadian Nutrient File Integration)
- Food Search & Retrieval - Search Health Canada's official CNF database by food name
- Macronutrient Analysis - Complete nutritional profiles with 13+ core nutrients
- LLM-Driven Unit Conversion - Intelligent handling of non-standard units like "4 fillets" with full transparency
- Bulk Processing - Analyze multiple foods in single operations for efficiency
- Unit Matching Intelligence - Clear status indicators for conversion decisions with LLM reasoning
⚡ Energy Requirements (EER Integration)
- Live EER Equations - Fetch current Energy Expenditure equations from Health Canada DRI tables
- Profile Management - Create and manage user profiles for repeated calculations
- PAL Categories - Physical Activity Level descriptions with examples
- 42+ Equations Available - Complete coverage of age groups, genders, and activity levels
📊 Dietary Reference Intakes (DRI Analysis)
- Complete DRI Tables - Macronutrient recommendations (EAR, RDA, AI, UL) for all age groups
- Adequacy Assessment - Compare actual intake against Health Canada recommendations
- AMDR Analysis - Acceptable Macronutrient Distribution Range evaluation
- Session-Based Workflows - Cache DRI data for complex multi-step nutrition analysis
- EER Integration - Convert energy requirements to macronutrient targets for meal planning
📥 Installation
Click the image to Watch the setup tutorial!
-
Prerequisites:
-
Clone the repository:
git clone https://github.com/Aryan-Jhaveri/mcp-foodguidecanada cd mcp-foodguidecanada
-
Install dependencies:
pip3 install -r requirements.txt
🚀 Running the Server using Claude Desktop Integration
To use this server with Claude Desktop:
-
Find your Python path: Open your terminal and run:
which python3
This will show the full path to your Python installation (e.g.,
/usr/bin/python3
,/opt/homebrew/bin/python3
, or/opt/anaconda3/bin/python3
) -
Get the absolute path to your project: In your terminal, navigate to the project directory and run:
pwd
This shows your full project path (e.g.,
mcp-foodguidecanada
) -
Open Claude Desktop settings:
- Navigate to Settings (⌘ + ,) → Developer → Edit Config
-
Add the server configuration: Replace the paths below with your actual paths from steps 1 and 2:
{ "mcpServers": { "FoodGuideSousChef": { "command": "/opt/homebrew/bin/python3", "args": [ "path/to/mcp-foodguidecanada/src/server.py" ], "cwd": "path/to/mcp-foodguidecanada" } } }
Common Python paths by system:
- Homebrew (Mac):
/opt/homebrew/bin/python3
- System Python (Mac):
/usr/bin/python3
- Anaconda:
/opt/anaconda3/bin/python3
- Linux:
/usr/bin/python3
- Homebrew (Mac):
-
Save and restart Claude Desktop:
- Save the configuration file
- Completely quit and restart Claude Desktop
- The server will now be available in your conversations
Troubleshooting
- If the server doesn't appear, check the Claude Desktop logs for error messages
- Verify Python 3.8+ is installed:
python3 --version
- Restart Claude Desktop:
- The server will now be available in your conversations
🏗️ Project Structure
Here's how the comprehensive nutrition platform is organized:
🗂️ Root Files
main.py
: Command-line interface for testing (alternative to MCP server)requirements.txt
: Python dependencies for the entire platformIMPLEMENTATIONS.md
: Development roadmap and architecture plans
📁 src/
Folder - Core Platform
-
server.py
: Main MCP server with 42+ specialized tools across 6 categories:- Recipe discovery and management tools
- Database and session management tools
- Math and calculation tools
- CNF nutrition analysis tools
- EER energy requirement tools
- DRI dietary reference intake tools
-
config.py
: Platform configuration including database settings and Health Canada endpoints -
cli.py
: Command-line interface for development and testing
📁 api/
Folder - Health Canada Integrations
search.py
: Canada's Food Guide recipe search and filteringrecipe.py
: Detailed recipe extraction and ingredient parsingcnf.py
: Canadian Nutrient File food search and nutrition data retrievaleer.py
: Energy Expenditure Requirements from DRI tablesdri.py
: Dietary Reference Intake tables and macronutrient recommendations
📁 db/
Folder - Database & Calculation Layer
connection.py
: SQLite database connection and managementschema.py
: Database schema and virtual session managementqueries.py
: Database operation tools registrationcnf_tools.py
: CNF nutrition analysis and unit conversion toolsmath_tools.py
: Recipe scaling, calculations, and arithmetic toolseer_tools.py
: Energy requirement calculation and profile managementdri_tools.py
: DRI analysis and adequacy assessment tools
📁 models/
Folder - Data Structures & Validation
recipe.py
: Recipe data models with ingredient parsingfilters.py
: Search filter management and cachingcnf_models.py
: CNF food and nutrition data modelseer_models.py
: EER calculation and profile modelsdri_models.py
: DRI table and assessment modelsmath_models.py
: Calculation tool input/output modelsdb_models.py
: Database operation models
📁 utils/
Folder - Support Functions
url_builder.py
: Canada's Food Guide URL constructiondownloader.py
: Recipe export functionality (JSON/Markdown)
📁 Storage & Data
cache/
: Filter data and temporary file storagedocs/
: Additional documentation and guidesdownloads/
: Recipe export output directoryfoodguide_data.db
: SQLite database for persistent favorites storage
🔄 Platform Architecture:
- MCP Server Layer:
server.py
exposes 42+ tools to AI assistants - Health Canada APIs: Live integration with CNF, DRI, and recipe databases
- Database Layer: Virtual sessions (memory) + persistent favorites (SQLite)
- Calculation Engine: Math tools for scaling, nutrition analysis, and comparisons
- LLM Integration: Intelligent unit conversion and decision-making workflows
⚠️ Known Issues and Limitations
Data Dependencies
- Multiple Website Dependencies: Functionality depends on Canada's Food Guide, Health Canada CNF database, and DRI tables maintaining consistent structure
- Internet Required: All nutrition data is fetched live from Health Canada websites
- Data Quality: Recipe and nutrition accuracy depends on Health Canada's data quality and updates
Performance Considerations
- Web Scraping Overhead: Recipe search may be slower than direct APIs due to HTML parsing
- Virtual Session Memory: Large datasets in virtual sessions consume RAM (auto-cleanup helps)
- Bulk Operation Limits: Some tools have built-in limits to prevent resource exhaustion
Calculation Accuracy
- LLM-Dependent Unit Conversion: Non-standard units like "4 fillets" require LLM reasoning for accurate conversion
- Math Verification Recommended: Complex calculations should be spot-checked for accuracy
- Ingredient Parsing Limitations: Unusual ingredient formats may not parse correctly
📋 Reference
This platform provides 42+ specialized tools across 6 major categories. Below are representative examples from each category.
🍲 Recipe Discovery Tools
search_recipes
Search Canada's Food Guide with advanced filtering.
- Parameters:
search_text
,fruits
,vegetables
,proteins
,meals
,appliances
,collections
,max_pages
- Returns: Array of recipe metadata with titles, URLs, and slugs
get_recipe
Extract complete recipe details from URL.
- Parameters:
url
(required) - Returns: Full recipe with ingredients, instructions, prep time, tips
add_to_favorites
Save recipes to persistent SQLite storage.
- Parameters:
recipe_url
,notes
(optional) - Returns: Confirmation with recipe stored in database
🗄️ Database & Session Tools
store_recipe_in_session
Store recipes in virtual memory sessions.
- Parameters:
session_id
,recipe_data
- Returns: Confirmation with parsed ingredient data
simple_recipe_setup
Combined recipe transfer, parsing, and nutrition preparation.
- Parameters:
session_id
,recipe_url
- Returns: Complete recipe setup for analysis
🧮 Math & Calculation Tools
scale_recipe_servings
Scale entire recipes using parsed ingredient data.
- Parameters:
session_id
,recipe_id
,target_servings
- Returns: Scaled ingredient amounts with units
bulk_math_calculator
Process multiple calculations in one operation (3x-10x efficiency gain).
- Parameters:
calculations
(array of expression objects) - Returns: All calculation results in single response
🥗 CNF Nutrition Analysis Tools
search_and_get_cnf_macronutrients
Search Canadian Nutrient File and retrieve nutrition data.
- Parameters:
food_name
,max_results
- Returns: CNF foods with complete macronutrient profiles
calculate_recipe_nutrition_summary
Analyze unit matching for LLM-driven conversion workflow.
- Parameters:
session_id
,recipe_id
- Returns: Unit matching analysis with conversion recommendations
bulk_get_cnf_macronutrients
Process multiple CNF foods efficiently.
- Parameters:
food_codes
(up to 20 foods) - Returns: Batch nutrition data with 90% tool call reduction
⚡ Energy Requirements (EER) Tools
get_eer_equations
Fetch Energy Expenditure Requirements from Health Canada.
- Parameters:
equation_type
,pal_category
- Returns: Live EER equations with coefficients in JSON format
create_user_profile
Create profiles for repeated EER calculations.
- Parameters:
profile_name
,age
,gender
,height
,weight
,pal_category
- Returns: Stored profile for calculation workflows
📊 Dietary Reference Intakes (DRI) Tools
get_macronutrient_dri_tables
Fetch complete DRI tables from Health Canada.
- Parameters: None (fetches all current DRI data)
- Returns: Complete macronutrient recommendations (EAR, RDA, AI, UL)
compare_intake_to_dri
Assess nutritional adequacy against Health Canada standards.
- Parameters:
age_range
,gender
,intake_data
- Returns: Adequacy assessment with risk evaluation
Made with ❤️ for Canada's Food Guide
Canada's Food Guide Health Canada's Canadian Nutrient File Health Canada's Dietary Reference Intakes