Skip to content

Commit fd9233b

Browse files
committed
Lazily construct McpServerFilters
1 parent f93a06c commit fd9233b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/ModelContextProtocol.Core/Server/McpServerOptions.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,15 @@ public sealed class McpServerOptions
9090
/// of various MCP server handlers. The first filter added is the outermost (first to execute),
9191
/// and each subsequent filter wraps closer to the handler.
9292
/// </remarks>
93-
public McpServerFilters Filters { get; } = new();
93+
public McpServerFilters Filters
94+
{
95+
get => field ??= new();
96+
set
97+
{
98+
Throw.IfNull(value);
99+
field = value;
100+
}
101+
}
94102

95103
/// <summary>
96104
/// Gets or sets the container of handlers used by the server for processing protocol messages.

0 commit comments

Comments
 (0)