fix: load mcp auth at tool call time

This commit is contained in:
lda
2026-06-13 07:07:39 +07:00 Verified
parent 38913cfdcb
commit 4cab4a7d5d
5 changed files with 89 additions and 1 deletions
+2
View File
@@ -34,6 +34,7 @@ def specs_from_discovered_tools(
*,
connection: ConnectionConfig,
auth: AuthRecord | None,
auth_loader: Callable[[], AuthRecord | None] | None = None,
executor: ToolExecutor,
tools: list[DiscoveredTool],
emit_event: Callable[[McpEvent], None] | None = None,
@@ -50,6 +51,7 @@ def specs_from_discovered_tools(
return source_specs_from_discovered_tools(
connection=source_connection,
auth=auth,
auth_loader=auth_loader,
executor=executor,
tools=tools,
emit_event=emit_tool_event if emit_event is not None else None,
@@ -273,6 +273,7 @@ class UpstreamTransportService:
specs = specs_from_discovered_tools(
connection=connection,
auth=auth,
auth_loader=lambda: self.load_connection_auth(connection),
executor=self.tool_executor_for(connection),
tools=capabilities.tools,
emit_event=self.event_sink,