# TheMealDB MCP

> TheMealDB MCP Server connects your AI agent to an international database containing thousands of recipes. Find meals by name, browse by food type (like Vegan or Pasta), filter by national cuisine (Japanese, Mexican, Italian), or get a random idea when you're stuck. Each recipe comes with full ingredients, measurements, and step-by-step cooking instructions.

## Overview
- **Category:** productivity
- **Price:** Free
- **Tags:** recipes, cooking, culinary-data, ingredients, database-search, meal-planning

## Description

This whole setup connects your agent straight to TheMealDB, a massive international recipe database. You're looking at thousands of recipes—everything from some classic Italian pasta dish to spicy Indian curry. It’s structured data; you ain't dealing with messy files here.

To find what you need, you got five main ways to go. Let's start with the big guns: running a general search or narrowing down by specific rules. **`search_meals`** lets your agent run a keyword query across the entire database. You just drop in terms like 'tacos,' 'chicken breast,' or even 'curry spices,' and it spits out full recipe records that match those ingredients or dish names. These results aren't just titles; they include full ingredient lists, precise measurements, and step-by-step instructions for making the whole damn thing.

If you know what kind of food you want but don't have a keyword, you can filter by geography or type. You use **`get_meals_by_cuisine`** when you only wanna see dishes from a specific country—say, Mexican or Japanese. You specify the nation, and the server pulls every available recipe from that cuisine’s dataset. If you're thinking about food groups instead of countries, **`get_meals_by_category`** is what you use. It filters the database to show only meals belonging to a specific food type, like Vegetarian, Dessert, or Breakfast.

Need every single detail on one recipe? You call **`get_meal_details`**. All you gotta do is provide that unique Meal ID, and the server dumps every piece of data associated with that single record. It's a deep dive; it gives you everything—the full process, measurements, the works.

Stuck for ideas? You don't even have to think about it. **`get_random_meal`** runs an immediate call and hands you a complete recipe suggestion right off the bat. It’s perfect when you need inspiration but don't wanna scroll through fifty pages of options. This whole system lets your agent handle complex dietary requirements, national cuisine filtering, or just finding a quick dinner idea using minimal input.

## Tools

### get_meal_details
Retrieves every piece of information for one specific recipe using its unique ID.

### get_meals_by_cuisine
Filters the database to show only dishes from a specific country, such as Japanese or Indian.

### get_meals_by_category
Finds all recipes that fall under a major food group, like Vegan or Dessert.

### get_random_meal
Provides an immediate recipe idea when you need inspiration and don't know what to search for.

### search_meals
Searches the entire database using general keywords, returning full recipes that match your query (e.g., 'chicken').

## Prompt Examples

**Prompt:** 
```
Find me an Italian pasta recipe.
```

**Response:** 
```
I found several Italian pasta recipes! The top result is Pasta Carbonara — a classic Roman dish made with eggs, Pecorino cheese, guanciale, and black pepper. Ready in 30 minutes, serves 4. Would you like the full recipe with measurements?
```

**Prompt:** 
```
Find a quick pasta recipe that takes less than 30 minutes.
```

**Response:** 
```
Scanning TheMealDB ('search_meals')...
I recommend the 'Spaghetti Carbonara' (Meal ID: 52982). It takes about 25 minutes.
Main ingredients: Spaghetti, Pancetta, Eggs, Parmesan.
Do you want me to list the full cooking instructions?
```

**Prompt:** 
```
Give me a list of highly rated vegetarian meals from Indian cuisine.
```

**Response:** 
```
Filtering categorical clusters ('filter_by_category' & 'filter_by_area')...
Here are some classic Indian vegetarian dishes from the database:
1. 'Dal Makhani' (Black Lentils)
2. 'Matar Paneer' (Peas and Cheese)
3. 'Baingan Bharta' (Roasted Eggplant)
Let me know if you need the recipe for one of these.
```

## Capabilities

### Find recipes by keyword
The agent runs a search query, and the server returns full recipe records matching ingredients or dish names.

### Filter meals by national origin
You specify a country (like Mexican or Chinese), and the server pulls all available recipes from that cuisine's dataset.

### Browse recipes by food type
The agent filters the database to show only meals belonging to a specific category, such as Vegetarian or Breakfast.

