Skip to content

Commit 0638ba4

Browse files
committed
Use TryAddEnumerable for McpServerOptionsSetup
1 parent cae5dff commit 0638ba4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ModelContextProtocol/Configuration/McpServerServiceCollectionExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using ModelContextProtocol.Server;
22
using Microsoft.Extensions.Options;
3+
using Microsoft.Extensions.DependencyInjection.Extensions;
34

45
namespace Microsoft.Extensions.DependencyInjection;
56

@@ -17,7 +18,7 @@ public static class McpServerServiceCollectionExtensions
1718
public static IMcpServerBuilder AddMcpServer(this IServiceCollection services, Action<McpServerOptions>? configureOptions = null)
1819
{
1920
services.AddOptions();
20-
services.AddTransient<IConfigureOptions<McpServerOptions>, McpServerOptionsSetup>();
21+
services.TryAddEnumerable(ServiceDescriptor.Transient<IConfigureOptions<McpServerOptions>, McpServerOptionsSetup>());
2122
if (configureOptions is not null)
2223
{
2324
services.Configure(configureOptions);

0 commit comments

Comments
 (0)