From e94dacb5b2366950539c4166549a7bd8d5d8f358 Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Sat, 17 May 2025 11:55:26 +0800 Subject: [PATCH] refactor: move mcphost package to top level --- cmd/mcphost.go | 2 +- internal/version/VERSION | 2 +- mcphost/README.md | 5 +++++ {pkg/mcphost => mcphost}/chat.go | 0 {pkg/mcphost => mcphost}/chat_test.go | 0 {pkg/mcphost => mcphost}/config.go | 0 {pkg/mcphost => mcphost}/config_test.go | 2 +- {pkg/mcphost => mcphost}/dump.go | 0 {pkg/mcphost => mcphost}/dump_test.go | 0 {pkg/mcphost => mcphost}/host.go | 0 {pkg/mcphost => mcphost}/host_test.go | 0 {pkg/mcphost => mcphost}/testdata/demo_weather.py | 0 {pkg/mcphost => mcphost}/testdata/test.mcp.json | 2 +- parser.go | 2 +- parser_test.go | 2 +- pkg/mcphost/README.md | 5 ----- runner.go | 2 +- server/main.go | 2 +- 18 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 mcphost/README.md rename {pkg/mcphost => mcphost}/chat.go (100%) rename {pkg/mcphost => mcphost}/chat_test.go (100%) rename {pkg/mcphost => mcphost}/config.go (100%) rename {pkg/mcphost => mcphost}/config_test.go (90%) rename {pkg/mcphost => mcphost}/dump.go (100%) rename {pkg/mcphost => mcphost}/dump_test.go (100%) rename {pkg/mcphost => mcphost}/host.go (100%) rename {pkg/mcphost => mcphost}/host_test.go (100%) rename {pkg/mcphost => mcphost}/testdata/demo_weather.py (100%) rename {pkg/mcphost => mcphost}/testdata/test.mcp.json (84%) delete mode 100644 pkg/mcphost/README.md diff --git a/cmd/mcphost.go b/cmd/mcphost.go index d2391f48..0c3e4287 100644 --- a/cmd/mcphost.go +++ b/cmd/mcphost.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/httprunner/httprunner/v5/pkg/mcphost" + "github.com/httprunner/httprunner/v5/mcphost" "github.com/spf13/cobra" ) diff --git a/internal/version/VERSION b/internal/version/VERSION index 30283b6c..e4c3c436 100644 --- a/internal/version/VERSION +++ b/internal/version/VERSION @@ -1 +1 @@ -v5.0.0-beta-2505171137 +v5.0.0-beta-2505171155 diff --git a/mcphost/README.md b/mcphost/README.md new file mode 100644 index 00000000..3f230af6 --- /dev/null +++ b/mcphost/README.md @@ -0,0 +1,5 @@ +# mcphost + +This package is a fork of [mark3labs/mcphost], it helps HttpRunner to interact with external tools through the Model Context Protocol (MCP). + +[mark3labs/mcphost]: https://github.com/mark3labs/mcphost \ No newline at end of file diff --git a/pkg/mcphost/chat.go b/mcphost/chat.go similarity index 100% rename from pkg/mcphost/chat.go rename to mcphost/chat.go diff --git a/pkg/mcphost/chat_test.go b/mcphost/chat_test.go similarity index 100% rename from pkg/mcphost/chat_test.go rename to mcphost/chat_test.go diff --git a/pkg/mcphost/config.go b/mcphost/config.go similarity index 100% rename from pkg/mcphost/config.go rename to mcphost/config.go diff --git a/pkg/mcphost/config_test.go b/mcphost/config_test.go similarity index 90% rename from pkg/mcphost/config_test.go rename to mcphost/config_test.go index df12544d..7688a394 100644 --- a/pkg/mcphost/config_test.go +++ b/mcphost/config_test.go @@ -25,6 +25,6 @@ func TestLoadSettings(t *testing.T) { weatherConfig := settings.MCPServers["weather"].Config.(STDIOServerConfig) assert.Equal(t, "uv", weatherConfig.Command) - assert.Equal(t, []string{"--directory", "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/pkg/mcphost/testdata", "run", "demo_weather.py"}, weatherConfig.Args) + assert.Equal(t, []string{"--directory", "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/mcphost/testdata", "run", "demo_weather.py"}, weatherConfig.Args) assert.Equal(t, map[string]string{"ABC": "123"}, weatherConfig.Env) } diff --git a/pkg/mcphost/dump.go b/mcphost/dump.go similarity index 100% rename from pkg/mcphost/dump.go rename to mcphost/dump.go diff --git a/pkg/mcphost/dump_test.go b/mcphost/dump_test.go similarity index 100% rename from pkg/mcphost/dump_test.go rename to mcphost/dump_test.go diff --git a/pkg/mcphost/host.go b/mcphost/host.go similarity index 100% rename from pkg/mcphost/host.go rename to mcphost/host.go diff --git a/pkg/mcphost/host_test.go b/mcphost/host_test.go similarity index 100% rename from pkg/mcphost/host_test.go rename to mcphost/host_test.go diff --git a/pkg/mcphost/testdata/demo_weather.py b/mcphost/testdata/demo_weather.py similarity index 100% rename from pkg/mcphost/testdata/demo_weather.py rename to mcphost/testdata/demo_weather.py diff --git a/pkg/mcphost/testdata/test.mcp.json b/mcphost/testdata/test.mcp.json similarity index 84% rename from pkg/mcphost/testdata/test.mcp.json rename to mcphost/testdata/test.mcp.json index e80e4d58..37c09fab 100644 --- a/pkg/mcphost/testdata/test.mcp.json +++ b/mcphost/testdata/test.mcp.json @@ -11,7 +11,7 @@ "weather": { "args": [ "--directory", - "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/pkg/mcphost/testdata", + "/Users/debugtalk/MyProjects/HttpRunner-dev/httprunner/mcphost/testdata", "run", "demo_weather.py" ], diff --git a/parser.go b/parser.go index d74cac9e..b2a554d8 100644 --- a/parser.go +++ b/parser.go @@ -19,7 +19,7 @@ import ( "github.com/httprunner/funplugin/fungo" "github.com/httprunner/httprunner/v5/code" "github.com/httprunner/httprunner/v5/internal/builtin" - "github.com/httprunner/httprunner/v5/pkg/mcphost" + "github.com/httprunner/httprunner/v5/mcphost" mcp2 "github.com/mark3labs/mcp-go/mcp" ) diff --git a/parser_test.go b/parser_test.go index 90c86e9d..a889a909 100644 --- a/parser_test.go +++ b/parser_test.go @@ -459,7 +459,7 @@ func TestCallMCPTool(t *testing.T) { // Create a new case runner for testing caseRunner, err := NewCaseRunner(TestCase{ Config: &TConfig{ - MCPConfigPath: "pkg/mcphost/testdata/test.mcp.json", + MCPConfigPath: "mcphost/testdata/test.mcp.json", }, }, nil) require.Nil(t, err) diff --git a/pkg/mcphost/README.md b/pkg/mcphost/README.md deleted file mode 100644 index 93a9250c..00000000 --- a/pkg/mcphost/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# mcphost - -This package is a fork of [mark3labs/mcphost], and it helps HttpRunner to interact with external tools through the Model Context Protocol (MCP). - -[mark3labs/mcphost]: https://github.com/mark3labs/mcphost \ No newline at end of file diff --git a/runner.go b/runner.go index 3b40aaeb..9d7446fa 100644 --- a/runner.go +++ b/runner.go @@ -28,7 +28,7 @@ import ( "github.com/httprunner/httprunner/v5/internal/builtin" "github.com/httprunner/httprunner/v5/internal/sdk" "github.com/httprunner/httprunner/v5/internal/version" - "github.com/httprunner/httprunner/v5/pkg/mcphost" + "github.com/httprunner/httprunner/v5/mcphost" "github.com/httprunner/httprunner/v5/uixt" "github.com/httprunner/httprunner/v5/uixt/option" ) diff --git a/server/main.go b/server/main.go index 61475aa3..201003c3 100644 --- a/server/main.go +++ b/server/main.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/httprunner/httprunner/v5/pkg/mcphost" + "github.com/httprunner/httprunner/v5/mcphost" "github.com/httprunner/httprunner/v5/uixt" "github.com/gin-gonic/gin"