namespace ModelContextProtocol.Client;
///
/// Provides options for configuring instances.
///
public sealed class StdioClientTransportOptions
{
///
/// Gets or sets the command to execute to start the server process.
///
/// The value is , empty, or composed entirely of whitespace.
public required string Command
{
get;
set
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("Command cannot be null or empty.", nameof(value));
}
field = value;
}
}
///
/// Gets or sets the arguments to pass to the server process when it is started.
///
public IList? Arguments { get; set; }
///
/// Gets or sets a transport identifier used for logging purposes.
///
public string? Name { get; set; }
///
/// Gets or sets the working directory for the server process.
///
public string? WorkingDirectory { get; set; }
///
/// Gets or sets environment variables to set for the server process.
///
///
///
/// This property allows you to specify environment variables that will be set in the server process's
/// environment. Setting these variables is useful for passing configuration, authentication information, or runtime flags
/// to the server without modifying its code.
///
///
/// By default, when starting the server process, the server process will inherit the current environment's variables,
/// as discovered via . After those variables are found, the entries
/// in this dictionary are used to augment and overwrite the entries read from the environment.
/// That includes removing the variables for any of this collection's entries with a null value.
///
///
public IDictionary? EnvironmentVariables { get; set; }
///
/// Gets or sets the timeout to wait for the server to shut down gracefully.
///
///
/// The amount of time to wait for the server to shut down gracefully. The default is 5 seconds.
///
///
///
/// This property dictates how long the client should wait for the server process to exit cleanly during shutdown
/// before forcibly terminating it. This balances giving the server enough time to clean up
/// resources and not hanging indefinitely if a server process becomes unresponsive.
///
///
public TimeSpan ShutdownTimeout { get; set; } = TimeSpan.FromSeconds(5);
///
/// Gets or sets a callback that is invoked for each line of stderr received from the server process.
///
public Action? StandardErrorLines { get; set; }
}