From bd718d03e78a75f0a970cc208aa2c5586ac439a6 Mon Sep 17 00:00:00 2001 From: Dean Shaw Date: Wed, 11 Jun 2025 17:53:47 -0400 Subject: [PATCH] Allow read only operations by default --- .../mcp/cli/commands/AddAwsServiceBundle.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/aws/aws-mcp-cli-commands/src/main/java/software/amazon/smithy/java/aws/mcp/cli/commands/AddAwsServiceBundle.java b/aws/aws-mcp-cli-commands/src/main/java/software/amazon/smithy/java/aws/mcp/cli/commands/AddAwsServiceBundle.java index 6633b07ac1..fe9946625c 100644 --- a/aws/aws-mcp-cli-commands/src/main/java/software/amazon/smithy/java/aws/mcp/cli/commands/AddAwsServiceBundle.java +++ b/aws/aws-mcp-cli-commands/src/main/java/software/amazon/smithy/java/aws/mcp/cli/commands/AddAwsServiceBundle.java @@ -34,24 +34,25 @@ public class AddAwsServiceBundle extends AbstractAddBundle { @Option(names = {"-b", "--blocked-apis"}, description = "List of APIs to hide in the MCP server") protected Set blockedApis; - @Option(names = "--include-write-apis", - description = "Include write APIs in the MCP server") - Boolean includeWriteApis; + @Option(names = "--read-only-apis", + description = "Include read only APIs in the MCP server", + defaultValue = "true") + protected boolean readOnlyApis; @Override protected CliBundle getNewToolConfig() { var bundleBuilder = AwsServiceBundler.builder() .serviceName(awsServiceName); - //If nothing is specified then default to only readOnlyOperations. + if (readOnlyApis) { + // Include read-only apis unless disabled + bundleBuilder.readOnlyOperations(); + } if (allowedApis != null) { // User explicitly specified allowed APIs - use only those bundleBuilder.exposedOperations(allowedApis); - } else if (includeWriteApis == null || !includeWriteApis) { - // Default case or explicit false - read-only operations - bundleBuilder.readOnlyOperations(); } - // Always apply blocked operations if specified if (blockedApis != null) { + // Always apply blocked operations if specified bundleBuilder.blockedOperations(blockedApis); } var bundle = bundleBuilder.build().bundle();