Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: add back MCP tool custom header (#13188)

Lynn67befc91193d
diff --git a/agent/component/agent_with_tools.py b/agent/component/agent_with_tools.py
index 5ff55adf93..fe665ead72 100644
--- a/agent/component/agent_with_tools.py
+++ b/agent/component/agent_with_tools.py
@@ -76,6 +76,7 @@ class AgentParam(LLMParam, ToolParamBase):
self.mcp = []
self.max_rounds = 5
self.description = ""
+ self.custom_header = {}
class Agent(LLM, ToolBase):
@@ -105,7 +106,8 @@ class Agent(LLM, ToolBase):
for mcp in self._param.mcp:
_, mcp_server = MCPServerService.get_by_id(mcp["mcp_id"])
- tool_call_session = MCPToolCallSession(mcp_server, mcp_server.variables)
+ custom_header = self._param.custom_header
+ tool_call_session = MCPToolCallSession(mcp_server, mcp_server.variables, custom_header)
for tnm, meta in mcp["tools"].items():
self.tool_meta.append(mcp_tool_metadata_to_openai_tool(meta))
self.tools[tnm] = tool_call_session