From e0bded292ffc8995cc117f21a5b224f41b2e6dae Mon Sep 17 00:00:00 2001 From: hugocasa Date: Wed, 2 Dec 2026 19:59:19 +0100 Subject: [PATCH] feat: show the consent page's tools in a searchable dialog, pick the access from a select Co-Authored-By: Claude Opus 5.5 --- backend/windmill-api/src/mcp/core.rs | 3 + .../lib/components/mcp/McpAccessPicker.svelte | 69 ++++++++++++------- .../lib/components/mcp/McpToolsModal.svelte | 42 +++++++++++ .../src/lib/components/mcp/toolsets.svelte.ts | 7 +- .../oauth/mcp_authorize/+page@(root).svelte | 16 ++--- 5 files changed, 104 insertions(+), 33 deletions(-) create mode 100644 frontend/src/lib/components/mcp/McpToolsModal.svelte diff --git a/backend/windmill-api/src/mcp/core.rs b/backend/windmill-api/src/mcp/core.rs index 2edf08df3a..44f35af475 100644 --- a/backend/windmill-api/src/mcp/core.rs +++ b/backend/windmill-api/src/mcp/core.rs @@ -1029,6 +1029,8 @@ struct ToolsetQuery { struct ToolsetEntry { name: String, description: String, + /// The JSON Schema of its arguments. + parameters: serde_json::Value, } /// The tools `/api/mcp` offers an `mcp:all` token at each access level, for the token @@ -1047,6 +1049,7 @@ async fn list_toolset_handler( .map(|tool| ToolsetEntry { name: tool.name.to_string(), description: tool.description.map(|d| d.to_string()).unwrap_or_default(), + parameters: serde_json::Value::Object((*tool.input_schema).clone()), }) .collect(), )) diff --git a/frontend/src/lib/components/mcp/McpAccessPicker.svelte b/frontend/src/lib/components/mcp/McpAccessPicker.svelte index e748b1051e..6e3843ebc3 100644 --- a/frontend/src/lib/components/mcp/McpAccessPicker.svelte +++ b/frontend/src/lib/components/mcp/McpAccessPicker.svelte @@ -40,6 +40,7 @@ import ToggleButtonGroup from '$lib/components/common/toggleButton-v2/ToggleButtonGroup.svelte' import ToggleButton from '$lib/components/common/toggleButton-v2/ToggleButton.svelte' import McpScopeSelector from './McpScopeSelector.svelte' + import Select from '$lib/components/select/Select.svelte' import McpToolList from './McpToolList.svelte' import { toolset } from './toolsets.svelte' import Section from '$lib/components/Section.svelte' @@ -63,6 +64,8 @@ fullLabel?: string /** Rendered between the access choice and the tool list. */ afterAccess?: Snippet + /** A select, with the chosen level's meaning under it, for a narrow dialog. */ + asSelect?: boolean } let { @@ -72,9 +75,17 @@ access = $bindable(), initialScopes = [], fullLabel = 'Build and run', - afterAccess + afterAccess, + asSelect = false }: Props = $props() + const LEVELS = $derived([ + { value: 'full', label: fullLabel }, + { value: 'read_run', label: 'Read and run' }, + { value: 'read', label: 'Read only' }, + { value: 'selected', label: 'Scripts and flows as tools' } + ]) + const initialAccess = mcpAccessOf(initialScopes) access = initialAccess const initialSelection = @@ -116,24 +127,31 @@
Access - - {#snippet children({ item })} - - - - - {/snippet} - + {#if asSelect} +