Aspire.MCP.Sample

This repository provides a sample MCP server and client using Aspire, demonstrating MCP communication within a structured Aspire environment, including a Blazor Chat client and integration with LLMs for function calling.

40
2

Aspire.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, showcasing how to establish and manage MCP communication using C# within a structured Aspire environment.

Quick Demo

5-Minute Overview of the Project

Check out this 5-minute video overview to see the project in action.

Features

  • MCP Server: Implements an MCP server to manage client communication.
  • MCP Client: A Blazor Chat client demonstrating how to connect and communicate with the MCP server.
  • Aspire Integration: Uses Aspire for containerized orchestration and service management.

Getting Started

Prerequisites

  • .NET SDK 9.0 or later
  • Visual Studio 2022 or Visual Studio Code
  • LLM or SLM that supports function calling, such as Azure AI Foundry (e.g., gpt-4o-mini) or Ollama (e.g., phi4-mini, llama3.2, or Qwq).

Run locally

  1. Clone the repository.
  2. Navigate to the Aspire project directory: cd .\src\McpSample.AppHost\
  3. Run the project: dotnet run
  4. In the Aspire Dashboard, navigate to the Blazor Chat client project.
  5. In the Chat Settings page, define the model to be used (Azure AI Foundry, GitHub Models, or Ollama).
  6. Chat with the model; Tool Result section displays MCP server function calls.

Aspire Dashboard
Chat Settings
Chat Demo

Architecture Diagram

(WIP)

  • High-level architecture diagram will be added soon.

GitHub Codespaces

(WIP)

  • Codespaces configuration will be added soon.

Deployment

Local Deployment

Azure Deployment

Contributing

Contributions are welcome! Feel free to submit issues and pull requests.

License

This project is licensed under the MIT License.

Repository

EL
elbruno

elbruno/Aspire.MCP.Sample

Created

March 24, 2025

Updated

March 28, 2025

Language

HTML

Category

AI