mealpilot-mcp

vrushabh05/mealpilot-mcp

3.2

If you are the rightful owner of mealpilot-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

MealPilot (MCP) is a Python-based server that transforms TheMealDB public recipe API into typed tools for LLMs using the Model Context Protocol (MCP).

Tools
4
Resources
0
Prompts
0

MealPilot (MCP) β€” Python LLM Tool Server for Recipe Discovery

License: MIT

Turn a public recipe API (TheMealDB) into typed tools for LLMs via the Model Context Protocol (MCP).
Supports search by name, filter by ingredient, fetch meal details, and a random meal endpoint β€” all with Pydantic validation, timeouts, result limits, and structured logging.

Demo (optional): add a GIF or video here β€” docs/demo.gif


✨ Features

  • MCP server exposing 4 agent tools for reliable LLM function-calling
  • Contract-first data models using Pydantic / JSON Schema
  • Resilient I/O: timeouts, result caps, structured stderr logging
  • Minimal deps: requests, pydantic
  • Works with mcp dev for quick local bring-up

πŸš€ Quickstart

# 1) Clone or download
git clone https://github.com/vrushabh05/mealpilot-mcp.git
cd mealpilot-mcp

# 2) (Optional) Create a virtualenv
python -m venv .venv && source .venv/bin/activate    # Windows: .venv\Scripts\activate

# 3) Install dependencies
pip install -r requirements.txt

# 4) Run the server
python meals_server.py

# 5) Dev with MCP (if installed)
mcp dev

If you don't have MCP CLI: https://github.com/modelcontextprotocol


🧰 Tools Exposed (MCP)

  • search_by_name(query: str) β†’ list of MealCard
  • filter_by_ingredient(ingredient: str) β†’ list of MealCard
  • meal_details(id: str) β†’ MealDetails
  • random_meal() β†’ MealDetails
Data Models (Pydantic)
class IngredientMeasure(BaseModel):
    ingredient: str
    measure: str

class MealCard(BaseModel):
    id: str
    name: str
    category: Optional[str] = None
    area: Optional[str] = None
    thumbnail: Optional[str] = None

class MealDetails(MealCard):
    instructions: Optional[str] = None
    tags: List[str] = []
    youtube: Optional[str] = None
    source: Optional[str] = None
    ingredients: List[IngredientMeasure] = []
Server Settings
  • TIMEOUT = 15 seconds
  • MAX_LIMIT = 25 results per tool by default
  • Structured logging to stderr (JSON or key-value style)

πŸ“¦ Project Structure (suggested)

.
β”œβ”€β”€ meals_server.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ .gitignore
└── docs/
    └── demo.gif   # (optional)

πŸ§ͺ Example Usage (pseudo)

{
  "tool": "search_by_name",
  "params": {"query": "pasta"},
  "timeout": 15000
}

Returns a list of MealCard objects with id, name, category, area, thumbnail.


πŸ”§ Development Notes

  • Fail fast on network errors; wrap API calls with requests + timeout
  • Validate and coerce third‑party API payloads into Pydantic models
  • Cap list sizes (MAX_LIMIT) to keep calls predictable for LLM agents

πŸ“„ License

Released under the MIT License. See LICENSE.

πŸ™Œ Acknowledgements

  • TheMealDB β€” Public recipe API
  • Model Context Protocol β€” Agent tool standard