Skip to content

Commit 2e51871

Browse files
authored
feat(ui): add button to enable Agentic MCP (#6400)
Signed-off-by: Ettore Di Giacinto <[email protected]>
1 parent 8067d25 commit 2e51871

File tree

3 files changed

+246
-110
lines changed

3 files changed

+246
-110
lines changed

core/http/endpoints/openai/mcp.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package openai
33
import (
44
"encoding/json"
55
"errors"
6+
"fmt"
67
"strings"
78
"sync"
89
"time"
@@ -49,6 +50,10 @@ func MCPCompletionEndpoint(cl *config.ModelConfigLoader, ml *model.ModelLoader,
4950
return fiber.ErrBadRequest
5051
}
5152

53+
if config.MCP.Servers == "" && config.MCP.Stdio == "" {
54+
return fmt.Errorf("no MCP servers configured")
55+
}
56+
5257
allTools := []*mcp.MCPTool{}
5358

5459
// Get MCP config from model config
@@ -78,6 +83,10 @@ func MCPCompletionEndpoint(cl *config.ModelConfigLoader, ml *model.ModelLoader,
7883
// defer tool.Close()
7984
}
8085

86+
if len(cogitoTools) == 0 {
87+
return fmt.Errorf("no tools found in the specified MCP servers")
88+
}
89+
8190
fragment := cogito.NewEmptyFragment()
8291

8392
for _, message := range input.Messages {

0 commit comments

Comments
 (0)