Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

fix(mcp): support older glibc and XDG data paths

Gadflycc717d116c15
diff --git a/.github/workflows/mcp-release.yml b/.github/workflows/mcp-release.yml
index e2ed8962c6..cca620dd57 100644
--- a/.github/workflows/mcp-release.yml
+++ b/.github/workflows/mcp-release.yml
@@ -363,9 +363,24 @@ jobs:
sudo apt-get update
sudo apt-get install -y libfontconfig1-dev
+ - name: Setup Python for cargo-zigbuild
+ if: runner.os == 'Linux'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.x'
+
+ - name: Install zig and cargo-zigbuild
+ if: runner.os == 'Linux'
+ run: pip install ziglang==0.14.0 cargo-zigbuild==0.23.0
+
- name: Build Rust CLI binary
shell: bash
- run: cargo build --release -p dbx-cli --no-default-features --target "${{ matrix.target }}"
+ run: |
+ if [[ "${{ runner.os }}" == "Linux" ]]; then
+ cargo zigbuild --release -p dbx-cli --no-default-features --target "${{ matrix.target }}.2.31"
+ else
+ cargo build --release -p dbx-cli --no-default-features --target "${{ matrix.target }}"
+ fi
- name: Stage platform package
shell: bash
@@ -538,9 +553,24 @@ jobs:
sudo apt-get update
sudo apt-get install -y libfontconfig1-dev
+ - name: Setup Python for cargo-zigbuild
+ if: runner.os == 'Linux'
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.x'
+
+ - name: Install zig and cargo-zigbuild
+ if: runner.os == 'Linux'
+ run: pip install ziglang==0.14.0 cargo-zigbuild==0.23.0
+
- name: Build Rust MCP binary
shell: bash
- run: cargo build --release -p dbx-mcp --target "${{ matrix.target }}"
+ run: |
+ if [[ "${{ runner.os }}" == "Linux" ]]; then
+ cargo zigbuild --release -p dbx-mcp --target "${{ matrix.target }}.2.31"
+ else
+ cargo build --release -p dbx-mcp --target "${{ matrix.target }}"
+ fi
- name: Stage platform package
shell: bash
diff --git a/Cargo.lock b/Cargo.lock
index ed17c22efb..a069ef22d5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1763,6 +1763,7 @@ version = "0.4.48"
dependencies = [
"async-trait",
"dbx-core",
+ "dirs",
"reqwest 0.12.28",
"rmcp",
"schemars 1.2.1",
diff --git a/crates/dbx-mcp/Cargo.toml b/crates/dbx-mcp/Cargo.toml
index 95ea77fdab..c1cd44ac7b 100644
--- a/crates/dbx-mcp/Cargo.toml
+++ b/crates/dbx-mcp/Cargo.toml
@@ -15,6 +15,7 @@ path = "src/main.rs"
[dependencies]
async-trait = "0.1"
dbx-core = { path = "../dbx-core", default-features = false }
+dirs = "6"
rmcp = { version = "2.2.0", features = ["client", "transport-io"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
schemars = "1"
diff --git a/crates/dbx-mcp/src/paths.rs b/crates/dbx-mcp/src/paths.rs
index 0966711b33..eaf2e074f8 100644
--- a/crates/dbx-mcp/src/paths.rs
+++ b/crates/dbx-mcp/src/paths.rs
@@ -2,27 +2,16 @@ use std::path::PathBuf;
pub const STORAGE_DB_FILE_NAME: &str = "dbx.db";
+/// Mirrors `dirs::data_dir()` (same call the Tauri desktop app makes) so MCP/CLI and the desktop
+/// app resolve the same `dbx.db`, including under `XDG_DATA_HOME` on Linux.
pub fn app_data_dir() -> Result<PathBuf, String> {
if let Some(path) = std::env::var_os("DBX_DATA_DIR").filter(|value| !value.is_empty()) {
return Ok(PathBuf::from(path));
}
- let home = std::env::var_os("HOME")
- .or_else(|| std::env::var_os("USERPROFILE"))
- .map(PathBuf::from)
- .ok_or_else(|| "Unable to resolve the user home directory. Set DBX_DATA_DIR explicitly.".to_string())?;
-
- #[cfg(target_os = "macos")]
- return Ok(home.join("Library/Application Support/com.dbx.app"));
-
- #[cfg(target_os = "windows")]
- return Ok(std::env::var_os("APPDATA")
- .map(PathBuf::from)
- .unwrap_or_else(|| home.join("AppData/Roaming"))
- .join("com.dbx.app"));
-
- #[cfg(not(any(target_os = "macos", target_os = "windows")))]
- return Ok(home.join(".local/share/com.dbx.app"));
+ let base = dirs::data_dir()
+ .ok_or_else(|| "Unable to resolve the user data directory. Set DBX_DATA_DIR explicitly.".to_string())?;
+ Ok(base.join("com.dbx.app"))
}
pub fn storage_db_path() -> Result<PathBuf, String> {