<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Avro Dotter</title>
    <description>The latest articles on Forem by Avro Dotter (@avrodotter).</description>
    <link>https://forem.com/avrodotter</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1470589%2Fead031f8-2a39-4ffc-8746-384049011499.jpeg</url>
      <title>Forem: Avro Dotter</title>
      <link>https://forem.com/avrodotter</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/avrodotter"/>
    <language>en</language>
    <item>
      <title>Nutrition Maxing CLI- log foods with macros into your Notion workspace through MCP</title>
      <dc:creator>Avro Dotter</dc:creator>
      <pubDate>Mon, 30 Mar 2026 07:02:30 +0000</pubDate>
      <link>https://forem.com/avrodotter/nutrition-maxing-cli-log-foods-with-macros-into-your-notion-workspace-through-mcp-5dpo</link>
      <guid>https://forem.com/avrodotter/nutrition-maxing-cli-log-foods-with-macros-into-your-notion-workspace-through-mcp-5dpo</guid>
      <description>&lt;h1&gt;
  
  
  Nutrition Maxing CLI - Notion MCP Challenge Submission
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/notion-2026-03-04"&gt;Notion MCP Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Nutrition Maxing CLI&lt;/strong&gt; - A natural language-powered nutrition logging system that transforms how users track their daily meals and macronutrients. Instead of manually entering food data, users simply tell the CLI what they ate, and it intelligently parses multi-item meals, estimates accurate macros, and syncs everything to their Notion database.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Natural Language Meal Logging&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Just say "I ate 3 eggs and toast" and it parses into separate entries&lt;/li&gt;
&lt;li&gt;Supports meal format: "Lunch: rice, dal, curry, vegetables"&lt;/li&gt;
&lt;li&gt;Recognizes meal types: Breakfast, Morning Snacks, Lunch, Evening Snacks, Dinner&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Accurate Macro Estimation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Uses IFCT 2017 (Indian Food Composition Tables) for Indian dishes&lt;/li&gt;
&lt;li&gt;Uses USDA FoodData Central for global foods&lt;/li&gt;
&lt;li&gt;Automatically calculates: Protein, Carbs, Fat, Fiber, Calories&lt;/li&gt;
&lt;li&gt;Distinguishes between dairy types (whole milk vs skim)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚡ &lt;strong&gt;Interactive REPL Experience&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Animated spinner showing real-time status: "Analyzing..." → "Logging..." → "Done"&lt;/li&gt;
&lt;li&gt;Welcome screen with guidance&lt;/li&gt;
&lt;li&gt;Persistent command history&lt;/li&gt;
&lt;li&gt;One-off and interactive modes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Notion Database Integration&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Logs each food item as a separate Notion page&lt;/li&gt;
&lt;li&gt;Tracks full macro breakdown per item&lt;/li&gt;
&lt;li&gt;Links to daily calorie summaries&lt;/li&gt;
&lt;li&gt;Auto-generates day pages with macro goals&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Technical Stack
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Framework&lt;/strong&gt;: TypeScript/Node.js CLI&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI&lt;/strong&gt;: Groq llama-3.1-8b-instant (agentic loop)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP&lt;/strong&gt;: Model Context Protocol for Notion integration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UI&lt;/strong&gt;: Chalk (terminal colors) + Readline (interactive input)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database&lt;/strong&gt;: Notion (food logs + calorie tracking)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Video Demo
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://youtu.be/OrPsTYzZDIk?si=6DnzAsBHLZ3BBj13" rel="noopener noreferrer"&gt;My video demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example flow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;User runs &lt;code&gt;notion&lt;/code&gt; → Welcome screen displays&lt;/li&gt;
&lt;li&gt;User types: "Lunch: 250g rice, 2 bowls dal, curry"&lt;/li&gt;
&lt;li&gt;Spinner animates with status updates&lt;/li&gt;
&lt;li&gt;Response shows 3 separate logged items with macros&lt;/li&gt;
&lt;li&gt;Data instantly synced to Notion&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Show us the code
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Repository&lt;/strong&gt;: &lt;a href="https://github.com/avrodotter/nutrition-maxing-cli" rel="noopener noreferrer"&gt;nutrition-maxing-cli on GitHub&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Project Structure
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apps/notion-cli/
├── src/
│   ├── groq-agent.ts          # Agentic loop with Groq
│   ├── mcp-client.ts          # Notion MCP communication
│   ├── repl.ts                # Interactive CLI interface
│   ├── cli.ts                 # Entry point
│   ├── ui.ts                  # Terminal UI components
│   └── styled-input.ts        # Styled input handler
├── dist/                      # Compiled JavaScript
├── package.json
└── tsconfig.json

nutrition-mcp/
├── index.js                   # MCP server with 3 nutrition tools
└── package.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Key Files
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;[groq-agent.ts]&lt;/strong&gt; - Core agentic loop&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;System prompt with IFCT 2017 + USDA standards&lt;/li&gt;
&lt;li&gt;Multi-item meal parsing logic&lt;/li&gt;
&lt;li&gt;Tool calling orchestration&lt;/li&gt;
&lt;li&gt;Status update callbacks for real-time UI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;[nutrition-mcp/index.js]&lt;/strong&gt; - Notion MCP Server&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;log_food&lt;/code&gt;: Save meal entries with macros&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_daily_nutrition&lt;/code&gt;: Retrieve foods for a date&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_daily_calories&lt;/code&gt;: Get calorie summary + goals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;[repl.ts])&lt;/strong&gt; - Interactive Interface&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Animated spinner (braille characters)&lt;/li&gt;
&lt;li&gt;Real-time status sync from AI agent&lt;/li&gt;
&lt;li&gt;Multi-turn interaction loop&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How I Used Notion MCP
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Integration Challenge
&lt;/h3&gt;

