diff --git a/mcp/mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/McpCli.java b/mcp/mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/McpCli.java index 31a1416e9..0bac5cb6a 100644 --- a/mcp/mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/McpCli.java +++ b/mcp/mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/McpCli.java @@ -8,7 +8,6 @@ import java.util.List; import java.util.ServiceLoader; import picocli.CommandLine; -import picocli.CommandLine.Command; import software.amazon.smithy.java.mcp.cli.commands.Configure; import software.amazon.smithy.java.mcp.cli.commands.InstallBundle; import software.amazon.smithy.java.mcp.cli.commands.ListBundles; @@ -22,14 +21,17 @@ * It discovers and registers all available configuration commands and * sets up the command hierarchy. */ -@Command(name = "mcp-registry", versionProvider = VersionProvider.class, mixinStandardHelpOptions = true, - scope = CommandLine.ScopeType.INHERIT) -public class McpCli { +public final class McpCli { + + private McpCli() { + throw new UnsupportedOperationException(); + } public static void main(String[] args) { + addSystemProperties(); var configureCommand = new CommandLine(new Configure()); discoverConfigurationCommands().forEach(configureCommand::addSubcommand); - var commandLine = new CommandLine(new McpCli()) + var commandLine = new CommandLine(new McpRegistry()) .addSubcommand(new StartServer()) .addSubcommand(new ListBundles()) .addSubcommand(new InstallBundle()) @@ -38,6 +40,10 @@ public static void main(String[] args) { commandLine.execute(args); } + private static void addSystemProperties() { + System.setProperty("jdk.httpclient.allowRestrictedHeaders", "host"); //This is required for JavaHttpClientTransport. + } + /** * Discovers and loads all ConfigurationCommand implementations using the Java ServiceLoader. * diff --git a/mcp/mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/McpRegistry.java b/mcp/mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/McpRegistry.java new file mode 100644 index 000000000..c0a7e9979 --- /dev/null +++ b/mcp/mcp-cli/src/main/java/software/amazon/smithy/java/mcp/cli/McpRegistry.java @@ -0,0 +1,12 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +package software.amazon.smithy.java.mcp.cli; + +import picocli.CommandLine; + +@CommandLine.Command(name = "mcp-registry", versionProvider = VersionProvider.class, mixinStandardHelpOptions = true, + scope = CommandLine.ScopeType.INHERIT) +final class McpRegistry {}