// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System.Text.Json.Serialization; namespace Microsoft.Mcp.Core.Areas.Server.Options; /// /// Configuration options for starting the MCP server service. /// public class ServiceStartOptions { /// /// Gets or sets the transport mechanism for the server. /// Defaults to standard I/O (stdio). /// [JsonPropertyName("transport")] public string Transport { get; set; } = TransportTypes.StdIo; /// /// Gets or sets the service namespaces to expose through the server. /// When null, all available namespaces are exposed. /// [JsonPropertyName("namespace")] public string[]? Namespace { get; set; } = null; /// /// Gets or sets the mode mode for the server. /// Defaults to 'namespace' mode which exposes one tool per service namespace. /// [JsonPropertyName("mode")] public string? Mode { get; set; } = ModeTypes.NamespaceProxy; /// /// Gets or sets the specific tool names to expose. /// When specified, only these tools will be available. /// [JsonPropertyName("tool")] public string[]? Tool { get; set; } = null; /// /// Gets or sets whether the server should operate in read-only mode. /// When true, only tools marked as read-only will be available. /// [JsonPropertyName("readOnly")] public bool? ReadOnly { get; set; } = null; /// /// Gets or sets whether debug mode is enabled. /// When true, verbose logging will be sent to stderr. /// [JsonPropertyName("debug")] public bool Debug { get; set; } = false; /// /// Gets or sets whether HTTP incoming authentication is disabled. /// When true, the server accepts unauthenticated HTTP requests. /// [JsonPropertyName("dangerouslyDisableHttpIncomingAuth")] public bool DangerouslyDisableHttpIncomingAuth { get; set; } = false; /// /// Gets or sets whether elicitation (user confirmation for high-risk operations like accessing secrets) is disabled (dangerous mode). /// When true, elicitation will always be treated as accepted without user confirmation. /// [JsonPropertyName("dangerouslyDisableElicitation")] public bool DangerouslyDisableElicitation { get; set; } = false; /// /// Gets or sets the outgoing authentication strategy for service requests. /// Determines whether to use hosting environment identity or on-behalf-of flow. /// [JsonPropertyName("outgoingAuthStrategy")] public OutgoingAuthStrategy OutgoingAuthStrategy { get; set; } = OutgoingAuthStrategy.NotSet; /// /// Gets or sets the folder path for support logging. /// When specified, detailed debug-level logging is enabled and logs are written to /// automatically generated files in this folder with timestamp-based filenames. /// Warning: This may include sensitive information in logs. /// [JsonPropertyName("supportLoggingFolder")] public string? SupportLoggingFolder { get; set; } = null; /// /// Gets or sets whether retry policy bounds checking is disabled. /// When true, no upper bounds are enforced on retry delays, max delays, network timeouts, or max retries. /// [JsonPropertyName("dangerouslyDisableRetryLimits")] public bool DangerouslyDisableRetryLimits { get; set; } = false; /// /// Gets or sets the Azure cloud environment for authentication. /// Supports well-known cloud names (AzureCloud, AzureChinaCloud, AzureUSGovernment) /// or custom authority host URLs starting with https://. /// [JsonPropertyName("cloud")] public string? Cloud { get; set; } = null; /// /// Gets a value indicating whether the server is running in HTTP (remote) mode. /// [JsonIgnore] public bool IsHttpMode => Transport == TransportTypes.Http; /// /// Gets or sets whether caching is disabled. /// [JsonPropertyName("disableCaching")] public bool DisableCaching { get; set; } = false; }