-
Notifications
You must be signed in to change notification settings - Fork 442
Description
Describe the bug
[ArgumentNullException]: Value cannot be null.
Parameter name: comparer
at System.Collections.Concurrent.ConcurrentDictionary2..ctor(Int32 concurrencyLevel, Int32 capacity, Boolean growLockArray, IEqualityComparer
1 comparer)
at System.Collections.Concurrent.ConcurrentDictionary2..ctor(IEqualityComparer
1 comparer)
at ModelContextProtocol.Server.McpServerPrimitiveCollection1..ctor(IEqualityComparer
1 keyComparer)
at ModelContextProtocol.McpServerOptionsSetup.Configure(McpServerOptions options)
This is caused by introduction of default-null IEqualityComparer in McpServerPrimitiveCollection constructor, apparently null is not actually accepted by ConcurrentDictionary constructor despite it being a nullable value.
To Reproduce
Steps to reproduce the behavior:
- Setup an MCP server with no tools, then McpServerOptionsSetup.Configure() will do this:
McpServerPrimitiveCollection toolCollection = options.Capabilities?.Tools?.ToolCollection ?? [];
the case where ToolCollection is null results in the above call stack
Expected behavior
Server runs with no tools
Logs
If applicable, add logs to help explain your problem.
Additional context
Add any other context about the problem here.