feat: show what a role limit leaves a new mcp token

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-12-02 13:23:22 +01:00
co-authored by Claude Opus 5.5
parent 34c323f110
commit a9f8bcf92b
@@ -34,6 +34,7 @@
import ClipboardPanel from '../details/ClipboardPanel.svelte'
import { workspaceMcpUrl } from '../mcp/workspaceAccess'
import McpAccessPicker, { type McpAccess } from '../mcp/McpAccessPicker.svelte'
import McpWorkspaceAccessList from '../mcp/McpWorkspaceAccessList.svelte'
import MultiSelect from '../select/MultiSelect.svelte'
import ToggleButtonGroup from '../common/toggleButton-v2/ToggleButtonGroup.svelte'
import ToggleButton from '../common/toggleButton-v2/ToggleButton.svelte'
@@ -378,14 +379,19 @@
// connection to that workspace alone, which its own URL makes of any sign-in.
const mcpWorkspaceAccess = resource(
() => mcpCreationMode,
async (on) =>
on ? await McpOauthService.listMcpWorkspaceAccess({}).catch(() => []) : []
async (on) => (on ? await McpOauthService.listMcpWorkspaceAccess({}).catch(() => []) : [])
)
const mcpAsTools = $derived(
!!mcpWorkspaceAccess.current?.some(
(w) => w.id === mcpBoundWorkspace && w.access === 'runnables'
)
)
// Shown only where a role sets the access: elsewhere the picked access is what the token gets.
const mcpRoleLimited = $derived(
!!mcpWorkspaceAccess.current?.some(
(w) => w.limited && (mcpAllWorkspaces || mcpWorkspaces.includes(w.id))
)
)
const mcpUrl = $derived(
mcpAsTools && mcpBoundWorkspace
? workspaceMcpUrl(mcpBoundWorkspace)
@@ -447,6 +453,14 @@
{/if}
{/snippet}
</McpAccessPicker>
{#if mcpRoleLimited}
<McpWorkspaceAccessList
workspaces={mcpWorkspaceAccess.current ?? []}
covered={mcpWorkspaces}
all={mcpAllWorkspaces}
access={mcpAccess}
/>
{/if}
{#if !mcpOnly}
<div>
<span class="block mb-1 text-emphasis text-xs font-semibold"
@@ -759,10 +773,10 @@
</p>
{#if privateRangesTrusted && allowedIps.length > 0}
<Alert type="warning" size="xs" title="Insiders can claim an allowed address">
This instance trusts a whole private range as proxies, so a host on its private network,
a job included, can name its own client address. The allowlist holds against callers
outside that network only. An instance admin can list the reverse proxies on the Client
IP instance settings page.
This instance trusts a whole private range as proxies, so a host on its private
network, a job included, can name its own client address. The allowlist holds against
callers outside that network only. An instance admin can list the reverse proxies on
the Client IP instance settings page.
</Alert>
{/if}
{#if clientIp}