Restructure IMcpEndpoint, IMcpClient, and IMcpServer (#723)

* Remove `McpEndpoint` & `IMcpClient`

* Revise naming, add abstract classes

* Fix missing renames

* Move extension methods to instance methods

* Add back old API, but obsoleted

* Add back obsoleted factory classes

* Move deprecation attributes

* `SseClientTransport` -> `HttpClientTransport`

* Update src/ModelContextProtocol.Core/Server/AugmentedServiceProvider.cs

Co-authored-by: Stephen Halter <halter73@gmail.com>

* PR feedback

* PR feedback

* Add back dispose lock

* Fix docs projects

* PR feedback

* Undo `docs/*.md` changes

---------

Co-authored-by: Stephen Halter <halter73@gmail.com>
This commit is contained in:
Mackinnon Buck 2025-09-16 13:22:10 -04:00 • committed by GitHub
commit 38b4a26998
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 5169 additions and 3786 deletions

View file

@ -44,7 +44,7 @@ public sealed class ClientCapabilities
/// server requests for listing root URIs. Root URIs serve as entry points for resource navigation in the protocol.
/// </para>
/// <para>
/// The server can use <see cref="McpServerExtensions.RequestRootsAsync"/> to request the list of
/// The server can use <see cref="McpServer.RequestRootsAsync"/> to request the list of
/// available roots from the client, which will trigger the client's <see cref="RootsCapability.RootsHandler"/>.
/// </para>
/// </remarks>
@ -78,7 +78,7 @@ public sealed class ClientCapabilities
/// </para>
/// <para>
/// Handlers provided via <see cref="NotificationHandlers"/> will be registered with the client for the lifetime of the client.
/// For transient handlers, <see cref="IMcpEndpoint.RegisterNotificationHandler"/> may be used to register a handler that can
/// For transient handlers, <see cref="McpSession.RegisterNotificationHandler"/> may be used to register a handler that can
/// then be unregistered by disposing of the <see cref="IAsyncDisposable"/> returned from the method.
/// </para>
/// </remarks>

View file

@ -62,8 +62,8 @@ public interface ITransport : IAsyncDisposable
/// </para>
/// <para>
/// This is a core method used by higher-level abstractions in the MCP protocol implementation.
/// Most client code should use the higher-level methods provided by <see cref="IMcpEndpoint"/>,
/// <see cref="McpEndpointExtensions"/>, <see cref="McpClientExtensions"/>, or <see cref="McpServerExtensions"/>,
/// Most client code should use the higher-level methods provided by <see cref="McpSession"/>,
/// <see cref="McpClient"/>, or <see cref="McpServer"/>,
/// rather than accessing this method directly.
/// </para>
/// </remarks>

View file

@ -29,7 +29,7 @@ public class JsonRpcMessageContext
/// </summary>
/// <remarks>
/// This is used to support the Streamable HTTP transport in its default stateful mode. In this mode,
/// the <see cref="IMcpServer"/> outlives the initial HTTP request context it was created on, and new
/// the <see cref="McpServer"/> outlives the initial HTTP request context it was created on, and new
/// JSON-RPC messages can originate from future HTTP requests. This allows the transport to flow the
/// context with the JSON-RPC message. This is particularly useful for enabling IHttpContextAccessor
/// in tool calls.

View file

@ -12,7 +12,7 @@ namespace ModelContextProtocol.Protocol;
/// </summary>
/// <remarks>
/// <para>
/// References are commonly used with <see cref="McpClientExtensions.CompleteAsync"/> to request completion suggestions for arguments,
/// References are commonly used with <see cref="McpClient.CompleteAsync"/> to request completion suggestions for arguments,
/// and with other methods that need to reference resources or prompts.
/// </para>
/// <para>

View file

@ -34,7 +34,7 @@ public sealed class SamplingCapability
/// generated content.
/// </para>
/// <para>
/// You can create a handler using the <see cref="McpClientExtensions.CreateSamplingHandler"/> extension
/// You can create a handler using the <see cref="McpClient.CreateSamplingHandler"/> extension
/// method with any implementation of <see cref="IChatClient"/>.
/// </para>
/// </remarks>

View file

@ -77,7 +77,7 @@ public sealed class ServerCapabilities
/// </para>
/// <para>
/// Handlers provided via <see cref="NotificationHandlers"/> will be registered with the server for the lifetime of the server.
/// For transient handlers, <see cref="IMcpEndpoint.RegisterNotificationHandler"/> may be used to register a handler that can
/// For transient handlers, <see cref="McpSession.RegisterNotificationHandler"/> may be used to register a handler that can
/// then be unregistered by disposing of the <see cref="IAsyncDisposable"/> returned from the method.
/// </para>
/// </remarks>