Canada's Food Guide MCP Server

Canada's Food Guide MCP Server

Provides 42+ specialized tools for nutrition analysis integrating Canada's Food Guide recipes with Health Canada's official databases (CNF, DRI, EER) for recipe discovery, macro calculations, energy requirements, and dietary adequacy assessments.

Category
访问服务器

README

🍲 <a href="https://food-guide.canada.ca/en/" target="_blank">Canada's Food Guide - MCP Server</a>

<a href="https://www.python.org/downloads/" target="_blank"><img src="https://img.shields.io/badge/python-3.8+-blue.svg" alt="Python 3.8+"></a> <a href="https://opensource.org/licenses/MIT" target="_blank"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a> <a href="https://modelcontextprotocol.io/" target="_blank"><img src="https://img.shields.io/badge/MCP-ModelContextProtocol-green.svg" alt="MCP"></a>

Example Video
Find Themed recipes for a week <a href="https://youtu.be/CjWSxeWg-O0?t=223" target="_blank"> themed-recipe-spedup </a>
Suggest recipes from an image of your groceries <a href="https://youtu.be/CjWSxeWg-O0?t=307" target="_blank"> from-image-to-show-recipes-spedup </a>
Calculate your estimated macros intake and energy requirements <a href="https://youtu.be/CjWSxeWg-O0?t=40" target="_blank"> calculate-eer-spedup </a>
Calculate Macros for a recipe <a href ="https://youtu.be/CjWSxeWg-O0?t=116" target="_blank">calculate-macros-spedup </a>

📝 Description

This is a comprehensive nutrition analysis platform that integrates <a href="https://food-guide.canada.ca/en/" target="_blank">Canada's Food Guide</a> recipes with Health Canada's official nutrition databases through a <a href="https://modelcontextprotocol.io/" target="_blank">Model Context Protocol (MCP)</a> 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 <a href="https://github.com/jlowin/fastmcp" target="_blank">FastMCP</a> with custom integrations to Health Canada's <a href="https://food-nutrition.canada.ca/cnf-fce/index-eng.jsp" target="_blank">Canadian Nutrient File (CNF)</a> database, <a href="https://www.canada.ca/en/health-canada/services/food-nutrition/healthy-eating/dietary-reference-intakes/tables.html" target="_blank">Dietary Reference Intakes (DRI)</a> 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 <a href="https://docs.google.com/spreadsheets/d/1TELVtKLN35yxGFC10751WnByRtpWndYPjC4WKWw4Cgo/edit?usp=sharing" target="_blank">google sheet</a> 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

✨ 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! Watch the setup tutorial

  1. Prerequisites:

    • <a href="https://www.python.org/#:~:text=Download" target="_blank">Python 3.8 or higher</a>
    • <a href="https://pip.pypa.io/en/stable/installation/" target="_blank">pip (Python package installer)</a>
  2. Clone the repository:

    git clone https://github.com/Aryan-Jhaveri/mcp-foodguidecanada
    cd mcp-foodguidecanada
    
  3. Install dependencies:

    pip3 install -r requirements.txt
    

🚀 Running the Server using Claude Desktop Integration

To use this server with Claude Desktop:

  1. 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)

  2. 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)

  3. Open Claude Desktop settings:

    • Navigate to Settings (⌘ + ,) → Developer → Edit Config
  4. 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
  5. 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
  1. 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 platform
  • IMPLEMENTATIONS.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 filtering
  • recipe.py: Detailed recipe extraction and ingredient parsing
  • cnf.py: Canadian Nutrient File food search and nutrition data retrieval
  • eer.py: Energy Expenditure Requirements from DRI tables
  • dri.py: Dietary Reference Intake tables and macronutrient recommendations

📁 db/ Folder - Database & Calculation Layer

  • connection.py: SQLite database connection and management
  • schema.py: Database schema and virtual session management
  • queries.py: Database operation tools registration
  • cnf_tools.py: CNF nutrition analysis and unit conversion tools
  • math_tools.py: Recipe scaling, calculations, and arithmetic tools
  • eer_tools.py: Energy requirement calculation and profile management
  • dri_tools.py: DRI analysis and adequacy assessment tools

📁 models/ Folder - Data Structures & Validation

  • recipe.py: Recipe data models with ingredient parsing
  • filters.py: Search filter management and caching
  • cnf_models.py: CNF food and nutrition data models
  • eer_models.py: EER calculation and profile models
  • dri_models.py: DRI table and assessment models
  • math_models.py: Calculation tool input/output models
  • db_models.py: Database operation models

📁 utils/ Folder - Support Functions

  • url_builder.py: Canada's Food Guide URL construction
  • downloader.py: Recipe export functionality (JSON/Markdown)

📁 Storage & Data

  • cache/: Filter data and temporary file storage
  • docs/: Additional documentation and guides
  • downloads/: Recipe export output directory
  • foodguide_data.db: SQLite database for persistent favorites storage

🔄 Platform Architecture:

  1. MCP Server Layer: server.py exposes 42+ tools to AI assistants
  2. Health Canada APIs: Live integration with CNF, DRI, and recipe databases
  3. Database Layer: Virtual sessions (memory) + persistent favorites (SQLite)
  4. Calculation Engine: Math tools for scaling, nutrition analysis, and comparisons
  5. 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

<div align="center"> <p>Made with ❤️ for Canada's Food Guide</p> <p> <a href="https://food-guide.canada.ca/en/" target="_blank">Canada's Food Guide</a> <a href="https://food-nutrition.canada.ca/cnf-fce/?lang=eng" target="_blank">Health Canada's Canadian Nutrient File</a> <a href="https://www.canada.ca/en/health-canada/services/food-nutrition/healthy-eating/dietary-reference-intakes/tables.html" target="_blank">Health Canada's Dietary Reference Intakes</a> </p> </div>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选