The Product Catalog MCP Server is a .NET 8 web application that implements a Model Context Protocol (MCP) server for managing retail product inventory. It provides a standardized interface for AI assistants and other applications to interact with product data through a set of well-defined tools and APIs.
The scenario provides an MCP Server product catalog backend which can be integrated into Copilot Studio (see Demoguide instructions) or Azure AI Foundry demos.
This scenario is part of the broader Azure Demo Catalog, available at Trainer-Demo-Deploy.
The Model Context Protocol is a standard that enables AI assistants to securely connect with external data sources and tools. This server acts as a bridge between AI models and product inventory data, allowing natural language interactions with product management operations.
- Framework: ASP.NET Core 8.0
- Protocol: Model Context Protocol (MCP)
- Data Storage: JSON file-based storage
- Language: C# with nullable reference types enabled
- Program.cs - Application entry point and service configuration
- ProductCatalogTools.cs - MCP tool definitions for product operations
- ProductService.cs - Business logic for product management
- Models.cs - Data models and DTOs
- Configuration - Server configuration settings
Products are represented by the Product class with the following properties:
public class Product
{
public string Name { get; set; } // Product name
public string Description { get; set; } // Product description
public string EAN { get; set; } // European Article Number (barcode)
public decimal Cost { get; set; } // Product price/cost
public int UnitsInStock { get; set; } // Current inventory count
public string Brand { get; set; } // Product manufacturer/brand
public List<string> Categories { get; set; } // Product categories/tags
}- β Add Products - Create new products in the inventory
- β Update Products - Modify existing product information
- β Remove Products - Delete products from the inventory
- β List Products - Retrieve all products in the catalog
- β Search Products - Find products by name, description, EAN, brand, or categories
- β Stock Tracking - Monitor units in stock for each product
- β Stock Updates - Modify inventory levels
- β Low Stock Detection - Identify products with low inventory levels
- Products are stored in JSON format in
Data/products.json - In-memory operations with file-based initialization
- Thread-safe operations using locking mechanisms
The server exposes the following tools through the MCP protocol:
| Tool Name | Description | Parameters |
|---|---|---|
ListProducts |
Returns all products in inventory | None |
AddProduct |
Adds a new product | name, description, ean, cost, unitsInStock, brand?, categories? |
UpdateProduct |
Updates existing product by EAN | ean + optional fields to update |
UpdateStock |
Updates stock quantity | ean, newStock |
RemoveProduct |
Removes product by EAN | ean |
SearchProducts |
Searches products by term | searchTerm |
GetLowStockProducts |
Gets products below threshold | threshold |
Returns the complete list of all products in the inventory.
Adds a new product to the inventory. Requires:
- name (string): Product name
- description (string): Product description
- ean (string): EAN barcode
- cost (decimal): Product cost
- unitsInStock (int): Stock quantity
- brand (string, optional): Product brand
- categories (string, optional): Comma-separated categories
Updates an existing product by EAN. Optional parameters:
- name, description, cost, brand, categories
Updates the stock quantity for a specific product by EAN.
Removes a product from the inventory by EAN.
Searches for products using a search term that matches against name, description, EAN, brand, or categories.
Returns products with stock levels below a specified threshold (default: 10 units).
graph TD
Root[π demo-mcp-productcatalog] --> Program[π Program.cs]
Root --> Project[π product-catalog-mcp-server.csproj]
Root --> Build[π build.ps1]
Root --> ReadMe[π README.md]
Root --> AppSettings[π appsettings.Development.json]
Root --> Config[π Configuration]
Config --> ConfigFile[π ProductCatalogMCPServerConfiguration.cs]
Root --> Data[π Data]
Data --> Products[π products.json]
Root --> Services[π Services]
Services --> IService[π IProductService.cs]
Services --> Service[π ProductService.cs]
Root --> Tools[π Tools]
Tools --> Models[π Models.cs]
Tools --> MCPTools[π ProductCatalogTools.cs]
Root --> Props[π Properties]
Props --> Launch[π launchSettings.json]
Root --> Infra[π infra]
Infra --> DeployPS[π deploy.ps1]
Infra --> DeploySH[π deploy.sh]
Infra --> Bicep[π main.bicep]
Infra --> BicepParam[π main.bicepparam]
Infra --> InfraReadMe[π README.md]
Root --> Bin[π bin]
Bin --> Debug1[π Debug]
Debug1 --> Net80[π net8.0]
Net80 --> Artifacts[π Built artifacts...]
Root --> Obj[π obj]
Obj --> Debug2[π Debug]
Debug2 --> Net80Obj[π net8.0]
Net80Obj --> BuildFiles[π Build files...]
style Root fill:#e1f5fe
style Program fill:#fff3e0
style Project fill:#fff3e0
style Config fill:#f3e5f5
style Data fill:#e8f5e8
style Services fill:#fff8e1
style Tools fill:#fce4ec
style Props fill:#f1f8e9
style Infra fill:#e0f2f1
style Bin fill:#f5f5f5
style Obj fill:#f5f5f5
graph LR
subgraph "MCP Server Application"
Entry[Program.cs<br/>Entry Point] --> MCPTools[ProductCatalogTools<br/>MCP Tools]
Entry --> BusinessLogic[ProductService<br/>Business Logic]
MCPTools --> BusinessLogic
DataModels[Models.cs<br/>Data Models] --> MCPTools
DataModels --> BusinessLogic
AppConfig[Configuration<br/>Settings] --> Entry
DataStore[products.json<br/>Data Store] --> BusinessLogic
end
subgraph "Infrastructure"
IaC[bicep templates<br/>IaC] --> Deployment[Azure Deployment]
Scripts[PowerShell Scripts<br/>Automation] --> Deployment
end
subgraph "MCP Protocol"
Assistant[AI Assistant] --> Transport[HTTP Transport]
Transport --> MCPTools
MCPTools --> Operations[Product Operations]
Operations --> Inventory[Inventory Management]
end
style Entry fill:#ffeb3b
style MCPTools fill:#4caf50
style BusinessLogic fill:#2196f3
style DataModels fill:#ff9800
style DataStore fill:#9c27b0
style IaC fill:#607d8b
style Assistant fill:#f44336
For a quick and simple setup, use these five basic commands:
From within the application folder in your favorite terminal/console, execute
dotnet runwhich starts the application on http://Localhost:47002
devtunnel user loginWhat it does: Authenticates you with the DevTunnel service using your Microsoft account. This is required before you can create or manage tunnels.
devtunnel create product-catalog-mcp -a --host-header unchangedWhat it does:
- Creates a new tunnel named
product-catalog-mcp -aflag makes the tunnel accessible to anyone (anonymous access)--host-header unchangedpreserves the original host header, which is important for applications that depend on specific host values
devtunnel port create product-catalog-mcp -p 47002What it does: Creates a port mapping for the product-catalog-mcp tunnel, forwarding traffic to local port 47002 where the Product Catalog MCP Server is running.
devtunnel host product-catalog-mcpWhat it does: Starts hosting the product-catalog-mcp tunnel, making your local application accessible via a public URL. This command will display the public URL that you can use to access your Product Catalog MCP Server from anywhere.
Note: Keep the terminal window with
devtunnel host product-catalog-mcpopen while you need the tunnel active. Make sure your Product Catalog MCP Server is running on port 47002 before starting the tunnel.
- Azure Developer CLI - AZD
- When installing AZD, the above the following tools will be installed on your machine as well, if not already installed:
- GitHub CLI
- Bicep CLI
- You need Owner or Contributor access permissions to an Azure Subscription to deploy the scenario.
- Create a new folder on your machine.
mkdir -p petender/demo-mcp-productcatalog- Next, navigate to the new folder.
cd petender/demo-mcp-productcatalog- Next, run
azd initto initialize the deployment.
azd init -t petender/demo-mcp-productcatalog- Last, run
azd upto trigger an actual deployment.
azd upβ© Note: you can delete the deployed scenario from the Azure Portal by deleting the Resource Group, or by running azd down from within the initiated folder.
This MCP server provides a robust foundation for AI-powered product management applications while maintaining simplicity and reliability in its core operations.