Class McpClientOptions
- Namespace
- ModelContextProtocol.Client
- Assembly
- ModelContextProtocol.dll
Provides configuration options for creating IMcpClient instances.
public class McpClientOptions
- Inheritance
-
McpClientOptions
- Inherited Members
Remarks
These options are typically passed to CreateAsync(IClientTransport, McpClientOptions?, ILoggerFactory?, CancellationToken) when creating a client. They define client capabilities, protocol version, and other client-specific settings.
Properties
Capabilities
Gets or sets the client capabilities to advertise to the server.
public ClientCapabilities? Capabilities { get; set; }
Property Value
ClientInfo
Gets or sets information about this client implementation, including its name and version.
public Implementation? ClientInfo { get; set; }
Property Value
Remarks
This information is sent to the server during initialization to identify the client. It's often displayed in server logs and can be used for debugging and compatibility checks.
When not specified, information sourced from the current process will be used.
InitializationTimeout
Gets or sets a timeout for the client-server initialization handshake sequence.
public TimeSpan InitializationTimeout { get; set; }
Property Value
Remarks
This timeout determines how long the client will wait for the server to respond during the initialization protocol handshake. If the server doesn't respond within this timeframe, an exception will be thrown.
Setting an appropriate timeout prevents the client from hanging indefinitely when connecting to unresponsive servers.
The default value is 60 seconds.
ProtocolVersion
Gets or sets the protocol version to request from the server, using a date-based versioning scheme.
public string ProtocolVersion { get; set; }
Property Value
Remarks
The protocol version is a key part of the initialization handshake. The client and server must agree on a compatible protocol version to communicate successfully. If the server doesn't support the requested version, it will respond with a version mismatch error.