Skip to content

Commit 5eb2bbe

Browse files
committed
improvement(mcp): let users re-open OAuth authorization anytime
A server stuck on 'OAuth Authorization required' had no discoverable way to re-trigger the auth popup once it was closed or abandoned: the connect button lived only in the server detail view and hard-disabled while 'Connecting…', a state cleared by polling popup.closed (unreliable under COOP), so it could stay locked until the 10-minute safety timeout. - Add an 'Authorize'/'Reopen authorization' action to the server list row menu for unconnected OAuth servers, so re-auth is reachable without drilling in. - Make the detail-view button always clickable (reopens a fresh popup) instead of locking on an unverifiable 'Connecting…' state.
1 parent 7db9108 commit 5eb2bbe

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/settings/components/mcp

apps/sim/app/workspace/[workspaceId]/settings/components/mcp/mcp.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,25 @@ interface ServerListItemProps {
6868
server: McpServer
6969
tools: McpTool[]
7070
isDeleting: boolean
71+
isConnecting: boolean
7172
isLoadingTools?: boolean
7273
isRefreshing?: boolean
7374
onRemove: () => void
7475
onViewDetails: () => void
76+
onAuthorize: () => void
7577
}
7678

7779
function ServerListItem({
7880
canManage,
7981
server,
8082
tools,
8183
isDeleting,
84+
isConnecting,
8285
isLoadingTools = false,
8386
isRefreshing = false,
8487
onRemove,
8588
onViewDetails,
89+
onAuthorize,
8690
}: ServerListItemProps) {
8791
const transportLabel = formatTransportLabel(server.transport || 'http')
8892
const toolsLabel = getServerToolsLabel(
@@ -121,6 +125,14 @@ function ServerListItem({
121125
label='Server actions'
122126
actions={[
123127
{ label: 'Details', onSelect: onViewDetails },
128+
...(canManage && server.authType === 'oauth' && server.connectionStatus !== 'connected'
129+
? [
130+
{
131+
label: isConnecting ? 'Reopen authorization' : 'Authorize',
132+
onSelect: onAuthorize,
133+
},
134+
]
135+
: []),
124136
...(canManage
125137
? [
126138
{
@@ -450,12 +462,13 @@ export function MCP() {
450462
<div>
451463
<Chip
452464
variant='primary'
453-
disabled={connectingOauthServers.has(server.id)}
454465
onClick={async () => {
455466
await startOauthForServer(server.id)
456467
}}
457468
>
458-
{connectingOauthServers.has(server.id) ? 'Connecting…' : 'Connect with OAuth'}
469+
{connectingOauthServers.has(server.id)
470+
? 'Reopen authorization window'
471+
: 'Connect with OAuth'}
459472
</Chip>
460473
</div>
461474
</div>
@@ -660,13 +673,15 @@ export function MCP() {
660673
server={server}
661674
tools={tools}
662675
isDeleting={deletingServers.has(server.id)}
676+
isConnecting={connectingOauthServers.has(server.id)}
663677
isLoadingTools={isLoadingTools}
664678
isRefreshing={
665679
refreshServerMutation.isPending &&
666680
refreshServerMutation.variables?.serverId === server.id
667681
}
668682
onRemove={() => handleRemoveServer(server.id)}
669683
onViewDetails={() => handleViewDetails(server.id)}
684+
onAuthorize={() => startOauthForServer(server.id)}
670685
/>
671686
)
672687
})}

0 commit comments

Comments
 (0)