freshcrate
Skin:/
Home > MCP Servers > csharp-sdk

csharp-sdk

The official C# SDK for Model Context Protocol servers and clients. Maintained in collaboration with Microsoft.

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

The official C# SDK for Model Context Protocol servers and clients. Maintained in collaboration with Microsoft.

README

MCP C# SDK

NuGet version

The official C# SDK for the Model Context Protocol, enabling .NET applications, services, and libraries to implement and interact with MCP clients and servers. Please visit the API documentation for more details on available functionality.

Packages

This SDK consists of three main packages:

  • ModelContextProtocol.Core NuGet version - For projects that only need to use the client or low-level server APIs and want the minimum number of dependencies.

  • ModelContextProtocol NuGet version - The main package with hosting and dependency injection extensions. References ModelContextProtocol.Core. This is the right fit for most projects that don't need HTTP server capabilities.

  • ModelContextProtocol.AspNetCore NuGet version - The library for HTTP-based MCP servers. References ModelContextProtocol.

Getting Started

To get started, see the Getting Started guide in the conceptual documentation for installation instructions, package-selection guidance, and complete examples for both clients and servers.

You can also browse the samples directory and the API documentation for more details on available functionality.

About MCP

The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). It enables secure integration between LLMs and various data sources and tools.

For more information about MCP:

License

This project is licensed under the Apache License 2.0.

Release History

