Remove enable http preproccessor blocks (#3437)

* Remove ENABLE_HTTP preprocessor blocks

* Update comment in New-BuildInfo.ps1

* Fix typo
This commit is contained in:
Alan Zimmer authored and GitHub committed 2026-09-09 17:12:09 -04:00
1 parent 6c873d3e68
commit 35b993399c
3 files changed
+4 -38

No files matched your search

-10
View File
@@ -28,16 +28,6 @@
<DefineConstants>$(DefineConstants);BUILD_NATIVE</DefineConstants>
</PropertyGroup>
<!-- We're using a prerelease version of IdWeb with trimmer support, which enables HTTP support for
trimmed azmcp builds across all distributions. The ENABLE_HTTP flag provides a rollback mechanism:
if we need to revert to an IdWeb version without trimmer support, we can disable HTTP accordingly.
Eventually, ENABLE_HTTP directives will be removed from the code as IdWeb's trimmer support moves
closer to GA.
See https://github.com/microsoft/mcp/issues/1764 -->
<PropertyGroup>
<DefineConstants>$(DefineConstants);ENABLE_HTTP</DefineConstants>
</PropertyGroup>
<!-- Windows AOT native build security flags to enable 'Control Flow Guard' (CFG) -->
<PropertyGroup Condition="'$(BuildNative)' == 'true' and $(RuntimeIdentifier.StartsWith('win'))">
<ControlFlowGuard>Guard</ControlFlowGuard>
@@ -218,8 +218,7 @@ public sealed class ServerStartCommand : BaseCommand<ServerStartOptions, string>
/// <summary>
/// Validates the transport configuration, ensuring the transport type is valid and compatible with other options.
/// Verifies that HTTP transport is only used when available (ENABLE_HTTP), and that --dangerously-disable-http-incoming-auth
/// is only specified with HTTP transport.
/// Verifies that --dangerously-disable-http-incoming-auth is only specified with HTTP transport.
/// </summary>
/// <param name="options">The bound ServerStartOptions.</param>
/// <param name="validationResult">Validation result to update on failure.</param>
@@ -236,12 +235,7 @@ public sealed class ServerStartCommand : BaseCommand<ServerStartOptions, string>
if (options.Transport == TransportTypes.Http)
{
#if ENABLE_HTTP
return;
#else
validationResult.Errors.Add($"{TransportTypes.Http} transport is only supported in the Docker image distribution of Azure MCP Server. Please use the Docker image or switch to {TransportTypes.StdIo} transport.");
return;
#endif
}
validationResult.Errors.Add($"Invalid transport '{options.Transport}'. Valid transports are: {TransportTypes.StdIo}, {TransportTypes.Http}.");
@@ -272,16 +266,11 @@ public sealed class ServerStartCommand : BaseCommand<ServerStartOptions, string>
{
if (options.OutgoingAuthStrategy == OutgoingAuthStrategy.UseOnBehalfOf)
{
#if ENABLE_HTTP
if (options.Transport != TransportTypes.Http || options.DangerouslyDisableHttpIncomingAuth)
{
validationResult.Errors.Add($"The {OutgoingAuthStrategy.UseOnBehalfOf} outgoing authentication strategy requires the server to run in authenticated HTTP mode (--transport http without --dangerously-disable-http-incoming-auth).");
}
return;
#else
validationResult.Errors.Add($"{OutgoingAuthStrategy.UseOnBehalfOf} outgoing authentication strategy is only supported in the Docker image distribution of Azure MCP Server. " +
"Please use the Docker image or switch to a different outgoing authentication strategy.");
#endif
}
}
@@ -316,7 +305,6 @@ public sealed class ServerStartCommand : BaseCommand<ServerStartOptions, string>
// that require a user-facing terminal (e.g. DeviceCodeCredential) can refuse to activate.
CustomChainedCredential.ActiveTransport = serverOptions.Transport;
#if ENABLE_HTTP
if (serverOptions.Transport == TransportTypes.Http)
{
if (serverOptions.DangerouslyDisableHttpIncomingAuth)
@@ -332,9 +320,6 @@ public sealed class ServerStartCommand : BaseCommand<ServerStartOptions, string>
{
return CreateStdioHost(serverOptions);
}
#else
return CreateStdioHost(serverOptions);
#endif
}
/// <summary>
@@ -880,7 +865,6 @@ public sealed class ServerStartCommand : BaseCommand<ServerStartOptions, string>
/// <returns>The resolved OutgoingAuthStrategy.</returns>
private static OutgoingAuthStrategy ResolveAuthStrategy(ServerStartOptions options)
{
#if ENABLE_HTTP
if (options.OutgoingAuthStrategy == OutgoingAuthStrategy.NotSet)
{
if (options.Transport == TransportTypes.Http)
@@ -895,9 +879,6 @@ public sealed class ServerStartCommand : BaseCommand<ServerStartOptions, string>
}
}
return options.OutgoingAuthStrategy;
#else
return OutgoingAuthStrategy.UseHostingEnvironmentIdentity;
#endif
}
private static WebApplication UseHttpsRedirectionIfEnabled(WebApplication app)
+3 -8
View File
@@ -37,14 +37,9 @@ $excludedPlatforms = @(
# Platforms outside of the standard combinations that should also be built. Setting a "specialPurpose" allows then to
# be targeted or excluded in packaging scripts
$additionalPlatforms = @(
# We currently use a prerelease version of Microsoft.Identity.Web with AOT-safe HTTP support,
# which allows shipping trimmed azmcp with http across all distributions (including Docker).
# Previously, Docker was shipped untrimmed to enable http support, while only other distributions
# where trimmed without HTTP support. These additional Docker platforms are retained as a rollback safety net
# in case we need to revert to the non-prerelease version and limit HTTP support to Docker only.
# Once Microsoft.Identity.Web with AOT support reaches GA, additionalPlatforms should be removed
# and Docker builds should use the standard platform definitions.
# https://github.com/microsoft/mcp/issues/1764
# Add additional builds for Docker as they use the musl runtime variant which differs from the default Linux builds.
# In the future we can evaluate if these can be moved to the standard Linux builds to remove two jobs from our
# standard pipeline.
@{
name = 'linux-musl-x64-docker'
operatingSystem = 'linux'