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
fix(mcp): enable DuckDB sidecar support
t8y2870d14e1c935
diff --git a/crates/dbx-mcp/Cargo.toml b/crates/dbx-mcp/Cargo.tomlindex f5db1cdff7..46520a5d30 100644--- a/crates/dbx-mcp/Cargo.toml+++ b/crates/dbx-mcp/Cargo.toml@@ -4,6 +4,10 @@ version = "0.4.46"edition = "2021"license = "Apache-2.0"+[features]+default = ["duckdb-sidecar"]+duckdb-sidecar = ["dbx-core/duckdb-sidecar"]+[[bin]]name = "dbx-mcp"path = "src/main.rs"diff --git a/crates/dbx-mcp/tests/local.rs b/crates/dbx-mcp/tests/local.rsindex 52c89aa0ff..cde4c1bfe5 100644--- a/crates/dbx-mcp/tests/local.rs+++ b/crates/dbx-mcp/tests/local.rs@@ -1,7 +1,7 @@use std::{ffi::OsString, sync::Arc};use dbx_core::{models::connection::ConnectionConfig, storage::Storage};-use dbx_mcp::{DbxMcpServer, LocalBackend, McpScope};+use dbx_mcp::{DbxBackend, DbxMcpServer, LocalBackend, McpScope};use rmcp::{model::CallToolRequestParams, ServiceExt};use serde_json::{json, Map, Value};use tempfile::tempdir;@@ -65,6 +65,37 @@ async fn local_backend_reads_dbx_storage_without_desktop_process() {server_task.abort();}+#[cfg(feature = "duckdb-sidecar")]+#[tokio::test]+async fn local_backend_uses_the_installed_duckdb_sidecar() {+ let directory = tempdir().expect("temporary data directory");+ let missing_driver = directory.path().join("missing-duckdb-driver");+ let _driver_path = EnvVarGuard::set("DBX_DUCKDB_DRIVER_PATH", &missing_driver.to_string_lossy());+ let db_path = directory.path().join("dbx.db");+ let storage = Storage::open(&db_path).await.expect("open storage");+ let connection: ConnectionConfig = serde_json::from_value(json!({+ "id": "local-duckdb",+ "name": "local-duckdb",+ "db_type": "duckdb",+ "host": ":memory:",+ "port": 0,+ "username": "",+ "password": "",+ "ssl": false+ }))+ .expect("minimal DuckDB connection config");+ storage.save_connections(std::slice::from_ref(&connection)).await.expect("save connection");++ let backend = LocalBackend::open(&db_path).await.expect("open local backend");+ let error = backend+ .execute_query(&connection, "main", "SELECT 1", Some(1), Some(5))+ .await+ .expect_err("missing DuckDB driver should fail");++ assert!(error.contains("DBX_DUCKDB_DRIVER_PATH"), "unexpected DuckDB error: {error}");+ assert!(!error.contains("not compiled"), "DuckDB sidecar feature was not enabled: {error}");+}+#[tokio::test]async fn legacy_read_only_config_applies_before_settings_are_opened() {let _allow_writes = EnvVarGuard::set("DBX_MCP_ALLOW_WRITES", "0");diff --git a/deploy/dockerhub/README.md b/deploy/dockerhub/README.mdindex b09f9964f5..439f86a130 100644--- a/deploy/dockerhub/README.md+++ b/deploy/dockerhub/README.md@@ -63,6 +63,8 @@ docker compose up -d --pull alwaysPersist `/app/data` with a named volume or bind mount. Removing this data removes saved connections and other DBX application data.+DuckDB is delivered as a standalone native driver instead of being embedded in `dbx-web`. Install the DuckDB driver from Driver Manager after the first launch. It is stored under `/app/data/agents` and remains available across container upgrades when `/app/data` is persisted.+## Reverse ProxyTo publish DBX under a path such as `https://example.com/dbx`, set:diff --git a/docs/content/docs/mcp.cn.mdx b/docs/content/docs/mcp.cn.mdxindex 06c7607ed0..783e4522c9 100644--- a/docs/content/docs/mcp.cn.mdx+++ b/docs/content/docs/mcp.cn.mdx@@ -103,6 +103,8 @@ DBX MCP 当前提供 10 个工具:PostgreSQL、MySQL、SQLite、兼容 SQL 数据库、独立 Redis 和 MongoDB 可以直接查询。部分 SSH、集群、厂商专用以及 Agent/JDBC 连接需要先安装对应的 DBX 组件。+DuckDB 使用独立的 DBX DuckDB 驱动。通过本地 MCP 查询 DuckDB 前,需要先在 **DBX Driver Manager** 中安装该驱动。MCP 二进制只包含 sidecar 客户端,不会内置 DuckDB 引擎。+### Agent/JDBC 数据库Oracle、人大金仓和虚谷需要匹配的 DBX 原生 Agent,但不需要 JRE。达梦、DB2、Hive、Trino、Snowflake、SAP HANA 等 JDBC Agent 数据库需要匹配的 Agent、JDBC 驱动和 JRE。请先在 DBX 中安装所需组件,再使用 MCP。@@ -111,6 +113,8 @@ Oracle、人大金仓和虚谷需要匹配的 DBX 原生 Agent,但不需要 JR设置 `DBX_WEB_URL` 后,MCP 会使用部署的 DBX Web 后端,而不是读取本机连接。如果 Web 登录启用了密码保护,还要设置 `DBX_WEB_PASSWORD`,值为 Web 登录页使用的密码。+DBX Web 和 Docker 同样需要独立 DuckDB 驱动。首次启动后可通过 Driver Manager 安装;Docker 会把驱动保存到 `/app/data/agents`,挂载 `/app/data` 数据卷后升级容器不会丢失。+### 桌面 UI 工具`dbx_open_table` 和 `dbx_execute_and_show` 要求 DBX 桌面端正在运行。其他查询工具可以在 DBX 关闭时使用。@@ -148,6 +152,7 @@ DBX 在 **设置 → MCP** 中保存一份权威策略,并在每次请求时<Accordion title="找不到 dbx.db">将 `DBX_DATA_DIR` 设置为包含 `dbx.db` 的目录。Windows 便携版通常是 `DBX.exe` 旁边的 `data` 目录。</Accordion><Accordion title="提示 DBX 未运行">只有 `dbx_open_table` 和 `dbx_execute_and_show` 需要桌面端运行;本地查询工具可以在 DBX 关闭时执行。</Accordion><Accordion title="Agent/JDBC 数据库无法启动">在 DBX Driver Manager 中安装或更新匹配的 Agent、JDBC 驱动和 JRE。厂商专有驱动不会随 MCP 原生包发布。</Accordion>+ <Accordion title="DuckDB 连接无法启动">在 DBX Driver Manager 中安装或更新 DuckDB 驱动。本地 MCP、DBX Web 和 Docker 都通过独立驱动运行 DuckDB,不会内置 DuckDB 引擎。</Accordion><Accordion title="出现 better-sqlite3 或 Node ABI 错误">MCP 不需要 `better-sqlite3`。请先升级 `@dbx-app/mcp-server`;如果错误来自 `@dbx-app/cli`,请按照 CLI 的安装要求处理,因为它们是两个独立的包。</Accordion></Accordions>diff --git a/docs/content/docs/mcp.mdx b/docs/content/docs/mcp.mdxindex dbe44b4557..2565f12c5e 100644--- a/docs/content/docs/mcp.mdx+++ b/docs/content/docs/mcp.mdx@@ -103,6 +103,8 @@ Set `DBX_DATA_DIR` to the directory containing `dbx.db`. Do not set it to the fiPostgreSQL, MySQL, SQLite, compatible SQL databases, standalone Redis, and MongoDB can be queried locally. Some SSH, cluster, vendor-specific, and Agent/JDBC connections require their DBX components to be installed.+DuckDB uses the standalone DBX DuckDB driver. Install it from **DBX Driver Manager** before querying a DuckDB connection through local MCP. The MCP binary includes the sidecar client but does not bundle the DuckDB engine.+### Agent/JDBC databasesOracle, KingBase, and XuguDB require their matching native DBX Agent but no JRE. Dameng, DB2, Hive, Trino, Snowflake, SAP HANA, and other JDBC Agent connections require the matching Agent, JDBC driver, and JRE. Install the required component in DBX before using MCP.@@ -111,6 +113,8 @@ Oracle, KingBase, and XuguDB require their matching native DBX Agent but no JRE.Set `DBX_WEB_URL` to use a deployed DBX Web backend instead of local connections. If the Web login is protected, also set `DBX_WEB_PASSWORD` to the same login password.+DBX Web and Docker require the same standalone DuckDB driver. Install it from Driver Manager after the first launch. Docker stores installed drivers under `/app/data/agents`, so they persist when `/app/data` is mounted as a volume.+### Desktop UI tools`dbx_open_table` and `dbx_execute_and_show` require the DBX desktop app to be running. Other query tools can run while DBX is closed.@@ -148,6 +152,7 @@ Updated servers do not let `DBX_MCP_ALLOW_WRITES` or `DBX_MCP_ALLOW_DANGEROUS_SQ<Accordion title="dbx.db cannot be found">Set `DBX_DATA_DIR` to the folder containing `dbx.db`. For Windows portable builds, this is normally the `data` folder beside `DBX.exe`.</Accordion><Accordion title="DBX is not running">Only `dbx_open_table` and `dbx_execute_and_show` require the desktop app. Local query tools can run without DBX open.</Accordion><Accordion title="An Agent/JDBC database cannot start">Install or update the matching DBX agent, JDBC driver, and JRE through DBX Driver Manager. Proprietary drivers are not included in the native MCP package.</Accordion>+ <Accordion title="A DuckDB connection cannot start">Install or update the DuckDB driver through DBX Driver Manager. Local MCP, DBX Web, and Docker use the standalone driver rather than embedding the DuckDB engine.</Accordion><Accordion title="I see a better-sqlite3 or Node ABI error">MCP does not require `better-sqlite3`. Upgrade `@dbx-app/mcp-server`; if the error comes from `@dbx-app/cli`, follow the CLI installation requirements because it is a separate package.</Accordion></Accordions>diff --git a/packages/mcp-server/README.md b/packages/mcp-server/README.mdindex eaed6f0a4d..e4afaaedd5 100644--- a/packages/mcp-server/README.md+++ b/packages/mcp-server/README.md@@ -162,6 +162,8 @@ This is the default. MCP reads DBX connection storage and executes supported conCommon native paths include PostgreSQL, MySQL, SQLite, compatible SQL databases, Redis standalone, and MongoDB. SSH, cluster, vendor-specific, or Agent/JDBC connections may require additional DBX infrastructure.+DuckDB runs through the standalone DBX DuckDB driver. Install it from DBX Driver Manager before using a DuckDB connection through local MCP. The MCP binary includes the sidecar client but does not bundle the DuckDB engine.+DBX connection storage defaults to:- macOS: `~/Library/Application Support/com.dbx.app/dbx.db`@@ -196,6 +198,8 @@ Set `DBX_WEB_URL` to use a deployed DBX Web backend instead of local desktop sto`DBX_WEB_PASSWORD` is the password used on the DBX Web login page. Desktop-local mode does not use it. Desktop UI tools are hidden in Web mode.+Docker and DBX Web also require the standalone DuckDB driver. Install it from Driver Manager after the first launch; when `/app/data` is persisted, the driver is stored under `/app/data/agents` and survives container upgrades.+### Windows portable DBXPoint `DBX_DATA_DIR` at the portable `data` directory containing `dbx.db`: