Nutrition Maxing CLI - Notion MCP Challenge Submission
This is a submission for the Notion MCP Challenge
What I Built
Nutrition Maxing CLI - 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.
Key Features
Natural Language Meal Logging
- Just say "I ate 3 eggs and toast" and it parses into separate entries
- Supports meal format: "Lunch: rice, dal, curry, vegetables"
- Recognizes meal types: Breakfast, Morning Snacks, Lunch, Evening Snacks, Dinner
Accurate Macro Estimation
- Uses IFCT 2017 (Indian Food Composition Tables) for Indian dishes
- Uses USDA FoodData Central for global foods
- Automatically calculates: Protein, Carbs, Fat, Fiber, Calories
- Distinguishes between dairy types (whole milk vs skim)
β‘ Interactive REPL Experience
- Animated spinner showing real-time status: "Analyzing..." β "Logging..." β "Done"
- Welcome screen with guidance
- Persistent command history
- One-off and interactive modes
Notion Database Integration
- Logs each food item as a separate Notion page
- Tracks full macro breakdown per item
- Links to daily calorie summaries
- Auto-generates day pages with macro goals
Technical Stack
- Framework: TypeScript/Node.js CLI
- AI: Groq llama-3.1-8b-instant (agentic loop)
- MCP: Model Context Protocol for Notion integration
- UI: Chalk (terminal colors) + Readline (interactive input)
- Database: Notion (food logs + calorie tracking)
Video Demo
Example flow:
- User runs
notionβ Welcome screen displays - User types: "Lunch: 250g rice, 2 bowls dal, curry"
- Spinner animates with status updates
- Response shows 3 separate logged items with macros
- Data instantly synced to Notion
Show us the code
Repository: nutrition-maxing-cli on GitHub
Project Structure
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
Key Files
[groq-agent.ts] - Core agentic loop
- System prompt with IFCT 2017 + USDA standards
- Multi-item meal parsing logic
- Tool calling orchestration
- Status update callbacks for real-time UI
[nutrition-mcp/index.js] - Notion MCP Server
-
log_food: Save meal entries with macros -
get_daily_nutrition: Retrieve foods for a date -
get_daily_calories: Get calorie summary + goals
[repl.ts]) - Interactive Interface
- Animated spinner (braille characters)
- Real-time status sync from AI agent
- Multi-turn interaction loop
How I Used Notion MCP
The Integration Challenge
Integrating with Notion requires more than just an API key. You need:
- Proper database structure (fields, relations, types)
- Reliable tool calling for data persistence
- Real-time feedback during async operations
- Accurate data matching (food entries to daily summaries)
How MCP Solved This
The Model Context Protocol provided:
1. Abstraction Layer
User Message β Groq AI β MCP Tool Calls β Notion API
Instead of the AI directly hitting Notion's REST API (which requires object/array construction), MCP tools handle all the complexity:
- Proper field type conversion (strings, numbers, relations)
- Automatic page creation with correct schema
- Relation management (linking food entries to daily pages)
2. Agentic Capabilities
The MCP server acts as an intelligent tool executor that:
- Validates parameters before sending to Notion
- Handles multi-step operations (create day page β create food entries β link relations)
- Provides structured responses for the AI to reason about
- Retries gracefully on failures
3. Real-time Status Feedback
// Agent can now report what it's doing at each step
onStatusUpdate?.("Analyzing your input...");
onStatusUpdate?.("Calling AI model...");
onStatusUpdate?.("Executing log_food...");
onStatusUpdate?.("Finalizing response...");
This transforms the user experience from opaque delays to transparent progress.
What It Unlocks
Without MCP: AI would need to construct complex Notion page objects, manage database IDs, handle page relations - bloating the system prompt and error handling.
With MCP:
- AI focuses on nutrition intelligence (macro estimation, meal parsing)
- MCP handles all Notion complexity
- System prompt stays clean and focused
- Easy to extend with new tools (hydration tracking, supplements, etc.)
- Decoupled architecture - can swap backends
Example: Multi-Item Meal Logging
User says: "Lunch: 250g rice, 2 bowls dal, curry"
AI Flow (via MCP):
- Parse into 3 items
- Estimate macros using IFCT 2017
- Call MCP
log_foodfor each item:
log_food(food_name="250g cooked rice", protein="7", carbs="56", fat="2", ...)
log_food(food_name="2 bowls arhar dal", protein="24", carbs="42", fat="2", ...)
log_food(food_name="curry", protein="8", carbs="12", fat="15", ...)
- MCP automatically:
- Creates 3 food log pages in Notion
- Finds or creates the day's calorie summary page
- Links all 3 entries to the correct day
- Updates macro rollups
Result: Clean architecture where AI and Notion are perfectly decoupled.
Submission Summary
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).
The result: A delightful user experience where complex meal logging feels instant and effortless.
Technologies Used: TypeScript, Groq API, Model Context Protocol, Notion API
Status: Ready for personal nutrition tracking
Top comments (0)