Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public class InstallBundle extends SmithyMcpCommand {
description = "Name of the registry to list the bundles from. If not provided it will use the default registry.")
String registryName;

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

@Option(names = {"--clients"},
description = "Names of client configs to update. If not specified all client configs registered would be updated")
Expand All @@ -41,39 +41,41 @@ public class InstallBundle extends SmithyMcpCommand {
protected void execute(ExecutionContext context) throws IOException {
var registry = context.registry();
var config = context.config();
var bundle = registry.getMcpBundle(name);
ConfigUtils.addMcpBundle(config, name, bundle);

var command = name;
List<String> args = null;
boolean shouldCreateWrapper = true;

if (bundle.getValue() instanceof GenericBundle genericBundle && genericBundle.isExecuteDirectly()) {
command = genericBundle.getRun().getExecutable();
args = genericBundle.getRun().getArgs();
shouldCreateWrapper = false;
}

if (shouldCreateWrapper) {
ConfigUtils.createWrapperScript(name);
ConfigUtils.ensureMcpServersDirInPath();
}

var newClientConfig = McpServerConfig.builder()
.command(command)
.args(args)
.build();
if (print == null) {
//By default, print the output if there are no configured client configs.
print = !config.hasClientConfigs();
}
ConfigUtils.addToClientConfigs(config, name, clients, newClientConfig);

System.out.println("Successfully installed " + name);

if (print) {
System.out.println("You can add the following to your MCP Servers config to use " + name);
System.out.println(newClientConfig);
for (var name : names) {
var bundle = registry.getMcpBundle(name);
ConfigUtils.addMcpBundle(config, name, bundle);

var command = name;
List<String> args = null;
boolean shouldCreateWrapper = true;

if (bundle.getValue() instanceof GenericBundle genericBundle && genericBundle.isExecuteDirectly()) {
command = genericBundle.getRun().getExecutable();
args = genericBundle.getRun().getArgs();
shouldCreateWrapper = false;
}

if (shouldCreateWrapper) {
ConfigUtils.createWrapperScript(name);
ConfigUtils.ensureMcpServersDirInPath();
}

var newClientConfig = McpServerConfig.builder()
.command(command)
.args(args)
.build();
if (print == null) {
//By default, print the output if there are no configured client configs.
print = !config.hasClientConfigs();
}
ConfigUtils.addToClientConfigs(config, name, clients, newClientConfig);

System.out.println("Successfully installed " + name);

if (print) {
System.out.println("You can add the following to your MCP Servers config to use " + name);
System.out.println(newClientConfig);
}
}
}

Expand Down