Add debug mode and upgrade mcp-go to v0.14.1

This commit is contained in:
hiifong
2025-03-20 23:01:05 +08:00
parent 18cb96fc80
commit 72d9b5a8dd
11 changed files with 60 additions and 24 deletions

View File

@@ -3,6 +3,7 @@ package cmd
import (
"context"
"flag"
"os"
"gitea.com/gitea/gitea-mcp/operation"
flagPkg "gitea.com/gitea/gitea-mcp/pkg/flag"
@@ -42,6 +43,12 @@ func init() {
"",
"Your personal access token",
)
flag.BoolVar(
&debug,
"d",
false,
"debug mode",
)
flag.BoolVar(
&debug,
"debug",
@@ -52,7 +59,24 @@ func init() {
flag.Parse()
flagPkg.Host = host
if flagPkg.Host == "" {
flagPkg.Host = os.Getenv("GITEA_HOST")
}
if flagPkg.Host == "" {
flagPkg.Host = "https://gitea.com"
}
flagPkg.Token = token
if flagPkg.Token == "" {
flagPkg.Token = os.Getenv("GITEA_TOKEN")
}
if debug {
flagPkg.Debug = debug
}
if !debug {
flagPkg.Debug = os.Getenv("GITEA_DEBUG") == "true"
}
}
func Execute(version string) {