Understand C# SDK
Explore C# SDK for building with the Model Context Protocol
Let’s explore the official C# SDK for MCP, which offers a robust set of NuGet packages that empower .NET developers to build applications that seamlessly interact with LLMs. This guide will provide a deep dive into the three core components of the MCP SDK for .NET.
The SDK is structured as a layered architecture with three distinct packages, each serving a specific purpose in the ecosystem:
Let’s examine each package in detail.
ModelContextProtocol.Core
Overview
ModelContextProtocol.Core is the essential building block of the MCP ecosystem. As the minimal dependency package, it provides the fundamental client and server APIs without the overhead of additional frameworks.
When to use this package:
- When you need the absolute minimum dependencies
- For low-level server implementation
- When building lightweight clients
- In constrained environments where dependency count matters
Key Features
- Basic client/server communication
- Tool registration and invocation
- Protocol message handling
- STDIO transport implementation
ModelContextProtocol
Overview
ModelContextProtocol is the primary package for most MCP implementations in .NET. It builds upon the Core package by adding dependency injection, hosting integration, and automatic tool discovery capabilities.
When to use this package:
- For standard application development
- When using dependency injection
- When you need automatic tool discovery
- For most server implementations that don’t require HTTP
Key Features
- Full dependency injection integration
- Automatic tool discovery via attributes
- Advanced server configuration
- Seamless integration with AI functions
- Hosting extensions for background services
ModelContextProtocol.AspNetCore
Overview
ModelContextProtocol.AspNetCore extends the MCP capabilities to HTTP-based communication, allowing you to create MCP servers that operate over standard HTTP protocols.
When to use this package:
- When you need HTTP-based MCP servers
- For web-based integrations
- When working with cloud services that require HTTP endpoints
- For scenarios where STDIO isn’t appropriate
Key Features
- HTTP transport implementation
- ASP.NET Core middleware integration
- Web API endpoint configuration
- Standard HTTP request/response handling
- Compatibility with existing web infrastructure
Final Thoughts
Want to build a .NET MCP server (console or hosted)? Start with ModelContextProtocol.
Building an HTTP-powered MCP server in ASP.NET Core? Use ModelContextProtocol.AspNetCore.
Need a lightweight client or minimal integration? Choose ModelContextProtocol.Core.
Let’s build real world applications using these packages to demonstrate their capabilities.
Last updated 10 Aug 2025, 20:01 +0100 .