meai-azure-ai-foundry -sample
.NET is also capable of building AI infused app really easily. This repository provides several sample apps using Microsoft.Extensions.AI, Azure AI Foundry, Foundry Local and MCP server/client.
claude mcp add --transport stdio devkimchi-meai-azure-ai-foundry-mcp-sample dotnet run --project ./src/McpTodo.ServerApp
How to use
This MCP server sample provides a .NET-based MCP server/client workflow for MEAI with Azure AI Foundry, Foundry Local, and various LLM integrations (OpenAI, Azure OpenAI, GitHub Models, Anthropic, Google Vertex AI). The server component exposes an MCP-compliant interface that coordinates prompts, models, and memory across clients, while the client app(s) can exercise the same capabilities locally. You can run the MCP server, then run a client app in another terminal to interact with the server and exchange messages or tasks using the configured AI providers. Typical usage involves configuring secrets for the chosen AI providers and selecting the desired ChatClient in appsettings.json, then launching the server and client to establish end-to-end MCP communication.
How to install
Prerequisites
- .NET 9 SDK
- Git
- (Optional) Foundry Local if you plan to test Foundry Local flows
Installation and setup
-
Clone the repository git clone https://github.com/devkimchi/meai-azure-ai-foundry-mcp-sample.git cd meai-azure-ai-foundry-mcp-sample
-
Restore and build the solution dotnet restore dotnet build
-
Prepare MCP server configuration The MCP server is configured to run via the MCP server app project. No extra npm/pipx steps are required for this .NET sample.
-
Run the MCP server dotnet run --project ./src/McpTodo.ServerApp
-
In a separate terminal, run the MCP client app compatible with your server dotnet watch run --project ./src/mcpTodo.ClientApp
Prerequisites recap
- Install .NET 9 SDK from the official site
- Ensure network access to your chosen AI providers (OpenAI, Azure OpenAI, GitHub Models, Anthropic, Google Vertex AI)
- Have API keys ready and configured via user secrets for the client project as shown in the README
Additional notes
Tips and notes:
- The sample relies on user secrets to store API keys. Update ConnectionStrings entries (openai, foundry, anthropic, google) in the Meai.ClientApp and Foundry.ClientApp projects as needed.
- To switch the LLM just change the ChatClient value in appsettings.json (e.g., openai, foundry, local, anthropic, google).
- If you plan to use Foundry Local, ensure you have Foundry Local CLI installed and a model added to Foundry Local before running the Foundry-related samples.
- For Azure AI Foundry integration, provide Endpoint and Key via user secrets as demonstrated in the README.
- If you encounter compatibility issues, verify that the environment variables and secrets match the provider you intend to use and that network access to provider endpoints is allowed in your environment.
Related MCP Servers
mcp-for-beginners
This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
anki
MCP server for anki
ai-workshop
Building GenAI Apps in C#: AI Templates, GitHub Models, Azure OpenAI & More
openai -agent-dotnet
Sample to create an AI Agent using OpenAI models with any MCP server running on Azure Container Apps
unity-editor
An MCP server and client for LLMs to interact with Unity Projects
stitch -auto
Automated installer for Stitch MCP - The easiest way to set up your Universal MCP server for Google Stitch.