mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 23:51:25 +08:00
feat: set mcp config file default path to ~/.hrp/mcp.json
This commit is contained in:
+4
-1
@@ -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 @@
|
|||||||
v5.0.0-beta-2504242030
|
v5.0.0-beta-2504242112
|
||||||
|
|||||||
Reference in New Issue
Block a user