From c129a1c97a83431bf31add17177c8a5f50b0f901 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 9 Oct 2025 11:48:59 -0300 Subject: [PATCH] fix: keep alive Signed-off-by: Carlos Alexandro Becker --- internal/llm/agent/mcp-tools.go | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/internal/llm/agent/mcp-tools.go b/internal/llm/agent/mcp-tools.go index e1ebbc9a2de428a88aaad9e1016d0d5a692c42fc..ae81a306b7981713b9faefc6cde860b640a2b5cf 100644 --- a/internal/llm/agent/mcp-tools.go +++ b/internal/llm/agent/mcp-tools.go @@ -342,18 +342,22 @@ func createMCPSession(ctx context.Context, name string, m config.MCPConfig, reso return nil, err } - client := mcp.NewClient(&mcp.Implementation{ - Name: "crush", - Version: version.Version, - Title: "Crush", - }, &mcp.ClientOptions{ - ToolListChangedHandler: func(context.Context, *mcp.ToolListChangedRequest) { - mcpBroker.Publish(pubsub.UpdatedEvent, MCPEvent{ - Type: MCPEventToolsListChanged, - Name: name, - }) + client := mcp.NewClient( + &mcp.Implementation{ + Name: "crush", + Version: version.Version, + Title: "Crush", }, - }) + &mcp.ClientOptions{ + ToolListChangedHandler: func(context.Context, *mcp.ToolListChangedRequest) { + mcpBroker.Publish(pubsub.UpdatedEvent, MCPEvent{ + Type: MCPEventToolsListChanged, + Name: name, + }) + }, + KeepAlive: time.Minute * 10, + }, + ) timeout := mcpTimeout(m) mcpCtx, cancel := context.WithCancel(ctx)