Skip to content

Commit 67b7370

Browse files
Aias00Erica177
andauthored
fix: skip unhealthy or disabled services form nacos and always marshal AllowTools field (#3220)
Co-authored-by: EricaLiu <30773688+Erica177@users.noreply.github.com>
1 parent ec504d6 commit 67b7370

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

registry/mcp_model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type McpServerRule struct {
4343
MatchRoute []string `json:"_match_route_,omitempty"`
4444
Server *ServerConfig `json:"server,omitempty"`
4545
Tools []*McpTool `json:"tools,omitempty"`
46-
AllowTools []string `json:"allowTools,omitempty"`
46+
AllowTools []string `json:"allowTools"`
4747
}
4848

4949
type ServerConfig struct {

registry/nacos/mcpserver/watcher.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ func (w *watcher) processToolConfig(dataId, data string, credentials map[string]
434434
rule.Server.SecuritySchemes = toolsDescription.SecuritySchemes
435435
}
436436

437-
var allowTools []string
437+
allowTools := []string{}
438438
for _, t := range toolsDescription.Tools {
439439
convertTool := &provider.McpTool{Name: t.Name, Description: t.Description}
440440

@@ -813,6 +813,9 @@ func generateServiceEntry(host string, services *model.Service) *v1alpha3.Servic
813813
endpoints := make([]*v1alpha3.WorkloadEntry, 0)
814814

815815
for _, service := range services.Hosts {
816+
if !service.Healthy || !service.Enable {
817+
continue
818+
}
816819
protocol := common.HTTP
817820
if service.Metadata != nil && service.Metadata["protocol"] != "" {
818821
protocol = common.ParseProtocol(service.Metadata["protocol"])

0 commit comments

Comments
 (0)