Skip to content

Commit 76535ee

Browse files
JoannaaKLSamMorrowDrums
authored andcommitted
Bind
1 parent 9e1d401 commit 76535ee

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

cmd/github-mcp-server/main.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,11 @@ var (
4949
Token: token,
5050
EnabledToolsets: enabledToolsets,
5151
DynamicToolsets: viper.GetBool("dynamic_toolsets"),
52-
ReadOnly: viper.GetBool("read-only"),
52+
ReadOnly: viper.GetBool("read-only") || viper.GetBool("read_only"),
5353
ExportTranslations: viper.GetBool("export-translations"),
5454
EnableCommandLogging: viper.GetBool("enable-command-logging"),
5555
LogFilePath: viper.GetString("log-file"),
5656
}
57-
5857
return ghmcp.RunStdioServer(stdioServerConfig)
5958
},
6059
}
@@ -65,13 +64,11 @@ func init() {
6564

6665
rootCmd.SetVersionTemplate("{{.Short}}\n{{.Version}}\n")
6766

68-
readOnlyFlag := false
69-
7067
// Add global flags that will be shared by all commands
7168
rootCmd.PersistentFlags().StringSlice("toolsets", github.DefaultTools, "An optional comma separated list of groups of tools to allow, defaults to enabling all")
7269
rootCmd.PersistentFlags().Bool("dynamic-toolsets", false, "Enable dynamic toolsets")
73-
rootCmd.PersistentFlags().BoolVar(&readOnlyFlag, "read-only", false, "Restrict the server to read-only operations")
74-
rootCmd.PersistentFlags().BoolVar(&readOnlyFlag, "read_only", false, "Restrict the server to read-only operations")
70+
rootCmd.PersistentFlags().Bool("read-only", false, "Restrict the server to read-only operations")
71+
rootCmd.PersistentFlags().Bool("read_only", false, "Restrict the server to read-only operations")
7572
rootCmd.PersistentFlags().String("log-file", "", "Path to log file")
7673
rootCmd.PersistentFlags().Bool("enable-command-logging", false, "When enabled, the server will log all command requests and responses to the log file")
7774
rootCmd.PersistentFlags().Bool("export-translations", false, "Save translations to a JSON file")
@@ -81,6 +78,7 @@ func init() {
8178
_ = viper.BindPFlag("toolsets", rootCmd.PersistentFlags().Lookup("toolsets"))
8279
_ = viper.BindPFlag("dynamic_toolsets", rootCmd.PersistentFlags().Lookup("dynamic-toolsets"))
8380
_ = viper.BindPFlag("read-only", rootCmd.PersistentFlags().Lookup("read-only"))
81+
_ = viper.BindPFlag("read_only", rootCmd.PersistentFlags().Lookup("read_only"))
8482
_ = viper.BindPFlag("log-file", rootCmd.PersistentFlags().Lookup("log-file"))
8583
_ = viper.BindPFlag("enable-command-logging", rootCmd.PersistentFlags().Lookup("enable-command-logging"))
8684
_ = viper.BindPFlag("export-translations", rootCmd.PersistentFlags().Lookup("export-translations"))
@@ -94,6 +92,7 @@ func initConfig() {
9492
// Initialize Viper configuration
9593
viper.SetEnvPrefix("github")
9694
viper.AutomaticEnv()
95+
9796
}
9897

9998
func main() {

0 commit comments

Comments
 (0)