Add AspNetCoreSseServer sample (#81)
* Add AspNetCoreSseMcpTransport sample * Fix build errors after rebase * React to McpServerFactory changes * Make Utf8JsonWriter non thread static * Fix test errors caused by not rebasing the HttpLister changes on factory overhaul commit
This commit is contained in:
parent
b5a26e4c33
commit
90dfc35fbd
1 changed files with 635 additions and 332 deletions
|
|
@ -11,7 +11,6 @@ public class SseServerIntegrationTestFixture : IDisposable
|
|||
private Process _process;
|
||||
|
||||
public ILoggerFactory LoggerFactory { get; }
|
||||
public McpClientFactory Factory { get; }
|
||||
public McpClientOptions DefaultOptions { get; }
|
||||
public McpServerConfig DefaultConfig { get; }
|
||||
|
||||
|
|
@ -24,7 +23,6 @@ public class SseServerIntegrationTestFixture : IDisposable
|
|||
DefaultOptions = new()
|
||||
{
|
||||
ClientInfo = new() { Name = "IntegrationTestClient", Version = "1.0.0" },
|
||||
Capabilities = new() { Sampling = new(), Roots = new() }
|
||||
};
|
||||
|
||||
DefaultConfig = new McpServerConfig
|
||||
|
|
@ -36,13 +34,6 @@ public class SseServerIntegrationTestFixture : IDisposable
|
|||
Location = "http://localhost:3001/sse"
|
||||
};
|
||||
|
||||
// Inject the mock transport into the factory
|
||||
Factory = new McpClientFactory(
|
||||
[DefaultConfig],
|
||||
DefaultOptions,
|
||||
LoggerFactory
|
||||
);
|
||||
|
||||
Start();
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +61,7 @@ public class SseServerIntegrationTestFixture : IDisposable
|
|||
{
|
||||
try
|
||||
{
|
||||
var client = Factory.GetClientAsync("test_server").Result;
|
||||
var client = McpClientFactory.CreateAsync(DefaultConfig, DefaultOptions, loggerFactory: LoggerFactory).GetAwaiter().GetResult();
|
||||
client.DisposeAsync().AsTask().Wait();
|
||||
LoggerFactory?.Dispose();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue