fix(mcp): trigger OAuth prompt during tool registration and dedupe helpers

OAuth authorization was only handled in MCPTool.Execute, so unauthenticated
services failed silently during RegisterMCPTools before any tool reached the
agent. Wire EventBus/session metadata into registration and reuse the same
getOrCreateMCPClientWithOAuthRetry path used at execution time.

Extract MCP OAuth session/wait/connect logic into mcp_oauth.go and remove the
duplicate waitForOAuthAndRetry + RegisterMCPContext layering in mcp_tool.go.
This commit is contained in:
wizardchen
2026-06-29 22:53:34 +08:00
committed by lyingbug
parent 9fd7a7f522
commit 505195865a
5 changed files with 255 additions and 143 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ type AgentService interface {
chatModel chat.Chat,
rerankModel rerank.Reranker,
eventBus *event.EventBus,
sessionID string,
sessionID, assistantMessageID string,
) (AgentEngine, error)
// ValidateConfig validates an agent configuration