Rename MCPEXP002 Subclassing_* constants to Extensibility_* (#1739)

Co-authored-by: arimu1 <19286898+arimu1@users.noreply.github.com>
This commit is contained in:
dev_Hakaze 2026-07-26 13:52:48 +07:00 • committed by GitHub
commit f2ce62ced9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 25 additions and 24 deletions

View file

@ -13,9 +13,10 @@ namespace ModelContextProtocol;
/// These APIs may change as the specification evolves.
/// </description></item>
/// <item><description>
/// <c>MCPEXP002</c> covers experimental SDK APIs that are unrelated to the MCP specification,
/// such as subclassing internal types or SDK-specific extensibility hooks. These APIs may
/// change or be removed based on SDK design feedback.
/// <c>MCPEXP002</c> covers SDK extensibility APIs that enable features to be implemented
/// in standalone packages without requiring Core to understand those features. The Tasks
/// package is one such consumer. These APIs remain experimental until additional
/// extensibility scenarios validate the design.
/// </description></item>
/// </list>
/// <para>
@ -65,31 +66,31 @@ internal static class Experimentals
public const string Apps_Url = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp003";
/// <summary>
/// Diagnostic ID for experimental SDK APIs unrelated to the MCP specification,
/// such as subclassing <c>McpClient</c>/<c>McpServer</c> or referencing <c>RunSessionHandler</c>.
/// Diagnostic ID for SDK extensibility APIs that enable independently packaged features,
/// such as Tasks, without requiring Core awareness of those features.
/// </summary>
/// <remarks>
/// This diagnostic ID covers experimental SDK-level extensibility APIs. All constants
/// in this group share the same diagnostic ID so users need only one suppression point
/// for SDK design preview features.
/// </remarks>
public const string Subclassing_DiagnosticId = "MCPEXP002";
public const string Extensibility_DiagnosticId = "MCPEXP002";
/// <summary>
/// Message for experimental subclassing of McpClient and McpServer.
/// Message for experimental extensibility points in the C# SDK implementation.
/// </summary>
public const string Subclassing_Message = "Subclassing McpClient and McpServer is experimental and subject to change.";
public const string Extensibility_Message = "This C# SDK extensibility API is experimental and subject to change.";
/// <summary>
/// URL for experimental subclassing of McpClient and McpServer.
/// URL for experimental extensibility points in the C# SDK implementation.
/// </summary>
public const string Subclassing_Url = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp002";
public const string Extensibility_Url = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp002";
/// <summary>
/// Diagnostic ID for the experimental <c>RunSessionHandler</c> API.
/// </summary>
/// <remarks>
/// This uses the same diagnostic ID as <see cref="Subclassing_DiagnosticId"/> because
/// This uses the same diagnostic ID as <see cref="Extensibility_DiagnosticId"/> because
/// both are experimental SDK APIs unrelated to the MCP specification.
/// </remarks>
public const string RunSessionHandler_DiagnosticId = "MCPEXP002";

View file

@ -12,7 +12,7 @@ public abstract partial class McpClient : McpSession
/// <summary>
/// Initializes a new instance of the <see cref="McpClient"/> class.
/// </summary>
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
[Experimental(Experimentals.Extensibility_DiagnosticId, UrlFormat = Experimentals.Extensibility_Url)]
protected McpClient()
{
}

View file

@ -83,7 +83,7 @@ public sealed class JsonRpcMessageContext
/// Streamable HTTP transports emit this value in the <c>Mcp-Name</c> header. This enables
/// extension methods to identify the named resource targeted by a request.
/// </remarks>
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
[Experimental(Experimentals.Extensibility_DiagnosticId, UrlFormat = Experimentals.Extensibility_Url)]
[JsonIgnore]
public string? RoutingName { get; set; }

View file

@ -20,7 +20,7 @@ namespace ModelContextProtocol.Protocol;
/// <see cref="Result"/> for the immediate result or <see cref="Alternate"/> for the alternate.
/// </para>
/// </remarks>
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
[Experimental(Experimentals.Extensibility_DiagnosticId, UrlFormat = Experimentals.Extensibility_Url)]
public class ResultOrAlternate<TResult> where TResult : Result
{
private readonly TResult? _result;

View file

@ -84,7 +84,7 @@ public sealed class McpRequestFilters
/// asynchronously, filters registered after it execute as part of that asynchronous operation.
/// </para>
/// </remarks>
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
[Experimental(Experimentals.Extensibility_DiagnosticId, UrlFormat = Experimentals.Extensibility_Url)]
public IList<McpRequestInvocationFilter<CallToolRequestParams, ResultOrAlternate<CallToolResult>>> CallToolWithAlternateFilters
{
get => field ??= [];

View file

@ -11,7 +11,7 @@ namespace ModelContextProtocol.Server;
/// <param name="next">The next request handler in the pipeline for this invocation.</param>
/// <param name="cancellationToken">The cancellation token for the current request.</param>
/// <returns>The result of the filtered request invocation.</returns>
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
[Experimental(Experimentals.Extensibility_DiagnosticId, UrlFormat = Experimentals.Extensibility_Url)]
public delegate ValueTask<TResult> McpRequestInvocationFilter<TParams, TResult>(
RequestContext<TParams> context,
McpRequestHandler<TParams, TResult> next,

View file

@ -39,7 +39,7 @@ public abstract partial class McpServer : McpSession
/// On the returned facade, redirected methods skip their client-capability checks,
/// because the alternate channel is responsible for delivering the request to the client.
/// </remarks>
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
[Experimental(Experimentals.Extensibility_DiagnosticId, UrlFormat = Experimentals.Extensibility_Url)]
public McpServer WithOutgoingRequestInterceptor(Func<string, JsonNode?, CancellationToken, ValueTask<JsonNode?>> interceptor)
{
Throw.IfNull(interceptor);

View file

@ -11,7 +11,7 @@ public abstract partial class McpServer : McpSession
/// <summary>
/// Initializes a new instance of the <see cref="McpServer"/> class.
/// </summary>
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
[Experimental(Experimentals.Extensibility_DiagnosticId, UrlFormat = Experimentals.Extensibility_Url)]
protected McpServer()
{
}

View file

@ -78,7 +78,7 @@ public sealed class McpServerHandlers
/// </para>
/// </remarks>
/// <exception cref="InvalidOperationException"><see cref="CallToolHandler"/> is already set.</exception>
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
[Experimental(Experimentals.Extensibility_DiagnosticId, UrlFormat = Experimentals.Extensibility_Url)]
public McpRequestHandler<CallToolRequestParams, ResultOrAlternate<CallToolResult>>? CallToolWithAlternateHandler
{
get;

View file

@ -217,6 +217,6 @@ public sealed class McpServerOptions
/// Handlers registered here take precedence over built-in handlers for the same method.
/// </para>
/// </remarks>
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
[Experimental(Experimentals.Extensibility_DiagnosticId, UrlFormat = Experimentals.Extensibility_Url)]
public IList<McpServerRequestHandler>? RequestHandlers { get; set; }
}

View file

@ -16,7 +16,7 @@ namespace ModelContextProtocol.Server;
/// <see cref="JsonNode"/> response, giving extensions full control over request/response serialization.
/// </para>
/// </remarks>
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
[Experimental(Experimentals.Extensibility_DiagnosticId, UrlFormat = Experimentals.Extensibility_Url)]
public sealed class McpServerRequestHandler
{
/// <summary>
@ -32,7 +32,7 @@ public sealed class McpServerRequestHandler
/// When set, Streamable HTTP servers require the request to include an <c>Mcp-Name</c>
/// header whose decoded value matches the string value of this parameter.
/// </remarks>
[Experimental(Experimentals.Subclassing_DiagnosticId, UrlFormat = Experimentals.Subclassing_Url)]
[Experimental(Experimentals.Extensibility_DiagnosticId, UrlFormat = Experimentals.Extensibility_Url)]
public string? RoutingNameParameter { get; init; }
/// <summary>