Skip to content

Commit d26f896

Browse files
committed
fix(profiles): --help not working after adding viper support
1 parent 20cb331 commit d26f896

File tree

1 file changed

+3
-2
lines changed
  • pkg/kubernetes-mcp-server/cmd

1 file changed

+3
-2
lines changed

pkg/kubernetes-mcp-server/cmd/root.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"k8s.io/klog/v2/textlogger"
1515
"os"
1616
"strconv"
17+
"strings"
1718
)
1819

1920
var rootCmd = &cobra.Command{
@@ -42,7 +43,7 @@ Kubernetes Model Context Protocol (MCP) server
4243
initLogging()
4344
profile := mcp.ProfileFromString(viper.GetString("profile"))
4445
if profile == nil {
45-
fmt.Printf("Invalid profile name: %s, valid names are: %s\n", viper.GetString("profile"), mcp.ProfileNames)
46+
fmt.Printf("Invalid profile name: %s, valid names are: %s\n", viper.GetString("profile"), strings.Join(mcp.ProfileNames, ", "))
4647
os.Exit(1)
4748
}
4849
klog.V(1).Infof("Starting kubernetes-mcp-server with profile: %s", profile.GetName())
@@ -121,6 +122,6 @@ func init() {
121122
rootCmd.Flags().IntP("sse-port", "", 0, "Start a SSE server on the specified port")
122123
rootCmd.Flags().StringP("sse-base-url", "", "", "SSE public base URL to use when sending the endpoint message (e.g. https://example.com)")
123124
rootCmd.Flags().StringP("kubeconfig", "", "", "Path to the kubeconfig file to use for authentication")
124-
rootCmd.Flags().Var(&profileFlag{&mcp.FullProfile{}}, "profile", "MCP profile to use")
125+
rootCmd.Flags().String("profile", "full", "MCP profile to use (one of: "+strings.Join(mcp.ProfileNames, ", ")+")")
125126
_ = viper.BindPFlags(rootCmd.Flags())
126127
}

0 commit comments

Comments
 (0)