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:
Stephen Halter 2025-03-18 03:56:44 -07:00 • committed by GitHub
commit 90dfc35fbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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();
}