This project is a sample MCP (Model Context Protocol) server for food recipes, using streamable HTTP transport. It provides endpoints to fetch all recipes, search recipes by ingredients, and get a recipe by name.
- Python 3.13 or higher
- pip (Python package manager)
Clone or download this repository and navigate to the project directory:
cd examples/mcp/streamable-http/mcp-server
It is recommended to use a virtual environment to manage dependencies:
python -m venv venv
.\venv\Scripts\Activate.ps1
python3 -m venv venv
source venv/bin/activate
Install the required packages using pip:
pip install -r requirements.txt
Start the MCP server:
python foodRecipeServer.py
The server will start on http://0.0.0.0:8001
using streamable HTTP transport.
You can interact with the server using HTTP requests or via the MCP protocol. The following tools are available:
get_recipes
: Get all available food recipes.search_recipe_by_ingredients
: Search for recipes by providing a list of ingredients.get_recipe_by_name
: Get a specific recipe by its name.
Get all recipes:
curl -H "Accept: text/event-stream" http://localhost:8001/mcp/tool/get_recipes
- Make sure the
recipes/FoodRecipes.json
file exists and contains valid recipe data. - For development, always use a virtual environment to avoid dependency conflicts.
This project is licensed under the MIT License. See the LICENSE file for details.