Inspiration
As LLMs become increasingly advanced, more and more people rely on them to answer questions and guide their everyday lives. However, LLMs still face issues with answering questions incorrectly due to faulty sources and AI hallucination. This becomes especially problematic in the case of nutrition and health. When someone asks an LLM a question like "How much protein is in salmon?" or "What foods are high in potassium?", the model answers from its training memory. This information can be outdated, inconsistent, and impossible to verify. Rather than relying on the model to remember or pull the correct information, we can give it the answer directly through an MCP server.
What it does
We created an open-source Model Context Protocol (MCP) server over the USDA database. Instead of the AI guessing nutritional values or using outdated information, our infrastructure allows any AI agent to query verified USDA data.
How we built it
Our solution connects AI assistants to live nutrition databases using the Model Context Protocol (MCP). Built with Python and FastMCP, the server exposes 13 tools across two sources: USDA FoodData Central (2M+ foods, government-grade analytical data, free REST API) and FatSecret (2.3M+ foods with strong restaurant chain coverage, OAuth 2.0). It runs locally via stdio for Claude Desktop or as an HTTP server for public deployment behind a reverse proxy. All responses are cached in SQLite after the first call. Cache keys are SHA-256 hashes of normalized arguments, so a hit returns in under 1ms versus 1–3 seconds for a live API request.
Challenges we ran into
We had to make sure that the context stacking between the Python backend and remote MCP server stayed stable during multi-turn agent loops. Translating custom server functions into Groq tool-calling schemas required the MCP protocol and LLM context memory to be coordinated properly.
Accomplishments that we're proud of
We're proud that we didn't just create a chatbot, but also an infrastructure that can be applied to multiple agents and is dynamic, not just static on one database. It can be extended to the whole open-source community, which makes us happy.
What we learned
We learned about creating MCP servers and debugging them, as well as working through the problems of context stacking. We also learned how to manage asynchronous state to keep a remote MCP server stable during multi-turn agent loops.
What's next for Food Facks
We plan to add more specialized APIs and increase our database/collection of food entries. We also plan to increase our meal prep selection from here, training our model to give recipes for foods in various cuisines, as well as more nuanced ways to give advice to people trying to reach their fitness goals.
Built With
- fast-mcp
- fatsecret-api
- fooddata-central-api
- groq
- llama-3.1
- mcp-sdk
- python
- react
- typescript
- vite
Log in or sign up for Devpost to join the conversation.