Releases: modelcontextprotocol/csharp-sdk
v0.1.0-preview.13
This release adds McpServerResource, McpClientResource, and related resource template types, and updates the Microsoft.Extensions.AI dependency.
Breaking Changes
Refer to the C# SDK Versioning documentation for details on versioning and breaking change policies.
- Resource type changes #391
ListResourcesAsyncreturn type changed fromIList<Resource>toIList<McpClientResource>ListResourceTemplatesAsyncreturn type changed similarlyReadResourceRequestParams.Urichanged from optional torequired- Multiple extension methods changed return types from
Task<T>toValueTask<T> IMcpServerPrimitive.Namerenamed toId(resource names aren't unique)McpServernow registers default handlers instead of failing for missing handlers
What's Changed
- Set IsError on CallToolResponse to true when result is ErrorContent #394 by @Astaggrock
- Add McpServer/ClientResource{Template} and friends #391 by @stephentoub
- Use WithResources in EverythingServer sample #400 by @stephentoub
- Update to latest M.E.AI version #401 by @stephentoub
Repository Infrastructure Updates
- Bump version to v0.1.0-preview.13 by @halter73
Acknowledgements
- @Astaggrock made their first contribution in #394
- @aaronpowell submitted #72 (resolved by #391)
- @Redth submitted #74 (resolved by #391)
- @halter73 @mikekistler reviewed pull requests
Full Changelog: v0.1.0-preview.12...v0.1.0-preview.13
v0.1.0-preview.12
This 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 documentation for details on versioning and breaking change policies.
- Removed batching support from
StreamableHttpServerTransport#372- Server no longer accepts batched (JSON array) JSON-RPC requests on the Streamable HTTP transport
What's Changed
- Add
SchemaCreateOptionsinMcpServerToolCreateOptions/McpServerPromptCreateOptions#354 by @1357310795 - Improve
WeatherTools.GetAlertsdescription in sample #363 by @vladnega - Add static resources to EverythingServer sample #361 by @mikekistler (co-authored by @halter73)
- Backfill trace injection test and migrate from
request.paramstorequest.params._meta#360 by @codefromthecrypt - Add a
McpClientTool.CallAsynchelper #367 by @stephentoub - Fix typo in
McpSession.cs#371 by @stephentoub - Update System and M.E.AI dependencies #374 by @stephentoub
- Add client-side Streamable HTTP transport support #356 by @halter73
- Remove batching support from
StreamableHttpServerTransport#372 by @halter73
Repository Infrastructure Updates
- Bump version to v0.1.0-preview.12 by @halter73
Acknowledgements
- @1357310795 made their first contribution in #354
- @vladnega made their first contribution in #363
- @codefromthecrypt made their first contribution in #360
- @mikekistler made their first contribution in #361
- @mwiemer-microsoft submitted #370 (resolved by #371)
- @eiriktsarpalis @jeffhandley @lmolkova @samsp-msft reviewed pull requests
Full Changelog: v0.1.0-preview.11...v0.1.0-preview.12
v0.1.0-preview.11
The 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 README.md #338 by @ferrywlto (co-authored by @halter73)
- Fixed issue preventing README.md client example from compiling #346 by @PederHP
Repository Infrastructure Updates
- Bump version to v0.1.0-preview.11 #332 by @jeffhandley
Acknowledgements
- @dogdie233 made their first contribution in #323
- @ferrywlto made their first contribution in #338
- @eiriktsarpalis reviewed pull requests
Full Changelog: v0.1.0-preview.10...v0.1.0-preview.11
v0.1.0-preview.10
This 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 documentation for details on versioning and breaking change policies.
- Clean up McpException and McpTransportException (#321):
McpException.ErrorCodechanged fromint?toMcpErrorCodeenum;McpTransportExceptionclass deleted; transport errors now throwInvalidOperationException
What's Changed
- Support progress notifications with McpClientTool and McpClientExtensions.CallToolAsync #312 by @stephentoub
- Add WithTools/Prompts overloads that accept McpServerTool/Prompts #319 by @stephentoub
- Clean up (use of) McpException and McpTransportException #321 by @stephentoub
- Add server-side Streamable HTTP transport support #330 by @halter73
Test Improvements
- Delete faulty assert #313 by @stephentoub
- Fix HandlesIProgressParameter test sporadically failing in CI #327 by @stephentoub
Repository Infrastructure Updates
- Bump version to 0.1.0-preview.10 #315 by @jeffhandley
Acknowledgements
- @LuisM000 @MaximPodolski @Meir017 @PederHP reviewed pull requests
Full Changelog: v0.1.0-preview.9...v0.1.0-preview.10
v0.1.0-preview.9
This 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 documentation for details on versioning and breaking change policies.
-
Wrap each request in a service scope #276
- All capability handler delegate types changed from
Func<..., Task<T>>toFunc<..., ValueTask<T>>includingSamplingHandler,ListToolsHandler,CallToolHandler,ListPromptsHandler,GetPromptHandler, and all resource/completion/logging handlers McpServerTool.InvokeAsyncandMcpServerPrompt.GetAsyncreturn types changed toValueTask
- All capability handler delegate types changed from
-
Add StreamableHttpHandler and WithHttpTransport #291
MapMcpremovedconfigureOptionsAsyncandrunSessionAsyncparameters; configuration moved toWithHttpTransport(Action<HttpServerTransportOptions>?)SseClientTransportOptions.MaxReconnectAttemptsandReconnectDelayproperties removed
-
Clean up logging #286
TransportBaseconstructor changed from(ILoggerFactory?)to(string name, ILoggerFactory?)— required parameter addedTransportBase.EndpointNamerenamed toTransportBase.NameTransportBase.Loggeraccessibility narrowed fromprotectedtoprivate protected- Custom transport implementations extending
TransportBasemust update
What's Changed
- Wrap each request in a service scope #276 by @stephentoub
- OpenTelemetry: context propagation and semconv update #262 by @lmolkova
- Add AdditionalHeader handling to ReceiveMessageAsync #295 by @ClosetheWorld
- Add StreamableHttpHandler and WithHttpTransport #291 by @halter73
- Remove unnecessary $ and fix some typos #305 by @MikeAlhayek
- Clean up logging #286 by @stephentoub
Documentation Updates
- Fix the docs and make them more readable #281 by @MikeAlhayek
Repository Infrastructure Updates
- Bump version to 0.1.0-preview.9 #284 by @eiriktsarpalis
- Workflow refactoring and improvements #273 by @jeffhandley
Acknowledgements
- @MikeAlhayek made their first contribution in #281
- @lmolkova made their first contribution in #262
- @ClosetheWorld made their first contribution in #295
- @JeffreySu submitted issue #234 (resolved by #276)
- @gong626035906 submitted issue #198 (resolved by #276)
Full Changelog: v0.1.0-preview.8...v0.1.0-preview.9
v0.1.0-preview.8
This 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 documentation for details on versioning and breaking change policies.
- Fix CreateMessageResult.Role type #264
CreateMessageResult.Rolechanged fromstringtoRoleenum type- Migration: Replace string values like
"assistant"withRole.Assistantor"user"withRole.User
- Expose JsonSerializerOptions in prompts APIs #279
WithPromptsremovedparamsmodifier; addedJsonSerializerOptions? serializerOptionsparameter- Migration: Wrap multiple type arguments in a collection, e.g.
WithPrompts([typeof(A), typeof(B)])
- Expose JsonSerializerOptions in tools APIs #266
WithToolsremovedparamsmodifier; addedJsonSerializerOptions? serializerOptionsparameter- Migration: Wrap multiple type arguments in a collection, e.g.
WithTools([typeof(A), typeof(B)])
What's Changed
- Fix CreateMessageRule.Role to be of type Role #264 by @stephentoub
- Delete some dead methods from Log.cs #277 by @stephentoub
- Expose a JsonSerializerOptions setting in the prompts APIs #279 by @eiriktsarpalis
Documentation Updates
- Add XML documentation comments across the SDK #238 by @robch (co-authored by @stephentoub)
- Augment McpServerTool/Prompt docs with details of parameter/result marshaling #271 by @stephentoub
Test Improvements
- Disable STJ reflection for testing #266 by @eiriktsarpalis (co-authored by @stephentoub)
Repository Infrastructure Updates
- Bump version to 0.1.0-preview.8 #256 by @eiriktsarpalis
Acknowledgements
Full Changelog: v0.1.0-preview.7...v0.1.0-preview.8
v0.1.0-preview.7
This 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 documentation for details on versioning and breaking change policies.
- Allow notification handlers post-creation temporary registration #223
ClientCapabilities.NotificationHandlersandServerCapabilities.NotificationHandlersdelegate changed fromFunc<..., Task>toFunc<..., CancellationToken, Task>
- Use strong-typing of params in most remaining McpClientExtensions methods #224
CallToolRequestParams.Argumentschanged fromDictionary<string, JsonElement>?toIReadOnlyDictionary<string, JsonElement>?GetPromptRequestParams.Argumentssimilarly changed
- Remove McpServerConfig and have McpClientFactory accept IClientTransport instances directly #230
McpServerConfigclass deletedMcpClientFactory.CreateAsyncparameter changed fromMcpServerConfigtoIClientTransportIClientTransportgained requiredNameproperty
- Add server completions capability #232
GetCompletionAsyncrenamed toCompleteAsyncWithGetCompletionHandlerrenamed toWithCompleteHandler
What's Changed
- Fix api.weather.gov/points response handling in WeatherTools #134 by @stvansolano (co-authored by @halter73)
- Everything server #151 by @aaronpowell
- Fix and enhance cancellation operations across MCP Sessions #179 by @Tyler-R-Kendrick (co-authored by @stephentoub)
- Propagate fix from AIFunctionFactory to TemporaryAIFunctionFactory #215 by @stephentoub
- Allow notification handlers post-creation temporary registration #223 by @stephentoub
- Use strong-typing of params in most remaining McpClientExtensions methods #224 by @stephentoub
- Use Kestrel for all in-memory HTTP tests #225 by @halter73
- Stop the host when the single session server service finishes #226 by @stephentoub
- Enable servers to log to the clients via ILogger #229 by @stephentoub
- Remove McpServerConfig and have McpClientFactory accept IClientTransport instances directly #230 by @eiriktsarpalis (co-authored by @halter73)
- Add server completions capability #232 by @stephentoub
- Fix race in KestrelInMemoryConnection #233 by @halter73
- Fix StdioServerTransport.DisposeAsync hang #235 by @halter73
- Update M.E.AI to latest version #241 by @stephentoub
- Avoid propagating server tool exception message to client #242 by @stephentoub
- Fixes #248 - Add CultureInfo.InvariantCulture to string interpolation #249 by @DGuhr
- Improve SSE response handling and URI construction in SseClientSession #251 by @239573049
- Use TryAddEnumerable for McpServerOptionsSetup #252 by @halter73
- Fix race in TransportBase.SetConnected #253 by @halter73
- Separate ASP.NET Core tests into a distinct project and make the main test project netfx compatible #254 by @eiriktsarpalis (co-authored by @halter73)
Documentation Updates
- Add SECURITY.md #239 by @jeffhandley
Repository Infrastructure Updates
- Bump package version to 0.1.0-preview.7 #212 by @eiriktsarpalis
- Bump xunit.v3 to 2.0.0 #231 by @eiriktsarpalis
- Update markdown-link-check to ignore external links causing 403 in CI #246 by @jeffhandley
Acknowledgements
- @DGuhr made their first contribution in #249
- @239573049 made their first contribution in #251
- @chuckries submitted #214 (resolved by #215)
- @StefH submitted #155 (resolved by #226)
- @mbcrawfo submitted #221 (resolved by #235)
- @dsp-ant @PederHP @tripathi-gaurav reviewed pull requests
Full Changelog: v0.1.0-preview.6...v0.1.0-preview.7
v0.1.0-preview.6
This release consolidates exception types into McpException and moves notification handler registrations into the capabilities model.
Breaking Changes
Refer to the C# SDK Versioning documentation for details on versioning and breaking change policies.
- Consolidate
McpClientException/McpServerExceptionintoMcpException#209McpClientExceptionclass deletedIMcpClient.ServerCapabilitieschanged from nullable to non-nullable (throwsInvalidOperationExceptionif not connected); same forServerInfo
- Move notification handler registrations to capabilities #207
AddNotificationHandlerremoved fromIMcpEndpoint- Notification handlers now set via
ClientCapabilities.NotificationHandlersandServerCapabilities.NotificationHandlers
What's Changed
- Disable response buffering for SSE responses #208 by @halter73
- Consolidate
McpClientException/McpServerExceptionintoMcpException#209 by @stephentoub - Move notification handler registrations to capabilities #207 by @stephentoub
Repository Infrastructure Updates
- Bump package version to 0.1.0-preview.6 #206 by @eiriktsarpalis
Acknowledgements
- @PederHP @Youssef1313 reviewed pull requests
Full Changelog: v0.1.0-preview.5...v0.1.0-preview.6
v0.1.0-preview.5
This 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 documentation for details on versioning and breaking change policies.
- Extend progress notification support #163
IMcpClientbase interface changed toIMcpEndpointSamplingCapability.SamplingHandlerdelegate signature gainedIProgress<ProgressNotificationValue>parameter
- Put MapMcp in Microsoft.AspNetCore.Builder namespace #171
McpEndpointRouteBuilderExtensionsmoved fromModelContextProtocol.AspNetCoretoMicrosoft.AspNetCore.Buildernamespace
- Split StdioClient/ServerTransports into Stdio : Stream #172
StdioServerTransportstream-based constructor removed; base class changed fromTransportBasetoStreamServerTransport;StdioClientStreamTransportreplaced byStdioClientSessionTransportand newStreamClientTransport- Migration: Use
StreamServerTransportfor custom stream-based servers; updateStdioServerTransportconstructor calls
- Allow JsonSerializerOptions parameters #182
- New
JsonSerializerOptions?parameter inserted beforecancellationTokeninListToolsAsync,EnumerateToolsAsync,GetPromptAsync SendNotificationAsyncextension method removed fromMcpClientExtensions
- New
- Remove McpServerConfig.Arguments property #192
McpServerConfig.Argumentsproperty removed- Migration: Use
McpServerConfig.TransportOptions["arguments"]instead
What's Changed
- Put MapMcp in Microsoft.AspNetCore.Builder namespace #171 by @halter73
- Split StdioClient/ServerTransports into Stdio : Stream #172 by @stephentoub
- Fixing WithPromptsFromAssembly #174 by @aaronpowell
- Enable IsAotCompatible for ModelContextProtocol.AspNetCore #175 by @stephentoub
- Configure hosted stdio servers to log to stderr #173 by @halter73
- Fix pagination handling in McpServer #177 by @stephentoub
- Extend progress notification support #163 by @Tyler-R-Kendrick (co-authored by @stephentoub)
- Make supposedly unreachable code less reachable #178 by @halter73
- Add initial Activity / Metric support #183 by @stephentoub
- Allow JsonSerializerOptions parameters for user-defined inputs and hardcode everything else to the source generator #182 by @eiriktsarpalis
- Write "event: message" to SSE response #192 by @halter73
- Changed the name of the ActivitySource and Metric to clarify that the semantic conventions have not been ratified yet #194 by @samsp-msft (co-authored by @stephentoub)
- Allow override of name and description of McpClientTool #165 by @PederHP
- Hardcode the source generator in one remaining location and simplify McpJsonUtilities #204 by @eiriktsarpalis
- Reduce dependencies to 8.x versions of packages #195 by @stephentoub
- Mark samples as AOT compatible #184 by @agocke (co-authored by @stephentoub)
Documentation Updates
Test Improvements
- Expand a few DI-related tests #201 by @stephentoub
- Add more unit tests #139 by @stvansolano (co-authored by @stephentoub)
Repository Infrastructure Updates
- Bump package version #169 by @eiriktsarpalis
Acknowledgements
- @Tyler-R-Kendrick made their first contribution in #163
- @agocke made their first contribution in #184
- @samsp-msft made their first contribution in #194
- @stvansolano made their first contribution in #139
- @zh6335901 submitted issue #154 (resolved by #165)
- @AArnott @JamesNK @lmolkova @WeihanLi reviewed pull requests
Full Changelog: v0.1.0-preview.4...v0.1.0-preview.5
v0.1.0-preview.4
This 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 documentation for details on versioning and breaking change policies.
- Add ModelContextProtocol.AspNetCore #160
HttpListenerSseServerTransportremovedIServerTransportinterface removedMapMcpSserenamed toMapMcpand moved to the newModelContextProtocol.AspNetCorepackage
What's Changed
- Add ModelContextProtocol.AspNetCore #160 by @halter73 (co-authored by @eiriktsarpalis @jeffhandley)
Repository Infrastructure Updates
- Bump package version #167 by @eiriktsarpalis
Acknowledgements
- @stephentoub reviewed pull requests
Full Changelog: v0.1.0-preview.3...v0.1.0-preview.4