&lt;p&gt;Integrating with Notion requires more than just an API key. You need:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Proper database structure (fields, relations, types)&lt;/li&gt;
&lt;li&gt;Reliable tool calling for data persistence&lt;/li&gt;
&lt;li&gt;Real-time feedback during async operations&lt;/li&gt;
&lt;li&gt;Accurate data matching (food entries to daily summaries)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  How MCP Solved This
&lt;/h3&gt;

&lt;p&gt;The Model Context Protocol provided:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Abstraction Layer&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;User Message → Groq AI → MCP Tool Calls → Notion API
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of the AI directly hitting Notion's REST API (which requires object/array construction), MCP tools handle all the complexity:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Proper field type conversion (strings, numbers, relations)&lt;/li&gt;
&lt;li&gt;Automatic page creation with correct schema&lt;/li&gt;
&lt;li&gt;Relation management (linking food entries to daily pages)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Agentic Capabilities&lt;/strong&gt;&lt;br&gt;
The MCP server acts as an intelligent tool executor that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Validates parameters before sending to Notion&lt;/li&gt;
&lt;li&gt;Handles multi-step operations (create day page → create food entries → link relations)&lt;/li&gt;
&lt;li&gt;Provides structured responses for the AI to reason about&lt;/li&gt;
&lt;li&gt;Retries gracefully on failures&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Real-time Status Feedback&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Agent can now report what it's doing at each step&lt;/span&gt;
&lt;span class="nx"&gt;onStatusUpdate&lt;/span&gt;&lt;span class="p"&gt;?.(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Analyzing your input...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;onStatusUpdate&lt;/span&gt;&lt;span class="p"&gt;?.(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Calling AI model...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;onStatusUpdate&lt;/span&gt;&lt;span class="p"&gt;?.(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Executing log_food...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;onStatusUpdate&lt;/span&gt;&lt;span class="p"&gt;?.(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Finalizing response...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This transforms the user experience from opaque delays to transparent progress.&lt;/p&gt;

&lt;h3&gt;
  
  
  What It Unlocks
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Without MCP&lt;/strong&gt;: AI would need to construct complex Notion page objects, manage database IDs, handle page relations - bloating the system prompt and error handling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With MCP&lt;/strong&gt;: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI focuses on nutrition intelligence (macro estimation, meal parsing)&lt;/li&gt;
&lt;li&gt;MCP handles all Notion complexity&lt;/li&gt;
&lt;li&gt;System prompt stays clean and focused&lt;/li&gt;
&lt;li&gt;Easy to extend with new tools (hydration tracking, supplements, etc.)&lt;/li&gt;
&lt;li&gt;Decoupled architecture - can swap backends&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example: Multi-Item Meal Logging
&lt;/h3&gt;

&lt;p&gt;User says: &lt;em&gt;"Lunch: 250g rice, 2 bowls dal, curry"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI Flow&lt;/strong&gt; (via MCP):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Parse into 3 items&lt;/li&gt;
&lt;li&gt;Estimate macros using IFCT 2017&lt;/li&gt;
&lt;li&gt;Call MCP &lt;code&gt;log_food&lt;/code&gt; for each item:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;   &lt;span class="nf"&gt;log_food&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;food_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;250g cooked rice&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;protein&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;7&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;carbs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;56&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fat&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...)&lt;/span&gt;
   &lt;span class="nf"&gt;log_food&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;food_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2 bowls arhar dal&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;protein&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;24&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;carbs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;42&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fat&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...)&lt;/span&gt;
   &lt;span class="nf"&gt;log_food&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;food_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;curry&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;protein&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;8&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;carbs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;12&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fat&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;15&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;MCP automatically:

&lt;ul&gt;
&lt;li&gt;Creates 3 food log pages in Notion&lt;/li&gt;
&lt;li&gt;Finds or creates the day's calorie summary page&lt;/li&gt;
&lt;li&gt;Links all 3 entries to the correct day&lt;/li&gt;
&lt;li&gt;Updates macro rollups&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;: Clean architecture where AI and Notion are perfectly decoupled.&lt;/p&gt;




&lt;h2&gt;
  
  
  Submission Summary
&lt;/h2&gt;

&lt;p&gt;This project demonstrates how Model Context Protocol elegantly solves the integration challenge between AI and Notion. By abstracting Notion operations into typed, validated tools, we enable the AI to focus on domain intelligence (nutrition) while MCP handles infrastructure concerns (database schema, relations, types).&lt;/p&gt;

&lt;p&gt;The result: A delightful user experience where complex meal logging feels instant and effortless.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technologies Used&lt;/strong&gt;: TypeScript, Groq API, Model Context Protocol, Notion API&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Status&lt;/strong&gt;: Ready for personal nutrition tracking&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>notionchallenge</category>
      <category>mcp</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
