FoodIdeas.McpServer
0.1.0-beta
dotnet tool install --global FoodIdeas.McpServer --version 0.1.0-beta
dotnet new tool-manifest
dotnet tool install --local FoodIdeas.McpServer --version 0.1.0-beta
#tool dotnet:?package=FoodIdeas.McpServer&version=0.1.0-beta&prerelease
nuke :add-package FoodIdeas.McpServer --version 0.1.0-beta
Food Ideas MCP Server
An HTTP-based Model Context Protocol (MCP) server that helps you discover food dishes based on available ingredients. Built with C# and ASP.NET Core, this server integrates with TheMealDB API to provide meal suggestions and detailed recipes.
Features
This MCP server provides two tools:
- FindMealsByIngredients - Search for up to 10 possible dishes based on your available ingredients
- GetMealRecipeById - Get detailed recipe information including ingredients, instructions, and video tutorials
Quick Start
Prerequisites
- .NET 8.0 SDK or higher
- Visual Studio Code with GitHub Copilot
- MCP support enabled in VS Code (version 1.102 or higher)
Running the Server Locally
This is an HTTP-based MCP server that runs on http://localhost:3000. You need to start it manually before VS Code can connect to it.
Step 1: Start the Server
Open a terminal in the project directory and run:
dotnet run --project food-ideas-mcp-sample/food-ideas-mcp-sample.csproj
Wait for the message:
Now listening on: http://localhost:3000
Step 2: Configure VS Code
Create or update .vscode/mcp.json in your workspace:
{
"servers": {
"food-ideas": {
"type": "http",
"url": "http://localhost:3000/"
}
},
"inputs": []
}
Step 3: Use the Tools
Once the server is running and configured, open GitHub Copilot Chat in VS Code and try:
- "I have eggs, flour, sugar, vanilla, milk, and baking soda. What can I make?"
- "What dishes can I make with chicken?"
- "Get me the full recipe for pancakes"
Copilot will automatically use the MCP server tools to search TheMealDB and provide recipe suggestions!
Debugging the Server
To debug the MCP server in VS Code:
Option 1: Using Launch Configuration
- Create
.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug MCP Server (HTTP)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/food-ideas-mcp-sample/bin/Debug/net8.0/food-ideas-mcp-sample.dll",
"args": [],
"cwd": "${workspaceFolder}/food-ideas-mcp-sample",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)",
"uriFormat": "%s"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS": "http://localhost:3000"
},
"console": "integratedTerminal"
}
]
}
- Set breakpoints in
FoodIdeaTools.csorFoodIdeaService.cs - Press F5 to start debugging
- Use the tools from GitHub Copilot Chat - your breakpoints will be hit!
Option 2: Attach to Running Process
- Start the server manually:
dotnet run - In VS Code, select Run > Attach to Process
- Choose the
food-ideas-mcp-sampleprocess - Your breakpoints are now active!
Architecture
Project Structure
food-ideas-mcp-sample/
├── Program.cs # ASP.NET Core startup and MCP configuration
├── Services/
│ └── FoodIdeaService.cs # Service to interact with TheMealDB API
└── Tools/
└── FoodIdeaTools.cs # MCP tool definitions
Key Components
- Program.cs: Configures the ASP.NET Core web application with HTTP transport for MCP
- FoodIdeaService: Handles HTTP requests to TheMealDB API
- FoodIdeaTools: Exposes MCP tools that can be called by AI assistants
NuGet Packages
ModelContextProtocol(v0.4.0-preview.3) - Core MCP SDKModelContextProtocol.AspNetCore(v0.4.0-preview.3) - HTTP transport supportMicrosoft.Extensions.Hosting- Hosting infrastructureMicrosoft.Extensions.Http- HttpClient support
Alternative: stdio Transport
If you prefer stdio transport (auto-started by VS Code), update Program.cs:
builder.Services
.AddMcpServer()
.WithStdioServerTransport() // Change from WithHttpTransport()
.WithTools<FoodIdeaTools>();
await builder.Build().RunAsync(); // Change from app.Run()
And update .vscode/mcp.json:
{
"servers": {
"food-ideas": {
"type": "stdio",
"command": "dotnet",
"args": [
"run",
"--project",
"${workspaceFolder}/food-ideas-mcp-sample/food-ideas-mcp-sample.csproj"
]
}
},
"inputs": []
}
Publishing to NuGet.org (Optional)
If you want to share this MCP server as a NuGet package:
Update package metadata in
.csproj:<PackageId>- Your unique package name<PackageVersion>- Version number<Description>- Package description
Build the package:
dotnet pack -c ReleasePublish to NuGet.org:
dotnet nuget push bin/Release/*.nupkg --api-key <your-api-key> --source https://api.nuget.org/v3/index.jsonUsers can then install via
dnx:{ "servers": { "food-ideas": { "type": "stdio", "command": "dnx", "args": ["<your-package-id>", "--version", "<version>", "--yes"] } } }
Troubleshooting
Server won't start
- Ensure .NET 8.0 SDK is installed:
dotnet --version - Check if port 3000 is already in use
- Review error messages in the terminal
VS Code can't connect
- Verify the server is running and listening on
http://localhost:3000 - Check that
.vscode/mcp.jsonhas the correct URL - Restart VS Code after changing the configuration
- Use MCP: List Servers command to check server status
Package version conflicts
- Ensure both
ModelContextProtocolandModelContextProtocol.AspNetCoreare on the same version - Run
dotnet restoreto refresh packages
Tools not appearing in Copilot
- Restart the MCP server using MCP: List Servers > Restart
- Clear cached tools: MCP: Reset Cached Tools
- Check the MCP output log: MCP: List Servers > Show Output
More Information
- Model Context Protocol Documentation
- MCP C# SDK GitHub
- Use MCP servers in VS Code
- TheMealDB API Documentation
- Microsoft .NET MCP Guide
License
This project uses the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0-beta | 109 | 1/30/2026 |