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

View File

@@ -1,6 +1,8 @@
package cmd
import (
"os"
"github.com/httprunner/httprunner/v5/server"
"github.com/spf13/cobra"
)
@@ -13,6 +15,7 @@ var serverCmd = &cobra.Command{
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
router := server.NewRouter()
mcpConfigPath = os.ExpandEnv(mcpConfigPath)
if mcpConfigPath != "" {
router.InitMCPHub(mcpConfigPath)
}
@@ -28,5 +31,5 @@ var (
func init() {
rootCmd.AddCommand(serverCmd)
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")
}