From f8a5c25f4b921dc10f0bc73a6c713a4c51d69657 Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Thu, 10 Apr 2025 11:20:00 +0800 Subject: [PATCH] change: mcp tool invoke url path --- internal/mcp/config.go | 3 +++ internal/mcp/hub.go | 2 ++ internal/version/VERSION | 2 +- server/main.go | 6 +++--- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/internal/mcp/config.go b/internal/mcp/config.go index a9e14c00..3377040b 100644 --- a/internal/mcp/config.go +++ b/internal/mcp/config.go @@ -5,6 +5,8 @@ import ( "fmt" "os" "time" + + "github.com/rs/zerolog/log" ) // MCPSettings represents the main configuration structure @@ -43,6 +45,7 @@ func (c *ServerConfig) GetTimeoutDuration() time.Duration { // LoadSettings loads MCP settings from the config file func LoadSettings(path string) (*MCPSettings, error) { + log.Info().Str("path", path).Msg("load MCP settings") data, err := os.ReadFile(path) if err != nil { return nil, fmt.Errorf("failed to read settings file: %w", err) diff --git a/internal/mcp/hub.go b/internal/mcp/hub.go index 32d28e3a..3283b82a 100644 --- a/internal/mcp/hub.go +++ b/internal/mcp/hub.go @@ -82,6 +82,8 @@ func (h *MCPHub) connectToServer(ctx context.Context, serverName string, config h.mu.Lock() defer h.mu.Unlock() + log.Debug().Str("server", serverName).Msg("connecting to MCP server") + // Close existing connection if any if existing, exists := h.connections[serverName]; exists { if err := existing.Client.Close(); err != nil { diff --git a/internal/version/VERSION b/internal/version/VERSION index 02950ee9..62200d6e 100644 --- a/internal/version/VERSION +++ b/internal/version/VERSION @@ -1 +1 @@ -v5.0.0-beta-2504091352 +v5.0.0-beta-2504101120 diff --git a/server/main.go b/server/main.go index 67400d48..9a690f17 100644 --- a/server/main.go +++ b/server/main.go @@ -50,11 +50,11 @@ func (r *Router) Init() { r.Engine.GET("/api/v1/devices", r.listDeviceHandler) r.Engine.POST("/api/v1/browser/create_browser", createBrowserHandler) - // tool operations - r.Engine.POST("/api/v1/tool/invoke", r.invokeToolHandler) - apiV1PlatformSerial := r.Group("/api/v1").Group("/:platform").Group("/:serial") + // tool operations + apiV1PlatformSerial.POST("/tool/invoke", r.invokeToolHandler) + // UI operations apiV1PlatformSerial.POST("/ui/tap", r.tapHandler) apiV1PlatformSerial.POST("/ui/right_click", r.rightClickHandler)