From f0254c990aa7a8beebef722c037c0240e4c643a8 Mon Sep 17 00:00:00 2001 From: hugocasa Date: Thu, 3 Dec 2026 11:40:51 +0100 Subject: [PATCH] fix: leave a tools workspace out of a read-only connection's list and say why in its card, select it from the card Co-Authored-By: Claude Opus 5.5 --- .../src/lib/components/mcp/workspaceAccess.test.ts | 2 +- frontend/src/lib/components/mcp/workspaceAccess.ts | 4 ++-- .../oauth/mcp_authorize/+page@(root).svelte | 13 +++++++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/frontend/src/lib/components/mcp/workspaceAccess.test.ts b/frontend/src/lib/components/mcp/workspaceAccess.test.ts index 5e0ffe3f11..69c2bf692f 100644 --- a/frontend/src/lib/components/mcp/workspaceAccess.test.ts +++ b/frontend/src/lib/components/mcp/workspaceAccess.test.ts @@ -56,7 +56,7 @@ it('serves a tools workspace only to a connection covering it alone', () => { const session = ws('b', 'read_only') expect(servedOn([tools], false, 'full')).toEqual([tools]) expect(servedOn([tools], true, 'full')).toEqual([]) - expect(servedOn([tools], true, 'read')).toEqual([tools]) + expect(servedOn([tools], true, 'read')).toEqual([]) expect(servedOn([tools, session], false, 'full')).toEqual([session]) }) diff --git a/frontend/src/lib/components/mcp/workspaceAccess.ts b/frontend/src/lib/components/mcp/workspaceAccess.ts index f7cab04c74..00fc87b2de 100644 --- a/frontend/src/lib/components/mcp/workspaceAccess.ts +++ b/frontend/src/lib/components/mcp/workspaceAccess.ts @@ -77,14 +77,14 @@ export function restriction(workspace: McpWorkspaceAccess, picked: McpAccess): s } /** The covered workspaces a connection serves. One set to scripts and flows as tools is served - * only to a connection covering it alone; a read-only one lists it as giving nothing. */ + * only to a connection covering it alone. */ export function servedOn( covered: McpWorkspaceAccess[], all: boolean, picked: McpAccess ): McpWorkspaceAccess[] { const alone = !all && covered.length === 1 - return covered.filter((w) => w.access !== 'runnables' || alone || picked === 'read') + return covered.filter((w) => w.access !== 'runnables' || alone) } /** The session toolset a connection with the `picked` access gets in a workspace, none where it diff --git a/frontend/src/routes/(root)/(logged)/oauth/mcp_authorize/+page@(root).svelte b/frontend/src/routes/(root)/(logged)/oauth/mcp_authorize/+page@(root).svelte index 4b4b851fad..042e1a1667 100644 --- a/frontend/src/routes/(root)/(logged)/oauth/mcp_authorize/+page@(root).svelte +++ b/frontend/src/routes/(root)/(logged)/oauth/mcp_authorize/+page@(root).svelte @@ -179,7 +179,7 @@ isGateway && !toolsOnly && !allWorkspaces && covered.length === 1 && isTools(covered[0]) ) const leftOut = $derived( - isGateway && access !== 'selected' && access !== 'read' + isGateway && access !== 'selected' ? workspaceAccess.filter((w) => isTools(w) && !served.includes(w)) : [] ) @@ -620,11 +620,16 @@ ? 'is not included' : 'are not included'} - {#if leftOutOpen} + {#if leftOutOpen && access === 'read'} +

+ {one ? 'Its role offers' : 'Their roles offer'} only scripts and flows as tools, which + a read-only client cannot run. +

+ {:else if leftOutOpen}

Scripts and flows as tools need a connection of their own: add {one ? 'its' - : 'each'} workspace URL to your AI client, or connect it alone here. + : 'each'} workspace URL to your AI client, or select it here instead.

{#each leftOut as w (w.id)} @@ -643,7 +648,7 @@ Copy workspace URL