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.
This commit is contained in:
Max 2025-11-28 19:53:48 +08:00
parent 8bf128e3ba
commit 36e3334058

View file

@ -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
}