Address some static analysis and TODOs (#12)

This commit is contained in:
Stephen Toub 2025-03-20 23:09:38 -04:00 • committed by GitHub
commit 33b9582199
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 132 additions and 123 deletions

View file

@ -30,10 +30,7 @@ public static partial class McpServerBuilderExtensions
/// <param name="builder">The builder instance.</param>
public static IMcpServerBuilder WithHttpListenerSseServerTransport(this IMcpServerBuilder builder)
{
if (builder is null)
{
throw new ArgumentNullException(nameof(builder));
}
Throw.IfNull(builder);
builder.Services.AddSingleton<IServerTransport, HttpListenerSseServerTransport>();
builder.Services.AddHostedService<McpServerHostedService>();

View file

@ -2,6 +2,7 @@
using ModelContextProtocol.Protocol.Types;
using ModelContextProtocol.Server;
using Microsoft.Extensions.Options;
using ModelContextProtocol.Utils;
namespace ModelContextProtocol.Configuration;
@ -9,10 +10,7 @@ internal sealed class McpServerOptionsSetup(IOptions<McpServerHandlers> serverHa
{
public void Configure(McpServerOptions options)
{
if (options is null)
{
throw new ArgumentNullException(nameof(options));
}
Throw.IfNull(options);
var assemblyName = Assembly.GetEntryAssembly()?.GetName();
options.ServerInfo = new Implementation