Default CLI config path to ~/.config/mcp/mcp.toml

Eliminates the need to pass --config on every command.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 15:16:34 -07:00
parent efa32a7712
commit 7133871be2

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"log"
"os"
"path/filepath"
"github.com/spf13/cobra"
)
@@ -18,7 +19,11 @@ func main() {
Use: "mcp",
Short: "Metacircular Control Plane CLI",
}
root.PersistentFlags().StringVarP(&cfgPath, "config", "c", "", "config file path")
defaultCfg := ""
if home, err := os.UserHomeDir(); err == nil {
defaultCfg = filepath.Join(home, ".config", "mcp", "mcp.toml")
}
root.PersistentFlags().StringVarP(&cfgPath, "config", "c", defaultCfg, "config file path")
root.AddCommand(&cobra.Command{
Use: "version",