Inspiration
It's 6pm and you're hungry. You want to eat healthy, but you're lactose intolerant, you're on a tight budget, and you have no idea what's actually affordable at the grocery store near you. You could open MyFitnessPal, but it only counts calories after you've already eaten. You could browse recipe apps, but they don't know about your allergies, your budget, or what's in stock locally.
74% of Americans want to eat healthier, but don't know where to start (American Heart Association). Over $150 per household gets wasted monthly on food that goes uneaten. And there are zero apps that connect your dietary needs, your budget, and your local grocery stores into one experience. We built Mahm to fix that. Mahm is an AI nutritionist that knows your constraints, recommends meals that work for you, plans your week, tracks your nutrition, and finds the ingredients at real local stores with real prices. The name stands for Make At Home Mmmm, also a homonym for "mom," because that's what using it feels like. Someone who actually cares what you eat.
What it does
Mahm has four modes that work together to take you from "I don't know what to eat" to a full week of meals with groceries sourced from your neighborhood.
- AI Nutritionist Chat
Mahm is a multi-turn conversational agent that gathers context before making recommendations. Tell her you're a vegetarian, lactose intolerant, on an $80/week budget, and a beginner cook. Then she reasons across all your constraints at once (vegetarian + fatigue = possible iron deficiency) and recommends meals that fit.
Push back, and she adapts. Say "I hate tofu" and she swaps every tofu dish for lentils and chickpeas, explaining each substitution.
Under the hood, Mahm has 4 custom agent tools: search_recipes — hybrid search across 500+ recipes via Elasticsearch, with dietary and cuisine filtering get_nutrition — validates nutritional claims before Mahm states them find_stores — real-time local grocery price comparison via Bright Data MCP generate_meal_plan — creates weekly plans optimized for budget, nutrition, and variety
- AI Meal Planner & Recipe Generator
Mahm generates personalized weekly meal plans based on your dietary needs, budget, schedule, and preferences. The plans account for variety, nutritional balance, and realistic time constraints. Once generated, you can swap, log, and plan meals.
There are two additional ways to generate and log meals: Generate through chat — request a meal from Mahm and it's automatically slotted into the meal planning calendar Upload a photo — snap a picture of a meal you ate from anywhere, and Mahm identifies the dish and its nutrients.
- Nutrition & Meal Tracker
A dashboard that gives you daily and weekly nutrition summaries — calories, macros, micronutrients — so you can see how your meals stack up against your goals over time. Autolog with calendar — for planned meals on the meal calendar. This means Mahm tracks both meals she recommends and meals you eat independently — giving you a complete picture of your nutrition, not just the days you cook at home.
- Smart Marketplace
Ask Mahm where to buy ingredients and she scrapes real prices from local grocery stores using Bright Data's MCP tools (search_engine + scrape_as_markdown). Real data, real stores, real prices. The marketplace is woven into the conversation. Mahm recommends a recipe, offers to find ingredients, and shows local prices. One continuous flow from dietary advice to shopping list.
How we built it
Architecture
Mahm runs as three microservices: the agent app (Next.js, port 3000), a recipe data API (port 3001), and a Flask backend for the marketplace (port 5000). The agent proxies requests to the other services via internal API routes (/api/recipes → data-apis, /api/marketplace → backend) and falls back to cached data when any service is down. This separation means we could develop and test each service independently, and any single service going down doesn't crash the demo — which saved us at least twice during the hackathon.
Agent Tool Loop & Prompt Engineering
Anthropic's Claude powers the Mahm agent via the Messages API. We implemented a manual tool loop: Claude receives the conversation, decides which tool(s) to call, the agent executes the tool and returns the result, and Claude generates the next response. This loops until Claude responds without a tool call. The 4 custom tools — search_recipes, get_nutrition, find_stores, and generate_meal_plan — are defined as function schemas that Claude can invoke autonomously. Claude decides on its own which tool to use and when, based on the conversation context. For example, if a user mentions they're vegetarian and fatigued, Claude will call get_nutrition to check iron-rich foods before recommending, then call search_recipes with those filters. No hardcoded logic determines this flow — it emerges from the prompt and Claude's reasoning.
The system prompt went through 8 revisions. Key design decisions: Strict nutrition grounding: Mahm is instructed to never state a calorie or nutrient claim without calling get_nutrition first. This eliminated hallucinated nutrition facts. Clarification-first behavior: Instead of immediately recommending, Mahm asks 2-3 follow-up questions to build a fuller picture of the user's constraints. This is what makes the multi-turn conversation feel like talking to a real nutritionist rather than getting search results. Graceful tool failure: If any tool returns an error, the agent receives it as structured JSON and responds with a helpful fallback rather than crashing the conversation. Personality layer: Mahm is warm but not overly casual — she feels like a knowledgeable friend, not a medical chatbot. We also built a cached demo conversation (GET /api/demo) that stores a pre-run multi-turn exchange, so we can instantly load a polished Greylock-style conversation for judges without waiting on API latency.
Recipe Search — Supabase + Elasticsearch
Recipes are stored in Supabase PostgreSQL — 500+ entries with dietary tags (vegetarian, vegan, gluten-free, dairy-free, etc.), cuisine type, cook time, skill level, and full ingredient lists. Supabase serves as the source of truth and handles user preferences and session data. Elasticsearch sits on top as the search and filtering layer. When the search_recipes tool fires, it queries Elasticsearch with a hybrid approach — combining keyword matching (for specific terms like "high iron" or "gluten-free") with semantic search via OpenAI GPT-4o embeddings (for intent-based queries like "something cozy for a cold night"). This hybrid approach is what lets Mahm understand both specific dietary filters and vague cravings in the same query. The Elasticsearch index is configured with weighted fields so dietary tags are prioritized over general description text — this is what prevents "vegan dinner" from returning pasta carbonara.
Bright Data Scraping & API Integration
The grocery marketplace is powered by Bright Data's MCP (Model Context Protocol) tools, specifically search_engine and scrape_as_markdown. The architecture works as follows: User asks Mahm where to buy ingredients for a recipe Claude calls the find_stores tool with the ingredient list and the user's zip code The agent app exposes a /api/scrape-ingredient endpoint that uses Bright Data's MCP to search for each ingredient across local grocery store websites search_engine finds product pages for each ingredient at stores near the user's location scrape_as_markdown extracts the structured price and availability data from those pages The Flask backend aggregates results across stores, compares prices, and returns a structured response to the agent Bright Data's unblocking proxy infrastructure is what makes this work. Grocery stores actively block programmatic access, and previous scraping approaches we tried failed within minutes. We also built fallback logic: if live scraping is slow or rate-limited, the system uses pre-scraped data for ~50 common ingredients at stores near Stanford.
Meal Planner Algorithm
The meal planner takes the user's full constraint profile (dietary restrictions, budget, skill level, time, preferences, dislikes) and generates a 7-day plan. The algorithm optimizes across several dimensions: Budget distribution — allocates the weekly budget across meals, front-loading cheaper meals to leave room for variety later in the week Nutritional balance — ensures daily protein, iron, fiber, and other key nutrients are distributed across meals rather than concentrated Variety — prevents the same cuisine or protein source from appearing on consecutive days Practical scheduling — assigns quicker meals to weekdays and more involved recipes to weekends based on available cooking time Once generated, the plan is presented in an editable interface where users can drag and drop meals between days, swap individual meals, or regenerate specific days while keeping the rest.
Meal Logging
The tracker supports three input methods, all feeding into the same nutrition dashboard: Chat-generated meals are logged automatically — when Mahm recommends a recipe, the nutrition data from get_nutrition is stored alongside the meal entry Photo uploads use a vision model to identify the dish, estimate portion size, and look up approximate nutritional content
Frontend
Next.js 15 + TypeScript + Tailwind CSS. The UI has five views: landing page, onboarding flow, chat interface, marketplace, and the meal planner/tracker dashboard. Google Calendar API handles meal schedule sync. The gingham and tomatoes were a fun appendage.
Challenges we ran into
Captchas. Stores actively block programmatic price lookups. Our first approach got blocked within 20 minutes, and our second hit rate limits immediately. Bright Data's MCP tools with their unblocking proxy infrastructure made it viable. We also built graceful degradation — if scraping fails, Mahm tells you honestly instead of making up prices.
Elasticsearch indexing. Our recipe search was returning pasta carbonara for "vegan dinner" because the initial index didn't weight dietary tags properly. We rebuilt the field weighting and hybrid scoring to prioritize dietary filters over general description text.
Accomplishments that we're proud of
- Shipped 4 working modes in 36 hours — chat, meal planner, nutrition tracker, and marketplace
- Live grocery prices from real local stores via Bright Data MCP
- Hybrid recipe search (Elasticsearch + OpenAI embeddings) that understands both dietary filters and vague cravings
- End-to-end commerce flow: chat → recipe → find ingredients → real prices at real stores
- Sleep rotation meant everyone was functional for the demo
- Learning how to work with random people! Two of our original team members dropped out at the last minute — we literally picked up random people in the basement of Huang and everything worked out
What we learned
Building the recipe search pipeline — Supabase for storage, Elasticsearch for hybrid search with OpenAI embeddings — taught me that search quality depends entirely on how you index. Weighting dietary tags above description text was the fix that made "vegan dinner" stop returning carbonara. Autonomous tool selection with Claude is powerful but requires extensive prompt iteration. The system prompt went through 8 versions. Multi-turn conversation design is essentially UX design. Bright Data's MCP tools are what made real-time scraping viable at hackathon speed, but also the trickiest to integrate due to rate limiting issues. Building the Flask backend to communicate with the agent's scraper endpoint through proxy routes was a crash course in microservice architecture under time pressure. The most important skill at a hackathon is knowing when to cut scope and when to push through. We planned 5 modes and shipped 4 because we made cut decisions early instead of debating them at 3am. Having all four modes polished for the demo made the difference.
What's next for Mahm: Made At Home... Mmmm
Grocery Delivery Integration The marketplace currently shows you prices — but you still have to go to the store yourself. The next step is connecting with delivery APIs (Instacart, DoorDash, Uber Eats) so you can go from Mahm's recommendation to groceries at your door without leaving the app. The commerce flow becomes: chat → recipe → find ingredients → order delivery. That's the full loop. Community Recipes & Social Features Right now Mahm searches our curated recipe database. We want to open this up — let users submit their own recipes, rate and review meals, and share meal plans with friends and family. On Agentverse, this becomes a recipe marketplace where creators can monetize their content and Mahm indexes community recipes alongside the curated ones. Cultural Cuisine Expansion Our current recipe database skews Western. We want to add properly sourced South Asian, West African, East Asian, Latin American, and Middle Eastern comfort food — not just fusion versions, but authentic recipes with local ingredient sourcing. Mahm should be able to recommend a proper dal makhani or jollof rice, with ingredients available at your neighborhood grocery store.
Built With
- anthropic
- bright-data-mcp
- claude-messages-api
- elasticsearch
- flask
- nextjs
- openai-gpt4o
- python
- supabase
- tailwindcss
- typescript
Log in or sign up for Devpost to join the conversation.