Skip to content

Commit 31f85f2

Browse files
committed
Update client configs in configure command
1 parent ed6bf36 commit 31f85f2

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

mcp/mcp-cli-api/src/main/java/software/amazon/smithy/java/mcp/cli/AbstractAddBundle.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55

66
package software.amazon.smithy.java.mcp.cli;
77

8+
import java.util.List;
9+
import java.util.Set;
10+
import picocli.CommandLine;
811
import software.amazon.smithy.java.mcp.cli.model.Location;
12+
import software.amazon.smithy.java.mcp.cli.model.McpServerConfig;
913

1014
/**
1115
* Abstract base class for CLI commands that add tool bundles to the Smithy MCP configuration.
@@ -16,6 +20,10 @@
1620
*/
1721
public abstract class AbstractAddBundle extends SmithyMcpCommand implements ConfigurationCommand {
1822

23+
@CommandLine.Option(names = {"--clients"},
24+
description = "Names of client configs to update. If not specified all client configs registered would be updated")
25+
protected Set<String> clients = Set.of();
26+
1927
@Override
2028
public final void execute(ExecutionContext context) throws Exception {
2129
var config = context.config();
@@ -25,6 +33,11 @@ public final void execute(ExecutionContext context) throws Exception {
2533
}
2634
var newConfig = getNewToolConfig();
2735
ConfigUtils.addMcpBundle(config, getToolBundleName(), newConfig.mcpBundle());
36+
var command = McpServerConfig.builder()
37+
.command("mcp-registry")
38+
.args(List.of("start-server", getToolBundleName()))
39+
.build();
40+
ConfigUtils.addToClientConfigs(config, getToolBundleName(), clients, command);
2841
System.out.println("Added tool bundle " + getToolBundleName());
2942
}
3043

0 commit comments

Comments
 (0)