Add a new token
{#if showMcpMode}
{
mcpCreationMode = e.detail
if (e.detail) {
newTokenLabel = 'MCP token'
newTokenExpiration = undefined
newTokenWorkspace = $workspaceStore
} else {
newTokenLabel = undefined
newTokenExpiration = undefined
newTokenWorkspace = defaultNewTokenWorkspace
}
}}
checked={mcpCreationMode}
options={{
right: 'Generate MCP URL',
rightTooltip:
'Generate a new MCP URL to make your scripts, flows, and API endpoints available as tools through your LLM clients.',
rightDocumentationLink: 'https://www.windmill.dev/docs/core_concepts/mcp'
}}
size="xs"
/>
{/if}
{#if scopes != undefined}
Scope
{#each scopes as scope}
{/each}
{/if}
{#if !mcpCreationMode && (!scopes || scopes.length === 0)}
{
showCustomScopes = e.detail
}}
options={{
right: 'Limit token permissions',
rightTooltip:
'By default, tokens have full API access. Enable this to restrict the token to specific scopes.'
}}
size="xs"
/>
{#if showCustomScopes}
{/if}
{/if}
{#if mcpCreationMode}
Scope
{#snippet children({ item })}
{/snippet}
{#if newMcpScope === 'folder'}
Select Folder
{/if}
Hub scripts (optional)
{#if loadingApps}
Loading...
{:else if errorFetchApps}
Error fetching apps
{:else}
{/if}
Workspace
{#each workspaces as workspace}
{workspace.name}
{/each}
{/if}
Label (optional)
{#if !mcpCreationMode}
Expires In (optional)
{/if}
{#if mcpCreationMode && newMcpScope === 'custom'}
{#if loadingRunnables}
Loading scripts and flows...
Loading...
{:else}
{#snippet sectionHeader(label: string, selectAll: () => void, clearAll: () => void)}
{label}
Select All
Clear All
{/snippet}
{@render sectionHeader('Scripts', selectAllScripts, clearAllScripts)}
{#if allScripts.length > 0}
{:else}
No scripts available
{/if}
{@render sectionHeader('Flows', selectAllFlows, clearAllFlows)}
{#if allFlows.length > 0}
{:else}
No flows available
{/if}
{@render sectionHeader('API Endpoints', selectAllEndpoints, clearAllEndpoints)}
e.name))}
placeholder="Select endpoints"
bind:value={selectedEndpoints}
/>
Selected: {selectedScripts.length} scripts, {selectedFlows.length} flows, {selectedEndpoints.length}
endpoints
Script wildcard patterns
{#snippet text()}
Add folder wildcards or complex patterns
Examples:
f/folder/* - all scripts/flows in folder
f/folder1/*,f/folder2/* - multiple folders
Mix: f/folder/*,f/specific/path
Patterns are combined with individual selections above.
{/snippet}
Pattern Help
{/if}
{:else if mcpCreationMode && (newMcpScope !== 'folder' || selectedFolder.length > 0)}
{#if loadingRunnables}
Scripts & Flows that will be available via MCP
Loading...
{:else}
{#if longPathWarning}
{longPathWarning}
{/if}
Scripts & Flows that will be available via MCP
{#if validRunnables.length > 0 && validRunnables.length <= 5}
{#each validRunnables as scriptOrFlow}
{scriptOrFlow}
{/each}
{:else if validRunnables.length > 0}
{#each validRunnables.slice(0, 3) as scriptOrFlow}
{scriptOrFlow}
{/each}
+{validRunnables.length - 3} more
{:else}
{warning}
{/if}
API endpoint tools that will be available via MCP
{#each mcpEndpointTools as endpoint}
{#snippet text()}
{endpoint.description}
{endpoint.method}
{endpoint.path}
{/snippet}
{endpoint.name}
{/each}
{/if}
{/if}
{
mcpCreationMode = false
}}
variant="default"
>
Cancel
createToken(mcpCreationMode)}
disabled={mcpCreationMode &&
(newTokenWorkspace == undefined ||
(newMcpScope === 'folder' && !selectedFolder) ||
(newMcpScope === 'custom' &&
selectedScripts.length === 0 &&
selectedFlows.length === 0 &&
selectedEndpoints.length === 0 &&
!customScriptPatterns.trim() &&
!customFlowPatterns.trim()))}
variant="accent"
>
New token