feat(mcp): add native installs and resource discovery
This commit is contained in:
36 files changed
+1934
-103
No files matched your search
@@ -132,7 +132,9 @@ import {
|
||||
aiTestConnection,
|
||||
checkMcpServerStatus,
|
||||
installMcpServer,
|
||||
installNativeMcpServer,
|
||||
uninstallMcpServer,
|
||||
uninstallNpmMcpServer,
|
||||
loadMcpHttpServerSettings,
|
||||
saveMcpHttpServerSettings,
|
||||
mcpHttpServerStatus,
|
||||
@@ -206,6 +208,7 @@ import {
|
||||
buildMcpWorkBuddyConfig,
|
||||
mcpWebBackendUrl,
|
||||
type McpLaunchConfig,
|
||||
preferMcpNativeLaunch,
|
||||
} from "@/lib/mcp/mcpConfigTemplates";
|
||||
import { beginMcpStatusRequest, mcpUpdateAvailability } from "@/lib/mcp/mcpUpdateStatus";
|
||||
import { notifyComponentUpdatesChanged } from "@/lib/updates/componentUpdateEvents";
|
||||
@@ -3864,6 +3867,9 @@ const mcpLaunchConfig = computed<McpLaunchConfig | undefined>(() => {
|
||||
};
|
||||
}
|
||||
const env = mcpStatus.value?.data_dir ? { DBX_DATA_DIR: mcpStatus.value.data_dir } : undefined;
|
||||
if (mcpStatus.value?.native_bin_path) {
|
||||
return preferMcpNativeLaunch({ command: "dbx-mcp-server", env }, mcpStatus.value.native_bin_path);
|
||||
}
|
||||
if (mcpStatus.value?.node_path && mcpStatus.value.script_path) {
|
||||
return {
|
||||
command: mcpStatus.value.node_path,
|
||||
@@ -3879,17 +3885,9 @@ const mcpLaunchConfig = computed<McpLaunchConfig | undefined>(() => {
|
||||
|
||||
const mcpJsonRecommendedConfig = computed(() => buildMcpJsonConfig(mcpLaunchConfig.value));
|
||||
|
||||
const mcpTraeRecommendedConfig = computed(() => {
|
||||
// TRAE currently splits Windows executable paths containing spaces, so bypass Node and launch the native MCP binary directly.
|
||||
const nativeBinPath = !isWeb && isWindows() ? mcpStatus.value?.native_bin_path : undefined;
|
||||
return buildMcpTraeConfig(mcpLaunchConfig.value, nativeBinPath ?? undefined);
|
||||
});
|
||||
const mcpTraeRecommendedConfig = computed(() => buildMcpTraeConfig(mcpLaunchConfig.value));
|
||||
|
||||
const mcpQoderRecommendedConfig = computed(() => {
|
||||
// Qoder follows TRAE's mcpServers JSON format and has the same Windows path parsing limitation.
|
||||
const nativeBinPath = !isWeb && isWindows() ? mcpStatus.value?.native_bin_path : undefined;
|
||||
return buildMcpQoderConfig(mcpLaunchConfig.value, nativeBinPath ?? undefined);
|
||||
});
|
||||
const mcpQoderRecommendedConfig = computed(() => buildMcpQoderConfig(mcpLaunchConfig.value));
|
||||
|
||||
const mcpVsCodeRecommendedConfig = computed(() => buildMcpVsCodeConfig(mcpLaunchConfig.value));
|
||||
|
||||
@@ -3918,11 +3916,19 @@ const mcpStatusLabel = computed(() => {
|
||||
});
|
||||
|
||||
const mcpCommand = computed(() => {
|
||||
if (!mcpStatus.value) return "npm install -g @dbx-app/mcp-server@latest";
|
||||
if (!mcpStatus.value) return isWindows() ? 'powershell -NoProfile -Command "irm https://dbxio.com/install-mcp.ps1 | iex"' : "curl -fsSL https://dbxio.com/install-mcp | sh";
|
||||
return mcpStatus.value.installed ? mcpStatus.value.update_command : mcpStatus.value.install_command;
|
||||
});
|
||||
|
||||
const mcpUninstallCommand = computed(() => mcpStatus.value?.uninstall_command || "npm uninstall -g @dbx-app/mcp-server");
|
||||
const mcpNativeMigrationAvailable = computed(() => mcpStatus.value?.installation_source === "npm");
|
||||
const mcpInstallDisabled = computed(() => mcpInstalling.value || mcpUninstalling.value || Boolean(mcpStatus.value?.installed && !mcpStatus.value.update_available && !mcpNativeMigrationAvailable.value));
|
||||
const mcpInstallButtonLabel = computed(() => {
|
||||
if (mcpInstalling.value) return t("settings.mcpInstalling");
|
||||
if (mcpNativeMigrationAvailable.value) return t("settings.mcpSwitchToNativeButton");
|
||||
if (!mcpStatus.value?.installed) return t("settings.mcpInstallButton");
|
||||
return mcpStatus.value.update_available ? t("settings.mcpUpdateButton") : t("settings.mcpUpToDate");
|
||||
});
|
||||
|
||||
async function refreshMcpStatus() {
|
||||
if (mcpStatusLoading.value) return;
|
||||
@@ -3963,7 +3969,7 @@ async function installMcp() {
|
||||
mcpInstallMessage.value = "";
|
||||
mcpInstallError.value = false;
|
||||
try {
|
||||
const result = await installMcpServer();
|
||||
const result = mcpNativeMigrationAvailable.value || !mcpStatus.value?.installed ? await installNativeMcpServer() : await installMcpServer();
|
||||
mcpInstallMessage.value = result;
|
||||
mcpInstallError.value = false;
|
||||
// 安装成功后刷新状态
|
||||
@@ -4004,6 +4010,28 @@ async function uninstallMcp() {
|
||||
}
|
||||
}
|
||||
|
||||
async function uninstallNpmMcpFallback() {
|
||||
if (mcpInstalling.value || mcpUninstalling.value || !mcpStatus.value?.npm_installed) return;
|
||||
if (!window.confirm(t("settings.mcpRemoveNpmFallbackConfirm"))) return;
|
||||
mcpUninstalling.value = true;
|
||||
mcpInstallMessage.value = "";
|
||||
mcpInstallError.value = false;
|
||||
try {
|
||||
mcpInstallMessage.value = await uninstallNpmMcpServer();
|
||||
await refreshMcpStatus();
|
||||
notifyComponentUpdatesChanged();
|
||||
} catch (e: any) {
|
||||
mcpInstallMessage.value = t("settings.mcpRemoveNpmFallbackFailed", { error: e?.message || String(e) });
|
||||
mcpInstallError.value = true;
|
||||
} finally {
|
||||
mcpUninstalling.value = false;
|
||||
window.setTimeout(() => {
|
||||
mcpInstallMessage.value = "";
|
||||
mcpInstallError.value = false;
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- WebDAV Sync ----------
|
||||
const webdavEndpoint = ref(localStorage.getItem("dbx-webdav-endpoint") || "");
|
||||
const webdavUsername = ref(localStorage.getItem("dbx-webdav-username") || "");
|
||||
@@ -9923,7 +9951,10 @@ LIMIT 100;</pre
|
||||
</div>
|
||||
|
||||
<div v-if="!isWeb" class="space-y-2">
|
||||
<Label>{{ mcpStatus?.installed ? t("settings.mcpUpdateCommand") : t("settings.mcpInstallCommand") }}</Label>
|
||||
<Label>{{ mcpStatus?.installed && !mcpNativeMigrationAvailable ? t("settings.mcpUpdateCommand") : t("settings.mcpInstallCommand") }}</Label>
|
||||
<p v-if="mcpNativeMigrationAvailable" class="rounded-md border border-blue-500/30 bg-blue-500/5 px-3 py-2 text-xs text-blue-700 dark:text-blue-300">
|
||||
{{ t("settings.mcpNativeMigrationHint") }}
|
||||
</p>
|
||||
<div class="flex min-w-0 items-center gap-2">
|
||||
<div class="min-w-0 flex-1 overflow-x-auto rounded-md border bg-background px-3 py-2 font-mono text-xs whitespace-nowrap">
|
||||
{{ mcpCommand }}
|
||||
@@ -9932,10 +9963,10 @@ LIMIT 100;</pre
|
||||
<CheckCircle2 v-if="mcpCopied === 'install'" class="h-4 w-4 text-green-500" />
|
||||
<Copy v-else class="h-4 w-4" />
|
||||
</Button>
|
||||
<Button type="button" variant="default" :disabled="mcpInstalling || mcpUninstalling || !mcpStatus?.npm_available || (mcpStatus?.installed && !mcpStatus?.update_available)" @click="installMcp">
|
||||
<Button type="button" variant="default" :disabled="mcpInstallDisabled" @click="installMcp">
|
||||
<Loader2 v-if="mcpInstalling" class="mr-2 h-4 w-4 animate-spin" />
|
||||
<CheckCircle2 v-if="!mcpInstalling && mcpStatus?.installed && !mcpStatus?.update_available" class="mr-2 h-4 w-4" />
|
||||
{{ mcpInstalling ? t("settings.mcpInstalling") : !mcpStatus?.installed ? t("settings.mcpInstallButton") : mcpStatus?.update_available ? t("settings.mcpUpdateButton") : t("settings.mcpUpToDate") }}
|
||||
<CheckCircle2 v-if="!mcpInstalling && mcpStatus?.installed && !mcpStatus?.update_available && !mcpNativeMigrationAvailable" class="mr-2 h-4 w-4" />
|
||||
{{ mcpInstallButtonLabel }}
|
||||
</Button>
|
||||
</div>
|
||||
<div
|
||||
@@ -9959,13 +9990,26 @@ LIMIT 100;</pre
|
||||
<CheckCircle2 v-if="mcpCopied === 'uninstall'" class="h-4 w-4 text-green-500" />
|
||||
<Copy v-else class="h-4 w-4" />
|
||||
</Button>
|
||||
<Button type="button" variant="outline" class="text-destructive hover:text-destructive" :disabled="mcpInstalling || mcpUninstalling || !mcpStatus.npm_available" @click="uninstallMcp">
|
||||
<Button type="button" variant="outline" class="text-destructive hover:text-destructive" :disabled="mcpInstalling || mcpUninstalling" @click="uninstallMcp">
|
||||
<Loader2 v-if="mcpUninstalling" class="mr-2 h-4 w-4 animate-spin" />
|
||||
<Trash2 v-else class="mr-2 h-4 w-4" />
|
||||
{{ mcpUninstalling ? t("settings.mcpUninstalling") : t("settings.mcpUninstallButton") }}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="!isWeb && mcpStatus?.installation_source !== 'npm' && mcpStatus?.npm_installed" class="rounded-md border border-amber-500/30 bg-amber-500/5 p-3">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<p class="min-w-0 flex-1 text-xs text-amber-800 dark:text-amber-200">
|
||||
{{ t("settings.mcpNpmFallbackHint") }}
|
||||
</p>
|
||||
<Button type="button" variant="outline" size="sm" :disabled="mcpInstalling || mcpUninstalling" @click="uninstallNpmMcpFallback">
|
||||
<Loader2 v-if="mcpUninstalling" class="mr-2 h-4 w-4 animate-spin" />
|
||||
<Trash2 v-else class="mr-2 h-4 w-4" />
|
||||
{{ t("settings.mcpRemoveNpmFallbackButton") }}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
@@ -10378,7 +10422,7 @@ LIMIT 100;</pre
|
||||
|
||||
<div v-if="mcpTransportTab === 'stdio'" class="flex items-center gap-2 text-xs text-muted-foreground">
|
||||
<Terminal class="h-3.5 w-3.5" />
|
||||
<span>{{ t("settings.mcpDetectionTiming") }} {{ t("settings.mcpNpmBoundary") }}</span>
|
||||
<span>{{ t("settings.mcpDetectionTiming") }} {{ t("settings.mcpNativeManagementBoundary") }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</Tabs>
|
||||
|
||||
+1
-1
@@ -615,7 +615,7 @@ describe("UpdateDialog aggregate update center", () => {
|
||||
await mountDialog(0, {}, undefined, {
|
||||
driverUpdates: [{ db_type: "mysql", label: "MySQL", version: "9.0.0", installed_version: "8.0.0", update_available: true }],
|
||||
jdbcUpdate: { installed: true, version: "0.1.0", latest_version: "0.2.0", update_available: true, compatible: true, path: "/tmp/jdbc" },
|
||||
mcpUpdate: { installed: true, npm_available: true, current_version: "1.0.0", latest_version: "1.1.0", update_available: true },
|
||||
mcpUpdate: { installed: true, installation_source: "npm", npm_available: true, npm_installed: true, current_version: "1.0.0", latest_version: "1.1.0", update_available: true },
|
||||
pluginUpdates: [
|
||||
{
|
||||
key: "official:example",
|
||||
|
||||
@@ -33,7 +33,9 @@ vi.mock("@/lib/plugins/pluginMarketplace", async (importOriginal) => ({ ...(awai
|
||||
|
||||
const mcpStatus = {
|
||||
installed: true,
|
||||
installation_source: "npm",
|
||||
npm_available: true,
|
||||
npm_installed: true,
|
||||
current_version: "1.0.0",
|
||||
latest_version: "1.1.0",
|
||||
update_available: true,
|
||||
|
||||
@@ -32,7 +32,9 @@ function deferred<T>(): Deferred<T> {
|
||||
function makeStatus(update_available: boolean, overrides: Partial<McpServerStatus> = {}): McpServerStatus {
|
||||
return {
|
||||
installed: true,
|
||||
installation_source: "npm",
|
||||
npm_available: true,
|
||||
npm_installed: true,
|
||||
node_path: null,
|
||||
node_version: null,
|
||||
current_version: "1.0.0",
|
||||
@@ -44,6 +46,7 @@ function makeStatus(update_available: boolean, overrides: Partial<McpServerStatu
|
||||
data_dir: null,
|
||||
install_command: "",
|
||||
update_command: "",
|
||||
uninstall_command: "",
|
||||
error: null,
|
||||
...overrides,
|
||||
};
|
||||
|
||||
@@ -8601,6 +8601,12 @@ export default {
|
||||
mcpUpdateCommand: "Upgrade command",
|
||||
mcpUninstallCommand: "Uninstall command",
|
||||
mcpInstallButton: "Install",
|
||||
mcpSwitchToNativeButton: "Switch to native (recommended)",
|
||||
mcpNativeMigrationHint: "Your npm installation remains usable. Install the standalone native binary, then update external MCP client configurations to the generated absolute path; DBX will not remove npm automatically.",
|
||||
mcpNpmFallbackHint: "The previous npm installation remains available as a fallback. First, use the matching Agent configuration below to replace the launch command with the displayed native absolute path. Remove the fallback only after every external MCP client has been migrated.",
|
||||
mcpRemoveNpmFallbackButton: "Remove npm fallback",
|
||||
mcpRemoveNpmFallbackConfirm: "Remove the retained npm DBX MCP installation? First confirm that every external MCP client has been updated to the displayed native absolute path using its matching Agent configuration below.",
|
||||
mcpRemoveNpmFallbackFailed: "Failed to remove npm fallback: {error}",
|
||||
mcpUpdateButton: "Upgrade",
|
||||
mcpUpToDate: "Up to date",
|
||||
mcpInstalling: "Installing...",
|
||||
@@ -8689,6 +8695,7 @@ export default {
|
||||
mcpPolicyLoadFailed: "Failed to load the MCP access policy: {error}",
|
||||
mcpDetectionTiming: "DBX checks automatically when this page opens; use Check again to refresh.",
|
||||
mcpNpmBoundary: "DBX checks MCP status; installation, upgrades, and uninstallation run through the detected npm, pnpm, or bun runtime.",
|
||||
mcpNativeManagementBoundary: "DBX installs and manages the standalone native server by default. Existing npm installations remain available as a fallback and are never removed automatically.",
|
||||
mcpRefresh: "Check again",
|
||||
mcpGuide: "MCP guide",
|
||||
mcpAuthTitle: "MCP authorization",
|
||||
|
||||
@@ -8574,6 +8574,12 @@ export default withEnglishFallback({
|
||||
mcpUpdateCommand: "升级命令",
|
||||
mcpUninstallCommand: "卸载命令",
|
||||
mcpInstallButton: "安装",
|
||||
mcpSwitchToNativeButton: "切换到原生安装(推荐)",
|
||||
mcpNativeMigrationHint: "现有 npm 安装会继续保留。安装独立原生二进制后,请把外部 MCP 客户端配置更新为页面生成的绝对路径;DBX 不会自动卸载 npm 包。",
|
||||
mcpNpmFallbackHint: "原 npm 安装仍作为兜底保留。请先按照下方对应 Agent 的配置,将启动命令改为所示的原生绝对路径;确认所有外部 MCP 客户端均已完成迁移后,再选择清理。",
|
||||
mcpRemoveNpmFallbackButton: "清理 npm 兜底",
|
||||
mcpRemoveNpmFallbackConfirm: "确定移除保留的 npm DBX MCP 安装吗?请先确认所有外部 MCP 客户端都已按照下方对应 Agent 的配置,改用所示的原生绝对路径。",
|
||||
mcpRemoveNpmFallbackFailed: "清理 npm 兜底失败:{error}",
|
||||
mcpUpdateButton: "升级",
|
||||
mcpUpToDate: "已是最新",
|
||||
mcpInstalling: "安装中...",
|
||||
@@ -8662,6 +8668,7 @@ export default withEnglishFallback({
|
||||
mcpPolicyLoadFailed: "加载 MCP 访问策略失败:{error}",
|
||||
mcpDetectionTiming: "打开此页时会自动检测,点击重新检查可刷新。",
|
||||
mcpNpmBoundary: "DBX 负责检查 MCP 状态;安装、升级和卸载由检测到的 npm、pnpm 或 bun 运行环境执行。",
|
||||
mcpNativeManagementBoundary: "DBX 默认安装并管理独立原生服务;现有 npm 安装继续作为兜底,且不会被自动卸载。",
|
||||
mcpRefresh: "重新检查",
|
||||
mcpGuide: "MCP 指南",
|
||||
mcpAuthTitle: "MCP 授权设置",
|
||||
|
||||
@@ -7213,6 +7213,12 @@ export default withEnglishFallback({
|
||||
mcpInstallCommand: "安裝命令",
|
||||
mcpUpdateCommand: "升級命令",
|
||||
mcpInstallButton: "安裝",
|
||||
mcpSwitchToNativeButton: "切換到原生安裝(推薦)",
|
||||
mcpNativeMigrationHint: "現有 npm 安裝會繼續保留。安裝獨立原生二進位後,請將外部 MCP 用戶端設定更新為頁面產生的絕對路徑;DBX 不會自動移除 npm 套件。",
|
||||
mcpNpmFallbackHint: "原 npm 安裝仍作為備援保留。請先依照下方對應 Agent 的設定,將啟動命令改為所示的原生絕對路徑;確認所有外部 MCP 用戶端均已完成遷移後,再選擇清理。",
|
||||
mcpRemoveNpmFallbackButton: "清理 npm 備援",
|
||||
mcpRemoveNpmFallbackConfirm: "確定移除保留的 npm DBX MCP 安裝嗎?請先確認所有外部 MCP 用戶端都已依照下方對應 Agent 的設定,改用所示的原生絕對路徑。",
|
||||
mcpRemoveNpmFallbackFailed: "清理 npm 備援失敗:{error}",
|
||||
mcpUpdateButton: "升級",
|
||||
mcpUpToDate: "已是最新",
|
||||
mcpInstalling: "安裝中...",
|
||||
@@ -7293,6 +7299,7 @@ export default withEnglishFallback({
|
||||
mcpPolicyLoadFailed: "載入 MCP 存取策略失敗:{error}",
|
||||
mcpDetectionTiming: "打開此頁時會自動檢測,點擊重新檢查可刷新。",
|
||||
mcpNpmBoundary: "DBX 只檢測和提示 MCP 狀態;安裝與升級仍由 npm、pnpm 或 bun 完成。",
|
||||
mcpNativeManagementBoundary: "DBX 預設安裝並管理獨立原生服務;現有 npm 安裝繼續作為備援,且不會被自動移除。",
|
||||
mcpRefresh: "重新檢查",
|
||||
mcpGuide: "MCP 指南",
|
||||
mcpAuthTitle: "MCP 授權設定",
|
||||
|
||||
@@ -1,7 +1,35 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { buildMcpCherryStudioConfig, buildMcpCodexConfig, buildMcpDeepSeekHarnessConfig, buildMcpJsonConfig, buildMcpOpenCodeConfig, buildMcpPiConfig, buildMcpQoderConfig, buildMcpTraeConfig, buildMcpVsCodeConfig, buildMcpWorkBuddyConfig, mcpWebBackendUrl } from "@/lib/mcp/mcpConfigTemplates";
|
||||
import {
|
||||
buildMcpCherryStudioConfig,
|
||||
buildMcpCodexConfig,
|
||||
buildMcpDeepSeekHarnessConfig,
|
||||
buildMcpJsonConfig,
|
||||
buildMcpOpenCodeConfig,
|
||||
buildMcpPiConfig,
|
||||
buildMcpQoderConfig,
|
||||
buildMcpTraeConfig,
|
||||
buildMcpVsCodeConfig,
|
||||
buildMcpWorkBuddyConfig,
|
||||
mcpWebBackendUrl,
|
||||
preferMcpNativeLaunch,
|
||||
} from "@/lib/mcp/mcpConfigTemplates";
|
||||
|
||||
describe("MCP config templates", () => {
|
||||
it.each(["/Users/DBX User/.dbx/bin/dbx-mcp", "/home/dbx/.dbx/bin/dbx-mcp", "C:\\Users\\DBX User\\.dbx\\bin\\dbx-mcp.exe"])("prefers native launch for every client: %s", (binary) => {
|
||||
const shim = { command: "node", args: ["/old/shim.js"], env: { DBX_DATA_DIR: "/custom/data" } };
|
||||
const native = preferMcpNativeLaunch(shim, binary);
|
||||
expect(native).toEqual({ command: binary, env: shim.env });
|
||||
for (const builder of [buildMcpJsonConfig, buildMcpTraeConfig, buildMcpQoderConfig, buildMcpVsCodeConfig, buildMcpCherryStudioConfig, buildMcpCodexConfig, buildMcpDeepSeekHarnessConfig, buildMcpOpenCodeConfig, buildMcpPiConfig, buildMcpWorkBuddyConfig]) {
|
||||
const result = builder(native);
|
||||
expect(result).toContain(JSON.stringify(binary));
|
||||
expect(result).toContain("DBX_DATA_DIR");
|
||||
expect(result).not.toContain("shim.js");
|
||||
}
|
||||
expect(preferMcpNativeLaunch(shim)).toBe(shim);
|
||||
expect(preferMcpNativeLaunch(shim, "")).toBe(shim);
|
||||
expect(preferMcpNativeLaunch()).toBeUndefined();
|
||||
});
|
||||
|
||||
it("builds the standard mcpServers JSON used by Claude, Cursor, TRAE, and Windsurf", () => {
|
||||
const config = JSON.parse(buildMcpJsonConfig());
|
||||
|
||||
|
||||
@@ -6,6 +6,20 @@ const tauriBackendSource = readFileSync(new URL("../../../lib/backend/tauri.ts",
|
||||
const httpBackendSource = readFileSync(new URL("../../../lib/backend/http.ts", import.meta.url), "utf8");
|
||||
|
||||
describe("MCP server management", () => {
|
||||
it("makes native installation the default while preserving npm as a migration fallback", () => {
|
||||
expect(settingsDialogSource).toContain('mcpStatus.value?.installation_source === "npm"');
|
||||
expect(settingsDialogSource).toContain('t("settings.mcpSwitchToNativeButton")');
|
||||
expect(settingsDialogSource).toContain('t("settings.mcpNativeMigrationHint")');
|
||||
expect(settingsDialogSource).toContain("await installNativeMcpServer()");
|
||||
expect(settingsDialogSource).toContain("await uninstallNpmMcpServer()");
|
||||
expect(settingsDialogSource).toContain("mcpStatus?.installation_source !== 'npm' && mcpStatus?.npm_installed");
|
||||
expect(settingsDialogSource).toContain(':disabled="mcpInstallDisabled"');
|
||||
expect(settingsDialogSource).not.toContain("!mcpStatus?.npm_available");
|
||||
expect(tauriBackendSource).toContain('installation_source: "native" | "homebrew" | "npm" | null');
|
||||
expect(tauriBackendSource).toContain('invoke("install_native_mcp_server")');
|
||||
expect(tauriBackendSource).toContain('invoke("uninstall_npm_mcp_server")');
|
||||
});
|
||||
|
||||
it("exposes a confirmed uninstall action only for an installed desktop server", () => {
|
||||
expect(settingsDialogSource).toContain('v-if="!isWeb && mcpStatus?.installed"');
|
||||
expect(settingsDialogSource).toContain('window.confirm(t("settings.mcpUninstallConfirm"))');
|
||||
|
||||
@@ -921,7 +921,9 @@ export const deleteHistoryEntry = forward("deleteHistoryEntry");
|
||||
// Updates
|
||||
export const checkMcpServerStatus = forward("checkMcpServerStatus");
|
||||
export const installMcpServer = forward("installMcpServer");
|
||||
export const installNativeMcpServer = forward("installNativeMcpServer");
|
||||
export const uninstallMcpServer = forward("uninstallMcpServer");
|
||||
export const uninstallNpmMcpServer = forward("uninstallNpmMcpServer");
|
||||
export const loadMcpHttpServerSettings = forward("loadMcpHttpServerSettings");
|
||||
export const saveMcpHttpServerSettings = forward("saveMcpHttpServerSettings");
|
||||
export const mcpHttpServerStatus = forward("mcpHttpServerStatus");
|
||||
|
||||
@@ -5200,7 +5200,9 @@ export async function fetchChangelog(lang?: string): Promise<import("@/lib/app/c
|
||||
export async function checkMcpServerStatus(): Promise<import("@/lib/backend/tauri").McpServerStatus> {
|
||||
return {
|
||||
installed: false,
|
||||
installation_source: null,
|
||||
npm_available: false,
|
||||
npm_installed: false,
|
||||
node_path: null,
|
||||
node_version: null,
|
||||
current_version: null,
|
||||
@@ -5221,10 +5223,18 @@ export async function installMcpServer(): Promise<string> {
|
||||
throw new Error("MCP Server installation is only available in the desktop app.");
|
||||
}
|
||||
|
||||
export async function installNativeMcpServer(): Promise<string> {
|
||||
throw new Error("Native MCP Server installation is only available in the desktop app.");
|
||||
}
|
||||
|
||||
export async function uninstallMcpServer(): Promise<string> {
|
||||
throw new Error("MCP Server uninstallation is only available in the desktop app.");
|
||||
}
|
||||
|
||||
export async function uninstallNpmMcpServer(): Promise<string> {
|
||||
throw new Error("MCP Server npm fallback removal is only available in the desktop app.");
|
||||
}
|
||||
|
||||
export async function getSystemProxyUrl(): Promise<string | null> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2968,7 +2968,9 @@ export interface UpdateDownloadProgress {
|
||||
|
||||
export interface McpServerStatus {
|
||||
installed: boolean;
|
||||
installation_source: "native" | "homebrew" | "npm" | null;
|
||||
npm_available: boolean;
|
||||
npm_installed: boolean;
|
||||
node_path: string | null;
|
||||
node_version: string | null;
|
||||
current_version: string | null;
|
||||
@@ -2992,10 +2994,18 @@ export async function installMcpServer(): Promise<string> {
|
||||
return invoke("install_mcp_server");
|
||||
}
|
||||
|
||||
export async function installNativeMcpServer(): Promise<string> {
|
||||
return invoke("install_native_mcp_server");
|
||||
}
|
||||
|
||||
export async function uninstallMcpServer(): Promise<string> {
|
||||
return invoke("uninstall_mcp_server");
|
||||
}
|
||||
|
||||
export async function uninstallNpmMcpServer(): Promise<string> {
|
||||
return invoke("uninstall_npm_mcp_server");
|
||||
}
|
||||
|
||||
export async function checkForUpdates(locale?: string, source?: UpdateDownloadSource): Promise<UpdateInfo> {
|
||||
return invoke("check_for_updates", { locale, source });
|
||||
}
|
||||
|
||||
@@ -8,6 +8,10 @@ const DEFAULT_MCP_LAUNCH_CONFIG: McpLaunchConfig = {
|
||||
command: "dbx-mcp-server",
|
||||
};
|
||||
|
||||
export function preferMcpNativeLaunch(config?: McpLaunchConfig, nativeBinPath?: string | null): McpLaunchConfig | undefined {
|
||||
return nativeBinPath ? { command: nativeBinPath, env: config?.env } : config;
|
||||
}
|
||||
|
||||
function launchConfig(config?: McpLaunchConfig): McpLaunchConfig {
|
||||
return config ?? DEFAULT_MCP_LAUNCH_CONFIG;
|
||||
}
|
||||
@@ -41,7 +45,7 @@ export function buildMcpJsonConfig(config?: McpLaunchConfig): string {
|
||||
}
|
||||
|
||||
export function buildMcpTraeConfig(config?: McpLaunchConfig, nativeBinPath?: string): string {
|
||||
return buildMcpJsonConfig(nativeBinPath ? { command: nativeBinPath, env: config?.env } : config);
|
||||
return buildMcpJsonConfig(preferMcpNativeLaunch(config, nativeBinPath));
|
||||
}
|
||||
|
||||
export function buildMcpQoderConfig(config?: McpLaunchConfig, nativeBinPath?: string): string {
|
||||
|
||||
@@ -81,7 +81,9 @@ export function previewJdbcUpdate(): JdbcPluginStatus {
|
||||
export function previewMcpUpdate(): McpServerStatus {
|
||||
return {
|
||||
installed: true,
|
||||
installation_source: "npm",
|
||||
npm_available: true,
|
||||
npm_installed: true,
|
||||
node_path: "/preview/bin/node",
|
||||
node_version: "v22.18.0",
|
||||
current_version: "0.4.88",
|
||||
|
||||
Reference in new issue
Block a user