Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Cli/func/Actions/HostActions/StartHostAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Script;
using Microsoft.Azure.WebJobs.Script.Config;
using Microsoft.Azure.WebJobs.Script.Configuration;
using Microsoft.Azure.WebJobs.Script.Description;
using Microsoft.Azure.WebJobs.Script.WebHost;
Expand Down Expand Up @@ -367,6 +368,11 @@ private void UpdateEnvironmentVariables(IDictionary<string, string> secrets)
Environment.SetEnvironmentVariable($"AzureFunctionsJobHost__functions__{i}", EnabledFunctions[i]);
}
}

if (FeatureFlags.IsEnabled(Constants.EnableMcpCustomHandlerFeatureFlag, SystemEnvironment.Instance))
{
Environment.SetEnvironmentVariable(Constants.FunctionsWorkerRuntime, Constants.Languages.Custom);
}
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/Cli/func/Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ internal static partial class Constants
public const string Dotnet = "dotnet";
public const string InProcDotNet8EnabledSetting = "FUNCTIONS_INPROC_NET8_ENABLED";
public const string AzureDevSessionsRemoteHostName = "AzureDevSessionsRemoteHostName";
public const string EnableMcpCustomHandlerFeatureFlag = "EnableMcpCustomHandlerPreview";

// forwardedHttpUrl sample format: https://n12abc3t-<port>.asse.devtunnels.ms/
public const string AzureDevSessionsPortSuffixPlaceholder = "<port>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ internal class McpCustomHandlerConfigurationProfile : IConfigurationProfile
{
// This feature flag enables MCP (Model Context Protocol) support for custom handlers
// This flag is not required locally, but is required when deploying to Azure environments.
private const string McpFeatureFlag = "EnableMcpCustomHandlerPreview";

public string Name { get; } = "mcp-custom-handler";

public async Task ApplyAsync(WorkerRuntime workerRuntime, bool force = false)
Expand Down Expand Up @@ -102,19 +100,19 @@ internal async Task ApplyLocalSettingsAsync(WorkerRuntime workerRuntime, bool fo
.Where(f => !string.IsNullOrWhiteSpace(f))
.ToList();

if (!flags.Contains(McpFeatureFlag, StringComparer.OrdinalIgnoreCase))
if (!flags.Contains(Constants.EnableMcpCustomHandlerFeatureFlag, StringComparer.OrdinalIgnoreCase))
{
flags.Add(McpFeatureFlag);
flags.Add(Constants.EnableMcpCustomHandlerFeatureFlag);
values[Constants.AzureWebJobsFeatureFlags] = string.Join(",", flags);
updatedFeatureFlag = true;

if (!hasFlagsKey)
{
SetupProgressLogger.Ok(Constants.LocalSettingsJsonFileName, $"Added feature flag '{McpFeatureFlag}'");
SetupProgressLogger.Ok(Constants.LocalSettingsJsonFileName, $"Added feature flag '{Constants.EnableMcpCustomHandlerFeatureFlag}'");
}
else
{
SetupProgressLogger.Ok(Constants.LocalSettingsJsonFileName, $"Appended feature flag '{McpFeatureFlag}'");
SetupProgressLogger.Ok(Constants.LocalSettingsJsonFileName, $"Appended feature flag '{Constants.EnableMcpCustomHandlerFeatureFlag}'");
}
}

Expand Down
Loading