Darko-Martinovic/McpServer
If you are the rightful owner of McpServer 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.
A modern Model Context Protocol (MCP) server designed for efficient supermarket inventory and sales management, featuring clean architecture and comprehensive logging.
GetProducts
Retrieves all products in the supermarket inventory.
GetSalesData
Gets sales data for a specific date range.
GetTotalRevenue
Calculates total revenue for a date range.
GetLowStockProducts
Identifies products with stock levels below a threshold.
GetSalesByCategory
Analyzes sales performance by product category.
Supermarket MCP Server
A modern, dual-mode server for supermarket inventory and sales management. Supports both Web API (REST) and console/MCP operation for integration with AI tools like Claude Desktop.
Features
- Dual Mode: Run as a Web API (REST endpoints) or as a console MCP tool provider
- Product & Sales Analytics: Inventory, sales, revenue, category, and stock tools
- Resource-like Endpoints: Real-time inventory, daily summaries, detailed product info
- SQL Server Integration: Robust, parameterized queries
- Comprehensive Logging: Serilog-based, file and console
Quick Start
Prerequisites
- .NET 9.0+
- SQL Server 2014+
- Node.js (for MCP Inspector, optional)
Setup
- Database:
- Run
Database/SetupDatabase.sql
to create tables and sample data
- Run
- Configure:
- Edit
appsettings.json
with your SQL Server connection string
- Edit
- Build:
dotnet build
- Run:
- Web API mode:
dotnet run --webapi # or use your published executable with --webapi
- Console/MCP mode:
dotnet run # or use with Claude Desktop/Inspector as shown below
- Web API mode:
Usage
Web API Mode
- Start the server with
--webapi
- Access endpoints like:
GET http://localhost:5000/api/Supermarket/products
(all products)GET http://localhost:5000/api/Supermarket/sales?startDate=2025-01-01&endDate=2025-01-31
(sales data)
- Any HTTP client or frontend can consume the API
MCP Tool Provider Mode
- Start the server without
--webapi
- Integrate with Claude Desktop or MCP Inspector
- Example Claude config (
claude_desktop_config.json
):{ "mcpServers": { "supermarket": { "command": "dotnet", "args": ["run", "--project", "/path/to/your/McpServer", "--no-build"] } } }
- Config file location:
C:\Users\<YourUsername>\AppData\Roaming\Claude
Configuration
- Connection String: Edit
appsettings.json
:{ "ConnectionStrings": { "DefaultConnection": "Server=your-server;Database=your-db;Integrated Security=true;TrustServerCertificate=true;" } }
- Claude Desktop: See above for config example and file location
Troubleshooting & Logs
- Logs:
Logs/mcpserver.log
(file), console output - Common issues: Check connection string, database setup, and logs for errors
- For MCP/Claude issues: Ensure config file is correct and restart the app after changes
For more details, see the code and comments. Contributions welcome!