Skip to content

Can structural equality be implemented for McpServerConfig? #181

Closed as not planned
@AArnott

Description

@AArnott

The McpServerConfig type is a record, which tends to implement structural equality by default for scalar values. However, it has an array and a dictionary, which requires special handling to achieve structural equality.

/// <summary>
/// Arguments (if any) to pass to the executable.
/// </summary>
public string[]? Arguments { get; init; }
/// <summary>
/// Additional transport-specific configuration.
/// </summary>
public Dictionary<string, string>? TransportOptions { get; init; }

For my use case, when we're looking at identifying duplicate server configurations across files or across reloads of a changed mcp.json file, it's useful to be able to recognize when two server config objects are identical.

I can implement this myself with a custom IEqualityComparer, but as the config may change over time to get new properties, having it build into the type itself would be great.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions