RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix(agent): close MCP sessions wrapped in MCPToolBinding (#18399)
var4dev63a454084ec4
diff --git a/agent/canvas.py b/agent/canvas.pyindex 4ccec4ae5a..14be6c10a6 100644--- a/agent/canvas.py+++ b/agent/canvas.py@@ -168,19 +168,22 @@ class Graph:logging.exception(e)def close(self):- from common.mcp_tool_call_conn import MCPToolCallSession+ from common.mcp_tool_call_conn import MCPToolBinding, MCPToolCallSessionseen = set()for cpn in self.components.values():obj = cpn.get("obj")if obj and hasattr(obj, "tools"):for tool in obj.tools.values():- if isinstance(tool, MCPToolCallSession) and id(tool) not in seen:- seen.add(id(tool))+ session = tool if isinstance(tool, MCPToolCallSession) else (+ tool.session if isinstance(tool, MCPToolBinding) else None+ )+ if isinstance(session, MCPToolCallSession) and id(session) not in seen:+ seen.add(id(session))try:- tool.close_sync(timeout=3)+ session.close_sync(timeout=3)except Exception:- pass+ logging.exception("Error closing MCP session for server %s", session._mcp_server.id)@staticmethoddef _get_component_name(dsl, cid):