VersionChangesUrgencyDate
v1.4.0**v1.4.0** introduces support for the Identity Assertion Authorization Grant (ID-JAG) flow via the new `IdentityAssertionGrantProvider`, enabling enterprise SSO scenarios where users authenticate once via their enterprise Identity Provider and access MCP servers without per-server authorization prompts. The release also adds a new `InheritEnvironmentVariables` option on `StdioClientTransportOptions` for controlling the child server's environment, alongside two security hardening fixes: the stdioHigh6/4/2026
v1.3.0**v1.3.0** focuses on improved transport diagnostics and security-focused documentation. The new public `ClientTransportClosedException` gives stdio and HTTP clients structured access to transport closure details (exit codes, process IDs, stderr tails, HTTP status codes) without parsing exception messages. Two reliability fixes harden the stdio process pipeline (preventing host crashes from user `StandardErrorLines` callbacks) and correct the stateless HTTP transport's capability advertisement. High5/8/2026
v1.2.0This release improves stateless HTTP transport defaults and documentation with a **breaking behavioral change** that we are considering as a server reliability fix and therefore not bumping the major version with this release. **Legacy SSE endpoints are now disabled by default** with a new `HttpServerTransportOptions.EnableLegacySse` property available to opt back into responding to the SSE endpoints; the property is marked as an `[Obsolete]` warning as we expect to remove this property in a futMedium3/27/2026
v1.1.0Highlights of v1.1.0 include client completion details for understanding when and why a client connection ended, auto-populated completion handlers from `AllowedValuesAttribute`, and bug fixes for server-initiated ping handling, server capabilities initialization, and in-flight message handler cleanup. ## What's Changed * Register ping handler in McpSessionHandler to support server-initiated pings #1391 by @stephentoub (co-authored by @Copilot) * Fix Extensions not being copied to ServerCLow3/6/2026
v1.0.0**This is the first stable release of the ModelContextProtocol C# SDK.** Thank you to all of the contributors who helped us achieve this milestone! ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Mark RunSessionHandler experimental (MCPEXP002) #1383** * `HttpServerTransportOptions.RunSessionHandler` is now annotated with `[Experimental("MLow2/25/2026
v1.0.0-rc.1This release candidate completes a full API surface area audit ahead of the 1.0.0 stable release, with more changes to public APIs to ensure consistency and long-term maintainability. Protocol DTO types are updated to match the MCP specification, deprecated filter APIs are removed, and bug fixes improve transport reliability and JSON handling. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details onLow2/24/2026
v0.9.0-preview.2This release focuses on API surface consistency and correctness ahead of 1.0.0. Public collection properties are now typed as `IList<T>` instead of concrete `List<T>` or `T[]`, and `Root.Meta` is aligned with the rest of the protocol DTOs by using `JsonObject?`. Other improvements include new experimental Extensions support for capabilities, missing `ResourceLinkBlock` properties, improved mimeType handling, and several documentation and test reliability fixes. **We plan to release the stableLow2/21/2026
v0.9.0-preview.1The 0.9.0-preview.1 release includes multiple breaking changes focused on quality, extensibility, usability, and API consistency as we continue refining the SDK in preparation for a stable 1.0.0 release. **We plan to release the stable 1.0.0 release early in the week of February 23, 2026.** ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **ULow2/20/2026
v0.8.0-preview.1The 0.8.0-preview.1 release includes new server-side capabilities including message-level filters and a distributed cache-backed event stream store, along with several bug fixes for transport reliability. This release also includes a breaking change that seals public Protocol reference types to prevent external inheritance, reinforcing the SDK's API contract as we continue refining toward a stable 1.0.0 release. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotoLow2/5/2026
v0.7.0-preview.1The 0.7.0-preview.1 release adds MCP task support, Streamable HTTP resumability with SSE event stream storage, and support for the 2025-11-25 protocol version. This release also introduces user-defined `JsonSerializerOptions` throughout SDK serialization APIs and includes several bug fixes for elicitation, source generator diagnostics, and URI template matching. The Streamable HTTP transport includes breaking changes to `StreamableHttpServerTransport` as part of the resumability implementation. Low1/28/2026
v0.6.0-preview.1This release includes improvements to source generator robustness, JSON-RPC deserialization performance, and OpenTelemetry semantic convention alignment. It also adds OAuth incremental scope consent support, fixes session timeout issues, and corrects tool result message handling for sampling with tools. Several documentation improvements and new client conformance tests round out the release. ## What's Changed * Remove s_additionalProperties from McpClientTool #1080 by @stephentoub (co-autLow1/14/2026
v0.5.0-preview.1The 0.5.0-preview.1 release of the Model Context Protocol C# SDK introduces significant API improvements including a unified `RequestOptions` parameter bag for client methods, removal of previously obsoleted APIs, and new support for Client ID Metadata Documents and URL mode elicitation. This release also adds conformance tests, `DebuggerDisplay` attributes for protocol types, and a convenience overload for resource subscriptions with handler delegates. ## Breaking Changes The 0.5.0-previeLow12/5/2025
v0.4.1-preview.1This release brings protocol type standardization, several MCP specification implementations, and new features including an incremental source generator for automatic `Description` attributes from XML comments and client session resumption support. This release includes breaking changes to protocol types and elicitation enum schemas; refer to the Breaking Changes section below for details. We are working toward the first stable version of the C# SDK as version 1.0.0, which will have compliancLow11/25/2025
v0.4.0-preview.3This release adds icons and metadata support (SEP-973), the new `McpMetaAttribute` for attaching custom metadata to tools, prompts, and resources, and .NET 10.0 target framework support. It also includes several bug fixes including faster shutdown for Streamable HTTP servers, proper exception propagation through tool call filters, and a fix for templated resource matching. This release contains breaking changes — see below for details and migration guidance. ## Breaking Changes Refer to thLow10/20/2025
v0.4.0-preview.2This release includes a breaking change to the Streamable HTTP transport's Stateless mode, making it truly sessionless by removing the data protection dependency and session ID tracking. It also fixes an issue with sending server notifications from request-specific McpServer instances used outside their original scope. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking Low10/8/2025
v0.4.0-preview.1The 0.4.0-preview.1 release of the Model Context Protocol C# SDK introduces several significant breaking API changes to improve the SDK's evolution path. Interfaces have been replaced by abstract classes, factory classes have been deprecated in favor of static factory methods, SSE transport types have been renamed to HTTP, and handlers/collections have been decoupled from protocol types. This release also adds new features including `ElicitAsync<T>`, middleware and authorization support for servLow9/25/2025
v0.3.0-preview.4This release includes bug fixes for ResourceLinkBlock deserialization and IEnumerable<ContentBlock> serialization, performance improvements to idle session tracking, enhanced MCP session logging, new samples, and the initial framework for conceptual documentation. ## What's Changed * Respect HandleResponse() and SkipHandler() calls in OnResourceMetadataRequest #607 by @halter73 * UnreferenceDisposable made slimmer #627 by @Scooletz * IdleTracking uses lists instead of SortedSet #629 by @Low8/20/2025
v0.3.0-preview.3This release improves .NET Framework support by adding cancellable stream reader polyfills, fixes a crash when `ResourceMetadata` is dynamically provided via events, ensures `IsExternalInit` type forwarding for multi-TFM consumers, and enables `IHttpContextAccessor` in Streamable HTTP tool calls by flowing `ExecutionContext` with JSON-RPC messages. It also updates Microsoft.Extensions.AI to 9.7.1. ## What's Changed * Add .NET Framework support with cancellable stream readers and enable netfx tLow7/16/2025
v0.3.0-preview.2This release introduces authorization support using ASP.NET Core's native authentication and authorization integration, enabling OAuth 2.0-protected MCP servers. It also includes improvements to URI template handling, structured output support in `McpClientTool`, constructor injection for `IMcpServer`, and a breaking change to default name casing for tools, prompts, and resources. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versionLow7/3/2025
v0.3.0-preview.1The v0.3.0-preview.1 release introduces spec-aligned content type renames, session ID support across transports, structured output for server tools, and improved Streamable HTTP client behavior. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for information regarding our versioning, breaking change, and support approaches. 1. **Content type renames to match spec #513** * `Content` renamed to `ContLow6/20/2025
v0.2.0-preview.3This release introduces the **ModelContextProtocol.Core** package, splitting the SDK into layered packages to provide client and low-level server APIs with minimal dependencies. Protocol record types are converted to classes for better forward compatibility, elicitation support is added, and protocol version negotiation is improved. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioningLow6/3/2025
v0.2.0-preview.2This release replaces `UseStreamableHttp` with a `TransportMode` enum for more flexible transport configuration, with auto-detection as the new default. It also improves SSE client transport compatibility, relaxes accept header validation, and adds tool invocation error logging. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Replace `UseStreLow5/29/2025
0.2.0-preview.1The 0.2.0-preview.1 release updates to stable Microsoft.Extensions.AI packages and fixes the nullable reference type annotation on `StdioClientTransportOptions.EnvironmentVariables`. ## What's Changed * **Update to stable M.E.AI :)** #421 by @stephentoub * Fix NRT annotation on `StdioClientTransportOptions.EnvironmentVariables` #419 by @stephentoub * Remove internal `GetBase64Data` helper in favor of `DataContent.Base64Data` #422 by @stephentoub ## Repository Infrastructure Updates Low5/16/2025
v0.1.0-preview.14This release consolidates namespaces across the SDK, adds stateless Streamable HTTP support, improves exception diagnostics for stdio transports, and fixes resource registration. It includes several breaking changes to namespaces, factory method signatures, and transport APIs. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Namespace consolidLow5/15/2025
v0.1.0-preview.13This release adds `McpServerResource`, `McpClientResource`, and related resource template types, and updates the Microsoft.Extensions.AI dependency. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Resource type changes #391** * `ListResourcesAsync` return type changed from `IList<Resource>` to `IList<McpClientResource>` * `ListResourcLow5/10/2025
v0.1.0-preview.12This release adds client-side Streamable HTTP transport support, removes batching from `StreamableHttpServerTransport`, and introduces schema creation options for tools and prompts. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Removed batching support from `StreamableHttpServerTransport` #372** * Server no longer accepts batched (JSON Low5/5/2025
v0.1.0-preview.11The 0.1.0-preview.11 release fixes the SSE Server /message endpoint to use root-relative URIs, fixes GET accept header validation in the Streamable HTTP transport, and improves documentation. ## What's Changed * Emit root-relative /message endpoint when using SSE Server #323 by @dogdie233 * Fix GET accept header validation for server-side Streamable HTTP transport and improve testing #345 by @halter73 ## Documentation Updates * Clarify McpClientTool inherits from AIFunction in READMLow4/24/2025
v0.1.0-preview.10This release cleans up `McpException` and `McpTransportException` with the `McpErrorCode` enum, adds progress notification support for `McpClientTool`, and introduces server-side Streamable HTTP transport support. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Clean up McpException and McpTransportException** (#321): `McpException.ErrorCode` changLow4/19/2025
v0.1.0-preview.9This release wraps each MCP request in a dependency injection service scope, introduces the Streamable HTTP transport with `StreamableHttpHandler` and `WithHttpTransport`, updates OpenTelemetry instrumentation with context propagation, and cleans up logging. It includes several breaking changes to handler delegate signatures, HTTP transport configuration, and transport base class APIs. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/veLow4/15/2025
v0.1.0-preview.8This release corrects the `CreateMessageResult.Role` type, exposes `JsonSerializerOptions` configuration across tool and prompt APIs, and adds comprehensive XML documentation comments across the SDK. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Fix CreateMessageResult.Role type #264** * `CreateMessageResult.Role` changed from `string` Low4/11/2025
v0.1.0-preview.7This release removes `McpServerConfig` in favor of `McpClientOptions`, introduces strong typing for request parameters, adds the server completions capability, enables notification handler registration after endpoint creation, and adds the Everything Server sample. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Allow notification handlers poLow4/9/2025
v0.1.0-preview.6This release consolidates exception types into `McpException` and moves notification handler registrations into the capabilities model. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Consolidate `McpClientException`/`McpServerException` into `McpException` #209** * `McpClientException` class deleted * `IMcpClient.ServerCapabilities` Low4/4/2025
v0.1.0-preview.5This release extends progress notification support, adds `JsonSerializerOptions` parameters for tool and prompt operations, adds initial OpenTelemetry observability, and reorganizes ASP.NET Core extension methods into the standard namespace. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Extend progress notification support #163** * `IMcLow4/3/2025
v0.1.0-preview.4This release introduces the **ModelContextProtocol.AspNetCore** package for hosting MCP servers in ASP.NET Core applications with SSE transport support. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Add ModelContextProtocol.AspNetCore #160** * `HttpListenerSseServerTransport` removed * `IServerTransport` interface removed * `MapMcpSse` rLow3/31/2025
v0.1.0-preview.3This release overhauls the resource system, refactors transports for graceful shutdown, introduces prompt support with `McpServerPrompt` and `McpClientPrompt`, and adds progress reporting and annotation support. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Add ToolAnnotations support #124** * `McpServerToolAttribute` constructor no longer accLow3/31/2025
v0.1.0-preview.2This release overhauls tool handling, makes options types fully mutable, adds logging capability, and improves serialization. ## Breaking Changes Refer to the [C# SDK Versioning](https://modelcontextprotocol.github.io/csharp-sdk/versioning.html) documentation for details on versioning and breaking change policies. 1. **Overhaul tool handling #89** * `McpToolAttribute` renamed to `McpServerToolAttribute`; `McpToolTypeAttribute` renamed to `McpServerToolTypeAttribute` * `WithTools()` renaLow3/27/2025
v0.1.0-preview.1.25171.12# MCP C# SDK https://www.nuget.org/packages/ModelContextProtocol/0.1.0-preview.1.25171.12 The official C# SDK for the [Model Context Protocol](https://modelcontextprotocol.io/), enabling .NET applications, services, and libraries to implement and interact with MCP clients and servers. > [!NOTE] > This is a preview release. Breaking changes can be introduced without prior notice. ## About MCP The Model Context Protocol (MCP) is an open protocol that standardizes how applicationsLow3/21/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

mcp-dotnet-samplesA comprehensive set of samples of creating and using MCP servers and clients with .NETmain@2026-06-05
mcp-for-beginnersThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed formain@2026-06-04
openclaw.netSelf-hosted OpenClaw gateway + agent runtime in .NET (NativeAOT-friendly)v0.1.1
dnSpy-MCPProvide static .NET assembly analysis through decompilation, IL disassembly, metadata inspection, and protection checks using dnSpyEx over MCP stdio.main@2026-04-15
Perigon.CLIThis is a tool that helps you quickly build backend services based on Asp.Net Core and EF Core. It provides command line, WebUI and IDE MCP support. In a well-designed project architecture that has bev10.0.0

More from modelcontextprotocol

python-sdkThe official Python SDK for Model Context Protocol servers and clients
typescript-sdkThe official TypeScript SDK for Model Context Protocol servers and clients
modelcontextprotocolSpecification and documentation for the Model Context Protocol
registryA community driven registry service for Model Context Protocol (MCP) servers.

More in MCP Servers

AstrBotAgentic IM Chatbot infrastructure that integrates lots of IM platforms, LLMs, plugins and AI feature, and can be your openclaw alternative. ✨
agentscopeBuild and run agents you can see, understand and trust.
claude-plugins-officialOfficial, Anthropic-managed directory of high quality Claude Code Plugins.
langchain4jLangChain4j is an open-source Java library that simplifies the integration of LLMs into Java applications through a unified API, providing access to popular LLMs and vector databases. It makes impleme