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:
parent
fe2ce2bc60
commit
38b4a26998
3 changed files with 5169 additions and 3786 deletions
|
|
@ -67,7 +67,7 @@ public partial class ElicitationTests : ClientServerTestBase
|
|||
[Fact]
|
||||
public async Task Can_Elicit_Information()
|
||||
{
|
||||
await using IMcpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
await using McpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
{
|
||||
Capabilities = new()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ModelContextProtocol.Client;
|
||||
using ModelContextProtocol.Protocol;
|
||||
using ModelContextProtocol.Server;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
@ -102,7 +101,7 @@ public partial class ElicitationTypedTests : ClientServerTestBase
|
|||
[Fact]
|
||||
public async Task Can_Elicit_Typed_Information()
|
||||
{
|
||||
await using IMcpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
await using McpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
{
|
||||
Capabilities = new()
|
||||
{
|
||||
|
|
@ -198,7 +197,7 @@ public partial class ElicitationTypedTests : ClientServerTestBase
|
|||
[Fact]
|
||||
public async Task Elicit_Typed_Respects_NamingPolicy()
|
||||
{
|
||||
await using IMcpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
await using McpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
{
|
||||
Capabilities = new()
|
||||
{
|
||||
|
|
@ -242,7 +241,7 @@ public partial class ElicitationTypedTests : ClientServerTestBase
|
|||
[Fact]
|
||||
public async Task Elicit_Typed_With_Unsupported_Property_Type_Throws()
|
||||
{
|
||||
await using IMcpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
await using McpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
{
|
||||
Capabilities = new()
|
||||
{
|
||||
|
|
@ -267,7 +266,7 @@ public partial class ElicitationTypedTests : ClientServerTestBase
|
|||
[Fact]
|
||||
public async Task Elicit_Typed_With_Nullable_Property_Type_Throws()
|
||||
{
|
||||
await using IMcpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
await using McpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
{
|
||||
Capabilities = new()
|
||||
{
|
||||
|
|
@ -290,7 +289,7 @@ public partial class ElicitationTypedTests : ClientServerTestBase
|
|||
[Fact]
|
||||
public async Task Elicit_Typed_With_NonObject_Generic_Type_Throws()
|
||||
{
|
||||
await using IMcpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
await using McpClient client = await CreateMcpClientForServer(new McpClientOptions
|
||||
{
|
||||
Capabilities = new()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class NotificationHandlerTests : ClientServerTestBase
|
|||
public async Task RegistrationsAreRemovedWhenDisposed()
|
||||
{
|
||||
const string NotificationName = "somethingsomething";
|
||||
await using IMcpClient client = await CreateMcpClientForServer();
|
||||
await using McpClient client = await CreateMcpClientForServer();
|
||||
|
||||
const int Iterations = 10;
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ public class NotificationHandlerTests : ClientServerTestBase
|
|||
public async Task MultipleRegistrationsResultInMultipleCallbacks()
|
||||
{
|
||||
const string NotificationName = "somethingsomething";
|
||||
await using IMcpClient client = await CreateMcpClientForServer();
|
||||
await using McpClient client = await CreateMcpClientForServer();
|
||||
|
||||
const int RegistrationCount = 10;
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ public class NotificationHandlerTests : ClientServerTestBase
|
|||
public async Task MultipleHandlersRunEvenIfOneThrows()
|
||||
{
|
||||
const string NotificationName = "somethingsomething";
|
||||
await using IMcpClient client = await CreateMcpClientForServer();
|
||||
await using McpClient client = await CreateMcpClientForServer();
|
||||
|
||||
const int RegistrationCount = 10;
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ public class NotificationHandlerTests : ClientServerTestBase
|
|||
public async Task DisposeAsyncDoesNotCompleteWhileNotificationHandlerRuns(int numberOfDisposals)
|
||||
{
|
||||
const string NotificationName = "somethingsomething";
|
||||
await using IMcpClient client = await CreateMcpClientForServer();
|
||||
await using McpClient client = await CreateMcpClientForServer();
|
||||
|
||||
var handlerRunning = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
var releaseHandler = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
|
@ -163,7 +163,7 @@ public class NotificationHandlerTests : ClientServerTestBase
|
|||
public async Task DisposeAsyncCompletesImmediatelyWhenInvokedFromHandler(int numberOfDisposals)
|
||||
{
|
||||
const string NotificationName = "somethingsomething";
|
||||
await using IMcpClient client = await CreateMcpClientForServer();
|
||||
await using McpClient client = await CreateMcpClientForServer();
|
||||
|
||||
var handlerRunning = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
var releaseHandler = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
|
|
|
|||
Loading…
Reference in a new issue