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
|
|
@ -280,9 +280,9 @@ public class McpServerTests
|
|||
await Can_Handle_Requests(
|
||||
serverCapabilities: null,
|
||||
method: "completion/complete",
|
||||
configureOptions: options => options with
|
||||
configureOptions: options =>
|
||||
{
|
||||
GetCompletionHandler = (request, ct) =>
|
||||
options.GetCompletionHandler = (request, ct) =>
|
||||
Task.FromResult(new CompleteResult
|
||||
{
|
||||
Completion = new()
|
||||
|
|
@ -291,7 +291,7 @@ public class McpServerTests
|
|||
Total = 2,
|
||||
HasMore = true
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
assertResult: response =>
|
||||
{
|
||||
|
|
@ -518,14 +518,11 @@ public class McpServerTests
|
|||
await Throws_Exception_If_No_Handler_Assigned(new ServerCapabilities { Tools = new() }, "tools/call", "CallTool handler not configured");
|
||||
}
|
||||
|
||||
private async Task Can_Handle_Requests(ServerCapabilities? serverCapabilities, string method, Func<McpServerOptions, McpServerOptions>? configureOptions, Action<object> assertResult)
|
||||
private async Task Can_Handle_Requests(ServerCapabilities? serverCapabilities, string method, Action<McpServerOptions>? configureOptions, Action<object> assertResult)
|
||||
{
|
||||
await using var transport = new TestServerTransport();
|
||||
var options = CreateOptions(serverCapabilities);
|
||||
if (configureOptions is not null)
|
||||
{
|
||||
options = configureOptions(options);
|
||||
}
|
||||
configureOptions?.Invoke(options);
|
||||
|
||||
await using var server = new McpServer(transport, options, _loggerFactory.Object, _serviceProvider);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue