From 1a5732b1580dda1201a981b8e6646d78ee0d1976 Mon Sep 17 00:00:00 2001 From: ConanYao Date: Mon, 24 Mar 2025 10:30:39 +0800 Subject: [PATCH] docs: add McpServerOptionsSetup code comment (#77) --- .../Configuration/McpServerOptionsSetup.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ModelContextProtocol/Configuration/McpServerOptionsSetup.cs b/src/ModelContextProtocol/Configuration/McpServerOptionsSetup.cs index f4509d5..4132140 100644 --- a/src/ModelContextProtocol/Configuration/McpServerOptionsSetup.cs +++ b/src/ModelContextProtocol/Configuration/McpServerOptionsSetup.cs @@ -6,19 +6,31 @@ using ModelContextProtocol.Utils; namespace ModelContextProtocol.Configuration; +/// +/// Configures the McpServerOptions using provided server handlers. +/// +/// The server handlers configuration options. internal sealed class McpServerOptionsSetup(IOptions serverHandlers) : IConfigureOptions { + /// + /// Configures the given McpServerOptions instance by setting server information + /// and applying custom server handlers. + /// + /// The options instance to be configured. public void Configure(McpServerOptions options) { Throw.IfNull(options); var assemblyName = Assembly.GetEntryAssembly()?.GetName(); + + // Set server information based on the entry assembly options.ServerInfo = new Implementation { Name = assemblyName?.Name ?? "McpServer", Version = assemblyName?.Version?.ToString() ?? "1.0.0", }; + // Apply custom server handlers serverHandlers.Value.OverwriteWithSetHandlers(options); } }