Skip to content

Releases: modelcontextprotocol/csharp-sdk

v0.4.0-preview.1

25 Sep 16:37
be2d0f5
Compare
Choose a tag to compare
v0.4.0-preview.1 Pre-release
Pre-release

Breaking Changes

The v0.4.0-preview.1 release includes several breaking API changes, included in #723 and #765.

  1. Interfaces were replaced by abstract classes to better allow evolution of the API surface in future versions.
  2. Factory classes were deprecated and replaced by static factory methods to improve usability and align with existing .NET patterns such as HttpClient.
  3. The 'Sse' (Server-Sent Events) APIs were renamed to use 'Http', aligning with the revised Transports nomenclature.
  4. APIs for handlers and callbacks were decoupled from the protocol representation for improved separation of concerns.

Interfaces replaced by abstract classes

The IMcpClient, IMcpServer, and IMcpEndpoint interfaces are marked as [Obsolete] and will be removed in an upcoming release. These interfaces are replaced by new abstract classes.

Old New
IMcpClient McpClient
IMcpServer McpServer
IMcpEndpoint McpSession

Action: Replace usages of the obsolete interfaces with the new abstract types. Change variable, field, and parameter types. Optional, but recommended: rename identifiers like endpointsession for clarity.

Factory classes deprecated

The McpClientFactory and McpServerFactory classes are marked as [Obsolete] and will be removed in an upcoming release.

Old New
McpClientFactory.CreateAsync(...) McpClient.CreateAsync(...)
McpServerFactory.CreateAsync(...) McpServer.CreateAsync(...)

Action: Replace calls to the factory classes with the static factory methods on the abstract classes.

Rename SseClientTransport to HttpClientTransport

The SseClientTransport and SseClientTransportOptions classes were renamed to reflect Http naming instead of Sse.

Old New
SseClientTransport HttpClientTransport
SseClientTransportOptions HttpClientTransportOptions

Action: Update usage of these types to utilize the new type names.

Decouple handlers and collections from protocol types

Handlers and collections in the Capabilities types are now obsolete; they've been moved to McpClientOptions and McpServerOptions.

Old New
myClientOptions.Capabilities.NotificationHandlers myClientOptions.Handlers.NotificationHandlers
myClientOptions.Capabilities.Elicitation.ElicitationHandler myClientOptions.Handlers.ElicitationHandler
myClientOptions.Capabilities.Roots.RootsHandler myClientOptions.Handlers.RootsHandler
myClientOptions.Capabilities.Sampling.SamplingHandler myClientOptions.Handlers.SamplingHandler
myServerOptions.Capabilities.NotificationHandlers myServerOptions.Handlers.NotificationHandlers
myServerOptions.Capabilities.Completions.CompleteHandler myServerOptions.Handlers.CompleteHandler
myServerOptions.Capabilities.Logging.SetLoggingLevelHandler myServerOptions.Handlers.SetLoggingLevelHandler
myServerOptions.Capabilities.Prompts.ListPromptsHandler myServerOptions.Handlers.ListPromptsHandler
myServerOptions.Capabilities.Prompts.GetPromptHandler myServerOptions.Handlers.GetPromptHandler
myServerOptions.Capabilities.Prompts.PromptCollection myServerOptions.PromptCollection
myServerOptions.Capabilities.Resources.ListResourceTemplatesHandler myServerOptions.Handlers.ListResourceTemplatesHandler
myServerOptions.Capabilities.Resources.ListResourcesHandler myServerOptions.Handlers.ListResourcesHandler
myServerOptions.Capabilities.Resources.ReadResourceHandler myServerOptions.Handlers.ReadResourceHandler
myServerOptions.Capabilities.Resources.SubscribeToResourcesHandler myServerOptions.Handlers.SubscribeToResourcesHandler
myServerOptions.Capabilities.Resources.UnsubscribeFromResourcesHandler myServerOptions.Handlers.UnsubscribeFromResourcesHandler
myServerOptions.Capabilities.Resources.ResourceCollection myServerOptions.ResourceCollection
myServerOptions.Capabilities.Tools.ListToolsHandler myServerOptions.Handlers.ListToolsHandler
myServerOptions.Capabilities.Tools.CallToolHandler myServerOptions.Handlers.CallToolHandler
myServerOptions.Capabilities.Tools.ToolCollection myServerOptions.ToolCollection

