Skip to content

Commit 155afe2

Browse files
waleedlatif1claude
andcommitted
fix(mcp): mark OAuth-pending servers disconnected so reauth UI surfaces
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent cdd6e2a commit 155afe2

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

apps/sim/lib/mcp/service.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff 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 =

0 commit comments

Comments
 (0)