FoodIdeas.McpServer 0.1.0-beta

This is a prerelease version of FoodIdeas.McpServer.

                    
dotnet tool install --global FoodIdeas.McpServer --version 0.1.0-beta
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local FoodIdeas.McpServer --version 0.1.0-beta
                    
This package contains a .NET tool you can call from the shell/command line.
#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:

  1. FindMealsByIngredients - Search for up to 10 possible dishes based on your available ingredients
  2. 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

  1. 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"
        }
    ]
}
  1. Set breakpoints in FoodIdeaTools.cs or FoodIdeaService.cs
  2. Press F5 to start debugging
  3. Use the tools from GitHub Copilot Chat - your breakpoints will be hit!

Option 2: Attach to Running Process

  1. Start the server manually: dotnet run
  2. In VS Code, select Run > Attach to Process
  3. Choose the food-ideas-mcp-sample process
  4. 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 SDK
  • ModelContextProtocol.AspNetCore (v0.4.0-preview.3) - HTTP transport support
  • Microsoft.Extensions.Hosting - Hosting infrastructure
  • Microsoft.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:

  1. Update package metadata in .csproj:

    • <PackageId> - Your unique package name
    • <PackageVersion> - Version number
    • <Description> - Package description
  2. Build the package:

    dotnet pack -c Release
    
  3. Publish to NuGet.org:

    dotnet nuget push bin/Release/*.nupkg --api-key <your-api-key> --source https://api.nuget.org/v3/index.json
    
  4. Users 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.json has the correct URL
  • Restart VS Code after changing the configuration
  • Use MCP: List Servers command to check server status

Package version conflicts

  • Ensure both ModelContextProtocol and ModelContextProtocol.AspNetCore are on the same version
  • Run dotnet restore to 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

License

This project uses the MIT License.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.1.0-beta 109 1/30/2026