From 52358c1c3bbf581739ce8b201fdac72f848b5970 Mon Sep 17 00:00:00 2001 From: Richard Hernandez Date: Wed, 11 Jun 2025 08:14:06 -0700 Subject: [PATCH] Update client configs in configure command --- .../smithy/java/mcp/cli/AbstractAddBundle.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mcp/mcp-cli-api/src/main/java/software/amazon/smithy/java/mcp/cli/AbstractAddBundle.java b/mcp/mcp-cli-api/src/main/java/software/amazon/smithy/java/mcp/cli/AbstractAddBundle.java index ff26479587..86482c0b78 100644 --- a/mcp/mcp-cli-api/src/main/java/software/amazon/smithy/java/mcp/cli/AbstractAddBundle.java +++ b/mcp/mcp-cli-api/src/main/java/software/amazon/smithy/java/mcp/cli/AbstractAddBundle.java @@ -5,7 +5,11 @@ package software.amazon.smithy.java.mcp.cli; +import java.util.List; +import java.util.Set; +import picocli.CommandLine; import software.amazon.smithy.java.mcp.cli.model.Location; +import software.amazon.smithy.java.mcp.cli.model.McpServerConfig; /** * Abstract base class for CLI commands that add tool bundles to the Smithy MCP configuration. @@ -16,6 +20,10 @@ */ public abstract class AbstractAddBundle extends SmithyMcpCommand implements ConfigurationCommand { + @CommandLine.Option(names = {"--clients"}, + description = "Names of client configs to update. If not specified all client configs registered would be updated") + protected Set clients = Set.of(); + @Override public final void execute(ExecutionContext context) throws Exception { var config = context.config(); @@ -25,6 +33,11 @@ public final void execute(ExecutionContext context) throws Exception { } var newConfig = getNewToolConfig(); ConfigUtils.addMcpBundle(config, getToolBundleName(), newConfig.mcpBundle()); + var command = McpServerConfig.builder() + .command("mcp-registry") + .args(List.of("start-server", getToolBundleName())) + .build(); + ConfigUtils.addToClientConfigs(config, getToolBundleName(), clients, command); System.out.println("Added tool bundle " + getToolBundleName()); }