Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(mcp-store): allow oauth reconnection (#93955)

Ben Whited15485c1ccba
diff --git a/products/mcp_store/frontend/gateway/GatewayServerScene.tsx b/products/mcp_store/frontend/gateway/GatewayServerScene.tsx
index affcc4e0f3ae..6f20fde97354 100644
--- a/products/mcp_store/frontend/gateway/GatewayServerScene.tsx
+++ b/products/mcp_store/frontend/gateway/GatewayServerScene.tsx
@@ -92,6 +92,7 @@ export function GatewayServerScene({
removingServerIds.has(server.id) ||
Boolean(connection && disconnectingInstallationIds.has(connection.installation_id))
const needsReconnect = Boolean(connection?.pending_oauth || connection?.needs_reauth)
+ const canReconnect = Boolean(connection && (server.auth_type === 'oauth' || needsReconnect))
const confirmRemoval = (): void => {
if (!connection && removalAction !== 'delete_for_everyone') {
return
@@ -183,7 +184,7 @@ export function GatewayServerScene({
}
/>
</div>
- {needsReconnect && (
+ {canReconnect && (
<LemonButton
type="primary"
size="small"
@@ -195,6 +196,7 @@ export function GatewayServerScene({
: undefined
}
onClick={() => reconnectServer(connection.installation_id)}
+ data-attr="mcp-server-reconnect"
>
Reconnect your account
</LemonButton>
diff --git a/products/mcp_store/frontend/gateway/GatewayServersHome.test.tsx b/products/mcp_store/frontend/gateway/GatewayServersHome.test.tsx
index 9e3a3715214f..444b4fe1231f 100644
--- a/products/mcp_store/frontend/gateway/GatewayServersHome.test.tsx
+++ b/products/mcp_store/frontend/gateway/GatewayServersHome.test.tsx
@@ -120,4 +120,26 @@ describe('GatewayServersHome', () => {
expect(connectServer).toHaveBeenCalledWith('server-id')
expect(openServer).toHaveBeenCalledTimes(1)
})
+
+ it('lets a user reconnect a healthy OAuth connection', () => {
+ render(
+ <GatewayServerCard
+ server={{
+ ...gatewayServer(),
+ auth_type: 'oauth',
+ your_connection: {
+ installation_id: 'installation-id',
+ is_enabled: true,
+ pending_oauth: false,
+ needs_reauth: false,
+ last_used_at: null,
+ },
+ }}
+ />
+ )
+
+ fireEvent.click(screen.getByText('Reconnect'))
+
+ expect(reconnectServer).toHaveBeenCalledWith('installation-id')
+ })
})
diff --git a/products/mcp_store/frontend/gateway/GatewayServersHome.tsx b/products/mcp_store/frontend/gateway/GatewayServersHome.tsx
index 63ebdd4cce13..260c765bcfa8 100644
--- a/products/mcp_store/frontend/gateway/GatewayServersHome.tsx
+++ b/products/mcp_store/frontend/gateway/GatewayServersHome.tsx
@@ -153,6 +153,7 @@ export function GatewayServerCard({
const connection = server.your_connection
const connected = Boolean(connection?.is_enabled && !connection.pending_oauth && !connection.needs_reauth)
const needsReconnect = Boolean(connection?.pending_oauth || connection?.needs_reauth)
+ const canReconnect = Boolean(connection && (server.auth_type === 'oauth' || needsReconnect))
const connecting = connectingServerId === server.id
const disabled = !server.is_team_enabled
const canConnectIndividual = !connection
@@ -217,13 +218,14 @@ export function GatewayServerCard({
{isAdmin && !recommended && <PeopleRow server={server} />}
</div>
<div className="shrink-0">
- {needsReconnect && connection ? (
+ {canReconnect && connection ? (
<LemonButton
size="small"
type="primary"
disabledReason={connectionDisabledReason}
onClick={() => reconnectServer(connection.installation_id)}
stopPropagation
+ data-attr="mcp-server-reconnect"
>
Reconnect
</LemonButton>