mikekistler/mcp-demo
If you are the rightful owner of mcp-demo and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This document provides a structured summary of a Model Context Protocol (MCP) server implemented in C# using the Microsoft SDK.
GetUserProfile
Returns a detailed user profile with personal information, address, and preferences.
GetProducts
Returns a list of products with specifications, pricing, and inventory data.
GetSalesAnalytics
Returns comprehensive sales analytics including revenue metrics, top products, and regional data.
MCP C# Server Demo
A simple Model Context Protocol (MCP) server implementation in C# using the official Microsoft SDK.
Features
This MCP server provides three tools that return structured data:
- GetUserProfile - Returns a detailed user profile with personal information, address, and preferences
- GetProducts - Returns a list of products with specifications, pricing, and inventory data
- GetSalesAnalytics - Returns comprehensive sales analytics including revenue metrics, top products, and regional data
Setup and Usage
Prerequisites
- .NET 9.0 or later
- The official ModelContextProtocol NuGet package (preview)
Running the Server
dotnet run --project McpServer/McpServer.csproj
MCP Configuration
The mcp.json
file contains the configuration for running this server with MCP clients like VS Code GitHub Copilot.
Example Tool Calls
-
Get user profile:
GetUserProfile(userId: "user123")
-
Get product list:
GetProducts(count: 3)
-
Get sales analytics:
GetSalesAnalytics(period: "monthly")
Project Structure
Program.cs
- Main server implementation with MCP tools and data modelsMcpServer.csproj
- Project file with dependenciesmcp.json
- MCP server configuration for clients
Data Models
The server defines several structured data models:
UserProfile
withAddress
andUserPreferences
Product
with features and specificationsSalesAnalytics
withTopProduct
andRegionalSales
data
All tools return complex, nested objects demonstrating structured output capabilities of the MCP protocol.