A comprehensive Model Context Protocol (MCP) server demonstrating Windows diagnostics capabilities with AI-powered workflows. Built with .NET 10 and showcasing MCP tools, resources, and prompts.
This is a production-ready MCP server with:
- ✅ Tools: System information, process management, event log snapshots
- ✅ Resources: Event log snapshot resources with pagination support
- ✅ Prompts: AI-guided diagnostic workflows
- ✅ AI Chat Client: Interactive diagnostics with Azure OpenAI
- ✅ Streamable HTTP transport (
/mcp) - ✅ .NET 10 implementation
- ✅ Multiple testing methods
- ✅ C# MCP client implementation
Perfect for learning MCP concepts and building AI-powered diagnostics!
dotnet build./test-mcp-server.ps1This runs a full smoke test:
- Builds the server
- Starts it locally
- Discovers tools
- Executes
get_system_info
# Install (one-time)
npm install -g @modelcontextprotocol/inspector
# Launch visual testing UI
.\launch-inspector.ps1Then in the browser:
- Click "Connect"
- Explore Tools, Resources, and Prompts tabs
- Test tools and view resources
- Try MCP prompts for diagnostic workflows
cd WinDiagMcpChat
dotnet runInteractive diagnostics with:
- Azure OpenAI integration
- Automatic prompt discovery
- AI-guided workflows
- Resource pagination handling
get_system_info- Returns comprehensive Windows system diagnostics
get_all_processes- Lists all running processes with CPU, memory, threads, handlesget_process_info- Gets detailed information for a specific process by ID
create_event_log_snapshot- Creates a snapshot of Windows Event Log entries- Returns an MCP resource URI for pagination support
- Supports XPath queries for filtering
- Stores snapshots for later access
troubleshoot_with_wmi- AI-assisted WMI diagnostics- Uses MCP Sampling to generate safe WMI queries from natural language
- Executes queries with guardrails
- Analyzes results automatically
MCP resource containing event log snapshot data in JSON format with pagination support.
Query Parameters:
limit- Number of events per page (default: 100)offset- Starting position (default: 0)
Example: eventlog://snapshot/abc123?limit=20&offset=0
Returns:
{
"SnapshotId": "abc123...",
"LogName": "Application",
"CreatedAt": "2025-01-15T10:30:00Z",
"Pagination": {
"TotalCount": 150,
"ReturnedCount": 20,
"Offset": 0,
"Limit": 20,
"HasMore": true,
"NextOffset": 20
},
"Events": [...]
}MCP Prompts provide AI-guided diagnostic workflows:
AnalyzeRecentApplicationErrors- Analyzes recent application errors from event logs- Parameters:
hoursBack(default: 24)
- Parameters:
ExplainHighCpu- Investigates processes causing high CPU usageDetectSecurityAnomalies- Detects security issues (requires elevation)DiagnoseSystemHealth- Comprehensive health check without elevation ⭐- Analyzes memory usage, crashes, performance issues
- Correlates processes with event logs
- Provides actionable recommendations
Usage Example:
Ask the chat client: "Do a system health check"
It will:
1. Retrieve the DiagnoseSystemHealth prompt
2. Follow the step-by-step workflow
3. Call get_all_processes
4. Create event log snapshots
5. Read resources with pagination
6. Analyze patterns
7. Present comprehensive health report
.NET 10 MCP server implementing tools, resources, and prompts for Windows diagnostics.
Interactive console chat client with:
- Azure OpenAI integration
- Automatic MCP tool discovery
- MCP prompt support
- Resource pagination handling
- Conversation history
| Method | Visual | Interactive | LLM | Prompts | Best For |
|---|---|---|---|---|---|
| test-mcp-server.ps1 | ❌ No | ❌ No | ❌ No | ❌ No | Quick tests, automation |
| MCP Inspector | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes | Development, debugging |
| WinDiagMcpChat | ❌ No | ✅ Yes | ✅ Yes | ✅ Yes | Custom client dev |
MCPDemo/
├── WinDiagMcpServer/ # .NET 10 MCP server
│ ├── Program.cs # Server setup
│ ├── Tools/
│ │ ├── SystemInfo/ # System info tool
│ │ ├── Process/ # Process management tools
│ │ └── EventLog/ # Event log tools
│ ├── Resources/
│ │ └── EventLog/ # Event log resources with pagination
│ ├── Prompts/
│ │ ├── EventLog/ # Event log analysis prompts
│ │ └── SystemDiagnosticsPromptType.cs # System diagnostic prompts
│ └── Infrastructure/ # Console UI, Win32 API
├── WinDiagMcpChat/ # AI-powered chat client
│ └── Program.cs # Azure OpenAI integration
├── launch-inspector.ps1 # Launch Inspector
└── docs/ # Documentation
├── TESTING.md # How to test (script + Inspector)
└── MCPDemoRoadmap.md # Development roadmap
- .NET 10 SDK
- Node.js 16+ (for Inspector)
- Azure OpenAI (for WinDiagMcpChat)
✅ Milestone 1 - Minimal diagnostics tool (STDIO)
✅ Milestone 2 - Process inspection
✅ Milestone 3 - Event log analysis (Resources & Prompts)
- Event log snapshot resources
- Resource pagination
- MCP prompts for diagnostic workflows
- AI chat client integration
Next: Milestone 4 - Move to HTTP + security
- TESTING.md - How to test (script + Inspector)
- MCPDemoRoadmap.md - Development roadmap
- System information retrieval
- Process listing and detailed inspection
- Event log snapshot creation with XPath filtering
- Event log snapshots with pagination
- Query parameter support (limit, offset)
- Efficient handling of large result sets
- AI-guided diagnostic workflows
- Parameterized prompts
- Step-by-step instructions for complex diagnostics
- Event log analysis, CPU investigation, health checks
- Chat client with Azure OpenAI
- Automatic tool and prompt discovery
- Resource pagination handling
- Conversation history management
MIT License