MealDB MCP Server
README.md
# MealDB MCP Server
A **Model Context Protocol (MCP)** server that provides AI assistants with access to the [**TheMealDB**](https://www.themealdb.com/) API for recipe and meal information. This server enables AI assistants to search for recipes, get detailed meal information, browse categories, and explore ingredients.
๐ **Hey Vibe Coders!** Ever have the problem where your partner asks you, *"What do you want to eat?"* and you just stare blankly? No more endless scrolling through delivery apps or decision paralysis! Let AI help you discover your next meal! ๐คโจ
๐ **Powered by [TheMealDB](https://www.themealdb.com/)** - An open, crowd-sourced database of recipes from around the world!
๐ก *Enjoying this product? Consider reaching out to [TheMealDB team](https://www.themealdb.com/api.php) to set up a production API for enhanced features and production usecases!*
## ๐ฝ๏ธ Features
- ๐ **Meal Search** - Search for meals by name
- ๐ **Meal Details** - Get complete recipe details including ingredients and instructions
- ๐ฒ **Random Meals** - Get random meal suggestions for when you're feeling adventurous
- ๐ **Category Browsing** - Explore meal categories and discover new cuisines
- ๐ฅ **Ingredient Search** - Find meals by specific ingredients you have on hand
- ๐ **Comprehensive Data** - Access to thousands of recipes from around the world
## ๐ Quick Start
### Prerequisites
- **Node.js 18+**
- **npm** or **yarn**
- A compatible **MCP client** (like Cursor with MCP support)
- **Docker & Docker Compose** *(optional, for containerized deployment)*
### ๐ป Local Installation *(Recommended)*
1. **Clone this repository**
```bash
git clone <your-repo-url>
cd mealdb-mcp
```
2. **Install dependencies**
```bash
npm install
```
3. **Build the server**
```bash
npm run build
```
4. **Start the server**
```bash
npm start
```
The server will start and listen for MCP requests via stdio.
### ๐ณ Docker Installation *(Optional)*
For a containerized setup *(requires Docker Desktop)*:
**Production deployment:**
```bash
npm run docker:prod
```
**Development with hot reload:**
```bash
npm run docker:dev
```
> โ ๏ธ **Note:** If you get a *"'docker-compose' is not recognized"* error, Docker isn't installed. Use the local installation method above instead.
## โ๏ธ Configuration
### For Cursor IDE
The server includes a `.cursor/mcp.json` configuration file that allows Cursor to automatically discover and use the MealDB server:
```json
{
"mcpServers": {
"mealdb-server": {
"command": "node",
"args": ["build/index.js"],
"env": {
"NODE_ENV": "development"
}
}
}
}
```
### For Other MCP Clients
Configure your MCP client to connect to this server using:
- **Command:** `node`
- **Arguments:** `["path/to/mealdb-mcp/build/index.js"]`
- **Working Directory:** `path/to/mealdb-mcp`
## ๐ ๏ธ Available Tools
### ๐ `search_meals`
Search for meals by name.
**Parameters:**
- `query` *(string)*: Name of the meal to search for
**Example:**
```json
{
"name": "search_meals",
"arguments": {
"query": "chicken"
}
}
```
### ๐ `get_meal_details`
Get detailed information about a specific meal by ID.
**Parameters:**
- `mealId` *(string)*: The ID of the meal to get details for
**Example:**
```json
{
"name": "get_meal_details",
"arguments": {
"mealId": "52772"
}
}
```
### ๐ฒ `get_random_meal`
Get a random meal suggestion.
**Parameters:** *None*
**Example:**
```json
{
"name": "get_random_meal",
"arguments": {}
}
```
### ๐ `list_categories`
Get all available meal categories.
**Parameters:** *None*
**Example:**
```json
{
"name": "list_categories",
"arguments": {}
}
```
### ๐ฅ `search_by_ingredient`
Find meals that contain a specific ingredient.
**Parameters:**
- `ingredient` *(string)*: Name of the ingredient to search for
**Example:**
```json
{
"name": "search_by_ingredient",
"arguments": {
"ingredient": "chicken"
}
}
```
## ๐ฌ Usage Examples
Here are some example queries you can ask an AI assistant using this MCP server:
- *"Find me some chicken recipes"*
- *"Get details for meal ID 52772"*
- *"Give me a random meal suggestion"*
- *"What meal categories are available?"*
- *"Find meals that contain tomatoes"*
- *"Show me Italian recipes"*
- *"What are some vegetarian options?"*
## ๐๏ธ Development
### Project Structure
```
mealdb-mcp/
โโโ src/
โ โโโ index.ts # Main MCP server implementation
โโโ build/ # Compiled JavaScript output
โโโ .cursor/
โ โโโ mcp.json # Cursor IDE configuration
โโโ package.json # Project dependencies and scripts
โโโ tsconfig.json # TypeScript configuration
โโโ README.md # This file
```
### Available Scripts
**Local Development:**
- `npm run build` - Compile TypeScript to JavaScript
- `npm run watch` - Watch for changes and recompile
- `npm start` - Start the MCP server
- `npm run prepare` - Build the project *(runs automatically on install)*
**Docker Commands:**
- `npm run docker:build` - Build Docker image
- `npm run docker:run` - Run container from built image
- `npm run docker:dev` - Start development environment with hot reload
- `npm run docker:prod` - Start production environment
- `npm run docker:stop` - Stop all containers
- `npm run docker:logs` - View container logs
- `npm run docker:clean` - Clean up containers and images
### API Information
This server uses the **free tier** of [TheMealDB API](https://www.themealdb.com/api.php) which provides:
- โ
Meal search by name
- โ
Meal details by ID
- โ
Random meal suggestions
- โ
Category listings
- โ
Ingredient-based filtering
- โ
Area/cuisine filtering
> **Note:** This server only uses free API endpoints. Premium features are not implemented.
## ๐ณ Docker Deployment
### Container Features
- ๐๏ธ **Multi-stage build** for optimized production images
- ๐ **Non-root user** for enhanced security
- ๐ **Health checks** for container monitoring
- ๐๏ธ **Alpine Linux** base for minimal image size
- ๐ **Development mode** with hot reload support
### Production Deployment
```bash
# Build and start in production mode
docker-compose up -d
# View logs
docker-compose logs -f mealdb-mcp-server
# Stop services
docker-compose down
```
### Development Deployment
```bash
# Start development environment with hot reload
docker-compose -f docker-compose.dev.yml up
# Or use the npm script
npm run docker:dev
```
### Environment Variables
Configure the container using environment variables:
```bash
NODE_ENV=production # Environment mode
PORT=3000 # Server port
```
## ๐ Security
- ๐ The server runs locally and doesn't expose any network ports
- ๐ All API calls are made to the public TheMealDB API
- ๐ No sensitive data is stored or transmitted
- ๐ Uses secure HTTPS connections to external APIs
## ๐ค Contributing
1. ๐ด Fork the repository
2. ๐ฟ Create a feature branch
3. โ๏ธ Make your changes
4. ๐งช Test thoroughly
5. ๐ค Submit a pull request
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- [TheMealDB](https://www.themealdb.com/) for providing the free recipe API
- [Model Context Protocol](https://modelcontextprotocol.io/) for the standardized AI-assistant communication protocol
- [Anthropic](https://www.anthropic.com/) for developing MCP
## ๐ Support & Help
### ๐ Need Help?
We're here to help you get the most out of your MealDB MCP Server! If you encounter any issues or have questions, here are your options:
**๐ง Get Support:**
- ๐ **Found a bug?** Open an issue in our [GitHub repository](https://github.com/your-repo/mealdb-mcp)
- ๐ก **Have a feature request?** We'd love to hear your ideas!
- โ **Need help with setup?** Check our troubleshooting guide below or ask for help
**๐ Useful Links:**
- ๐ [TheMealDB API Documentation](https://www.themealdb.com/api.php)
- ๐ [TheMealDB Website](https://www.themealdb.com/)
- ๐ [Model Context Protocol Documentation](https://modelcontextprotocol.io/)
### Common Issues & Solutions
**๐จ "'docker-compose' is not recognized" Error:**
If you see this error when running `npm run docker:prod`, it means Docker isn't installed on your system. You have two options:
1. **Install Docker Desktop** *(recommended for containerized deployment)*:
- Download from https://www.docker.com/products/docker-desktop/
- Install and restart your computer
- Verify with `docker --version` and `docker compose version`
2. **Run locally without Docker** *(simpler setup)*:
```bash
npm install
npm run build
npm start
```
**๐ง Build or Runtime Issues:**
1. โ
Check that Node.js 18+ is installed (`node --version`)
2. โ
Ensure all dependencies are installed (`npm install`)
3. โ
Verify the build completed successfully (`npm run build`)
4. โ
Check that your MCP client is configured correctly
5. โ
Make sure you're in the correct directory
6. โ
Try clearing node_modules and reinstalling: `rm -rf node_modules package-lock.json && npm install`
**Still having trouble?** Don't hesitate to reach out - we're happy to help! ๐ค
---
**Happy Cooking! ๐ณ**
**Made with โค๏ธ by Traves Theberge**This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessOutdated data