Inspiration

Packaged food labels are hard to read. Ingredient lists are full of E-numbers and additives, allergen warnings are easy to miss, and comparing two products in a store aisle takes time. We wanted a voice assistant like Alexa+ to answer questions such as "Is this safe for my nut allergy?" or "Which of these two cereals has less sugar?" using real, open data. The Open Food Facts database has that data, and the Model Context Protocol (MCP) gives an AI assistant a standard way to use it. That is how FoodPlus started.

What it does

FoodPlus is an MCP server that lets an AI assistant understand packaged food products. It exposes 8 tools:

  • get_product_by_barcode: look up a product by EAN/UPC for its name, brand, ingredients, nutrition and allergens
  • search_products: search by name, brand or description, with pagination
  • get_nutrition_info: Nutri-Score, NOVA group, calories and nutrient levels
  • check_dietary_preferences: vegetarian, vegan, gluten-free and dairy-free checks
  • check_allergens: allergens and traces, with safety disclaimers
  • analyze_ingredients: plain-language explanations of additives, E-numbers and emulsifiers
  • compare_products: compare 2-5 products by sugar, fat, protein, calories or overall
  • find_alternatives: healthier options in the same category

Example questions it can answer:

  • "Is this packet of chips high in sodium?"
  • "Which of these two peanut butters is healthier?"
  • "What are maltodextrin and INS 621?"
  • "Find a similar cereal with less sugar."

How we built it

We built FoodPlus in TypeScript on Node.js with Express. It follows the MCP spec 2025-11-25 over Streamable HTTP, with a single POST /mcp endpoint carrying JSON-RPC 2.0. The official MCP SDK handles the protocol, including initialize, tools/list and tools/call.

The code is split into three layers:

Alexa+ Simulation Frontend (MCP Client)
  │  POST /mcp (JSON-RPC 2.0)
  ▼
Express HTTP layer  → origin guard, body limits, health check
MCP SDK             → initialize, tools/list, tools/call
Tool Registry       → 8 tools, per-tool input validation
Services            → Open Food Facts API client + nutrition analysis engine
  ▼
Open Food Facts Public API (v2)

Each tool lives in its own file, and the business logic sits in a separate services layer with no MCP types in it. We added session management (Mcp-Session-Id), origin validation, structured JSON logging with correlation IDs, and Docker and Docker Compose support. Tests run with Vitest, and a smoke-test script checks the live server.

Challenges we ran into

  • Strict protocol compliance: We had to get the lifecycle right, with business errors returned as isError: true, protocol failures returned as JSON-RPC errors, and no stack traces leaked to clients.
  • Messy crowd-sourced data: Open Food Facts entries are often incomplete or inconsistent, so the tools had to handle missing fields gracefully.
  • Safety-sensitive answers: Allergen and dietary answers affect real people, so we added clear disclaimers and wrote the results conservatively.
  • Voice-friendly output: Responses had to be structured enough for an assistant to summarize in a sentence or two.
  • External API reliability: We added timeouts for both outbound API calls and inbound requests so a slow upstream doesn't hang the assistant.

Accomplishments that we're proud of

  • A fully spec-compliant MCP server with 8 useful, well-validated tools
  • A clean architecture that makes adding a new tool a one-file job
  • Production-minded touches: Docker support, health checks, origin guards and structured logging
  • A test suite plus a smoke-test script, so anyone can verify the server in minutes
  • Turning an open, community-built food database into something an assistant can use in conversation

What we learned

  • How MCP works in practice, from the initialize handshake and tool discovery to calling tools over Streamable HTTP
  • Good tool design means clear descriptions and strict input schemas, so the model knows when and how to call each tool
  • Keeping business logic separate from protocol code makes testing much easier
  • Nutrition labels, Nutri-Score and NOVA classifications are more nuanced than they look
  • Open data is powerful, but it needs careful handling when health and allergies are involved

What's next for FoodPlus

  • Add response caching to cut latency and reduce load on the Open Food Facts API
  • Support personal profiles, so allergies and diets are remembered across queries
  • Add multi-language support for ingredient and product data
  • Improve ingredient analysis with richer additive explanations and risk information
  • Support barcode scanning from images for a hands-free experience
  • Publish the server so any MCP-compatible assistant can use it, not just the Alexa+ simulator

Source code: github.com/AbhishekKhond005/Open-Food-Facts-MCP

Share this project:

Updates

Submission history