Action: Replace usages of the obsolete handlers and collections with the corresponding APIs on the options types.

Collections

Old

new McpServerOptions() 
{
    Capabilities = new() 
    {
        Tools = new() 
        { 
            ToolCollection = [McpServerTool.Create(...)] 
        }
    }
};

New

new McpServerOptions()
{
    ToolCollection = [McpServerTool.Create(...)]
};

Handlers

Old

new McpServerOptions()
{
    Capabilities = new()
    {
        Tools = new()
        {
            CallToolHandler = (request, ct) => { ... }
        }
    }
};

New

new McpServerOptions()
{
    Handlers = new()
    {
        CallToolHandler = (request, ct) => { ... }
    }
};

What's Changed

New Contributors

Read more

v0.3.0-preview.4

20 Aug 19:09
15f8e89
Compare
Choose a tag to compare
v0.3.0-preview.4 Pre-release
Pre-release

What's Changed

  • Respect HandleResponse() and SkipHandler() calls in OnResourceMetadataRequest by @halter73 in #607
  • UnreferenceDisposable made slimmer by @Scooletz in #627
  • IdleTracking uses lists instead of SortedSet by @Scooletz in #629
  • Fix ResourceLinkBlock deserialization by adding missing "name" case by @Copilot in #645
  • Add an in-memory transport sample by @stephentoub in #664
  • Remove 'Sse' from AspNetCoreSseServer sample name by @halter73 in #665
  • Fix NotSupportedException when returning IEnumerable by @Copilot in #675
  • Enhance HTTP and MCP session logging by @theojiang25 in #608
  • Remove special-casing of string enumerables in McpServerTool by @stephentoub in #699
  • Prune idle sessions before starting new ones by @halter73 in #701
  • Add framework for conceptual docs by @mikekistler in #708

New Contributors

Full Changelog: v0.3.0-preview.3...v0.3.0-preview.4

v0.3.0-preview.3

16 Jul 13:18
3156818
Compare
Choose a tag to compare
v0.3.0-preview.3 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: v0.3.0-preview.2...v0.3.0-preview.3

v0.3.0-preview.2

03 Jul 21:49
a6fd6fc
Compare
Choose a tag to compare
v0.3.0-preview.2 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: v0.3.0-preview.1...v0.3.0-preview.2

v0.3.0-preview.1

20 Jun 16:18
283a052
Compare
Choose a tag to compare
v0.3.0-preview.1 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: v0.2.0-preview.3...v0.3.0-preview.1

v0.2.0-preview.3

03 Jun 20:42
046903c
Compare
Choose a tag to compare
v0.2.0-preview.3 Pre-release
Pre-release

What's Changed

Full Changelog: v0.2.0-preview.2...v0.2.0-preview.3

v0.2.0-preview.2

29 May 17:01
6351b3d
Compare
Choose a tag to compare
v0.2.0-preview.2 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: 0.2.0-preview.1...v0.2.0-preview.2

0.2.0-preview.1

16 May 15:44
9c3ac60
Compare
Choose a tag to compare
0.2.0-preview.1 Pre-release
Pre-release

What's Changed

Full Changelog: v0.1.0-preview.14...0.2.0-preview.1

v0.1.0-preview.14

15 May 02:12
106ab80
Compare
Choose a tag to compare
v0.1.0-preview.14 Pre-release
Pre-release

What's Changed

Full Changelog: v0.1.0-preview.13...v0.1.0-preview.14

v0.1.0-preview.13

10 May 15:48
61092e0
Compare
Choose a tag to compare
v0.1.0-preview.13 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: v0.1.0-preview.12...v0.1.0-preview.13