Skip to content

Commit 3f2663b

Browse files
authored
Merge branch 'main' into adwsingh/fix-aws-bundles-again
2 parents 7ce45e4 + 1766f3c commit 3f2663b

1 file changed

Lines changed: 37 additions & 35 deletions

File tree

mcp/mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/commands/InstallBundle.java

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public class InstallBundle extends SmithyMcpCommand {
2626
description = "Name of the registry to list the bundles from. If not provided it will use the default registry.")
2727
String registryName;
2828

29-
@Parameters(description = "Name of the MCP bundle to install.")
30-
String name;
29+
@Parameters(description = "Names of the MCP bundles to install.")
30+
Set<String> names;
3131

3232
@Option(names = {"--clients"},
3333
description = "Names of client configs to update. If not specified all client configs registered would be updated")
@@ -41,39 +41,41 @@ public class InstallBundle extends SmithyMcpCommand {
4141
protected void execute(ExecutionContext context) throws IOException {
4242
var registry = context.registry();
4343
var config = context.config();
44-
var bundle = registry.getMcpBundle(name);
45-
ConfigUtils.addMcpBundle(config, name, bundle);
46-
47-
var command = name;
48-
List<String> args = null;
49-
boolean shouldCreateWrapper = true;
50-
51-
if (bundle.getValue() instanceof GenericBundle genericBundle && genericBundle.isExecuteDirectly()) {
52-
command = genericBundle.getRun().getExecutable();
53-
args = genericBundle.getRun().getArgs();
54-
shouldCreateWrapper = false;
55-
}
56-
57-
if (shouldCreateWrapper) {
58-
ConfigUtils.createWrapperScript(name);
59-
ConfigUtils.ensureMcpServersDirInPath();
60-
}
61-
62-
var newClientConfig = McpServerConfig.builder()
63-
.command(command)
64-
.args(args)
65-
.build();
66-
if (print == null) {
67-
//By default, print the output if there are no configured client configs.
68-
print = !config.hasClientConfigs();
69-
}
70-
ConfigUtils.addToClientConfigs(config, name, clients, newClientConfig);
71-
72-
System.out.println("Successfully installed " + name);
73-
74-
if (print) {
75-
System.out.println("You can add the following to your MCP Servers config to use " + name);
76-
System.out.println(newClientConfig);
44+
for (var name : names) {
45+
var bundle = registry.getMcpBundle(name);
46+
ConfigUtils.addMcpBundle(config, name, bundle);
47+
48+
var command = name;
49+
List<String> args = null;
50+
boolean shouldCreateWrapper = true;
51+
52+
if (bundle.getValue() instanceof GenericBundle genericBundle && genericBundle.isExecuteDirectly()) {
53+
command = genericBundle.getRun().getExecutable();
54+
args = genericBundle.getRun().getArgs();
55+
shouldCreateWrapper = false;
56+
}
57+
58+
if (shouldCreateWrapper) {
59+
ConfigUtils.createWrapperScript(name);
60+
ConfigUtils.ensureMcpServersDirInPath();
61+
}
62+
63+
var newClientConfig = McpServerConfig.builder()
64+
.command(command)
65+
.args(args)
66+
.build();
67+
if (print == null) {
68+
//By default, print the output if there are no configured client configs.
69+
print = !config.hasClientConfigs();
70+
}
71+
ConfigUtils.addToClientConfigs(config, name, clients, newClientConfig);
72+
73+
System.out.println("Successfully installed " + name);
74+
75+
if (print) {
76+
System.out.println("You can add the following to your MCP Servers config to use " + name);
77+
System.out.println(newClientConfig);
78+
}
7779
}
7880
}
7981

0 commit comments

Comments
 (0)