Skip to content
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f636f4b
Initial plan
Copilot Nov 18, 2025
701597c
Remove internal usages of obsolete capability properties
Copilot Nov 18, 2025
d826cd3
Remove all obsolete API definitions and related tests
Copilot Nov 18, 2025
cd8f7ae
Merge main branch and resolve conflicts
Copilot Nov 19, 2025
3d20111
Merge remote-tracking branch 'origin/main' into copilot/remove-obsole…
Copilot Nov 19, 2025
eb31afb
Remove unused duplicate CreateSamplingHandler and helper methods from…
Copilot Nov 19, 2025
c7deb7f
Delete empty McpEndpointExtensions and McpServerExtensions classes
Copilot Nov 19, 2025
4d6fe0a
Remove obsolete IMcpEndpoint, IMcpClient, IMcpServer interfaces and M…
Copilot Nov 19, 2025
2decb2d
Remove extra newlines before closing braces in capability classes
Copilot Nov 19, 2025
4443cfc
Merge main branch and resolve conflicts (PR #976 integration)
Copilot Nov 20, 2025
44083aa
Revert "Merge main branch and resolve conflicts (PR #976 integration)"
MackinnonBuck Nov 20, 2025
cd9ce13
Merge remote-tracking branch 'origin/main' into copilot/remove-obsole…
MackinnonBuck Nov 20, 2025
93a6877
Remove remaining obsolete EnumSchema and LegacyTitledEnumSchema types…
Copilot Nov 21, 2025
186d85c
Restore EnumSchemaTests.cs and add back valid enum schema tests witho…
Copilot Nov 21, 2025
04e1326
Revert: "Remove remaining obsolete EnumSchema and LegacyTitledEnumSch…
jeffhandley Nov 26, 2025
40df946
Merge branch 'main' into copilot/remove-obsolete-apis
jeffhandley Nov 26, 2025
3c29253
Introduce Obsoletions/Experimentals pattern for custom diagnostics.
jeffhandley Nov 26, 2025
6fcf81c
Fix failing enum schema tests
jeffhandley Nov 26, 2025
981386e
Merge branch 'main' into copilot/remove-obsolete-apis
jeffhandley Nov 27, 2025
95708d6
Revise diagnostic ID ranges for analyzers, obsoletions, experimentals
jeffhandley Nov 27, 2025
7e074f8
Fix XML comment reference to RegisterNotificationHandler
jeffhandley Nov 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/Common/Experimentals.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Diagnostics.CodeAnalysis;

namespace ModelContextProtocol;

/// <summary>
/// Defines diagnostic IDs, Messages, and Urls for APIs annotated with <see cref="ExperimentalAttribute"/>.
/// </summary>
/// <remarks>
/// When an experimental API is associated with an experimental specification, the message
/// should refer to the specification version that introduces the feature and the SEP
/// when available. If there is a SEP associated with the experimental API, the Url should
/// point to the SEP issue.
/// <para>
/// Diagnostic IDs cannot be reused when experimental API are removed or promoted to stable.
/// This ensures that users do not suppress warnings for new diagnostics with existing
/// suppressions that might be left in place from prior uses of the same diagnostic ID.
/// </para>
/// </remarks>
internal static class Experimentals
{
// public const string Tasks_DiagnosticId = "MCP50001";
// public const string Tasks_Message = "The Tasks feature is experimental within specification version 2025-11-25 and is subject to change. See SEP-1686 for more information.";
// public const string Tasks_Url = "https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1686";
}
22 changes: 22 additions & 0 deletions src/Common/Obsoletions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
namespace ModelContextProtocol;

/// <summary>
/// Defines diagnostic IDs, Messages, and Urls for APIs annotated with <see cref="ObsoleteAttribute"/>.
/// </summary>
/// <remarks>
/// When a deprecated API is associated with an specification change, the message
/// should refer to the specification version that introduces the change and the SEP
/// when available. If there is a SEP associated with the experimental API, the Url should
/// point to the SEP issue.
/// <para>
/// Diagnostic IDs cannot be reused when obsolete APIs are removed or restored.
/// This ensures that users do not suppress warnings for new diagnostics with existing
/// suppressions that might be left in place from prior uses of the same diagnostic ID.
/// </para>
/// </remarks>
internal static class Obsoletions
{
public const string LegacyTitledEnumSchema_DiagnosticId = "MCP00001";
public const string LegacyTitledEnumSchema_Message = "The EnumSchema and LegacyTitledEnumSchema APIs are deprecated as of specification version 2025-11-25 and will be removed in a future major version. See SEP-1330 for more information.";
public const string LegacyTitledEnumSchema_Url = "https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1330";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#if !NET
namespace System.Diagnostics.CodeAnalysis;

/// <summary>
/// Indicates that an API is experimental and it may change in the future.
/// </summary>
/// <remarks>
/// This attribute allows call sites to be flagged with a diagnostic that indicates that an experimental
/// feature is used. Authors can use this attribute to ship preview features in their assemblies.
/// </remarks>
[AttributeUsage(AttributeTargets.Assembly |
AttributeTargets.Module |
AttributeTargets.Class |
AttributeTargets.Struct |
AttributeTargets.Enum |
AttributeTargets.Constructor |
AttributeTargets.Method |
AttributeTargets.Property |
AttributeTargets.Field |
AttributeTargets.Event |
AttributeTargets.Interface |
AttributeTargets.Delegate, Inherited = false)]
internal sealed class ExperimentalAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="ExperimentalAttribute"/> class, specifying the ID that the compiler will use
/// when reporting a use of the API the attribute applies to.
/// </summary>
/// <param name="diagnosticId">The ID that the compiler will use when reporting a use of the API the attribute applies to.</param>
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}

/// <summary>
/// Gets the ID that the compiler will use when reporting a use of the API the attribute applies to.
/// </summary>
/// <value>The unique diagnostic ID.</value>
/// <remarks>
/// The diagnostic ID is shown in build output for warnings and errors.
/// <para>This property represents the unique ID that can be used to suppress the warnings or errors, if needed.</para>
/// </remarks>
public string DiagnosticId { get; }

/// <summary>
/// Gets or sets an optional message associated with the experimental attribute.
/// </summary>
/// <value>The message that provides additional information about the experimental feature.</value>
/// <remarks>
/// This message can be used to provide more context or guidance about the experimental feature.
/// </remarks>
public string? Message { get; set; }

/// <summary>
/// Gets or sets the URL for corresponding documentation.
/// The API accepts a format string instead of an actual URL, creating a generic URL that includes the diagnostic ID.
/// </summary>
/// <value>The format string that represents a URL to corresponding documentation.</value>
/// <remarks>An example format string is <c>https://contoso.com/obsoletion-warnings/{0}</c>.</remarks>
public string? UrlFormat { get; set; }
}
#endif
38 changes: 38 additions & 0 deletions src/Common/Polyfills/System/ObsoleteAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#if !NET
namespace System;

