fix(mcp): register sessions (#6429)

Because of this, the first calls to the MCP endpoint would fail and
later would succeeds thanks to the cache.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto
2025-10-10 18:03:07 +02:00
committed by GitHub
parent 4aac0ef42e
commit d763bce46d

View File

@@ -62,6 +62,7 @@ func SessionsFromMCPConfig(
}
log.Debug().Msgf("[MCP remote server] Connected to MCP server %s", server.URL)
cache.cache[name] = append(cache.cache[name], mcpSession)
allSessions = append(allSessions, mcpSession)
}
for _, server := range stdio.Servers {
@@ -79,6 +80,7 @@ func SessionsFromMCPConfig(
}
log.Debug().Msgf("[MCP stdio server] Connected to MCP server %s", command)
cache.cache[name] = append(cache.cache[name], mcpSession)
allSessions = append(allSessions, mcpSession)
}
signals.RegisterGracefulTerminationHandler(func() {