Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions apps/web/src/components/settings/Integrations.test.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 25 additions & 12 deletions apps/web/src/components/settings/Integrations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,21 @@ export function Integrations() {
(userMcpConnections.data ?? []).map((entry) => [entry.mcpId, entry]),
);
const canSetUpLinearOauth = isAdmin && linearOauthUnavailable;
const canReconnectLinear =
isAdmin && Boolean(linearInstallation.data) && !linearOauthUnavailable;
const startLinearConnection = () => {
connectLinear.mutate(undefined, {
onSuccess: (url) => {
window.location.href = url;
},
onError: (error) =>
toast.error(
error instanceof Error
? error.message
: 'Failed to enable Linear. Please try again.',
),
});
};
const openMcpToolDialog = (integration: McpIntegrationDefinition) =>
setToolDialogState({
mcpId: integration.id,
Expand Down Expand Up @@ -1346,7 +1361,15 @@ export function Integrations() {
linearOauthSetup.isPending || linearOauthSetup.data == null,
icon: <Settings2 />,
}
: undefined,
: canReconnectLinear
? {
label: 'Reconnect',
ariaLabel: 'Reconnect Linear',
onAction: startLinearConnection,
isPending: connectLinear.isPending,
icon: <RefreshCw />,
}
: undefined,
onAction: linearOauthUnavailable
? undefined
: () => {
Expand All @@ -1364,17 +1387,7 @@ export function Integrations() {
return;
}

connectLinear.mutate(undefined, {
onSuccess: (url) => {
window.location.href = url;
},
onError: (error) =>
toast.error(
error instanceof Error
? error.message
: 'Failed to enable Linear. Please try again.',
),
});
startLinearConnection();
},
},
...visibleMcpIntegrations
Expand Down
18 changes: 18 additions & 0 deletions packages/types/src/__tests__/mcp-oauth.test.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion packages/types/src/mcp-oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ export type McpConnectionRole =
| 'linear_org_install'
| 'linear_user_link';

export const LINEAR_APP_OAUTH_SCOPES = [
'read',
'write',
'app:assignable',
'app:mentionable',
] as const;

/**
* MCP Server Configuration
* This is what gets written to .roomote/mcp.json in the workspace
Expand Down Expand Up @@ -633,7 +640,9 @@ export function getMcpIntegrationOauthScopes(
}

if (integration.id === 'linear') {
return role === 'linear_user_link' ? ['read'] : ['read', 'write'];
return role === 'linear_user_link'
? ['read']
: [...LINEAR_APP_OAUTH_SCOPES];
}

return integration.oauthScopes;
Expand Down
Loading