Master Model Context Protocol (MCP) server development using .NET, Aspire 13.4, and .NET 10. Build cloud-native MCP servers with streaming, caching, and security patterns, then deploy to Azure Container Apps and Kubernetes.
Building MCP Servers with .NET
Duration: 3 days
Learn how to design, implement, and operate Model Context Protocol (MCP) servers with .NET using the MCP .NET SDK 2.0, integrate them with cloud-native architectures using .NET Aspire 13.4, and deploy to production using .NET 10 with modern observability and resilience patterns.
Who Should Attend
- .NET developers with C# experience building cloud-native applications
- Solution and AI architects planning MCP integration strategies
- Teams exposing enterprise systems and data sources to AI assistants via MCP
Prerequisites
- Solid C# and .NET experience
- HTTP/REST fundamentals and JSON serialization understanding
- Basic understanding of AI assistants and LLM-based tool calling
- Visual Studio 2026 or Visual Studio Code installed
- Docker Desktop (for containerized labs)
- Azure Developer CLI (azd) for deployment exercises
Learning Goals
- Understand the Model Context Protocol architecture and the tool/resource model
- Build secure, production-ready MCP servers in .NET/C# targeting .NET 10
- Implement tools and resources with streaming responses, caching, and error handling
- Design cloud-native MCP architectures using .NET Aspire 13.4 for orchestration and service discovery
- Integrate MCP servers with AI clients, Microsoft Agent Framework, and Claude Desktop
- Apply security patterns including Managed Identity and enterprise authorization flows
- Debug, test, and observe MCP servers using OpenTelemetry and Aspire diagnostics
- Deploy MCP servers to Azure Container Apps and Kubernetes using Aspire manifests
Course Content
MCP Fundamentals and Ecosystem
- What MCP is and why it matters for enterprise AI integration
- Protocol architecture: capabilities, messages, tools vs resources
- Cross-application access and identity authorization patterns
- Supported clients: Microsoft Agent Framework, Claude Desktop, Visual Studio, VS Code
Environment Setup and Cloud-Native Architecture
- MCP .NET SDK 2.0: packages, project structure, and modern patterns
- .NET Aspire 13.4 orchestration: AppHost fundamentals and single-file AppHosts
- Configuration patterns, environment variables, secrets management, and service discovery
- Build automation, hot reload, and Aspire dashboard
Core Server Development
- Bootstrapping an MCP server; capabilities and handshake protocol
- Implementing core messages, error handling, and graceful failures
- Structured logging with correlation IDs and .NET Aspire observability
- OpenTelemetry integration and automated telemetry discovery
Implementing Tools
- Tool definitions and JSON schema for parameters and results
- Streaming responses, progress updates, and cancellation tokens
- Async execution patterns, timeouts, and error resilience
- Advanced .NET 10 features: field-backed properties, primitive collections
- Examples: database queries, HTTP APIs, filesystem access
Providing Resources
- Static and dynamic resources; templates and variable substitution
- Caching strategies and performance optimization techniques
- Resource streaming and server hints for client optimization
- Integration with Aspire caching services (Redis, distributed cache)
- Real-world examples: filesystem resources, database queries, external APIs
Advanced Features and Aspire Integration
- Prompt templates and sampling settings
- Middleware and request pipelines with Aspire service discovery
- Multi-service MCP architectures orchestrated with Aspire
- Authentication and authorization: Managed Identity, OAuth flows
- Rate limiting, quotas, and resource governance
- Server-to-server bridging and cross-service communication
Cloud-Native Deployment with Aspire
- End-to-end Aspire-based deployment workflows
- Integrating with Microsoft Agent Framework agents and Aspire workflows
- Azure Container Apps deployment via Azure Developer CLI
- Kubernetes manifest generation from Aspire AppHost
- Docker containerization and multi-container orchestration
- Aspire manifests for connection string management and environment customization
Security, Resilience, and Best Practices
- Input validation and sanitization with .NET 10 analyzers
- Secrets management with Azure Key Vault and Managed Identity
- Enterprise authorization patterns and principle of least privilege
- DoS protection, rate limiting, and resource quota enforcement
- Aspire-integrated health checks and circuit breaker patterns
- Monitoring with Application Insights and OpenTelemetry
Testing, Debugging, and Observability
- Unit and integration testing patterns for MCP servers
- Testing with Aspire TestingBuilder for containerized dependencies
- Contract and schema validation for tool parameters
- MCP Inspector and Aspire Dashboard for debugging and diagnostics
- Application Insights trace analysis and distributed tracing
- Troubleshooting common interoperability issues
Capstone Project
- Design and build a complete, production-ready MCP server
- Orchestrate multiple services with Aspire
- Deploy to Azure Container Apps using Aspire and Azure Developer CLI
- Implement comprehensive telemetry and health checks
- Performance optimization and code review
Hands-on Labs
- Build a filesystem MCP server with Aspire orchestration and health checks
- Implement a database query tool with validation, streaming responses, and timeouts
- Create an API-integration server with Redis caching provisioned via Aspire
- Design a multi-service MCP architecture with Aspire service discovery
- Deploy to Azure Container Apps using Aspire and Azure Developer CLI
- Instrument and debug services using Application Insights and Aspire Dashboard
- Generate Kubernetes manifests from an Aspire AppHost and deploy to a cluster
Outcomes
After completing this course, participants will be able to architect and implement production-grade MCP servers using modern .NET practices, orchestrate distributed MCP systems with Aspire, apply security and resilience patterns, and deploy to cloud-native environments with comprehensive observability.
Development Environment
- OS: Windows 10/11, macOS, or Linux
- SDK: .NET 10.0 or later (for field-backed properties, primitive collections, advanced analyzers)
- IDE: Visual Studio 2026, Visual Studio Code, or JetBrains Rider
- Containerization: Docker Desktop
- Deployment: Azure Developer CLI (azd) for Azure labs; kubectl for Kubernetes labs
- AI Client: Claude Desktop, Microsoft Agent Framework, or VS Code extension for testing
- Optional: Kubernetes cluster (minikube, AKS) for advanced deployment scenarios
- Key Libraries: MCP .NET SDK 2.0, .NET Aspire 13.4, OpenTelemetry, Moq, TUnit (for testing)