fix: startup logs an invalid OAuth client error for MCP servers that were never registered (#34938)

An OAuth 2.1 MCP tool server that had not gone through Register Client yet logged "Stored OAuth client data is invalid; reconnect this tool server" on every startup, even though nothing was stored. Such a server is now skipped at startup, the same way it is skipped when a user connects, so the log stays quiet until it is registered. Client data that cannot be read, for example after the encryption key changed, is still reported.

Relates to #34937
This commit is contained in:
Classic298 authored and GitHub committed 2026-11-24 18:45:22 +04:00
1 parent 3e88289868
commit 810f2ddd8a
1 file changed
+2 -1
+2 -1
View File
@@ -653,8 +653,9 @@ async def initialize_runtime_config(app: FastAPI):
if tool_server_connection.get('type', 'openapi') == 'mcp':
server_id = (tool_server_connection.get('info') or {}).get('id')
auth_type = tool_server_connection.get('auth_type', 'none')
oauth_client_info = (tool_server_connection.get('info') or {}).get('oauth_client_info', '')
if server_id and auth_type in ('oauth_2.1', 'oauth_2.1_static'):
if server_id and auth_type in ('oauth_2.1', 'oauth_2.1_static') and oauth_client_info:
try:
oauth_client_info = resolve_oauth_client_info(tool_server_connection)
oauth_client_info = await recover_oauth_client_metadata(tool_server_connection, oauth_client_info)