How code-express-ai/trading-mcp-dotnet works
This repository provides a read-only MCP interface to a fictional trading database, plus a data generator that seeds that database. The user workflow is: an assistant host sends tool requests to the server; the server authenticates and checks requests, runs fixed trading tools, and returns results queried from SQL Server. Tool calls are audited. The generator creates synthetic trading data and loads it into SQL Server. The README documents layered database protections and optional Entra authentication; some internal wiring is not shown in the sampled excerpts, so uncertain links are omitted or marked dashed.
Main entry points: McpServerApplication.cs MCP application · TradingTools.cs Eight read-only tools · SyntheticData.cs Synthetic dataset · TradingRepository.cs Trading repository
Components 19
MCP server
- MCP application
McpServer/McpServerApplication.cs - Tool-call audit
McpServer/Audit/AuditService.cs
Request security
- Authentication and checks
McpServer/Auth - Caller rate limits
McpServer/Auth/CallerRateLimiter.cs
Trading access
- Eight read-only tools
McpServer/Tools/TradingTools.cs - Argument validation
McpServer/Tools/ToolArguments.cs - Trading repository
McpServer/Repository/TradingRepository.cs - Trading result models
McpServer/Model
Data generation
- Generator entry
DataGenerator/Program.cs - Generator options
DataGenerator/GeneratorOptions.cs - Synthetic dataset
DataGenerator/Generation/SyntheticData.cs - Seed examples
DataGenerator/Generation/SeedData.cs - Trading data generators
DataGenerator/Generation - Generated data models
DataGenerator/Models/GeneratedData.cs - Database loader
DataGenerator/DataLoader.cs - Transactional seeder
DataGenerator/Database/DatabaseSeeder.cs
Other components
- Assistant host
- SQL Server
- Microsoft Entra ID
Connections 19
- Assistant host → MCP application: sends MCP requests
README.md - MCP application → Authentication and checks: checks requests
McpServer/McpServerApplication.cs - MCP application → Caller rate limits: limits callers
McpServer/McpServerApplication.cs - MCP application → Eight read-only tools: registers tools
McpServer/McpServerApplication.cs - Eight read-only tools → Argument validation: validates inputs
McpServer/Tools/TradingTools.cs - Eight read-only tools → Tool-call audit: runs through
- Tool-call audit → Trading repository: writes audit
McpServer/Audit/AuditService.cs - Eight read-only tools → Trading repository: queries trading data
- Trading repository → SQL Server: executes procedures
README.md - Trading repository → Trading result models: returns rows
McpServer/Repository/TradingRepository.cs - MCP application → Microsoft Entra ID: supports authentication
README.md - Generator entry → Generator options: reads settings
- Generator entry → Synthetic dataset: generates dataset
- Synthetic dataset → Seed examples: uses examples
- Synthetic dataset → Trading data generators: combines generators
DataGenerator/Generation/SyntheticData.cs - Synthetic dataset → Generated data models: produces data
DataGenerator/Generation/SyntheticData.cs - Generator entry → Database loader: loads dataset
DataGenerator/Program.cs - Database loader → Transactional seeder: seeds database
DataGenerator/DataLoader.cs - Transactional seeder → SQL Server: bulk loads rows
DataGenerator/Database/DatabaseSeeder.cs