About Aspire.MCP.Sample
Aspire.MCP.Sample is a sample project built on Aspire that pairs an MCP server with a Blazor chat client. It is intended for developers who want to learn MCP communication and Azure deployment in C#.
Key features
- 01Aspire orchestration of services and containers
- 02MCP server handling client communication
- 03Blazor chat client connected to the MCP server
- 04Model choice among Azure AI Foundry, Ollama or GitHub Models
- 05Deployment to Azure with azd commands
Use cases
- 01Learning how to build an MCP server and client in C#
- 02Testing function calling with local Ollama models
- 03Deploying an MCP server to Azure using azd
MCP support
The project includes a sample MCP server and an MCP client. The client calls the server's functions from a chat interface and displays the tool results.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEAspire.MCP.Sample
Sample MCP Server and MCP client using Aspire.
Overview
This sample demonstrates a Model Context Protocol (MCP) Server and client setup using Aspire. It showcases how to establish and manage MCP communication, using C# in a structured Aspire environment.
Quick Demo
Check out this 5-minute video overview to see the project in action.
Check out this 5-minute video overview to see how to deploy the solution to Azure, and how to consume the deployed MCP Server in Azure from Visual Studio Code.
Features
- Aspire Integration: Uses Aspire for containerized orchestration and service management.
- MCP Server: Implements an MCP server to manage client communication.
- MCP Client: Sample Blazor Chat client demonstrating how to connect and communicate with the MCP server.
- Model Selection: The Chat Client can use LLMs from Azure AI Foundry, Ollama or GitHub models. The selected model must support function calling to be able to call the MCP server functions.
- Function Calling: Demonstrates how to call functions from the MCP server using the selected model.
- Tool Result: Displays the result of the function call in the chat interface.
- Azure Deployment: The project can be easily deployed to Azure using
azdcommands.
Getting Started
Prerequisites
- .NET SDK 9.0 or later
- Visual Studio 2022 or Visual Studio code
- LLM or SLM that supports function calling.
- Azure AI Foundry to run models in the cloud. IE: gpt-4o-mini
- GitHub Models to run models in the cloud. IE: gpt-4o-mini
- Ollama for running local models. Suggested: phi4-mini, llama3.2 or Qwq
Run locally
-
Clone the repository:
-
Navigate to the Aspire project directory:
cd .\src\McpSample.AppHost\ -
Run the project:
dotnet run -
In the Aspire Dashboard, navigate to the Blazor Chat client project.

-
In the Chat Settings page, define the model to be used. You choose to use models in Azure AI Foundry (suggested gpt-4o-mini), GitHub Models or locally with ollama (suggested llama3.2)

-
Now you can chat with the model. Everytime that one of the functions of the MCP server is called, the
Tool Resultsection will be displayed in the chat.
Architecture Diagram

GitHub Codespaces
(WIP)
- Codespaces configuration will be added soon.
Deployment
Once you've opened the project in Codespaces, or locally, you can deploy it to Azure.
From a Terminal window, open the folder with the clone of this repo and run the following commands.
-
Login to Azure:
azd auth login -
Provision and deploy all the resources:
azd upIt will prompt you to provide an
azdenvironment name (like "aspiremcp"), select a subscription from your Azure account, and select a location. -
When
azdhas finished deploying, you'll see the list of resources created in Azure and a set of URIs in the command output. -
Visit the blazorchat URI, and you should see the MCP Chat App! 🎉
Note: The deploy files are located in the ./src/McpSample.AppHost/infra/ folder. They are generated by the Aspire AppHost project.
Contributing
Contributions are welcome! Feel free to submit issues and pull requests.
License
This project is licensed under the MIT License.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.

