Remove ExperimentalAttribute from official Extensions/Tasks/MRTR APIs and align MCPEXP001 usage (#1642)
This commit is contained in:
parent
e7b450efc1
commit
90c853103d
16 changed files with 9 additions and 62 deletions
|
|
@ -27,7 +27,7 @@ If you use experimental APIs, you will get one of the diagnostics shown below. T
|
||||||
|
|
||||||
| Diagnostic ID | Description |
|
| Diagnostic ID | Description |
|
||||||
| :------------ | :---------- |
|
| :------------ | :---------- |
|
||||||
| `MCPEXP001` | Experimental APIs for features in the MCP specification itself, including Tasks and Extensions. Tasks provide a mechanism for asynchronous long-running operations that can be polled for status and results (see [SEP-2663](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/seps/2663-tasks-extension.md)). Extensions provide a framework for extending the Model Context Protocol while maintaining interoperability (see [SEP-2133](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2133)). |
|
| `MCPEXP001` | Experimental APIs tied to MCP specification features. Reuse this ID for newly introduced experimental spec features, and add feature-specific messages/URLs in `Experimentals`. |
|
||||||
| `MCPEXP002` | Experimental SDK APIs unrelated to the MCP specification itself, including subclassing `McpClient`/`McpServer` (see [#1363](https://github.com/modelcontextprotocol/csharp-sdk/pull/1363)) and `RunSessionHandler`, which may be removed or change signatures in a future release (consider using `ConfigureSessionOptions` instead). |
|
| `MCPEXP002` | Experimental SDK APIs unrelated to the MCP specification itself, including subclassing `McpClient`/`McpServer` (see [#1363](https://github.com/modelcontextprotocol/csharp-sdk/pull/1363)) and `RunSessionHandler`, which may be removed or change signatures in a future release (consider using `ConfigureSessionOptions` instead). |
|
||||||
| `MCPEXP003` | Experimental MCP Apps extension APIs. MCP Apps is the first official MCP extension (`io.modelcontextprotocol/ui`), enabling servers to deliver interactive UIs inside AI clients (see [MCP Apps specification](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx)). |
|
| `MCPEXP003` | Experimental MCP Apps extension APIs. MCP Apps is the first official MCP extension (`io.modelcontextprotocol/ui`), enabling servers to deliver interactive UIs inside AI clients (see [MCP Apps specification](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx)). |
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ namespace ModelContextProtocol;
|
||||||
/// Experimental diagnostic IDs are grouped by category:
|
/// Experimental diagnostic IDs are grouped by category:
|
||||||
/// <list type="bullet">
|
/// <list type="bullet">
|
||||||
/// <item><description>
|
/// <item><description>
|
||||||
/// <c>MCPEXP001</c> covers APIs related to experimental features in the MCP specification itself,
|
/// <c>MCPEXP001</c> covers APIs related to experimental features in the MCP specification itself.
|
||||||
/// such as Extensions. These APIs may change as the specification evolves.
|
/// These APIs may change as the specification evolves.
|
||||||
/// </description></item>
|
/// </description></item>
|
||||||
/// <item><description>
|
/// <item><description>
|
||||||
/// <c>MCPEXP002</c> covers experimental SDK APIs that are unrelated to the MCP specification,
|
/// <c>MCPEXP002</c> covers experimental SDK APIs that are unrelated to the MCP specification,
|
||||||
|
|
@ -36,19 +36,13 @@ namespace ModelContextProtocol;
|
||||||
internal static class Experimentals
|
internal static class Experimentals
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Diagnostic ID for the experimental MCP Extensions feature.
|
/// Diagnostic ID for experimental MCP specification features.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string Extensions_DiagnosticId = "MCPEXP001";
|
/// <remarks>
|
||||||
|
/// When introducing a new experimental specification feature, add feature-specific message
|
||||||
/// <summary>
|
/// and URL constants that use this diagnostic ID.
|
||||||
/// Message for the experimental MCP Extensions feature.
|
/// </remarks>
|
||||||
/// </summary>
|
public const string SpecificationFeature_DiagnosticId = "MCPEXP001";
|
||||||
public const string Extensions_Message = "The Extensions feature is part of a future MCP specification version that has not yet been ratified and is subject to change.";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// URL for the experimental MCP Extensions feature.
|
|
||||||
/// </summary>
|
|
||||||
public const string Extensions_Url = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp001";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Diagnostic ID for experimental MCP Apps extension APIs.
|
/// Diagnostic ID for experimental MCP Apps extension APIs.
|
||||||
|
|
@ -110,22 +104,4 @@ internal static class Experimentals
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string RunSessionHandler_Url = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp002";
|
public const string RunSessionHandler_Url = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp002";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Diagnostic ID for the experimental Multi Round-Trip Requests (MRTR) feature.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// This uses the same diagnostic ID as <see cref="Extensions_DiagnosticId"/> because MRTR
|
|
||||||
/// is an experimental feature in the MCP specification (SEP-2322).
|
|
||||||
/// </remarks>
|
|
||||||
public const string Mrtr_DiagnosticId = "MCPEXP001";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Message for the experimental MRTR feature.
|
|
||||||
/// </summary>
|
|
||||||
public const string Mrtr_Message = "The Multi Round-Trip Requests (MRTR) feature is experimental per the MCP specification (SEP-2322) and is subject to change.";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// URL for the experimental MRTR feature.
|
|
||||||
/// </summary>
|
|
||||||
public const string Mrtr_Url = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp001";
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using ModelContextProtocol.Client;
|
using ModelContextProtocol.Client;
|
||||||
using ModelContextProtocol.Server;
|
using ModelContextProtocol.Server;
|
||||||
|
|
@ -84,7 +83,6 @@ public sealed class ClientCapabilities
|
||||||
/// interoperability. Clients advertise extension support via this field during the initialization handshake.
|
/// interoperability. Clients advertise extension support via this field during the initialization handshake.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public IDictionary<string, object>? Extensions
|
public IDictionary<string, object>? Extensions
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
|
@ -20,7 +19,6 @@ namespace ModelContextProtocol.Protocol;
|
||||||
/// parameters can be accessed via the typed accessor properties.
|
/// parameters can be accessed via the typed accessor properties.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
|
||||||
[JsonConverter(typeof(Converter))]
|
[JsonConverter(typeof(Converter))]
|
||||||
public sealed class InputRequest
|
public sealed class InputRequest
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace ModelContextProtocol.Protocol;
|
namespace ModelContextProtocol.Protocol;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -54,7 +52,6 @@ namespace ModelContextProtocol.Protocol;
|
||||||
/// }
|
/// }
|
||||||
/// </code>
|
/// </code>
|
||||||
/// </example>
|
/// </example>
|
||||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
|
||||||
public class InputRequiredException : Exception
|
public class InputRequiredException : Exception
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace ModelContextProtocol.Protocol;
|
namespace ModelContextProtocol.Protocol;
|
||||||
|
|
@ -22,7 +21,6 @@ namespace ModelContextProtocol.Protocol;
|
||||||
/// This type is part of the Multi Round-Trip Requests (MRTR) mechanism defined in SEP-2322.
|
/// This type is part of the Multi Round-Trip Requests (MRTR) mechanism defined in SEP-2322.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
|
||||||
public sealed class InputRequiredResult : Result
|
public sealed class InputRequiredResult : Result
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Text.Json.Serialization.Metadata;
|
using System.Text.Json.Serialization.Metadata;
|
||||||
|
|
@ -21,7 +20,6 @@ namespace ModelContextProtocol.Protocol;
|
||||||
/// the corresponding <see cref="InputRequest.Method"/> key in the <see cref="InputRequiredResult.InputRequests"/> map.
|
/// the corresponding <see cref="InputRequest.Method"/> key in the <see cref="InputRequiredResult.InputRequests"/> map.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
|
||||||
[JsonConverter(typeof(Converter))]
|
[JsonConverter(typeof(Converter))]
|
||||||
public sealed class InputResponse
|
public sealed class InputResponse
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text.Json.Nodes;
|
using System.Text.Json.Nodes;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
|
@ -36,7 +35,6 @@ public abstract class RequestParams
|
||||||
/// the value is the client's response to that input request.
|
/// the value is the client's response to that input request.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public IDictionary<string, InputResponse>? InputResponses
|
public IDictionary<string, InputResponse>? InputResponses
|
||||||
{
|
{
|
||||||
|
|
@ -59,7 +57,6 @@ public abstract class RequestParams
|
||||||
/// exact value without modification.
|
/// exact value without modification.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string? RequestState
|
public string? RequestState
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using ModelContextProtocol.Server;
|
using ModelContextProtocol.Server;
|
||||||
|
|
||||||
|
|
@ -82,7 +81,6 @@ public sealed class ServerCapabilities
|
||||||
/// interoperability. Servers advertise extension support via this field during the initialization handshake.
|
/// interoperability. Servers advertise extension support via this field during the initialization handshake.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public IDictionary<string, object>? Extensions
|
public IDictionary<string, object>? Extensions
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using ModelContextProtocol.Protocol;
|
using ModelContextProtocol.Protocol;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace ModelContextProtocol.Server;
|
namespace ModelContextProtocol.Server;
|
||||||
|
|
@ -31,7 +30,6 @@ namespace ModelContextProtocol.Server;
|
||||||
/// specification for details on the tasks extension.
|
/// specification for details on the tasks extension.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
|
||||||
public interface IMcpTaskStore
|
public interface IMcpTaskStore
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
using ModelContextProtocol.Protocol;
|
using ModelContextProtocol.Protocol;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace ModelContextProtocol.Server;
|
namespace ModelContextProtocol.Server;
|
||||||
|
|
@ -20,7 +19,6 @@ namespace ModelContextProtocol.Server;
|
||||||
/// implement a custom <see cref="IMcpTaskStore"/>.
|
/// implement a custom <see cref="IMcpTaskStore"/>.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
|
||||||
public class InMemoryMcpTaskStore : IMcpTaskStore
|
public class InMemoryMcpTaskStore : IMcpTaskStore
|
||||||
{
|
{
|
||||||
private readonly ConcurrentDictionary<string, McpTaskInfo> _tasks = new();
|
private readonly ConcurrentDictionary<string, McpTaskInfo> _tasks = new();
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
||||||
using ModelContextProtocol.Protocol;
|
using ModelContextProtocol.Protocol;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace ModelContextProtocol.Server;
|
namespace ModelContextProtocol.Server;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides data for the <see cref="IMcpTaskStore.InputResponseReceived"/> event.
|
/// Provides data for the <see cref="IMcpTaskStore.InputResponseReceived"/> event.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
|
||||||
public sealed class InputResponseReceivedEventArgs
|
public sealed class InputResponseReceivedEventArgs
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -600,7 +600,6 @@ public abstract partial class McpServer : McpSession
|
||||||
/// <param name="taskId">The task ID in the store.</param>
|
/// <param name="taskId">The task ID in the store.</param>
|
||||||
/// <param name="store">The task store to write input requests to.</param>
|
/// <param name="store">The task store to write input requests to.</param>
|
||||||
/// <returns>An <see cref="IDisposable"/> that restores the previous context when disposed.</returns>
|
/// <returns>An <see cref="IDisposable"/> that restores the previous context when disposed.</returns>
|
||||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
|
||||||
public IDisposable CreateMcpTaskScope(
|
public IDisposable CreateMcpTaskScope(
|
||||||
string taskId,
|
string taskId,
|
||||||
IMcpTaskStore store)
|
IMcpTaskStore store)
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,6 @@ public abstract partial class McpServer : McpSession
|
||||||
/// the required feature) instead of throwing <see cref="Protocol.InputRequiredException"/>.
|
/// the required feature) instead of throwing <see cref="Protocol.InputRequiredException"/>.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Experimental(Experimentals.Mrtr_DiagnosticId, UrlFormat = Experimentals.Mrtr_Url)]
|
|
||||||
public virtual bool IsMrtrSupported => false;
|
public virtual bool IsMrtrSupported => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
|
|
||||||
namespace ModelContextProtocol.Server;
|
namespace ModelContextProtocol.Server;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -9,7 +7,6 @@ namespace ModelContextProtocol.Server;
|
||||||
/// and <see cref="McpServer.RequestRootsAsync(ModelContextProtocol.Protocol.ListRootsRequestParams, CancellationToken)"/>
|
/// and <see cref="McpServer.RequestRootsAsync(ModelContextProtocol.Protocol.ListRootsRequestParams, CancellationToken)"/>
|
||||||
/// are redirected through the task store as input requests rather than sent directly to the client.
|
/// are redirected through the task store as input requests rather than sent directly to the client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
|
||||||
internal sealed class McpTaskExecutionContext
|
internal sealed class McpTaskExecutionContext
|
||||||
{
|
{
|
||||||
internal static readonly AsyncLocal<McpTaskExecutionContext?> Current = new();
|
internal static readonly AsyncLocal<McpTaskExecutionContext?> Current = new();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
using ModelContextProtocol.Protocol;
|
using ModelContextProtocol.Protocol;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace ModelContextProtocol.Server;
|
namespace ModelContextProtocol.Server;
|
||||||
|
|
@ -14,7 +13,6 @@ namespace ModelContextProtocol.Server;
|
||||||
/// types (<see cref="CreateTaskResult"/>, <see cref="GetTaskResult"/>) when communicating with clients.
|
/// types (<see cref="CreateTaskResult"/>, <see cref="GetTaskResult"/>) when communicating with clients.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[Experimental(Experimentals.Extensions_DiagnosticId, UrlFormat = Experimentals.Extensions_Url)]
|
|
||||||
public sealed record McpTaskInfo(
|
public sealed record McpTaskInfo(
|
||||||
string TaskId,
|
string TaskId,
|
||||||
McpTaskStatus Status,
|
McpTaskStatus Status,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue