From 35333c8acd3357b3ef5116d0e478d4ffbc012a49 Mon Sep 17 00:00:00 2001 From: Patrick Hallisey Date: Thu, 12 Feb 2026 17:30:12 -0800 Subject: [PATCH 1/3] Move Azure specific services into the Azure core project --- .../src/Services/Azure/BaseAzureResourceService.cs | 0 .../src/Services/Azure/BaseAzureService.cs | 0 .../Azure/ResourceGroup/IResourceGroupService.cs | 0 .../Azure/ResourceGroup/ResourceGroupService.cs | 0 .../Azure/Subscription/ISubscriptionService.cs | 0 .../Azure/Subscription/SubscriptionService.cs | 0 .../src/Services/Azure/Tenant/ITenantService.cs | 0 .../src/Services/Azure/Tenant/TenantService.cs | 0 .../Tenant/TenantServiceCollectionExtensions.cs | 0 .../src/Areas/Server/Commands/ServiceStartCommand.cs | 4 ---- .../src/Areas/Server/Options/TransportTypes.cs | 2 +- .../Authentication/IAzureTokenCredentialProvider.cs | 1 - servers/Azure.Mcp.Server/src/Program.cs | 12 ++++++++++++ servers/Fabric.Mcp.Server/src/Program.cs | 6 ------ 14 files changed, 13 insertions(+), 12 deletions(-) rename core/{Microsoft.Mcp.Core => Azure.Mcp.Core}/src/Services/Azure/BaseAzureResourceService.cs (100%) rename core/{Microsoft.Mcp.Core => Azure.Mcp.Core}/src/Services/Azure/BaseAzureService.cs (100%) rename core/{Microsoft.Mcp.Core => Azure.Mcp.Core}/src/Services/Azure/ResourceGroup/IResourceGroupService.cs (100%) rename core/{Microsoft.Mcp.Core => Azure.Mcp.Core}/src/Services/Azure/ResourceGroup/ResourceGroupService.cs (100%) rename core/{Microsoft.Mcp.Core => Azure.Mcp.Core}/src/Services/Azure/Subscription/ISubscriptionService.cs (100%) rename core/{Microsoft.Mcp.Core => Azure.Mcp.Core}/src/Services/Azure/Subscription/SubscriptionService.cs (100%) rename core/{Microsoft.Mcp.Core => Azure.Mcp.Core}/src/Services/Azure/Tenant/ITenantService.cs (100%) rename core/{Microsoft.Mcp.Core => Azure.Mcp.Core}/src/Services/Azure/Tenant/TenantService.cs (100%) rename core/{Microsoft.Mcp.Core => Azure.Mcp.Core}/src/Services/Azure/Tenant/TenantServiceCollectionExtensions.cs (100%) diff --git a/core/Microsoft.Mcp.Core/src/Services/Azure/BaseAzureResourceService.cs b/core/Azure.Mcp.Core/src/Services/Azure/BaseAzureResourceService.cs similarity index 100% rename from core/Microsoft.Mcp.Core/src/Services/Azure/BaseAzureResourceService.cs rename to core/Azure.Mcp.Core/src/Services/Azure/BaseAzureResourceService.cs diff --git a/core/Microsoft.Mcp.Core/src/Services/Azure/BaseAzureService.cs b/core/Azure.Mcp.Core/src/Services/Azure/BaseAzureService.cs similarity index 100% rename from core/Microsoft.Mcp.Core/src/Services/Azure/BaseAzureService.cs rename to core/Azure.Mcp.Core/src/Services/Azure/BaseAzureService.cs diff --git a/core/Microsoft.Mcp.Core/src/Services/Azure/ResourceGroup/IResourceGroupService.cs b/core/Azure.Mcp.Core/src/Services/Azure/ResourceGroup/IResourceGroupService.cs similarity index 100% rename from core/Microsoft.Mcp.Core/src/Services/Azure/ResourceGroup/IResourceGroupService.cs rename to core/Azure.Mcp.Core/src/Services/Azure/ResourceGroup/IResourceGroupService.cs diff --git a/core/Microsoft.Mcp.Core/src/Services/Azure/ResourceGroup/ResourceGroupService.cs b/core/Azure.Mcp.Core/src/Services/Azure/ResourceGroup/ResourceGroupService.cs similarity index 100% rename from core/Microsoft.Mcp.Core/src/Services/Azure/ResourceGroup/ResourceGroupService.cs rename to core/Azure.Mcp.Core/src/Services/Azure/ResourceGroup/ResourceGroupService.cs diff --git a/core/Microsoft.Mcp.Core/src/Services/Azure/Subscription/ISubscriptionService.cs b/core/Azure.Mcp.Core/src/Services/Azure/Subscription/ISubscriptionService.cs similarity index 100% rename from core/Microsoft.Mcp.Core/src/Services/Azure/Subscription/ISubscriptionService.cs rename to core/Azure.Mcp.Core/src/Services/Azure/Subscription/ISubscriptionService.cs diff --git a/core/Microsoft.Mcp.Core/src/Services/Azure/Subscription/SubscriptionService.cs b/core/Azure.Mcp.Core/src/Services/Azure/Subscription/SubscriptionService.cs similarity index 100% rename from core/Microsoft.Mcp.Core/src/Services/Azure/Subscription/SubscriptionService.cs rename to core/Azure.Mcp.Core/src/Services/Azure/Subscription/SubscriptionService.cs diff --git a/core/Microsoft.Mcp.Core/src/Services/Azure/Tenant/ITenantService.cs b/core/Azure.Mcp.Core/src/Services/Azure/Tenant/ITenantService.cs similarity index 100% rename from core/Microsoft.Mcp.Core/src/Services/Azure/Tenant/ITenantService.cs rename to core/Azure.Mcp.Core/src/Services/Azure/Tenant/ITenantService.cs diff --git a/core/Microsoft.Mcp.Core/src/Services/Azure/Tenant/TenantService.cs b/core/Azure.Mcp.Core/src/Services/Azure/Tenant/TenantService.cs similarity index 100% rename from core/Microsoft.Mcp.Core/src/Services/Azure/Tenant/TenantService.cs rename to core/Azure.Mcp.Core/src/Services/Azure/Tenant/TenantService.cs diff --git a/core/Microsoft.Mcp.Core/src/Services/Azure/Tenant/TenantServiceCollectionExtensions.cs b/core/Azure.Mcp.Core/src/Services/Azure/Tenant/TenantServiceCollectionExtensions.cs similarity index 100% rename from core/Microsoft.Mcp.Core/src/Services/Azure/Tenant/TenantServiceCollectionExtensions.cs rename to core/Azure.Mcp.Core/src/Services/Azure/Tenant/TenantServiceCollectionExtensions.cs diff --git a/core/Microsoft.Mcp.Core/src/Areas/Server/Commands/ServiceStartCommand.cs b/core/Microsoft.Mcp.Core/src/Areas/Server/Commands/ServiceStartCommand.cs index 284f444c85..609955d7b2 100644 --- a/core/Microsoft.Mcp.Core/src/Areas/Server/Commands/ServiceStartCommand.cs +++ b/core/Microsoft.Mcp.Core/src/Areas/Server/Commands/ServiceStartCommand.cs @@ -182,10 +182,6 @@ public override async Task ExecuteAsync(CommandContext context, var options = BindOptions(parseResult); - // Update the UserAgentPolicy for all Azure service calls to include the transport type. - var transport = string.IsNullOrEmpty(options.Transport) ? TransportTypes.StdIo : options.Transport; - BaseAzureService.InitializeUserAgentPolicy(transport); - try { using var tracerProvider = AddIncomingAndOutgoingHttpSpans(options); diff --git a/core/Microsoft.Mcp.Core/src/Areas/Server/Options/TransportTypes.cs b/core/Microsoft.Mcp.Core/src/Areas/Server/Options/TransportTypes.cs index 51002fa5d1..489c5169d9 100644 --- a/core/Microsoft.Mcp.Core/src/Areas/Server/Options/TransportTypes.cs +++ b/core/Microsoft.Mcp.Core/src/Areas/Server/Options/TransportTypes.cs @@ -6,7 +6,7 @@ namespace Azure.Mcp.Core.Areas.Server.Options; /// /// Defines the supported transport mechanisms for the Azure MCP server. /// -internal static class TransportTypes +public static class TransportTypes { /// /// Standard Input/Output transport mechanism. diff --git a/core/Microsoft.Mcp.Core/src/Services/Azure/Authentication/IAzureTokenCredentialProvider.cs b/core/Microsoft.Mcp.Core/src/Services/Azure/Authentication/IAzureTokenCredentialProvider.cs index 3447ec48b0..ce0cd331cf 100644 --- a/core/Microsoft.Mcp.Core/src/Services/Azure/Authentication/IAzureTokenCredentialProvider.cs +++ b/core/Microsoft.Mcp.Core/src/Services/Azure/Authentication/IAzureTokenCredentialProvider.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using Azure.Core; -using Azure.Mcp.Core.Services.Azure.Tenant; using Microsoft.Extensions.DependencyInjection; namespace Azure.Mcp.Core.Services.Azure.Authentication; diff --git a/servers/Azure.Mcp.Server/src/Program.cs b/servers/Azure.Mcp.Server/src/Program.cs index a99466d18d..e00dc94387 100644 --- a/servers/Azure.Mcp.Server/src/Program.cs +++ b/servers/Azure.Mcp.Server/src/Program.cs @@ -4,8 +4,10 @@ using System.Net; using Azure.Mcp.Core.Areas.Server; using Azure.Mcp.Core.Areas.Server.Commands; +using Azure.Mcp.Core.Areas.Server.Options; using Azure.Mcp.Core.Commands; using Azure.Mcp.Core.Helpers; +using Azure.Mcp.Core.Services.Azure; using Azure.Mcp.Core.Services.Azure.ResourceGroup; using Azure.Mcp.Core.Services.Azure.Subscription; using Azure.Mcp.Core.Services.Azure.Tenant; @@ -15,6 +17,7 @@ using Azure.Mcp.Core.Services.Time; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using Microsoft.Mcp.Core.Areas; using Microsoft.Mcp.Core.Commands; using Microsoft.Mcp.Core.Models.Command; @@ -232,6 +235,15 @@ internal static void ConfigureServices(IServiceCollection services) internal static async Task InitializeServicesAsync(IServiceProvider serviceProvider) { + ServiceStartOptions? options = serviceProvider.GetService>()?.Value; + + if(options != null) + { + // Update the UserAgentPolicy for all Azure service calls to include the transport type. + var transport = string.IsNullOrEmpty(options.Transport) ? TransportTypes.StdIo : options.Transport; + BaseAzureService.InitializeUserAgentPolicy(transport); + } + // Perform any initialization before starting the service. // If the initialization operation fails, do not continue because we do not want // invalid telemetry published. diff --git a/servers/Fabric.Mcp.Server/src/Program.cs b/servers/Fabric.Mcp.Server/src/Program.cs index 5039e9b3c1..f36e384304 100644 --- a/servers/Fabric.Mcp.Server/src/Program.cs +++ b/servers/Fabric.Mcp.Server/src/Program.cs @@ -7,9 +7,6 @@ using Azure.Mcp.Core.Commands; using Azure.Mcp.Core.Extensions; using Azure.Mcp.Core.Models; -using Azure.Mcp.Core.Services.Azure.ResourceGroup; -using Azure.Mcp.Core.Services.Azure.Subscription; -using Azure.Mcp.Core.Services.Azure.Tenant; using Azure.Mcp.Core.Services.Caching; using Azure.Mcp.Core.Services.ProcessExecution; using Azure.Mcp.Core.Services.Telemetry; @@ -144,8 +141,6 @@ internal static void ConfigureServices(IServiceCollection services) services.AddMemoryCache(); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(); // !!! WARNING !!! @@ -153,7 +148,6 @@ internal static void ConfigureServices(IServiceCollection services) // The http-traport-specific implementations and configurations must be registered // within ServiceStartCommand.ExecuteAsync(). services.AddHttpClientServices(); - services.AddAzureTenantService(); services.AddSingleUserCliCacheService(); foreach (var area in Areas) From 0b345eb765756d23424560ac7948c3a3b3e966dd Mon Sep 17 00:00:00 2001 From: Patrick Hallisey Date: Tue, 17 Feb 2026 11:47:52 -0800 Subject: [PATCH 2/3] Update servers/Azure.Mcp.Server/src/Program.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- servers/Azure.Mcp.Server/src/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servers/Azure.Mcp.Server/src/Program.cs b/servers/Azure.Mcp.Server/src/Program.cs index e00dc94387..2610fae3c8 100644 --- a/servers/Azure.Mcp.Server/src/Program.cs +++ b/servers/Azure.Mcp.Server/src/Program.cs @@ -237,7 +237,7 @@ internal static async Task InitializeServicesAsync(IServiceProvider serviceProvi { ServiceStartOptions? options = serviceProvider.GetService>()?.Value; - if(options != null) + if (options != null) { // Update the UserAgentPolicy for all Azure service calls to include the transport type. var transport = string.IsNullOrEmpty(options.Transport) ? TransportTypes.StdIo : options.Transport; From 0f2bb75047ae914fd4fac758865fbeef9728affa Mon Sep 17 00:00:00 2001 From: Patrick Hallisey Date: Tue, 17 Feb 2026 12:20:53 -0800 Subject: [PATCH 3/3] Fix spelling issues --- .vscode/cspell.json | 1 + .../Azure/Authentication/IAzureTokenCredentialProvider.cs | 2 +- servers/Azure.Mcp.Server/src/Program.cs | 6 +++--- servers/Fabric.Mcp.Server/src/Program.cs | 6 +++--- servers/Template.Mcp.Server/src/Program.cs | 6 +++--- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index e4a22c9522..ea5043d2ee 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -56,6 +56,7 @@ "rohit", "vcolin", "vinay", + "vukelich", "wbreza", "xiangyan" ] diff --git a/core/Microsoft.Mcp.Core/src/Services/Azure/Authentication/IAzureTokenCredentialProvider.cs b/core/Microsoft.Mcp.Core/src/Services/Azure/Authentication/IAzureTokenCredentialProvider.cs index ce0cd331cf..36550de787 100644 --- a/core/Microsoft.Mcp.Core/src/Services/Azure/Authentication/IAzureTokenCredentialProvider.cs +++ b/core/Microsoft.Mcp.Core/src/Services/Azure/Authentication/IAzureTokenCredentialProvider.cs @@ -9,7 +9,7 @@ namespace Azure.Mcp.Core.Services.Azure.Authentication; /// /// Providers instances of appropriate for the current environment. /// Implementations are expected to be of , however, in -/// multi-user enviornments using on-behalf-of downstream authentication, the implementation +/// multi-user environments using on-behalf-of downstream authentication, the implementation /// must return credentials within the context of the user in the current execution context. /// /// diff --git a/servers/Azure.Mcp.Server/src/Program.cs b/servers/Azure.Mcp.Server/src/Program.cs index 12885ddb53..e37b883f7f 100644 --- a/servers/Azure.Mcp.Server/src/Program.cs +++ b/servers/Azure.Mcp.Server/src/Program.cs @@ -165,7 +165,7 @@ private static void WriteResponse(CommandResponse response) /// /// 's command picking: The container used to populate instances of /// and selected by - /// baesd on the command line input. This container is a local variable in + /// based on the command line input. This container is a local variable in /// , and it is not tied to /// Microsoft.Extensions.Hosting.IHostBuilder (stdio) nor any /// Microsoft.AspNetCore.Hosting.IWebHostBuilder (http). @@ -191,7 +191,7 @@ private static void WriteResponse(CommandResponse response) /// on or , both of which have /// transport-specific implementations. This method can add the stdio-specific /// implementation to allow the first container (used for command picking) to work, - /// but such transport-specific registrations must be overriden within + /// but such transport-specific registrations must be overridden within /// with the appropriate /// transport-specific implementation based on command line arguments. /// @@ -219,7 +219,7 @@ internal static void ConfigureServices(IServiceCollection services) // !!! WARNING !!! // stdio-transport-specific implementations of ITenantService and ICacheService. - // The http-traport-specific implementations and configurations must be registered + // The http-transport-specific implementations and configurations must be registered // within ServiceStartCommand.ExecuteAsync(). services.AddHttpClientServices(configureDefaults: true); services.AddAzureTenantService(); diff --git a/servers/Fabric.Mcp.Server/src/Program.cs b/servers/Fabric.Mcp.Server/src/Program.cs index cfca3800f5..33f437e637 100644 --- a/servers/Fabric.Mcp.Server/src/Program.cs +++ b/servers/Fabric.Mcp.Server/src/Program.cs @@ -94,7 +94,7 @@ private static void WriteResponse(CommandResponse response) /// /// 's command picking: The container used to populate instances of /// and selected by - /// baesd on the command line input. This container is a local variable in + /// based on the command line input. This container is a local variable in /// , and it is not tied to /// Microsoft.Extensions.Hosting.IHostBuilder (stdio) nor any /// Microsoft.AspNetCore.Hosting.IWebHostBuilder (http). @@ -120,7 +120,7 @@ private static void WriteResponse(CommandResponse response) /// on or , both of which have /// transport-specific implementations. This method can add the stdio-specific /// implementation to allow the first container (used for command picking) to work, - /// but such transport-specific registrations must be overriden within + /// but such transport-specific registrations must be overridden within /// with the appropriate /// transport-specific implementation based on command line arguments. /// @@ -146,7 +146,7 @@ internal static void ConfigureServices(IServiceCollection services) // !!! WARNING !!! // stdio-transport-specific implementations of ITenantService and ICacheService. - // The http-traport-specific implementations and configurations must be registered + // The http-transport-specific implementations and configurations must be registered // within ServiceStartCommand.ExecuteAsync(). services.AddHttpClientServices(); services.AddSingleUserCliCacheService(); diff --git a/servers/Template.Mcp.Server/src/Program.cs b/servers/Template.Mcp.Server/src/Program.cs index a4c4e3612b..4063f27fd0 100644 --- a/servers/Template.Mcp.Server/src/Program.cs +++ b/servers/Template.Mcp.Server/src/Program.cs @@ -91,7 +91,7 @@ private static void WriteResponse(CommandResponse response) /// /// 's command picking: The container used to populate instances of /// and selected by - /// baesd on the command line input. This container is a local variable in + /// based on the command line input. This container is a local variable in /// , and it is not tied to /// Microsoft.Extensions.Hosting.IHostBuilder (stdio) nor any /// Microsoft.AspNetCore.Hosting.IWebHostBuilder (http). @@ -117,7 +117,7 @@ private static void WriteResponse(CommandResponse response) /// on or , both of which have /// transport-specific implementations. This method can add the stdio-specific /// implementation to allow the first container (used for command picking) to work, - /// but such transport-specific registrations must be overriden within + /// but such transport-specific registrations must be overridden within /// with the appropriate /// transport-specific implementation based on command line arguments. /// @@ -143,7 +143,7 @@ internal static void ConfigureServices(IServiceCollection services) // !!! WARNING !!! // stdio-transport-specific implementations of ICacheService. - // The http-traport-specific implementations and configurations must be registered + // The http-transport-specific implementations and configurations must be registered // within ServiceStartCommand.ExecuteAsync(). services.AddSingleUserCliCacheService();