Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(permissions): give external MCP tools their own Ask First row

purple0c6a1d41d35b
diff --git a/src/api/__tests__/tool-schema-shape.test.ts b/src/api/__tests__/tool-schema-shape.test.ts
index fd5eac51..ad8e054c 100644
--- a/src/api/__tests__/tool-schema-shape.test.ts
+++ b/src/api/__tests__/tool-schema-shape.test.ts
@@ -31,7 +31,7 @@ const TOOLS: MCPToolDefinition[] = toolRegistry.getAll()
/** The permission map that hides nothing, so the transport checks see everything. */
const ALL_ALLOWED = {
filesystem: 'auto', terminal: 'auto', desktop: 'auto', web: 'auto',
- system: 'auto', image: 'auto', video: 'auto', workflow: 'auto',
+ system: 'auto', image: 'auto', video: 'auto', workflow: 'auto', mcp: 'auto',
} as const
/** JSON-Schema types every one of the four transports understands. */
diff --git a/src/api/mcp/__tests__/external-client.test.ts b/src/api/mcp/__tests__/external-client.test.ts
index cc21b076..02e001c7 100644
--- a/src/api/mcp/__tests__/external-client.test.ts
+++ b/src/api/mcp/__tests__/external-client.test.ts
@@ -181,7 +181,8 @@ describe('connecting to an external server', () => {
const tools = await client.connect()
expect(tools).toHaveLength(1)
- expect(tools[0]).toMatchObject({ name: 'get_forecast', source: 'external', serverId: 'srv-1' })
+ // B12: its own permission row, never 'workflow'.
+ expect(tools[0]).toMatchObject({ name: 'get_forecast', category: 'mcp', source: 'external', serverId: 'srv-1' })
expect(client.isConnected()).toBe(true)
})
diff --git a/src/api/mcp/__tests__/mcp-tools-ask-first.test.ts b/src/api/mcp/__tests__/mcp-tools-ask-first.test.ts
new file mode 100644
index 00000000..233e47d6
--- /dev/null
+++ b/src/api/mcp/__tests__/mcp-tools-ask-first.test.ts
@@ -0,0 +1,77 @@
+/**
+ * B12 (28.10.2026): every tool of an external MCP server was filed under
+ * 'workflow'. "Workflows: Auto" therefore ran a shell or file MCP server
+ * without a card, and "Terminal: Blocked" did not touch it. External tools
+ * now sit in a row of their own, 'mcp', that asks first by default.
+ */
+import { describe, it, expect } from 'vitest'
+import { ToolRegistry } from '../tool-registry'
+import { DEFAULT_PERMISSIONS, type MCPToolDefinition, type PermissionMap } from '../types'
+import { resolveApprovalLevel } from '../../../lib/agent-approval-policy'
+
+// What a server hands over, including a definition that claims a category.
+const shellTool = (category: MCPToolDefinition['category']): MCPToolDefinition => ({
+ name: 'start_process',
+ description: 'run a shell command',
+ inputSchema: { type: 'object', properties: { command: { type: 'string' } }, required: ['command'] },
+ category,
+ source: 'external',
+})
+
+// The report's matrix: Workflows on Auto, Terminal blocked, MCP left at its default.
+const reported: PermissionMap = {
+ ...DEFAULT_PERMISSIONS,
+ workflow: 'auto',
+ terminal: 'blocked',
+ filesystem: 'confirm',
+ mcp: 'confirm',
+}
+
+function levelInAgentChat(registry: ToolRegistry, permissions: PermissionMap): string {
+ return resolveApprovalLevel('start_process', {
+ categoryLevel: registry.getPermissionLevelWithOverrides('start_process', permissions, {}),
+ codexMode: null,
+ readOnlyRun: false,
+ })
+}
+
+describe('external MCP tools have their own permission row', () => {
+ it('a new install asks before any MCP tool', () => {
+ expect(DEFAULT_PERMISSIONS.mcp).toBe('confirm')
+ })
+
+ it('Workflows on Auto does not run an MCP tool unattended', () => {
+ const registry = new ToolRegistry()
+ registry.registerExternal('srv-shell', [shellTool('workflow')], async () => 'ran')
+ expect(registry.getToolByName('start_process')?.category).toBe('mcp')
+ expect(levelInAgentChat(registry, reported)).toBe('confirm')
+ })
+
+ it('a server cannot file its tool under a row the user set to Auto', () => {
+ const registry = new ToolRegistry()
+ registry.registerExternal('srv-shell', [shellTool('web')], async () => 'ran')
+ expect(levelInAgentChat(registry, { ...reported, web: 'auto' })).toBe('confirm')
+ })
+
+ it('the MCP row decides: Blocked hides the tool, Auto runs it', () => {
+ const registry = new ToolRegistry()
+ registry.registerExternal('srv-shell', [shellTool('workflow')], async () => 'ran')
+ const blocked = { ...reported, mcp: 'blocked' as const }
+ expect(registry.getAvailableTools(blocked).map((t) => t.name)).not.toContain('start_process')
+ expect(levelInAgentChat(registry, blocked)).toBe('blocked')
+ expect(levelInAgentChat(registry, { ...reported, mcp: 'auto' })).toBe('auto')
+ })
+
+ it('a permission map without the new key still asks', () => {
+ const registry = new ToolRegistry()
+ registry.registerExternal('srv-shell', [shellTool('workflow')], async () => 'ran')
+ const { mcp: _gone, ...old } = reported
+ expect(levelInAgentChat(registry, old as PermissionMap)).toBe('confirm')
+ })
+
+ it('Code mode keeps its presets: Ask asks, Bypass runs', () => {
+ const d = { categoryLevel: 'confirm' as const, readOnlyRun: false, external: true }
+ expect(resolveApprovalLevel('start_process', { ...d, codexMode: 'ask' })).toBe('confirm')
+ expect(resolveApprovalLevel('start_process', { ...d, codexMode: 'bypass' })).toBe('auto')
+ })
+})
diff --git a/src/api/mcp/__tests__/mobile-tool-filter.test.ts b/src/api/mcp/__tests__/mobile-tool-filter.test.ts
index cda67462..00cd8a77 100644
--- a/src/api/mcp/__tests__/mobile-tool-filter.test.ts
+++ b/src/api/mcp/__tests__/mobile-tool-filter.test.ts
@@ -230,7 +230,7 @@ describe('media, permissions and the working folder', () => {
expect(defaultPermissionsForDevice()).toEqual(DEFAULT_PERMISSIONS)
expect(DEFAULT_PERMISSIONS).toEqual({
filesystem: 'confirm', terminal: 'confirm', desktop: 'confirm', web: 'auto',
- system: 'auto', image: 'confirm', video: 'confirm', workflow: 'confirm',
+ system: 'auto', image: 'confirm', video: 'confirm', workflow: 'confirm', mcp: 'confirm',
})
})
diff --git a/src/api/mcp/__tests__/tool-registry-builtin-hijack.test.ts b/src/api/mcp/__tests__/tool-registry-builtin-hijack.test.ts
index b322616e..85357f3f 100644
--- a/src/api/mcp/__tests__/tool-registry-builtin-hijack.test.ts
+++ b/src/api/mcp/__tests__/tool-registry-builtin-hijack.test.ts
@@ -22,7 +22,7 @@ import type { MCPToolDefinition, PermissionMap } from '../types'
const perms: PermissionMap = {
filesystem: 'auto', terminal: 'auto', desktop: 'auto', web: 'auto',
- system: 'auto', image: 'auto', video: 'auto', workflow: 'auto',
+ system: 'auto', image: 'auto', video: 'auto', workflow: 'auto', mcp: 'auto',
}
const builtin = (name: string): MCPToolDefinition => ({
diff --git a/src/api/mcp/__tests__/tool-registry-external.test.ts b/src/api/mcp/__tests__/tool-registry-external.test.ts
index 373da033..d6643e3f 100644
--- a/src/api/mcp/__tests__/tool-registry-external.test.ts
+++ b/src/api/mcp/__tests__/tool-registry-external.test.ts
@@ -12,6 +12,7 @@ const fullPerms: PermissionMap = {
image: 'auto',
video: 'auto',
workflow: 'auto',
+ mcp: 'auto',
}
const mkTool = (name: string, extra: Partial<MCPToolDefinition> = {}): MCPToolDefinition => ({
diff --git a/src/api/mcp/external-client.ts b/src/api/mcp/external-client.ts
index aa9eb44b..192cf570 100644
--- a/src/api/mcp/external-client.ts
+++ b/src/api/mcp/external-client.ts
@@ -309,7 +309,9 @@ export class MCPExternalClient {
name: toolName,
description: asString(t.description) || '',
inputSchema: isToolInputSchema(t.inputSchema) ? t.inputSchema : EMPTY_INPUT_SCHEMA,
- category: 'workflow', // External tools default to workflow category
+ // Their own permission row (B12): an external tool can do anything
+ // its server does, and Ask First is the default for that row.
+ category: 'mcp',
source: 'external',
serverId: this.config.id,
})
diff --git a/src/api/mcp/tool-registry.ts b/src/api/mcp/tool-registry.ts
index 8e571a20..404d418c 100644
--- a/src/api/mcp/tool-registry.ts
+++ b/src/api/mcp/tool-registry.ts
@@ -156,7 +156,10 @@ export class ToolRegistry {
(executor as ExternalToolExecutor)(name, args)
: (executor as LegacyToolExecutor)
this.tools.set(name, {
- definition: { ...tool, source: 'external', serverId },
+ // Whatever category a definition claims, an external tool sits in
+ // 'mcp' (B12): a server must not file its own shell tool under a row
+ // the user set to Auto.
+ definition: { ...tool, category: 'mcp', source: 'external', serverId },
executor: bound,
})
}
@@ -212,7 +215,8 @@ export class ToolRegistry {
getPermissionLevel(toolName: string, permissions: PermissionMap): PermissionLevel {
const tool = this.tools.get(toolName)?.definition
- if (tool) return permissions[tool.category]
+ // A map from before a category existed has no key for it: ask.
+ if (tool) return permissions[tool.category] ?? 'confirm'
// A9: a retired name has no definition to read a category off, and the
// 'confirm' below meant Agent mode opened an approval dialog for
// `git_status`, whose executor is one fixed read. Read-only retired names
diff --git a/src/api/mcp/types.ts b/src/api/mcp/types.ts
index c30d8149..054ff1d7 100644
--- a/src/api/mcp/types.ts
+++ b/src/api/mcp/types.ts
@@ -2,7 +2,11 @@
import { isMobile } from '../../lib/device-kind'
import { mobilePermissionDefaults } from '../../lib/mobile-permission-defaults'
-export type ToolCategory = 'filesystem' | 'terminal' | 'desktop' | 'web' | 'system' | 'image' | 'video' | 'workflow'
+// 'mcp' holds every tool of an external MCP server (B12, 28.10.2026). Those
+// tools used to be filed under 'workflow', so "Workflows: Auto" ran a shell or
+// file MCP server unattended while "Terminal: Blocked" never saw it. A server
+// can do anything, so its tools get a row of their own that asks first.
+export type ToolCategory = 'filesystem' | 'terminal' | 'desktop' | 'web' | 'system' | 'image' | 'video' | 'workflow' | 'mcp'
export type PermissionLevel = 'blocked' | 'confirm' | 'auto'
@@ -21,6 +25,7 @@ export const DEFAULT_PERMISSIONS: PermissionMap = {
// old persisted 'blocked' (which was UI-locked, never a user choice) up.
video: 'confirm',
workflow: 'confirm',
+ mcp: 'confirm',
}
/**
diff --git a/src/components/chat/PermissionOverrideBar.tsx b/src/components/chat/PermissionOverrideBar.tsx
index c974ca98..96d7f3ee 100644
--- a/src/components/chat/PermissionOverrideBar.tsx
+++ b/src/components/chat/PermissionOverrideBar.tsx
@@ -2,7 +2,7 @@ import { usePermissionStore } from '../../stores/permissionStore'
import { useChatStore } from '../../stores/chatStore'
import type { PermissionLevel, ToolCategory } from '../../api/mcp/types'
import { useToolSupport } from '../../hooks/useToolSupport'
-import { FolderOpen, Terminal, Monitor, Globe, Cpu, Image, Film, GitBranch, Lock } from 'lucide-react'
+import { FolderOpen, Terminal, Monitor, Globe, Cpu, Image, Film, GitBranch, Plug, Lock } from 'lucide-react'
import { HINWEIS_TEXT } from '../../lib/hinweis'
// Image AND video generation are LIVE (chat agent → ComfyUI; video unlocked
@@ -19,6 +19,7 @@ const CATEGORIES: { key: ToolCategory; icon: typeof Globe; label: string }[] = [
{ key: 'image', icon: Image, label: 'Image' },
{ key: 'video', icon: Film, label: 'Video' },
{ key: 'workflow', icon: GitBranch, label: 'Workflows' },
+ { key: 'mcp', icon: Plug, label: 'MCP' },
]
/**
diff --git a/src/components/settings/PermissionSettings.tsx b/src/components/settings/PermissionSettings.tsx
index 0e207001..1276fdfa 100644
--- a/src/components/settings/PermissionSettings.tsx
+++ b/src/components/settings/PermissionSettings.tsx
@@ -1,6 +1,6 @@
import { usePermissionStore } from '../../stores/permissionStore'
import type { ToolCategory, PermissionLevel } from '../../api/mcp/types'
-import { FolderOpen, Terminal, Monitor, Globe, Cpu, Image, Film, GitBranch, X } from 'lucide-react'
+import { FolderOpen, Terminal, Monitor, Globe, Cpu, Image, Film, GitBranch, Plug, X } from 'lucide-react'
import { useEffect, useMemo, useState } from 'react'
import { useComputerStore } from '../../stores/computerStore'
import { useModelStore } from '../../stores/modelStore'
@@ -57,7 +57,12 @@ const CATEGORIES: {
{ key: 'filesystem', label: 'Filesystem', description: "Read, write, search files in the chat's working folder. Reading there never asks", icon: FolderOpen, risk: 'medium' },
{ key: 'image', label: 'Image Generation', description: 'Generate images', icon: Image, risk: 'medium' },
{ key: 'video', label: 'Video Generation', description: 'Generate video', icon: Film, risk: 'medium' },
- { key: 'workflow', label: 'Workflows', description: 'Execute saved agent workflows', icon: GitBranch, risk: 'medium' },
+ // B12: MCP tools hingen frueher an dieser Zeile, ohne dass es dastand.
+ { key: 'workflow', label: 'Workflows', description: 'Saved agent workflows and sub agents. Not MCP server tools', icon: GitBranch, risk: 'medium' },
+ // Eigene Zeile fuer jedes Werkzeug eines MCP-Servers: ein Server kann
+ // Befehle ausfuehren und Dateien schreiben, und Terminal oder Filesystem
+ // decken ihn nicht ab. Darum steht sie per Vorgabe auf Ask First.
+ { key: 'mcp', label: 'MCP / External Tools', description: 'Every tool of a connected MCP server, including ones that run commands or write files', icon: Plug, risk: 'high' },
{ key: 'terminal', label: 'Terminal / Shell', description: 'Execute commands, run code', icon: Terminal, risk: 'high' },
{ key: 'desktop', label: 'Desktop Control', description: 'Screenshots. Blocked also switches computer control off', icon: Monitor, risk: 'high' },
]
diff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.ts
index f4f00336..401cffb6 100644
--- a/src/hooks/useCodex.ts
+++ b/src/hooks/useCodex.ts
@@ -238,7 +238,9 @@ const streamWithTools = streamOllamaChatWithTools
// therefore unreachable from the Code tab. Local models only see it on a
// delegate/parallel intent via the keyword router; cloud models get it in
// the full catalog.
-const CODEX_CATEGORIES = ['filesystem', 'terminal', 'system', 'web', 'image', 'video', 'workflow'] as const
+// mcp: external MCP tools moved out of 'workflow' into a row of their own
+// (B12) and stay reachable here. Ask and Bypass decide them as before.
+const CODEX_CATEGORIES = ['filesystem', 'terminal', 'system', 'web', 'image', 'video', 'workflow', 'mcp'] as const
// Detect when the model emits a re-introduction of itself ("Hello, I am
diff --git a/src/lib/__tests__/remote-turn-caps.test.ts b/src/lib/__tests__/remote-turn-caps.test.ts
index 65ff6875..8a537258 100644
--- a/src/lib/__tests__/remote-turn-caps.test.ts
+++ b/src/lib/__tests__/remote-turn-caps.test.ts
@@ -20,7 +20,7 @@ describe('rights as the upper bound of a phone turn', () => {
it('maps the missing rights to blocked categories', () => {
expect(capsFor({ agent: true, files: true, terminal: true, create: true })).toEqual({})
expect(capsFor({ agent: false, files: false, terminal: false, create: false })).toEqual({
- filesystem: 'blocked', terminal: 'blocked', desktop: 'blocked', image: 'blocked', video: 'blocked', workflow: 'blocked', web: 'blocked', system: 'blocked',
+ filesystem: 'blocked', terminal: 'blocked', desktop: 'blocked', mcp: 'blocked', image: 'blocked', video: 'blocked', workflow: 'blocked', web: 'blocked', system: 'blocked',
})
})
diff --git a/src/lib/__tests__/small-model-mode.test.ts b/src/lib/__tests__/small-model-mode.test.ts
index d002b778..abf7ed8f 100644
--- a/src/lib/__tests__/small-model-mode.test.ts
+++ b/src/lib/__tests__/small-model-mode.test.ts
@@ -32,6 +32,7 @@ const fullPerms: PermissionMap = {
image: 'auto',
video: 'auto',
workflow: 'auto',
+ mcp: 'auto',
}
const mkTool = (
diff --git a/src/lib/__tests__/tool-selection-async.test.ts b/src/lib/__tests__/tool-selection-async.test.ts
index 139b3cde..14df525e 100644
--- a/src/lib/__tests__/tool-selection-async.test.ts
+++ b/src/lib/__tests__/tool-selection-async.test.ts
@@ -13,6 +13,7 @@ const fullPerms: PermissionMap = {
image: 'auto',
video: 'auto',
workflow: 'auto',
+ mcp: 'auto',
}
const mkTool = (name: string, description: string, category: keyof PermissionMap = 'system'): MCPToolDefinition => ({
diff --git a/src/lib/__tests__/tool-selection.test.ts b/src/lib/__tests__/tool-selection.test.ts
index d4472e06..edf75fd3 100644
--- a/src/lib/__tests__/tool-selection.test.ts
+++ b/src/lib/__tests__/tool-selection.test.ts
@@ -47,6 +47,7 @@ const ALL_ALLOWED: PermissionMap = {
image: 'auto',
video: 'auto',
workflow: 'auto',
+ mcp: 'auto',
}
function toolNames(tools: MCPToolDefinition[]): string[] {
@@ -264,6 +265,7 @@ describe('tool-selection', () => {
image: 'blocked',
video: 'blocked',
workflow: 'blocked',
+ mcp: 'blocked',
}
// Message that matches web tools (blocked) and filesystem (blocked)
const result = selectRelevantTools('search and read', ALL_TOOLS, permissions)
@@ -311,7 +313,7 @@ describe('tool-selection', () => {
describe('external (MCP) tools are always offered', () => {
const external = (name: string): MCPToolDefinition => ({
- ...makeTool(name, 'workflow'),
+ ...makeTool(name, 'mcp'),
source: 'external' as const,
serverId: 'srv1',
})
@@ -326,7 +328,7 @@ describe('external (MCP) tools are always offered', () => {
it('still excludes external tools when their category is blocked', () => {
const tools = [...ALL_TOOLS, external('list_directory')]
- const out = selectRelevantTools('write a poem', tools, { ...ALL_ALLOWED, workflow: 'blocked' })
+ const out = selectRelevantTools('write a poem', tools, { ...ALL_ALLOWED, mcp: 'blocked' })
expect(toolNames(out)).not.toContain('list_directory')
})
diff --git a/src/lib/plugins/__tests__/rea-plugin.test.ts b/src/lib/plugins/__tests__/rea-plugin.test.ts
index 34517c70..e2237dd1 100644
--- a/src/lib/plugins/__tests__/rea-plugin.test.ts
+++ b/src/lib/plugins/__tests__/rea-plugin.test.ts
@@ -133,7 +133,7 @@ describe('the REA switch', () => {
await startRea()
expect(useReaRuntime.getState()).toMatchObject({ phase: 'on', tools: 3, error: null })
expect(reaTools().map((t) => t.name)).toEqual(['rea_inspect', 'rea_asar_list', 'rea_trace'])
- expect(reaTools().every((t) => t.source === 'external' && t.category === 'workflow')).toBe(true)
+ expect(reaTools().every((t) => t.source === 'external' && t.category === 'mcp')).toBe(true)
await toolRegistry.execute('rea_inspect', { path: '/tmp/app.asar' })
expect(fake.calls).toEqual([['rea_inspect', { path: '/tmp/app.asar' }]])
})
diff --git a/src/lib/remote-turn-caps.ts b/src/lib/remote-turn-caps.ts
index a50cf0a4..976ff1d1 100644
--- a/src/lib/remote-turn-caps.ts
+++ b/src/lib/remote-turn-caps.ts
@@ -20,7 +20,7 @@ const caps = new Map<string, Partial<PermissionMap>>()
export function capsFor(rights: RemoteRights): Partial<PermissionMap> {
const off: ToolCategory[] = []
if (!rights.files) off.push('filesystem')
- if (!rights.terminal) off.push('terminal', 'desktop')
+ if (!rights.terminal) off.push('terminal', 'desktop', 'mcp')
if (!rights.create) off.push('image', 'video', 'workflow')
if (!rights.agent) off.push('web', 'system')
return Object.fromEntries(off.map((c) => [c, 'blocked'])) as Partial<PermissionMap>
diff --git a/src/lib/tool-roster.ts b/src/lib/tool-roster.ts
index b88511d8..833f4c29 100644
--- a/src/lib/tool-roster.ts
+++ b/src/lib/tool-roster.ts
@@ -29,6 +29,7 @@ const GROUPS: { label: string; categories: ToolCategory[] }[] = [
{ label: 'Web', categories: ['web'] },
{ label: 'System', categories: ['system', 'desktop'] },
{ label: 'Creative', categories: ['image', 'video', 'workflow'] },
+ { label: 'MCP servers', categories: ['mcp'] },
]
/**
diff --git a/src/stores/__tests__/permissionStore.test.ts b/src/stores/__tests__/permissionStore.test.ts
index 93765ced..5a209a35 100644
--- a/src/stores/__tests__/permissionStore.test.ts
+++ b/src/stores/__tests__/permissionStore.test.ts
@@ -31,6 +31,31 @@ describe('video category unlock (v2.5.3)', () => {
})
})
+// B12 (28.10.2026): MCP tools left 'workflow' for a row of their own. A saved
+// Workflows: Auto must not carry over into running MCP tools unattended.
+describe('MCP row migration (v4)', () => {
+ it('Workflows on Auto becomes MCP on Ask First', () => {
+ const { mcp: _none, ...v3 } = { ...DEFAULT_PERMISSIONS, workflow: 'auto', terminal: 'blocked' }
+ const migrated = migratePermissionState({ globalPermissions: v3, conversationOverrides: { c1: { workflow: 'auto' } } }, 3)
+ expect(migrated.globalPermissions.mcp).toBe('confirm')
+ expect(migrated.globalPermissions.workflow).toBe('auto')
+ expect(migrated.globalPermissions.terminal).toBe('blocked')
+ expect(migrated.conversationOverrides.c1.mcp).toBeUndefined()
+ })
+
+ it('Workflows Blocked keeps MCP tools blocked, globally and per chat', () => {
+ const { mcp: _none, ...v3 } = { ...DEFAULT_PERMISSIONS, workflow: 'blocked' }
+ const migrated = migratePermissionState({ globalPermissions: v3, conversationOverrides: { c1: { workflow: 'blocked' } } }, 3)
+ expect(migrated.globalPermissions.mcp).toBe('blocked')
+ expect(migrated.conversationOverrides.c1.mcp).toBe('blocked')
+ })
+
+ it('a v4 choice for the MCP row is kept', () => {
+ const migrated = migratePermissionState({ globalPermissions: { ...DEFAULT_PERMISSIONS, mcp: 'auto' } }, 4)
+ expect(migrated.globalPermissions.mcp).toBe('auto')
+ })
+})
+
describe('permissionStore', () => {
beforeEach(() => {
usePermissionStore.setState({
diff --git a/src/stores/permissionStore.ts b/src/stores/permissionStore.ts
index 9f18a37f..b8a89b3e 100644
--- a/src/stores/permissionStore.ts
+++ b/src/stores/permissionStore.ts
@@ -15,7 +15,7 @@ export type ToolOverrides = Record<string, PermissionLevel>
* agent code can serve a read-only "chat" scope, an edit-capable "edit"
* scope, or the full "agent" scope.
*
- * chat → no filesystem-write, no terminal, no image_generate, no workflow
+ * chat → no filesystem-write, no terminal, no image_generate, no workflow, no MCP
* edit → filesystem + web only (no shell, no codegen, no comfy)
* agent → everything (current default behaviour)
*/
@@ -125,7 +125,7 @@ export const usePermissionStore = create<PermissionState>()(
{
name: 'locally-uncensored-permissions',
storage: safeJSONStorage(),
- version: 3,
+ version: 4,
migrate: migratePermissionState,
}
)
@@ -176,6 +176,24 @@ export function migratePermissionState(persisted: unknown, version: number): Per
}
}
}
+ // v4 (B12, 28.10.2026): external MCP tools left 'workflow' for a category
+ // of their own. They used to follow the Workflows row, so a user with
+ // Workflows on Auto ran every MCP tool unattended, a shell server included.
+ // Carrying that Auto over would keep exactly the hole this closes, so the
+ // new row starts at Ask First. Only Blocked carries over, globally and per
+ // chat: whoever switched Workflows off also switched MCP tools off and must
+ // not find them back on.
+ if (version < 4) {
+ if (isRecord(globals) && asString(globals.mcp) === undefined) {
+ globals.mcp = globals.workflow === 'blocked' ? 'blocked' : 'confirm'
+ }
+ const perChat = prop(persisted, 'conversationOverrides')
+ if (isRecord(perChat)) {
+ for (const chat of Object.values(perChat)) {
+ if (isRecord(chat) && chat.workflow === 'blocked' && chat.mcp === undefined) chat.mcp = 'blocked'
+ }
+ }
+ }
// zustand types migrate as returning the FULL store, but a blob only ever
// carries the partialized slice and `merge` puts the actions back.
return persisted as PermissionState
@@ -192,7 +210,7 @@ export const MODE_SCOPE_ALLOWED_CATEGORIES: Record<ModeScope, ReadonlyArray<Tool
// Editing: adds filesystem writes. No shell, no codegen, no ComfyUI.
edit: ['filesystem', 'web', 'system'],
// Full agent: everything.
- agent: ['filesystem', 'terminal', 'desktop', 'web', 'system', 'image', 'video', 'workflow'],
+ agent: ['filesystem', 'terminal', 'desktop', 'web', 'system', 'image', 'video', 'workflow', 'mcp'],
}
/**