Skip to content

Commit deacd75

Browse files
committed
feat: add version subcommand to display build metadata
1 parent 1a6e33e commit deacd75

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmd/github-mcp-server/main.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,26 @@ var (
3939
logFile := viper.GetString("log-file")
4040
readOnly := viper.GetBool("read-only")
4141
exportTranslations := viper.GetBool("export-translations")
42+
logCommands := viper.GetBool("enable-command-logging")
43+
4244
logger, err := initLogger(logFile)
4345
if err != nil {
4446
stdlog.Fatal("Failed to initialize logger:", err)
4547
}
46-
logCommands := viper.GetBool("enable-command-logging")
48+
4749
if err := runStdioServer(readOnly, logger, logCommands, exportTranslations); err != nil {
4850
stdlog.Fatal("failed to run stdio server:", err)
4951
}
5052
},
5153
}
54+
55+
versionCmd = &cobra.Command{
56+
Use: "version",
57+
Short: "Print version information",
58+
Run: func(_ *cobra.Command, _ []string) {
59+
fmt.Printf("GitHub MCP Server\nVersion: %s\nCommit: %s\nBuild Date: %s\n", version, commit, date)
60+
},
61+
}
5262
)
5363

5464
func init() {
@@ -70,6 +80,7 @@ func init() {
7080

7181
// Add subcommands
7282
rootCmd.AddCommand(stdioCmd)
83+
rootCmd.AddCommand(versionCmd)
7384
}
7485

7586
func initConfig() {

0 commit comments

Comments
 (0)