mcp-demo

mikekistler/mcp-demo

3.2

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.

Tools
  1. GetUserProfile

    Returns a detailed user profile with personal information, address, and preferences.

  2. GetProducts

    Returns a list of products with specifications, pricing, and inventory data.

  3. 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:

  1. GetUserProfile - Returns a detailed user profile with personal information, address, and preferences
  2. GetProducts - Returns a list of products with specifications, pricing, and inventory data
  3. 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

  1. Get user profile:

    GetUserProfile(userId: "user123")
    
  2. Get product list:

    GetProducts(count: 3)
    
  3. Get sales analytics:

    GetSalesAnalytics(period: "monthly")
    

Project Structure

  • Program.cs - Main server implementation with MCP tools and data models
  • McpServer.csproj - Project file with dependencies
  • mcp.json - MCP server configuration for clients

Data Models

The server defines several structured data models:

  • UserProfile with Address and UserPreferences
  • Product with features and specifications
  • SalesAnalytics with TopProduct and RegionalSales data

All tools return complex, nested objects demonstrating structured output capabilities of the MCP protocol.