From 36e333405807090c112e23fc966554086cb5c50c Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 28 Nov 2025 19:53:48 +0800 Subject: [PATCH] Enhance MCP loading functionality by checking for directory existence - Added a check to verify if the 'mcps' directory exists before attempting to load MCP files, improving error handling and preventing unnecessary operations. - Updated the error handling in the MCP loading function to ensure robustness in the application flow. --- test/utils.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/utils.go b/test/utils.go index f0fbe604..7fb4e2f1 100644 --- a/test/utils.go +++ b/test/utils.go @@ -617,8 +617,14 @@ func loadConnector(t *testing.T, cfg config.Config) { } func loadMCP(t *testing.T, cfg config.Config) { + // Check if mcps directory exists + exists, err := application.App.Exists("mcps") + if err != nil || !exists { + return + } + exts := []string{"*.mcp.yao", "*.mcp.json", "*.mcp.jsonc"} - err := application.App.Walk("mcps", func(root, file string, isdir bool) error { + err = application.App.Walk("mcps", func(root, file string, isdir bool) error { if isdir { return nil }