Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: invalidate tool provider cache after MCP authentication (#29972)
Novice0ab80fe5c09b
diff --git a/api/controllers/console/workspace/tool_providers.py b/api/controllers/console/workspace/tool_providers.pyindex a2fc45c29c4..cb711d16e44 100644--- a/api/controllers/console/workspace/tool_providers.py+++ b/api/controllers/console/workspace/tool_providers.py@@ -1081,6 +1081,8 @@ class ToolMCPAuthApi(Resource):credentials=provider_entity.credentials,authed=True,)+ # Invalidate cache after updating credentials+ ToolProviderListCache.invalidate_cache(tenant_id)return {"result": "success"}except MCPAuthError as e:try:@@ -1094,16 +1096,22 @@ class ToolMCPAuthApi(Resource):with Session(db.engine) as session, session.begin():service = MCPToolManageService(session=session)response = service.execute_auth_actions(auth_result)+ # Invalidate cache after auth actions may have updated provider state+ ToolProviderListCache.invalidate_cache(tenant_id)return responseexcept MCPRefreshTokenError as e:with Session(db.engine) as session, session.begin():service = MCPToolManageService(session=session)service.clear_provider_credentials(provider_id=provider_id, tenant_id=tenant_id)+ # Invalidate cache after clearing credentials+ ToolProviderListCache.invalidate_cache(tenant_id)raise ValueError(f"Failed to refresh token, please try to authorize again: {e}") from eexcept (MCPError, ValueError) as e:with Session(db.engine) as session, session.begin():service = MCPToolManageService(session=session)service.clear_provider_credentials(provider_id=provider_id, tenant_id=tenant_id)+ # Invalidate cache after clearing credentials+ ToolProviderListCache.invalidate_cache(tenant_id)raise ValueError(f"Failed to connect to MCP server: {e}") from e