fix(mcp): let the tool allowlist express plugin tools with wildcards
This commit is contained in:
1 parent
e7883a6466
commit
6f5511a732
15 files changed
+208
-3
No files matched your search
@@ -233,7 +233,18 @@ import {
|
||||
} from "@/lib/mcp/mcpConfigTemplates";
|
||||
import { beginMcpStatusRequest, mcpUpdateAvailability } from "@/lib/mcp/mcpUpdateStatus";
|
||||
import { notifyComponentUpdatesChanged } from "@/lib/updates/componentUpdateEvents";
|
||||
import { isMcpPolicyMutationBlocked, MCP_CAPABILITY_ROWS, MCP_EXECUTION_MODE_COLUMNS, MCP_TOOL_OPTIONS, mcpExecutionModeFromPolicy, mcpPolicyFieldsForExecutionMode, toggleMcpAllowedToolName, type McpExecutionMode } from "@/lib/mcp/mcpPolicySelection";
|
||||
import {
|
||||
addMcpAllowedToolName,
|
||||
customMcpAllowedToolNames,
|
||||
isMcpPolicyMutationBlocked,
|
||||
MCP_CAPABILITY_ROWS,
|
||||
MCP_EXECUTION_MODE_COLUMNS,
|
||||
MCP_TOOL_OPTIONS,
|
||||
mcpExecutionModeFromPolicy,
|
||||
mcpPolicyFieldsForExecutionMode,
|
||||
toggleMcpAllowedToolName,
|
||||
type McpExecutionMode,
|
||||
} from "@/lib/mcp/mcpPolicySelection";
|
||||
import { isMacOS, isWindows } from "@/lib/backend/platform";
|
||||
import { combineDataTypeForDatabase, dataTypeLengthInputValue, getDataTypeOptions, getDefaultLengthForType, isDataTypeLengthDisabled, splitDataType } from "@/lib/table/tableStructureEditorState";
|
||||
import { useToast } from "@/composables/useToast";
|
||||
@@ -3710,6 +3721,24 @@ function onMcpToolAllowedChange(name: string, allowed: boolean) {
|
||||
void saveMcpPolicy({ allowedToolNames: toggleMcpAllowedToolName(mcpAllowedToolNames.value, name, allowed) });
|
||||
}
|
||||
|
||||
// Entries beyond the static options: discovered plugin tool names and the
|
||||
// `dbx_<prefix>__*` / `dbx_*__*` wildcards the backend matcher expands. They
|
||||
// are invisible in the checkbox grid, so they render as removable chips.
|
||||
const mcpCustomToolEntries = computed(() => customMcpAllowedToolNames(mcpAllowedToolNames.value));
|
||||
const mcpCustomToolInput = ref("");
|
||||
|
||||
function onMcpCustomToolAdd() {
|
||||
const rawName = mcpCustomToolInput.value;
|
||||
if (!rawName.trim()) return;
|
||||
const { names, added } = addMcpAllowedToolName(mcpAllowedToolNames.value, rawName);
|
||||
mcpCustomToolInput.value = "";
|
||||
if (added) void saveMcpPolicy({ allowedToolNames: names });
|
||||
}
|
||||
|
||||
function onMcpCustomToolRemove(name: string) {
|
||||
void saveMcpPolicy({ allowedToolNames: toggleMcpAllowedToolName(mcpAllowedToolNames.value, name, false) });
|
||||
}
|
||||
|
||||
const mcpConnectionPolicyConnections = computed(() => {
|
||||
const allowed = mcpEffectiveAllowedConnectionIds.value;
|
||||
return allowed === null ? mcpSelectableConnections.value : mcpSelectableConnections.value.filter((connection) => allowed.includes(connection.id));
|
||||
@@ -10598,6 +10627,21 @@ LIMIT 100;</pre
|
||||
<span>{{ t(tool.labelKey) }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<div class="flex gap-2">
|
||||
<Input v-model="mcpCustomToolInput" class="h-8 flex-1 font-mono text-xs" :placeholder="t('settings.mcpToolCustomPlaceholder')" :disabled="mcpPolicyControlsDisabled" spellcheck="false" @keydown.enter.prevent="onMcpCustomToolAdd" />
|
||||
<Button variant="outline" size="sm" class="h-8 shrink-0" :disabled="mcpPolicyControlsDisabled || !mcpCustomToolInput.trim()" @click="onMcpCustomToolAdd">{{ t("settings.mcpToolCustomAdd") }}</Button>
|
||||
</div>
|
||||
<p class="text-xs text-muted-foreground">{{ t("settings.mcpToolCustomHint") }}</p>
|
||||
<div v-if="mcpCustomToolEntries.length" class="flex flex-wrap gap-1.5">
|
||||
<span v-for="name in mcpCustomToolEntries" :key="name" class="flex items-center gap-1 rounded border bg-background px-2 py-1 font-mono text-xs">
|
||||
{{ name }}
|
||||
<button type="button" class="text-muted-foreground transition-colors hover:text-destructive" :disabled="mcpPolicyControlsDisabled" :aria-label="t('settings.mcpToolCustomRemove')" @click="onMcpCustomToolRemove(name)">
|
||||
<X class="size-3" />
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in new issue
Block a user