### Get full details of one meal
You provide a unique Meal ID, and the server returns every piece of data associated with that single recipe record.

### Generate random ideas
The agent executes a call to get an unexpected but complete recipe suggestion for immediate use.

## Use Cases

### The dinner dilemma (No idea what to cook)
A user asks, "What should I make tonight?" The agent runs `get_random_meal`. It returns a complete recipe for 'Beef Stew,' including the full ingredient list and cooking steps. Problem solved in two tool calls.

### The specialized query (Need something French)
A developer needs to build an app filter specifically for French cuisine. Instead of searching general keywords, they use `get_meals_by_cuisine` with the 'French' parameter. The agent gets a clean list of only French dishes.

### The content sprint (Need ideas fast)
A food blogger needs 10 recipes for an article on Vegan cooking. They run `get_meals_by_category` using the 'Vegan' filter, then iterate through results, calling `get_meal_details` for each one to gather comprehensive data.

### The refinement loop (Need something quick)
A user first searches broadly with `search_meals` for 'pasta'. The initial results are too varied. They refine the query by running a second tool, `get_meals_by_category`, specifically filtering by 'Pasta' to get more accurate suggestions.

## Benefits

- **Structured Data Access:** You get full ingredients, measurements, and instructions for every recipe. This isn't just a list; it's deployable cooking data.
- **Precise Filtering:** Don't guess the right query. Use `get_meals_by_cuisine` to pull only dishes from 27+ countries (e.g., use 'Thai' instead of searching for general Asian food).
- **Workflow Flexibility:** When a user needs an idea, run `get_random_meal`. This solves the 'what should I cook?' problem instantly without needing complex prompting.
- **Granular Detail Retrieval:** After finding a match via `search_meals`, use `get_meal_details` to pull every single piece of data—the full instructions and YouTube links included.
- **Categorical Depth:** Need something light? Use `get_meals_by_category` for types like 'Seafood' or 'Vegetarian'. It’s a quick way to narrow down massive result sets.

## How It Works

The bottom line is your agent accesses a massive culinary knowledge graph without needing to know how the database is organized.

1. You ask your agent to find meals (e.g., 'I need Italian pasta').
2. Your agent calls the appropriate tool, like `search_meals` or `get_meals_by_cuisine`, passing required parameters.
3. The server executes the query against TheMealDB and returns structured JSON data containing ingredients, instructions, and measurements.

## Frequently Asked Questions

**How do I find recipes only from Mexican cuisine using TheMealDB MCP Server?**
You use `get_meals_by_cuisine` and pass 'Mexican' as the area. This limits your search pool immediately, giving you only dishes originating from Mexico.

**Does the `search_meals` tool handle ingredient lists?**
Yes. The `search_meals` tool returns full recipe details, which include comprehensive ingredient lists and specific measurements for everything needed.

**What if I just want a spontaneous cooking idea? Should I use get_random_meal?**
Exactly. If you're stuck on what to cook tonight, `get_random_meal` is the simplest tool. It skips filtering entirely and gives you an immediate recipe suggestion.

**Can I find vegetarian recipes from Thai cuisine?**
Yes, this requires two steps: First, use `get_meals_by_cuisine` with 'Thai'. Then, run a targeted search using keywords like 'vegetarian' within the results.

**Does using the `search_meals` tool require an API key or any authentication setup?**
No, you don't. The server requires zero authentication, so your agent can connect and start searching immediately without needing any keys or credentials.

**What specific data points do I receive when using the `get_meal_details` tool?**
You get complete details for that single meal. This includes the full ingredient list, exact measurements, and step-by-step cooking instructions.

**How should my agent combine results from `get_meals_by_category` and `get_meals_by_cuisine`?**
You run them sequentially. Your AI client can first filter the cuisine to narrow the region, and then apply a category tool—like 'Vegan' or 'Pasta'—to refine the list further.

**If my query for `search_meals` comes up empty, what should I tell my agent?**
Try broadening your search terms. If one specific dish doesn't work, pivot to using `get_meals_by_category` or try searching by a general ingredient instead.

**Do I need an API key?**
No. TheMealDB provides free open access for development and personal projects. No registration or API key required.