diff --git a/src/Cli.Tests/EndToEndTests.cs b/src/Cli.Tests/EndToEndTests.cs
index 2d408031b1..52749d0295 100644
--- a/src/Cli.Tests/EndToEndTests.cs
+++ b/src/Cli.Tests/EndToEndTests.cs
@@ -1233,6 +1233,11 @@ public void TestBaseRouteIsConfigurableForSWA(string authProvider, bool isExcept
[DataRow(ApiType.GraphQL, true, false, true, false, DisplayName = "Validate that GraphQL endpoint is disabled when enabled option is omitted and disabled option is included in the init command.")]
[DataRow(ApiType.GraphQL, true, true, false, false, DisplayName = "Validate that GraphQL endpoint is disabled when enabled option is set to false and disabled option is included in the init command.")]
[DataRow(ApiType.GraphQL, true, true, true, true, true, DisplayName = "Validate that config generation fails when enabled and disabled options provide conflicting values for GraphQL endpoint.")]
+ [DataRow(ApiType.MCP, false, false, true, true, DisplayName = "Validate that MCP endpoint is enabled when both enabled and disabled options are omitted from the init command.")]
+ [DataRow(ApiType.MCP, false, true, true, true, DisplayName = "Validate that MCP endpoint is enabled when enabled option is set to true and disabled option is omitted from the init command.")]
+ [DataRow(ApiType.MCP, true, false, true, false, DisplayName = "Validate that MCP endpoint is disabled when enabled option is omitted and disabled option is included in the init command.")]
+ [DataRow(ApiType.MCP, true, true, false, false, DisplayName = "Validate that MCP endpoint is disabled when enabled option is set to false and disabled option is included in the init command.")]
+ [DataRow(ApiType.MCP, true, true, true, true, true, DisplayName = "Validate that config generation fails when enabled and disabled options provide conflicting values for MCP endpoint.")]
public void TestEnabledDisabledFlagsForApis(
ApiType apiType,
bool includeDisabledFlag,
@@ -1278,12 +1283,18 @@ public void TestEnabledDisabledFlagsForApis(
Assert.IsNotNull(runtimeConfig.Runtime.Rest);
Assert.AreEqual(expectedEnabledFlagValueInConfig, runtimeConfig.Runtime.Rest.Enabled);
}
- else
+ else if (apiType is ApiType.GraphQL)
{
Assert.IsNotNull(runtimeConfig.Runtime);
Assert.IsNotNull(runtimeConfig.Runtime.GraphQL);
Assert.AreEqual(expectedEnabledFlagValueInConfig, runtimeConfig.Runtime.GraphQL.Enabled);
}
+ else
+ {
+ Assert.IsNotNull(runtimeConfig.Runtime);
+ Assert.IsNotNull(runtimeConfig.Runtime.Mcp);
+ Assert.AreEqual(expectedEnabledFlagValueInConfig, runtimeConfig.Runtime.Mcp.Enabled);
+ }
}
}
diff --git a/src/Cli/Commands/InitOptions.cs b/src/Cli/Commands/InitOptions.cs
index 0d3f8f7824..ce09ef63fd 100644
--- a/src/Cli/Commands/InitOptions.cs
+++ b/src/Cli/Commands/InitOptions.cs
@@ -111,19 +111,19 @@ public InitOptions(
[Option("runtime.base-route", Default = null, Required = false, HelpText = "Specifies the base route for API requests.")]
public string? RuntimeBaseRoute { get; }
- [Option("rest.disabled", Default = false, Required = false, HelpText = "Disables REST endpoint for all entities.")]
+ [Option("rest.disabled", Default = false, Required = false, Hidden = true, HelpText = "[Deprecated] Use --rest.enabled false instead. Disables REST endpoint for all entities.")]
public bool RestDisabled { get; }
[Option("graphql.path", Default = GraphQLRuntimeOptions.DEFAULT_PATH, Required = false, HelpText = "Specify the GraphQL endpoint's default prefix.")]
public string GraphQLPath { get; }
- [Option("graphql.disabled", Default = false, Required = false, HelpText = "Disables GraphQL endpoint for all entities.")]
+ [Option("graphql.disabled", Default = false, Required = false, Hidden = true, HelpText = "[Deprecated] Use --graphql.enabled false instead. Disables GraphQL endpoint for all entities.")]
public bool GraphQLDisabled { get; }
[Option("mcp.path", Default = McpRuntimeOptions.DEFAULT_PATH, Required = false, HelpText = "Specify the MCP endpoint's default prefix.")]
public string McpPath { get; }
- [Option("mcp.disabled", Default = false, Required = false, HelpText = "Disables MCP endpoint for all entities.")]
+ [Option("mcp.disabled", Default = false, Required = false, Hidden = true, HelpText = "[Deprecated] Use --mcp.enabled false instead. Disables MCP endpoint for all entities.")]
public bool McpDisabled { get; }
[Option("rest.enabled", Required = false, HelpText = "(Default: true) Enables REST endpoint for all entities. Supported values: true, false.")]
diff --git a/src/Cli/ConfigGenerator.cs b/src/Cli/ConfigGenerator.cs
index 88591f2e86..0db7d5c934 100644
--- a/src/Cli/ConfigGenerator.cs
+++ b/src/Cli/ConfigGenerator.cs
@@ -102,21 +102,28 @@ public static bool TryCreateRuntimeConfig(InitOptions options, FileSystemRuntime
// If --rest.disabled flag is included in the init command, we log a warning to not use this flag as it will be deprecated in future versions of DAB.
if (options.RestDisabled is true)
{
- _logger.LogWarning("The option --rest.disabled will be deprecated and support for the option will be removed in future versions of Data API builder." +
- " We recommend that you use the --rest.enabled option instead.");
+ _logger.LogWarning("The option --rest.disabled is deprecated and support for the option will be removed in future versions of Data API builder." +
+ " Use the --rest.enabled option instead.");
}
// If --graphql.disabled flag is included in the init command, we log a warning to not use this flag as it will be deprecated in future versions of DAB.
if (options.GraphQLDisabled is true)
{
- _logger.LogWarning("The option --graphql.disabled will be deprecated and support for the option will be removed in future versions of Data API builder." +
- " We recommend that you use the --graphql.enabled option instead.");
+ _logger.LogWarning("The option --graphql.disabled is deprecated and support for the option will be removed in future versions of Data API builder." +
+ " Use the --graphql.enabled option instead.");
+ }
+
+ // If --mcp.disabled flag is included in the init command, we log a warning to not use this flag as it will be deprecated in future versions of DAB.
+ if (options.McpDisabled is true)
+ {
+ _logger.LogWarning("The option --mcp.disabled is deprecated and support for the option will be removed in future versions of Data API builder." +
+ " Use the --mcp.enabled option instead.");
}
bool restEnabled, graphQLEnabled, mcpEnabled;
if (!TryDetermineIfApiIsEnabled(options.RestDisabled, options.RestEnabled, ApiType.REST, out restEnabled) ||
!TryDetermineIfApiIsEnabled(options.GraphQLDisabled, options.GraphQLEnabled, ApiType.GraphQL, out graphQLEnabled) ||
- !TryDetermineIfMcpIsEnabled(options.McpEnabled, out mcpEnabled))
+ !TryDetermineIfApiIsEnabled(options.McpDisabled, options.McpEnabled, ApiType.MCP, out mcpEnabled))
{
return false;
}
@@ -236,7 +243,7 @@ public static bool TryCreateRuntimeConfig(InitOptions options, FileSystemRuntime
}
}
- if (options.RestDisabled && options.GraphQLDisabled)
+ if (!restEnabled && !graphQLEnabled)
{
_logger.LogError("Both Rest and GraphQL cannot be disabled together.");
return false;
@@ -333,17 +340,6 @@ private static bool TryDetermineIfApiIsEnabled(bool apiDisabledOptionValue, CliB
return true;
}
- ///
- /// Helper method to determine if the mcp api is enabled or not based on the enabled/disabled options in the dab init command.
- ///
- /// True, if MCP is enabled
- /// Out param isMcpEnabled
- /// True if MCP is enabled
- private static bool TryDetermineIfMcpIsEnabled(CliBool mcpEnabledOptionValue, out bool isMcpEnabled)
- {
- return TryDetermineIfApiIsEnabled(false, mcpEnabledOptionValue, ApiType.MCP, out isMcpEnabled);
- }
-
///
/// Helper method to determine if the multiple create operation is enabled or not based on the inputs from dab init command.
///