feat: set mcp config file default path to ~/.hrp/mcp.json

This commit is contained in:
lilong.129
2025-04-24 21:12:03 +08:00
parent 1659e47927
commit 9473345ec9
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -1,6 +1,8 @@
package cmd package cmd
import ( import (
"os"
"github.com/httprunner/httprunner/v5/server" "github.com/httprunner/httprunner/v5/server"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@@ -13,6 +15,7 @@ var serverCmd = &cobra.Command{
Args: cobra.MinimumNArgs(1), Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
router := server.NewRouter() router := server.NewRouter()
mcpConfigPath = os.ExpandEnv(mcpConfigPath)
if mcpConfigPath != "" { if mcpConfigPath != "" {
router.InitMCPHub(mcpConfigPath) router.InitMCPHub(mcpConfigPath)
} }
@@ -28,5 +31,5 @@ var (
func init() { func init() {
rootCmd.AddCommand(serverCmd) rootCmd.AddCommand(serverCmd)
serverCmd.Flags().IntVarP(&port, "port", "p", 8082, "port to run the server on") serverCmd.Flags().IntVarP(&port, "port", "p", 8082, "port to run the server on")
serverCmd.Flags().StringVarP(&mcpConfigPath, "mcp-config", "c", "", "path to the MCP config file") serverCmd.Flags().StringVarP(&mcpConfigPath, "mcp-config", "c", "$HOME/.hrp/mcp.json", "path to the MCP config file")
} }
+1 -1
View File
@@ -1 +1 @@
v5.0.0-beta-2504242030 v5.0.0-beta-2504242112