/// <summary>
/// Marks program elements that are no longer in use.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum |
AttributeTargets.Interface | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Delegate,
Inherited = false)]
internal sealed class ObsoleteAttribute : Attribute
{
public ObsoleteAttribute()
{
}

public ObsoleteAttribute(string? message)
{
Message = message;
}

public ObsoleteAttribute(string? message, bool error)
{
Message = message;
IsError = error;
}

public string? Message { get; }

public bool IsError { get; }

public string? DiagnosticId { get; set; }

public string? UrlFormat { get; set; }
}
#endif
50 changes: 0 additions & 50 deletions src/ModelContextProtocol.Core/Client/IMcpClient.cs

This file was deleted.

4 changes: 1 addition & 3 deletions src/ModelContextProtocol.Core/Client/McpClient.Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ namespace ModelContextProtocol.Client;
/// <summary>
/// Represents an instance of a Model Context Protocol (MCP) client session that connects to and communicates with an MCP server.
/// </summary>
#pragma warning disable CS0618 // Type or member is obsolete
public abstract partial class McpClient : McpSession, IMcpClient
#pragma warning restore CS0618 // Type or member is obsolete
public abstract partial class McpClient : McpSession
{
/// <summary>Creates an <see cref="McpClient"/>, connecting it to the specified server.</summary>
/// <param name="clientTransport">The transport instance used to communicate with the server.</param>
Expand Down
4 changes: 1 addition & 3 deletions src/ModelContextProtocol.Core/Client/McpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ namespace ModelContextProtocol.Client;
/// <summary>
/// Represents an instance of a Model Context Protocol (MCP) client session that connects to and communicates with an MCP server.
/// </summary>
#pragma warning disable CS0618 // Type or member is obsolete
public abstract partial class McpClient : McpSession, IMcpClient
#pragma warning restore CS0618 // Type or member is obsolete
public abstract partial class McpClient : McpSession
{
/// <summary>
/// Gets the capabilities supported by the connected server.
Expand Down
Loading
Loading