File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/ModelContextProtocol/Configuration Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 6
6
7
7
namespace ModelContextProtocol . Configuration ;
8
8
9
+ /// <summary>
10
+ /// Configures the McpServerOptions using provided server handlers.
11
+ /// </summary>
12
+ /// <param name="serverHandlers">The server handlers configuration options.</param>
9
13
internal sealed class McpServerOptionsSetup ( IOptions < McpServerHandlers > serverHandlers ) : IConfigureOptions < McpServerOptions >
10
14
{
15
+ /// <summary>
16
+ /// Configures the given McpServerOptions instance by setting server information
17
+ /// and applying custom server handlers.
18
+ /// </summary>
19
+ /// <param name="options">The options instance to be configured.</param>
11
20
public void Configure ( McpServerOptions options )
12
21
{
13
22
Throw . IfNull ( options ) ;
14
23
15
24
var assemblyName = Assembly . GetEntryAssembly ( ) ? . GetName ( ) ;
25
+
26
+ // Set server information based on the entry assembly
16
27
options . ServerInfo = new Implementation
17
28
{
18
29
Name = assemblyName ? . Name ?? "McpServer" ,
19
30
Version = assemblyName ? . Version ? . ToString ( ) ?? "1.0.0" ,
20
31
} ;
21
32
33
+ // Apply custom server handlers
22
34
serverHandlers . Value . OverwriteWithSetHandlers ( options ) ;
23
35
}
24
36
}
You can’t perform that action at this time.
0 commit comments