25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat(mcp): add one-click install/upgrade button
t8y26c5716916260
diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vueindex c753230cd9..a5daa2da84 100644--- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue+++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue@@ -37,7 +37,22 @@ import { isTauriRuntime } from "@/lib/tauriRuntime";import { useTheme } from "@/composables/useTheme";import { copyToClipboard } from "@/lib/clipboard";import { clearDebugLogs as clearStoredDebugLogs, downloadDebugLogs, getDebugLogBundleText } from "@/lib/debugLog";-import { aiListModels, aiTestConnection, checkMcpServerStatus, forgetWebdavSavedPassword, listSystemFonts, saveWebdavSavedPassword, webdavPasswordStatus, webdavSyncDownload, webdavSyncTest, webdavSyncUpload, type AiModelInfo, type McpServerStatus, type WebDavConfig } from "@/lib/api";+import {+ aiListModels,+ aiTestConnection,+ checkMcpServerStatus,+ installMcpServer,+ forgetWebdavSavedPassword,+ listSystemFonts,+ saveWebdavSavedPassword,+ webdavPasswordStatus,+ webdavSyncDownload,+ webdavSyncTest,+ webdavSyncUpload,+ type AiModelInfo,+ type McpServerStatus,+ type WebDavConfig,+} from "@/lib/api";import { eventToShortcut } from "@/lib/keyboardShortcuts";import { SHORTCUT_DEFINITIONS, findShortcutConflict, normalizeShortcutSettings, type ShortcutActionId } from "@/lib/shortcutRegistry";import { normalizeSidebarHiddenTablePrefixes } from "@/lib/sidebarTableNameDisplay";@@ -628,6 +643,9 @@ const mcpCopied = ref<"" | "install" | "claude-config" | "codex-config">("");const mcpConfigTab = ref<"claude" | "codex">("claude");const mcpReadonlyMode = ref(false);const mcpAllowDangerous = ref(false);+const mcpInstalling = ref(false);+const mcpInstallMessage = ref("");+const mcpInstallError = ref(false);const mcpEnvEntries = computed(() => {const entries: Array<[string, string]> = [];@@ -717,6 +735,30 @@ async function copyMcpText(kind: "install" | "claude-config" | "codex-config", v}, 1500);}+async function installMcp() {+ if (mcpInstalling.value) return;+ mcpInstalling.value = true;+ mcpInstallMessage.value = "";+ mcpInstallError.value = false;+ try {+ const result = await installMcpServer();+ mcpInstallMessage.value = result;+ mcpInstallError.value = false;+ // 安装成功后刷新状态+ await refreshMcpStatus();+ } catch (e: any) {+ mcpInstallMessage.value = e?.message || String(e);+ mcpInstallError.value = true;+ } finally {+ mcpInstalling.value = false;+ // 3秒后清除消息+ 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") || "");@@ -2276,6 +2318,17 @@ watch(<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 || !mcpStatus?.npm_available || (mcpStatus?.installed && !mcpStatus?.update_available)" @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") }}+ </Button>+ </div>+ <div+ v-if="mcpInstallMessage"+ :class="['text-xs px-3 py-2 rounded-md border', mcpInstallError ? 'bg-red-50 text-red-700 border-red-200 dark:bg-red-950/30 dark:text-red-300 dark:border-red-800' : 'bg-green-50 text-green-700 border-green-200 dark:bg-green-950/30 dark:text-green-300 dark:border-green-800']"+ >+ {{ mcpInstallMessage }}</div></div>diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.tsindex 64f5547d34..d50ec7f024 100644--- a/apps/desktop/src/i18n/locales/en.ts+++ b/apps/desktop/src/i18n/locales/en.ts@@ -2174,6 +2174,12 @@mcpBinPath: "Command path",mcpInstallCommand: "Install command",mcpUpdateCommand: "Upgrade command",+ mcpInstallButton: "Install",+ mcpUpdateButton: "Upgrade",+ mcpUpToDate: "Up to date",+ mcpInstalling: "Installing...",+ mcpInstallSuccess: "Installation successful",+ mcpInstallFailed: "Installation failed",mcpConfig: "MCP config",mcpCodexConfig: "Codex config",mcpCodexConfigPath: "Codex can use ~/.codex/config.toml or a project-level .codex/config.toml.",diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.tsindex 50e0172d66..06e08c230c 100644--- a/apps/desktop/src/i18n/locales/es.ts+++ b/apps/desktop/src/i18n/locales/es.ts@@ -1890,6 +1890,12 @@mcpBinPath: "Ruta del comando",mcpInstallCommand: "Comando de instalación",mcpUpdateCommand: "Comando de actualización",+ mcpInstallButton: "Instalar",+ mcpUpdateButton: "Actualizar",+ mcpUpToDate: "Actualizado",+ mcpInstalling: "Instalando...",+ mcpInstallSuccess: "Instalación exitosa",+ mcpInstallFailed: "Error de instalación",mcpConfig: "Configuración de MCP",mcpCodexConfig: "Configuración de Codex",mcpCodexConfigPath: "Codex puede usar ~/.codex/config.toml o .codex/config.toml dentro del proyecto.",diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.tsindex bb394bdd5c..3cee816b2d 100644--- a/apps/desktop/src/i18n/locales/it.ts+++ b/apps/desktop/src/i18n/locales/it.ts@@ -1959,6 +1959,12 @@mcpBinPath: "Comando path",mcpInstallCommand: "Comando di installazione",mcpUpdateCommand: "Comando di aggiornamento",+ mcpInstallButton: "Installa",+ mcpUpdateButton: "Aggiorna",+ mcpUpToDate: "Aggiornato",+ mcpInstalling: "Installazione...",+ mcpInstallSuccess: "Installazione completata",+ mcpInstallFailed: "Installazione fallita",mcpConfig: "Configurazione MCP",mcpCodexConfig: "Configurazione Codex",mcpCodexConfigPath: "Codex può utilizzare ~/.codex/config.toml o un .codex/config.toml a livello di progetto.",diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.tsindex c44dada1c1..4bec67483b 100644--- a/apps/desktop/src/i18n/locales/pt-BR.ts+++ b/apps/desktop/src/i18n/locales/pt-BR.ts@@ -1970,6 +1970,12 @@mcpBinPath: "Caminho do comando",mcpInstallCommand: "Comando de instalação",mcpUpdateCommand: "Comando de atualização",+ mcpInstallButton: "Instalar",+ mcpUpdateButton: "Atualizar",+ mcpUpToDate: "Atualizado",+ mcpInstalling: "Instalando...",+ mcpInstallSuccess: "Instalação bem-sucedida",+ mcpInstallFailed: "Falha na instalação",mcpConfig: "Configuração do MCP",mcpCodexConfig: "Configuração do Codex",mcpCodexConfigPath: "O Codex pode usar ~/.codex/config.toml ou um .codex/config.toml no nível do projeto.",diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.tsindex 0af9caeafb..41eb7463c9 100644--- a/apps/desktop/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/src/i18n/locales/zh-CN.ts@@ -2198,6 +2198,12 @@mcpBinPath: "命令路径",mcpInstallCommand: "安装命令",mcpUpdateCommand: "升级命令",+ mcpInstallButton: "安装",+ mcpUpdateButton: "升级",+ mcpUpToDate: "已是最新",+ mcpInstalling: "安装中...",+ mcpInstallSuccess: "安装成功",+ mcpInstallFailed: "安装失败",mcpConfig: "MCP 配置",mcpCodexConfig: "Codex 配置",mcpCodexConfigPath: "Codex 可放在 ~/.codex/config.toml 或项目级 .codex/config.toml。",diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.tsindex 12417eddfd..ea555dbaff 100644--- a/apps/desktop/src/lib/api.ts+++ b/apps/desktop/src/lib/api.ts@@ -294,6 +294,7 @@ export const deleteHistoryEntry = forward("deleteHistoryEntry");// Updatesexport const checkMcpServerStatus = forward("checkMcpServerStatus");+export const installMcpServer = forward("installMcpServer");export const checkForUpdates = forward("checkForUpdates");export const getSystemProxyUrl = forward("getSystemProxyUrl");export const getAppVersion = forward("getAppVersion");diff --git a/apps/desktop/src/lib/tauri.ts b/apps/desktop/src/lib/tauri.tsindex 8cd544e85b..8509163520 100644--- a/apps/desktop/src/lib/tauri.ts+++ b/apps/desktop/src/lib/tauri.ts@@ -1043,6 +1043,10 @@ export async function checkMcpServerStatus(): Promise<McpServerStatus> {return invoke("check_mcp_server_status");}+export async function installMcpServer(): Promise<string> {+ return invoke("install_mcp_server");+}+export async function checkForUpdates(): Promise<UpdateInfo> {return invoke("check_for_updates");}diff --git a/src-tauri/src/commands/mcp.rs b/src-tauri/src/commands/mcp.rsindex 5a86401385..a47df8a0ba 100644--- a/src-tauri/src/commands/mcp.rs+++ b/src-tauri/src/commands/mcp.rs@@ -62,6 +62,26 @@ pub async fn check_mcp_server_status() -> Result<McpServerStatus, String> {})}+#[tauri::command]+pub async fn install_mcp_server() -> Result<String, String> {+ tauri::async_runtime::spawn_blocking(|| {+ let output = command_output(+ "npm",+ &["install", "-g", "@dbx-app/mcp-server@latest", "--registry=https://registry.npmjs.org"],+ )?;++ if !output.success {+ let error_msg = if !output.stderr.is_empty() { output.stderr } else { output.stdout };+ return Err(format!("Installation failed: {}", error_msg));+ }++ let version = installed_mcp_version().unwrap_or_else(|| "unknown".to_string());+ Ok(format!("Successfully installed @dbx-app/mcp-server@{}", version))+ })+ .await+ .map_err(|e| e.to_string())?+}+async fn fetch_latest_mcp_version() -> Result<String, String> {let mut builder = reqwest::Client::builder().timeout(Duration::from_secs(10)).user_agent("dbx-mcp-status-checker");let proxy_url =diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex d07513c1da..fc26b77a86 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -514,6 +514,7 @@ pub fn run() {commands::history::clear_history,commands::history::delete_history_entry,commands::mcp::check_mcp_server_status,+ commands::mcp::install_mcp_server,commands::update::check_for_updates,commands::update::get_system_proxy_url,commands::transfer::start_transfer,