Skip to content
This repository was archived by the owner on Mar 21, 2025. It is now read-only.

Commit b2773b1

Browse files
committed
Fix test errors caused by not rebasing the HttpLister changes on factory overhaul commit
1 parent 2d73e04 commit b2773b1

File tree

6 files changed

+258
-262
lines changed

6 files changed

+258
-262
lines changed

samples/TestServerWithHosting/Program.cs

+3-10
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,9 @@
1717

1818
var builder = Host.CreateApplicationBuilder(args);
1919
builder.Services.AddSerilog();
20-
builder.Services.AddMcpServer(options =>
21-
{
22-
options.Capabilities = new()
23-
{
24-
Tools = new()
25-
};
26-
})
27-
.WithStdioServerTransport()
28-
.WithTools();
29-
//.WithCallToolHandler((r, ct) => Task.FromResult(new McpDotNet.Protocol.Types.CallToolResponse()));
20+
builder.Services.AddMcpServer()
21+
.WithStdioServerTransport()
22+
.WithTools();
3023

3124
var app = builder.Build();
3225

src/mcpdotnet/Configuration/McpServerServiceCollectionExtension.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public static IMcpServerBuilder AddMcpServer(this IServiceCollection services, A
2323
services.AddSingleton(services =>
2424
{
2525
IServerTransport serverTransport = services.GetRequiredService<IServerTransport>();
26-
McpServerOptions options = services.GetRequiredService<McpServerOptions>();
26+
IOptions<McpServerOptions> options = services.GetRequiredService<IOptions<McpServerOptions>>();
2727
ILoggerFactory? loggerFactory = services.GetService<ILoggerFactory>();
2828

29-
return McpServerFactory.Create(serverTransport, options, loggerFactory, services);
29+
return McpServerFactory.Create(serverTransport, options.Value, loggerFactory, services);
3030
});
3131

3232
services.AddOptions();

0 commit comments

Comments
 (0)