File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -413,7 +413,23 @@ class McpService {
413413 result . reason instanceof UnauthorizedError
414414 ) {
415415 // Pending user authorization or expired refresh — not a hard failure.
416+ // Force the row back to 'disconnected' so the settings UI surfaces the
417+ // "Connect with OAuth" button instead of leaving stale 'connected' state.
416418 logger . info ( `[${ requestId } ] Skipping server ${ server . name } : OAuth authorization pending` )
419+ statusUpdates . push (
420+ db
421+ . update ( mcpServers )
422+ . set ( {
423+ connectionStatus : 'disconnected' ,
424+ lastError : null ,
425+ updatedAt : new Date ( ) ,
426+ } )
427+ . where ( eq ( mcpServers . id , server . id ! ) )
428+ . then ( ( ) => undefined )
429+ . catch ( ( err ) => {
430+ logger . warn ( `[${ requestId } ] Failed to mark server ${ server . id } disconnected:` , err )
431+ } )
432+ )
417433 } else {
418434 failedCount ++
419435 const errorMessage =
You can’t perform that action at this time.
0 commit comments