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。

feat(mcp): publish native release assets and docs

t8y29020a4dd51e0
diff --git a/.github/workflows/mcp-release.yml b/.github/workflows/mcp-release.yml
index d7dd26c39e..c87d7ed85b 100644
--- a/.github/workflows/mcp-release.yml
+++ b/.github/workflows/mcp-release.yml
@@ -8,6 +8,7 @@ on:
required: true
permissions:
+ attestations: write
contents: write
id-token: write
@@ -502,6 +503,100 @@ jobs:
fi
pnpm --filter "@dbx-app/mcp-server" publish --access public --provenance --no-git-checks
+ publish-mcp-github-release:
+ name: Publish MCP GitHub Release assets
+ runs-on: ubuntu-latest
+ needs: [prepare, publish-mcp-server]
+ steps:
+ - uses: actions/checkout@v5
+ with:
+ ref: ${{ needs.prepare.outputs.tag }}
+
+ - uses: actions/setup-node@v6
+ with:
+ node-version: 22.13.0
+ registry-url: https://registry.npmjs.org
+
+ - name: Build native release archives from npm packages
+ shell: bash
+ env:
+ VERSION: ${{ needs.prepare.outputs.version }}
+ run: |
+ set -euo pipefail
+ mkdir -p release-assets
+
+ pack_unix() {
+ package_name="$1"
+ asset_name="$2"
+ work_dir="$(mktemp -d)"
+ npm pack "${package_name}@${VERSION}" --pack-destination "${work_dir}" --json > "${work_dir}/pack.json"
+ tarball="${work_dir}/$(jq -r '.[0].filename' "${work_dir}/pack.json")"
+ tar -xzf "${tarball}" -C "${work_dir}"
+ mkdir -p "${work_dir}/archive"
+ cp "${work_dir}/package/bin/dbx-mcp" "${work_dir}/archive/dbx-mcp"
+ chmod +x "${work_dir}/archive/dbx-mcp"
+ tar -C "${work_dir}/archive" -czf "release-assets/${asset_name}.tar.gz" dbx-mcp
+ }
+
+ pack_windows() {
+ package_name="$1"
+ asset_name="$2"
+ work_dir="$(mktemp -d)"
+ npm pack "${package_name}@${VERSION}" --pack-destination "${work_dir}" --json > "${work_dir}/pack.json"
+ tarball="${work_dir}/$(jq -r '.[0].filename' "${work_dir}/pack.json")"
+ tar -xzf "${tarball}" -C "${work_dir}"
+ zip -j "release-assets/${asset_name}.zip" "${work_dir}/package/bin/dbx-mcp.exe"
+ }
+
+ pack_unix "@dbx-app/mcp-darwin-arm64" "dbx-mcp-darwin-arm64"
+ pack_unix "@dbx-app/mcp-darwin-x64" "dbx-mcp-darwin-x64"
+ pack_unix "@dbx-app/mcp-linux-arm64-gnu" "dbx-mcp-linux-arm64-gnu"
+ pack_unix "@dbx-app/mcp-linux-x64-gnu" "dbx-mcp-linux-x64-gnu"
+ pack_windows "@dbx-app/mcp-win32-arm64" "dbx-mcp-win32-arm64"
+ pack_windows "@dbx-app/mcp-win32-x64" "dbx-mcp-win32-x64"
+
+ (
+ cd release-assets
+ sha256sum *.tar.gz *.zip > SHA256SUMS
+ )
+
+ - name: Attest native release archives
+ uses: actions/attest-build-provenance@v3
+ with:
+ subject-path: release-assets/*
+
+ - name: Publish GitHub Release
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ TAG: ${{ needs.prepare.outputs.tag }}
+ VERSION: ${{ needs.prepare.outputs.version }}
+ run: |
+ cat > release-notes.md <<EOF
+ DBX MCP ${VERSION} provides precompiled native binaries for macOS, Linux, and Windows.
+
+ Recommended npm installation:
+
+ \`\`\`bash
+ npm install -g @dbx-app/mcp-server@${VERSION}
+ \`\`\`
+
+ Native archives run without Node.js. Download the archive matching your operating system and CPU, verify it with \`SHA256SUMS\`, extract \`dbx-mcp\` (or \`dbx-mcp.exe\`), and configure your MCP client to run it directly.
+
+ This package release is separate from the DBX desktop application release and is intentionally not marked as the repository's latest release.
+ EOF
+
+ if gh release view "${TAG}" >/dev/null 2>&1; then
+ gh release upload "${TAG}" release-assets/* --clobber
+ gh release edit "${TAG}" --title "DBX MCP ${VERSION}" --notes-file release-notes.md --latest=false
+ else
+ gh release create "${TAG}" release-assets/* \
+ --verify-tag \
+ --title "DBX MCP ${VERSION}" \
+ --notes-file release-notes.md \
+ --latest=false
+ fi
+
publish-homebrew-formula:
name: Publish Homebrew formula
runs-on: ubuntu-latest
diff --git a/README.md b/README.md
index d3262613e0..796203189a 100644
--- a/README.md
+++ b/README.md
@@ -140,7 +140,7 @@ Dark mode with native title bar sync · 9 editor themes · English, 简体中文
## AI Agent Integration (MCP)
-DBX provides an [MCP server](packages/mcp-server/) that lets AI coding agents query your databases using connections already configured in DBX.
+DBX provides a separate [Rust-powered MCP server](packages/mcp-server/) that lets AI coding agents query databases using connections configured in DBX. The MCP server is distributed independently from the desktop application, so installing DBX does not automatically install the MCP executable.
```bash
npx @dbx-app/mcp-server
@@ -177,6 +177,8 @@ For DBX Web or Docker deployments, point the MCP server at the Web backend API.
Works with Claude Code, Cursor, Windsurf, and any MCP-compatible agent. Supports listing connections, browsing tables, executing SQL, and opening tables directly in DBX's UI.
+Precompiled native binaries are also published for macOS, Linux, and Windows in [package releases](https://github.com/t8y2/dbx/releases?q=packages-v). They run without Node.js and are suitable for offline or server environments. The npm installation uses the same Rust binary through a small Node.js launcher.
+
DBX also provides a dedicated CLI package for terminal, script, and Codex workflows:
```bash
@@ -407,7 +409,7 @@ Yes. The desktop app works fully offline. For air-gapped driver installs, downlo
<details>
<summary><strong>How is DBX different from DBeaver / TablePlus / Beekeeper Studio?</strong></summary>
-DBX is 20 MB with no runtime dependencies (no Java, no Python). It includes AI and MCP natively — not as plugins. It supports 60+ databases across desktop, Docker, and web from a single codebase.
+DBX is 20 MB with no runtime dependencies for its native database features (no system Java or Python required). AI is built into the application, while MCP is provided as a separately installed Rust companion package or native binary. It supports 60+ databases across desktop, Docker, and web from a shared Rust core.
</details>
<details>
diff --git a/docs/content/docs/mcp.cn.mdx b/docs/content/docs/mcp.cn.mdx
index b6d8578399..e4aa31f374 100644
--- a/docs/content/docs/mcp.cn.mdx
+++ b/docs/content/docs/mcp.cn.mdx
@@ -1,20 +1,17 @@
---
title: MCP 集成
-description: 通过 MCP 协议让 Claude Code、Cursor 等 AI 编程助手直接查询你的数据库。
+description: 通过 Model Context Protocol 让 AI 编程助手查询你的数据库。
---
-<Callout type="info">一行配置,让 AI 编程助手直接查询你的数据库。支持 Claude Code、Cursor、Windsurf、VS Code Copilot。</Callout>
+<Callout type="info">把 AI 助手连接到 DBX,即可查看数据库结构、查询数据,并在 DBX 中打开结果。</Callout>
## 什么是 MCP?
-MCP(Model Context Protocol)是一个开放协议,让 AI 编程助手能够调用外部工具。DBX 的 MCP Server 把你在 DBX 中配置的数据库连接暴露给 AI 助手,这样你可以用自然语言查询数据库,AI 自动生成并执行 SQL。
+MCP(Model Context Protocol)是让 AI 客户端调用外部工具的开放协议。DBX MCP 可以让 AI 助手使用 DBX 中已经配置好的数据库连接。
-```
-你:"查看 orders 表最近 7 天的订单量趋势"
-
-AI 助手 → MCP Server → 你的数据库 → 返回结果
- ↓
- DBX 的连接配置(含密码)
+```text
+AI 助手 → DBX MCP → 你的数据库 → 返回结果
+ ↘ DBX 桌面端(打开或展示结果)
```
## 快速开始
@@ -27,11 +24,12 @@ AI 助手 → MCP Server → 你的数据库 → 返回结果
npm install -g @dbx-app/mcp-server
```
+ npm 会自动安装当前平台需要的依赖。不要使用 `--no-optional`。
</Step>
<Step>
### 配置 AI 助手
- 在你的工作目录创建 `.mcp.json`:
+ 在项目目录创建 `.mcp.json`:
```json
{
@@ -44,232 +42,108 @@ AI 助手 → MCP Server → 你的数据库 → 返回结果
}
```
- Windows 便携版需要额外设置 `DBX_DATA_DIR`,指向 `DBX.exe` 同级的 `data` 目录:
-
- ```json
- {
- "mcpServers": {
- "dbx": {
- "command": "npx",
- "args": ["-y", "@dbx-app/mcp-server"],
- "env": {
- "DBX_DATA_DIR": "D:\\DBX_x64-portable\\data"
- }
- }
- }
- }
- ```
-
+ 如果使用全局安装,可将 `command` 改为 `dbx-mcp-server`。Windows 便携版请将 `DBX_DATA_DIR` 设置为 `DBX.exe` 同级的 `data` 目录。
</Step>
<Step>
### 开始使用
- 在 AI 助手中直接用自然语言说:
+ 在 AI 助手中直接使用自然语言:
- "列出我的数据库连接"
- "查看 local-pg 上有哪些表"
- "查看 users 表的结构"
- "查询最近 7 天的订单数量"
- "打开 orders 表"(需要 DBX 运行中)
-
</Step>
</Steps>
## 支持的 AI 助手
-| 助手 | 配置方式 |
-| ----------------- | ----------------------- |
-| Claude Code | `.mcp.json`(原生支持) |
-| Cursor | `.cursor/mcp.json` |
-| Windsurf | `.windsurfrules` |
-| VS Code + Copilot | MCP 扩展 |
+| AI 助手 | 配置方式 |
+| --- | --- |
+| Claude Code | `.mcp.json` |
+| Cursor | `.cursor/mcp.json` |
+| Windsurf | MCP 配置 |
+| VS Code + Copilot | MCP 扩展/配置 |
## 工具列表
-DBX MCP Server 提供以下工具,AI 助手会根据你的需求自动调用:
-
-### `dbx_list_connections`
-
-列出 DBX 中所有已配置的数据库连接。
-
-**示例对话:**
-
-> "列出我的数据库连接"
-
-**返回:**
-
-```
-| Name | Type | Host | Port | Database |
-| -------- | -------- | --------- | ---- | -------- |
-| local-pg | postgres | 127.0.0.1 | 5432 | |
-| prod-db | mysql | db.example| 3306 | myapp |
-```
-
-### `dbx_list_tables`
-
-列出指定连接的表和视图。
-
-| 参数 | 必填 | 说明 |
-| ----------------- | ---- | -------------------------- |
-| `connection_name` | 是 | DBX 连接名称 |
-| `schema` | 否 | Schema 名称(默认 public) |
-
-### `dbx_describe_table`
-
-获取表的列定义,AI 用它来理解你的数据结构。
-
-| 参数 | 必填 | 说明 |
-| ----------------- | ---- | -------------------------- |
-| `connection_name` | 是 | DBX 连接名称 |
-| `table` | 是 | 表名 |
-| `schema` | 否 | Schema 名称(默认 public) |
+DBX MCP 当前提供 10 个工具:
-**返回:**
+| 工具 | 说明 |
+| --- | --- |
+| `dbx_list_connections` | 列出当前 MCP 会话可见的连接 |
+| `dbx_add_connection` | 添加连接到本地 DBX 存储 |
+| `dbx_remove_connection` | 从本地 DBX 存储删除连接 |
+| `dbx_list_tables` | 列出表、视图或集合 |
+| `dbx_describe_table` | 返回列定义和表元数据 |
+| `dbx_get_schema_context` | 返回适合 AI 使用的紧凑 Schema 上下文 |
+| `dbx_execute_query` | 执行 SQL 或支持的 MongoDB shell 命令,最多返回 100 行 |
+| `dbx_execute_redis_command` | 执行 Redis 命令 |
+| `dbx_open_table` | 在运行中的 DBX 桌面端打开表 |
+| `dbx_execute_and_show` | 执行查询并在 DBX 中展示结果 |
-```
-| Column | Type | Nullable | Default | Comment |
-| ----------- | --------- | -------- | ------- | ------- |
-| id (PK) | integer | NO | | |
-| user_id | integer | NO | | 用户 ID |
-| total | numeric | NO | 0 | 订单金额 |
-| created_at | timestamp | NO | now() | |
-```
-
-### `dbx_execute_query`
-
-执行 SQL 查询,返回结果(最多 100 行)。
-
-| 参数 | 必填 | 说明 |
-| ----------------- | ---- | ------------ |
-| `connection_name` | 是 | DBX 连接名称 |
-| `sql` | 是 | SQL 查询语句 |
-
-### `dbx_get_schema_context`
-
-返回用于生成 SQL 的紧凑表结构上下文。
-
-| 参数 | 必填 | 说明 |
-| ----------------- | ---- | ------------------------------------ |
-| `connection_name` | 是 | DBX 连接名称 |
-| `schema` | 否 | Schema 名称 |
-| `tables` | 否 | 指定要包含的表名 |
-| `max_tables` | 否 | 最多包含多少张表,范围限制在 1 到 20 |
-
-### `dbx_add_connection`
-
-添加新的数据库连接。
-
-| 参数 | 必填 | 说明 |
-| ---------- | ---- | ----------------------------------------------- |
-| `name` | 是 | 连接名称 |
-| `db_type` | 是 | 数据库类型(postgres、mysql、sqlite、redis 等) |
-| `host` | 是 | 数据库主机 |
-| `port` | 是 | 数据库端口 |
-| `username` | 否 | 用户名 |
-| `password` | 否 | 密码 |
-| `database` | 否 | 默认数据库名 |
-| `ssl` | 否 | 是否启用 SSL(默认 false) |
-
-**示例对话:**
-
-> "添加一个 PostgreSQL 连接,名称 prod-db,地址 db.example.com:5432"
-
-### `dbx_remove_connection`
+启用连接作用域后,修改连接和桌面 UI 工具会被隐藏。
-删除数据库连接。
+## 数据库访问
-| 参数 | 必填 | 说明 |
-| ----------------- | ---- | ---------------- |
-| `connection_name` | 是 | 要删除的连接名称 |
+### 本地连接
-**示例对话:**
+这是默认模式。MCP 使用 DBX 中保存的连接配置。执行数据库查询时不要求 DBX 桌面端保持运行。
-> "删除 test-db 连接"
+常见的本地数据库文件路径:
-### `dbx_open_table`
+| 平台 | 默认路径 |
+| --- | --- |
+| macOS | `~/Library/Application Support/com.dbx.app/dbx.db` |
+| Linux | `~/.local/share/com.dbx.app/dbx.db` |
+| Windows | `%APPDATA%\com.dbx.app\dbx.db` |
-在 DBX 桌面端打开指定表。**需要 DBX 正在运行。**
+`DBX_DATA_DIR` 必须指向包含 `dbx.db` 的目录,而不是数据库文件本身。Windows 便携版通常是 `DBX.exe` 同级的 `data` 目录。
-| 参数 | 必填 | 说明 |
-| ----------------- | ---- | ------------ |
-| `connection_name` | 是 | DBX 连接名称 |
-| `table` | 是 | 表名 |
-| `database` | 否 | 数据库名 |
-| `schema` | 否 | Schema 名称 |
-
-DBX 会自动新开一个 tab 显示数据,窗口自动置前。
-
-### `dbx_execute_and_show`
-
-在 DBX 桌面端执行 SQL 并展示结果。**需要 DBX 正在运行。**
-
-| 参数 | 必填 | 说明 |
-| ----------------- | ---- | ------------ |
-| `connection_name` | 是 | DBX 连接名称 |
-| `sql` | 是 | SQL 查询语句 |
-| `database` | 否 | 数据库名 |
-
-## 工作原理
-
-### 连接配置
-
-MCP Server 从 DBX 的 SQLite 数据库读取连接信息:
-
-| 平台 | 路径 |
-| ------- | -------------------------------------------------- |
-| macOS | `~/Library/Application Support/com.dbx.app/dbx.db` |
-| Linux | `~/.local/share/com.dbx.app/dbx.db` |
-| Windows | `%APPDATA%\com.dbx.app\dbx.db` |
-
-Windows 便携版的数据通常在 `DBX.exe` 同级的 `data\dbx.db`。如果 MCP 列出的连接不是当前 DBX 中的最新连接,请在 MCP 配置中设置 `DBX_DATA_DIR`,值为包含 `dbx.db` 的 `data` 文件夹,例如 `D:\DBX_x64-portable\data`。不要手工复制 `dbx.db` 到默认目录,否则两个连接库会分叉。
-
-### UI 联动
-
-`dbx_open_table` 和 `dbx_execute_and_show` 通过本地 HTTP 接口与运行中的 DBX 应用通信:
-
-```
-AI 助手 → MCP Server → HTTP localhost → DBX 后端 → Tauri 事件 → 前端打开 tab
-```
+PostgreSQL、MySQL、SQLite、兼容 SQL 数据库、独立 Redis 和 MongoDB 可以直接查询。部分 SSH、集群、厂商专用以及 Agent/JDBC 连接需要先安装对应的 DBX 组件。
-### 支持的数据库
+### Agent/JDBC 数据库
-桌面本地模式下,MCP 查询支持 PostgreSQL、MySQL 及兼容数据库。Web 模式会通过 `DBX_WEB_URL` 转发到 DBX Web 后端。打开表等 UI 联动能力支持当前 DBX 桌面端可以打开的所有数据库类型。
+达梦、人大金仓、Oracle、DB2、Hive、Trino、Snowflake、SAP HANA 等 Agent/JDBC 数据库,需要匹配的 DBX Agent、JDBC 驱动和 JRE。请先在 DBX 中安装,再使用 MCP。
-### SQL 安全
+### DBX Web / Docker 模式
-MCP 查询执行默认非常保守:
+设置 `DBX_WEB_URL` 后,MCP 会使用部署的 DBX Web 后端,而不是读取本机连接。如果 Web 登录启用了密码保护,还要设置 `DBX_WEB_PASSWORD`,值为 Web 登录页使用的密码。
-| 规则 | 默认行为 |
-| ---------------------------------------------- | ---------------------------------- |
-| 空 SQL 或无法识别的 SQL | 阻止 |
-| 多条 SQL 语句 | 允许;会逐条进行安全检查并依次执行 |
-| 非只读 SQL | 阻止,除非显式允许写入 |
-| `DROP`、`TRUNCATE`、`ALTER` | 阻止,除非显式允许危险 SQL |
-| 允许写入时没有 `WHERE` 的 `UPDATE` 或 `DELETE` | 阻止 |
+### 桌面 UI 工具
-设置 `DBX_MCP_ALLOW_WRITES=1` 可以允许写入语句。只有在受控环境并且确实需要破坏性 SQL 时,才设置 `DBX_MCP_ALLOW_DANGEROUS_SQL=1`。
+`dbx_open_table` 和 `dbx_execute_and_show` 要求 DBX 桌面端正在运行。其他查询工具可以在 DBX 关闭时使用。
-### 桌面模式与 Web 模式
+## 安全和环境变量
-| 模式 | 如何选择 | 说明 |
-| ------------ | ------------------ | -------------------------------------------------------- |
-| 桌面本地模式 | 默认 | 读取 DBX 桌面端连接存储,并可调用桌面专属 UI bridge 工具 |
-| Web 模式 | 设置 `DBX_WEB_URL` | 不读取本机桌面存储,而是把请求发给 DBX Web 后端 |
+普通写入默认允许。设置 `DBX_MCP_ALLOW_WRITES=0` 可强制只读。`DROP`、`TRUNCATE`、`ALTER`、Redis 破坏性命令以及危险 MongoDB 修改默认仍会阻止,除非设置 `DBX_MCP_ALLOW_DANGEROUS_SQL=1`。
-对于启用了密码保护的 DBX Web 或 Docker 部署,还需要在 MCP Server 环境变量中设置 `DBX_WEB_PASSWORD`。这里填写的就是 DBX Web 登录页使用的密码,也包括首次打开 Web 页面时通过 setup 设置的密码。为了让 MCP 可用,不需要在启动 DBX Web 时额外设置 `DBX_PASSWORD`;`DBX_PASSWORD` 只是服务端环境变量覆盖。当 Web 后端要求认证但没有提供密码时,MCP 调用会在返回任何连接数据前失败。桌面本地模式不使用 `DBX_WEB_PASSWORD`。
+| 变量 | 用途 |
+| --- | --- |
+| `DBX_DATA_DIR` | 覆盖本地 DBX 数据目录 |
+| `DBX_WEB_URL` | 使用 DBX Web/Docker 后端 |
+| `DBX_WEB_PASSWORD` | 登录 DBX Web |
+| `DBX_MCP_ALLOW_WRITES` | 设置为 `0` 强制只读 |
+| `DBX_MCP_ALLOW_DANGEROUS_SQL` | 允许危险 SQL、Redis 和 MongoDB 操作 |
+| `DBX_MCP_SCOPE_CONNECTION_ID` | 限制为一个连接 ID |
+| `DBX_MCP_SCOPE_CONNECTION_NAME` | 限制为一个连接名称 |
+| `DBX_MCP_SCOPE_DATABASE` | 限制为一个数据库 |
+| `DBX_MCP_DEBUG_SQL` | 临时诊断时输出 SQL |
## 常见问题
<Accordions>
- <Accordion title="MCP Server 连不上数据库">检查 DBX 中该连接是否能正常连接。MCP Server 使用相同的连接配置和密码。确认数据库服务正在运行,网络可达。</Accordion>
- <Accordion title="dbx_open_table 报 'DBX is not running'">需要先启动 DBX 桌面应用。UI 联动功能依赖 DBX 运行时的本地 HTTP 服务(端口 4224)。</Accordion>
- <Accordion title="连接名称找不到">连接名称匹配不区分大小写,但需要和 DBX 中配置的名称一致。用 `dbx_list_connections` 查看所有可用名称。</Accordion>
- <Accordion title="查询超时">MCP Server 的查询超时为 30 秒。如果查询较慢,考虑添加索引或简化查询。也可以让 AI 助手先用 `dbx_describe_table` 了解表结构,再生成优化后的查询。</Accordion>
- <Accordion title="Docker 环境下如何使用 MCP?">把 `DBX_WEB_URL` 设置为 DBX Web 地址。如果 Web 页面需要密码,也要把 `DBX_WEB_PASSWORD` 设置为同一个 Web 登录密码;否则 MCP 会拒绝访问受保护的 Web API。</Accordion>
+ <Accordion title="npm 没有安装当前平台包">不要使用 `--no-optional`,重新安装 `@dbx-app/mcp-server`,并用 `node -p 'process.platform + "-" + process.arch'` 检查平台。Alpine Linux 默认使用 musl,目前不在 Linux 发布包支持范围内。</Accordion>
+ <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="出现 better-sqlite3 或 Node ABI 错误">MCP 不需要 `better-sqlite3`。请先升级 `@dbx-app/mcp-server`;如果错误来自 `@dbx-app/cli`,请按照 CLI 的安装要求处理,因为它们是两个独立的包。</Accordion>
</Accordions>
## 系统要求
-- [DBX](https://github.com/t8y2/dbx) 已安装并配置了至少一个数据库连接
-- Node.js 18+
-- UI 联动功能需要 DBX v0.3.9+
+- Node.js 18.18.0 或更高版本
+- 已安装 DBX,并至少配置一个数据库连接
+- Agent/JDBC 数据库需要匹配的 Agent、驱动和 JRE
+- 使用两个桌面 UI 工具时,需要保持 DBX 桌面端运行
diff --git a/docs/content/docs/mcp.mdx b/docs/content/docs/mcp.mdx
index c213cb531c..fda28b44fa 100644
--- a/docs/content/docs/mcp.mdx
+++ b/docs/content/docs/mcp.mdx
@@ -3,18 +3,15 @@ title: MCP Integration
description: Let AI coding agents query your databases through the Model Context Protocol.
---
-<Callout type="info">One line of config to let AI coding agents query your databases directly. Works with Claude Code, Cursor, Windsurf, and VS Code Copilot.</Callout>
+<Callout type="info">Connect your AI assistant to DBX and let it inspect schemas, query data, and open results in DBX.</Callout>
## What is MCP?
-MCP (Model Context Protocol) is an open protocol that lets AI coding agents call external tools. DBX's MCP Server exposes your database connections to AI agents, so you can query databases using natural language — the AI generates and executes SQL automatically.
+MCP (Model Context Protocol) lets AI clients call external tools. DBX MCP gives your AI assistant access to the database connections configured in DBX.
-```
-You: "Show me the order volume trend for the last 7 days"
-
-AI Agent → MCP Server → Your Database → Results
- ↓
- DBX connection configs (with passwords)
+```text
+AI agent → DBX MCP → your database → results
+ ↘ DBX desktop app (open or display results)
```
## Quick Start
@@ -27,11 +24,12 @@ AI Agent → MCP Server → Your Database → Results
npm install -g @dbx-app/mcp-server
```
+ npm automatically installs the package for your current platform. Do not use `--no-optional`.
</Step>
<Step>
### Configure Your AI Agent
- Create `.mcp.json` in your working directory:
+ Create `.mcp.json` in your project directory:
```json
{
@@ -44,232 +42,108 @@ AI Agent → MCP Server → Your Database → Results
}
```
- Windows portable builds need `DBX_DATA_DIR` set to the `data` directory next to `DBX.exe`:
-
- ```json
- {
- "mcpServers": {
- "dbx": {
- "command": "npx",
- "args": ["-y", "@dbx-app/mcp-server"],
- "env": {
- "DBX_DATA_DIR": "D:\\DBX_x64-portable\\data"
- }
- }
- }
- }
- ```
-
+ If you installed the package globally, you can use `"command": "dbx-mcp-server"`. For Windows portable DBX, set `DBX_DATA_DIR` to the `data` directory next to `DBX.exe`.
</Step>
<Step>
### Start Using
- Just ask your AI agent in natural language:
+ Ask your AI assistant in natural language:
- "List my database connections"
- - "Show the tables in my local-pg connection"
+ - "Show the tables on local-pg"
- "Describe the users table"
- - "Query the average salary from employees"
- - "Open the orders table" (requires DBX running)
-
+ - "Count the orders from the last 7 days"
+ - "Open the orders table" (requires DBX to be running)
</Step>
</Steps>
## Supported AI Agents
-| Agent | Configuration |
-| ----------------- | ---------------------------- |
-| Claude Code | `.mcp.json` (native support) |
-| Cursor | `.cursor/mcp.json` |
-| Windsurf | `.windsurfrules` |
-| VS Code + Copilot | MCP extension |
+| Agent | Configuration |
+| --- | --- |
+| Claude Code | `.mcp.json` |
+| Cursor | `.cursor/mcp.json` |
+| Windsurf | MCP configuration |
+| VS Code + Copilot | MCP extension/configuration |
## Tools
-DBX MCP Server provides the following tools. Your AI agent calls them automatically based on your requests:
-
-### `dbx_list_connections`
-
-List all database connections configured in DBX.
-
-**Example:**
-
-> "List my database connections"
-
-**Response:**
-
-```
-| Name | Type | Host | Port | Database |
-| -------- | -------- | --------- | ---- | -------- |
-| local-pg | postgres | 127.0.0.1 | 5432 | |
-| prod-db | mysql | db.example| 3306 | myapp |
-```
-
-### `dbx_list_tables`
-
-List tables and views for a connection.
-
-| Parameter | Required | Description |
-| ----------------- | -------- | ----------------------------- |
-| `connection_name` | Yes | DBX connection name |
-| `schema` | No | Schema name (default: public) |
-
-### `dbx_describe_table`
-
-Get column definitions for a table. The AI uses this to understand your data structure before generating queries.
-
-| Parameter | Required | Description |
-| ----------------- | -------- | ----------------------------- |
-| `connection_name` | Yes | DBX connection name |
-| `table` | Yes | Table name |
-| `schema` | No | Schema name (default: public) |
+DBX MCP currently provides 10 tools:
-**Response:**
+| Tool | Description |
+| --- | --- |
+| `dbx_list_connections` | List connections visible to the MCP session |
+| `dbx_add_connection` | Add a connection to local DBX storage |
+| `dbx_remove_connection` | Remove a connection from local DBX storage |
+| `dbx_list_tables` | List tables, views, or collections |
+| `dbx_describe_table` | Return columns and table metadata |
+| `dbx_get_schema_context` | Return compact schema context for an AI model |
+| `dbx_execute_query` | Execute SQL or a supported MongoDB shell command, returning at most 100 rows |
+| `dbx_execute_redis_command` | Execute a Redis command |
+| `dbx_open_table` | Open a table in the running DBX desktop app |
+| `dbx_execute_and_show` | Execute a query and display the result in DBX |
-```
-| Column | Type | Nullable | Default | Comment |
-| ----------- | --------- | -------- | ------- | ---------- |
-| id (PK) | integer | NO | | |
-| user_id | integer | NO | | User ID |
-| total | numeric | NO | 0 | Order total|
-| created_at | timestamp | NO | now() | |
-```
-
-### `dbx_execute_query`
-
-Execute a SQL query and return results (max 100 rows).
-
-| Parameter | Required | Description |
-| ----------------- | -------- | ------------------- |
-| `connection_name` | Yes | DBX connection name |
-| `sql` | Yes | SQL query |
-
-### `dbx_get_schema_context`
-
-Return compact table and column context for SQL generation.
-
-| Parameter | Required | Description |
-| ----------------- | -------- | ------------------------------------------------------------ |
-| `connection_name` | Yes | DBX connection name |
-| `schema` | No | Schema name |
-| `tables` | No | Specific table names to include |
-| `max_tables` | No | Maximum number of tables to include; capped between 1 and 20 |
-
-### `dbx_add_connection`
-
-Add a new database connection to DBX.
-
-| Parameter | Required | Description |
-| ---------- | -------- | ---------------------------------------------------- |
-| `name` | Yes | Connection name |
-| `db_type` | Yes | Database type (postgres, mysql, sqlite, redis, etc.) |
-| `host` | Yes | Database host |
-| `port` | Yes | Database port |
-| `username` | No | Username |
-| `password` | No | Password |
-| `database` | No | Default database name |
-| `ssl` | No | Enable SSL (default: false) |
-
-**Example:**
-
-> "Add a PostgreSQL connection named prod-db on db.example.com:5432"
-
-### `dbx_remove_connection`
+Connection-scoped sessions hide connection-mutating and desktop UI tools.
-Remove a database connection from DBX.
+## Database Access
-| Parameter | Required | Description |
-| ----------------- | -------- | -------------------------------- |
-| `connection_name` | Yes | Name of the connection to remove |
+### Local connections
-**Example:**
+MCP uses the connections saved in DBX. DBX does not need to remain open for database queries.
-> "Remove the test-db connection"
+Common local paths include:
-### `dbx_open_table`
+| Platform | Default database file |
+| --- | --- |
+| macOS | `~/Library/Application Support/com.dbx.app/dbx.db` |
+| Linux | `~/.local/share/com.dbx.app/dbx.db` |
+| Windows | `%APPDATA%\com.dbx.app\dbx.db` |
-Open a table in DBX desktop app UI. **Requires DBX to be running.**
+Set `DBX_DATA_DIR` to the directory containing `dbx.db`. Do not set it to the file itself.
-| Parameter | Required | Description |
-| ----------------- | -------- | ------------------- |
-| `connection_name` | Yes | DBX connection name |
-| `table` | Yes | Table name |
-| `database` | No | Database name |
-| `schema` | No | Schema name |
-
-DBX opens a new tab with the table data and brings the window to front.
-
-### `dbx_execute_and_show`
-
-Execute a SQL query in DBX desktop app UI. **Requires DBX to be running.**
-
-| Parameter | Required | Description |
-| ----------------- | -------- | ------------------- |
-| `connection_name` | Yes | DBX connection name |
-| `sql` | Yes | SQL query |
-| `database` | No | Database name |
-
-## How It Works
-
-### Connection Configs
-
-The MCP Server reads DBX's SQLite database:
-
-| Platform | Path |
-| -------- | -------------------------------------------------- |
-| macOS | `~/Library/Application Support/com.dbx.app/dbx.db` |
-| Linux | `~/.local/share/com.dbx.app/dbx.db` |
-| Windows | `%APPDATA%\com.dbx.app\dbx.db` |
-
-Windows portable builds usually store data in `data\dbx.db` next to `DBX.exe`. If MCP lists older connections than the running DBX app, set `DBX_DATA_DIR` in the MCP config to the `data` folder that contains `dbx.db`, for example `D:\DBX_x64-portable\data`. Do not copy `dbx.db` into the default directory, because that creates two diverging connection stores.
-
-### UI Integration
-
-`dbx_open_table` and `dbx_execute_and_show` communicate with the running DBX app via a local HTTP interface:
-
-```
-AI Agent → MCP Server → HTTP localhost → DBX backend → Tauri event → Frontend opens tab
-```
+PostgreSQL, 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.
-### Supported Databases
+### Agent/JDBC databases
-MCP query support in desktop local mode is implemented for PostgreSQL, MySQL, and compatible databases. Web mode delegates to the DBX web backend configured by `DBX_WEB_URL`. UI integration such as opening a table supports all database types that the running DBX desktop app can open.
+Dameng, Kingbase, Oracle, DB2, Hive, Trino, Snowflake, SAP HANA, and other Agent/JDBC connections require the matching DBX Agent, JDBC driver, and JRE. Install them in DBX before using MCP.
-### SQL Safety
+### DBX Web and Docker mode
-MCP query execution is intentionally conservative:
+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.
-| Rule | Default |
-| ------------------------------------------------------------ | ---------------------------------------------------------- |
-| Empty or unrecognized SQL | Blocked |
-| Multiple SQL statements | Allowed; each statement is checked and executed separately |
-| Non-read SQL | Blocked unless writes are explicitly allowed |
-| `DROP`, `TRUNCATE`, or `ALTER` | Blocked unless dangerous SQL is explicitly allowed |
-| `UPDATE` or `DELETE` without `WHERE` when writes are allowed | Blocked |
+### Desktop UI tools
-Set `DBX_MCP_ALLOW_WRITES=1` to allow write statements. Set `DBX_MCP_ALLOW_DANGEROUS_SQL=1` only in controlled environments where destructive SQL is expected.
+`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.
-### Desktop And Web Mode
+## Safety and Environment Variables
-| Mode | How It Is Selected | Notes |
-| ------------------ | ------------------ | ------------------------------------------------------------------------------ |
-| Desktop local mode | Default | Reads DBX desktop connection storage and can call desktop-only UI bridge tools |
-| Web mode | Set `DBX_WEB_URL` | Sends requests to the DBX web backend instead of reading local desktop storage |
+Writes are enabled by default. Use `DBX_MCP_ALLOW_WRITES=0` for read-only operation. Dangerous SQL such as `DROP`, `TRUNCATE`, and `ALTER`, Redis destructive commands, and dangerous MongoDB mutations remain blocked unless `DBX_MCP_ALLOW_DANGEROUS_SQL=1` is set.
-For DBX Web or Docker deployments that have password protection enabled, also set `DBX_WEB_PASSWORD` in the MCP server environment. This is the same password used on the DBX Web login page, including the password created by the first-run setup screen. You do not need to set `DBX_PASSWORD` on the DBX Web server just for MCP; `DBX_PASSWORD` is only a server-side environment override. MCP calls fail before returning connection data when the Web backend requires authentication and no password is provided. Desktop local mode does not use `DBX_WEB_PASSWORD`.
+| Variable | Purpose |
+| --- | --- |
+| `DBX_DATA_DIR` | Override the local DBX data directory |
+| `DBX_WEB_URL` | Use a DBX Web/Docker backend |
+| `DBX_WEB_PASSWORD` | Authenticate to DBX Web |
+| `DBX_MCP_ALLOW_WRITES` | Set to `0` to force read-only execution |
+| `DBX_MCP_ALLOW_DANGEROUS_SQL` | Allow dangerous SQL, Redis, and MongoDB operations |
+| `DBX_MCP_SCOPE_CONNECTION_ID` | Restrict the session to one connection ID |
+| `DBX_MCP_SCOPE_CONNECTION_NAME` | Restrict the session to one connection name |
+| `DBX_MCP_SCOPE_DATABASE` | Restrict the session to one database |
+| `DBX_MCP_DEBUG_SQL` | Include SQL in temporary diagnostics |
-## FAQ
+## Troubleshooting
<Accordions>
- <Accordion title="MCP Server can't connect to my database">Check that the connection works in DBX first. The MCP Server uses the same config and credentials. Make sure the database is running and network-reachable.</Accordion>
- <Accordion title="dbx_open_table says 'DBX is not running'">Start the DBX desktop app first. UI integration requires DBX's local HTTP service (port 4224).</Accordion>
- <Accordion title="Connection name not found">Connection name matching is case-insensitive but must match the name configured in DBX. Use `dbx_list_connections` to see all available names.</Accordion>
- <Accordion title="Query timeout">MCP Server has a 30-second query timeout. Consider adding indexes or simplifying your query. You can also ask the AI to use `dbx_describe_table` first to understand the schema, then generate an optimized query.</Accordion>
- <Accordion title="How to use MCP with Docker?">Set `DBX_WEB_URL` to your DBX Web URL. If the Web UI requires a password, set `DBX_WEB_PASSWORD` to the same password used on the Web login page; otherwise MCP will refuse protected Web API access.</Accordion>
+ <Accordion title="The optional platform package was not installed">Reinstall without `--no-optional`, then verify the platform with `node -p 'process.platform + "-" + process.arch'`. The current platform must appear in the supported platform table.</Accordion>
+ <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="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>
## Requirements
-- [DBX](https://github.com/t8y2/dbx) installed with at least one connection configured
-- Node.js 18+
-- UI integration requires DBX v0.3.9+
+- Node.js 18.18.0 or newer
+- DBX installed with at least one connection configured
+- Matching DBX Agent, JDBC driver, and JRE for Agent/JDBC connections
+- DBX desktop app running when using the two UI tools
diff --git a/packages/mcp-server/README.md b/packages/mcp-server/README.md
index 98fa23bde4..6d2fe07ec1 100644
--- a/packages/mcp-server/README.md
+++ b/packages/mcp-server/README.md
@@ -1,65 +1,204 @@
# DBX MCP Server
-MCP server for [DBX](https://github.com/t8y2/dbx) — lets AI agents (Claude Code, Cursor, etc.) query your databases using connections already configured in DBX.
+Rust-powered Model Context Protocol server for [DBX](https://github.com/t8y2/dbx). It lets MCP-compatible AI agents inspect schemas and run safe database operations using connections configured in DBX.
-[中文](#中文说明) | English
+[中文说明](#中文说明) | [npm](https://www.npmjs.com/package/@dbx-app/mcp-server) | [Native releases](https://github.com/t8y2/dbx/releases?q=packages-v)
+
+## Architecture
+
+```text
+@dbx-app/mcp-server
+└── small Node.js launcher
+ └── platform-specific Rust dbx-mcp binary
+ └── dbx-core database and agent infrastructure
+```
+
+The MCP protocol, connection loading, SQL safety, schema access, Redis support, MongoDB shell parsing, Web backend access, and database execution are implemented in Rust. Node.js is used only by the npm launcher so existing `npm`, `npx`, and MCP client configurations continue to work.
## Features
-- **Zero config** — Automatically reads your DBX connections (including passwords from system keyring)
-- **10 tools** — List/add/remove connections, list tables, describe table, get schema context, execute SQL, execute Redis commands, open tables, and execute-and-show results
-- **Connection pooling** — Reuses database connections across queries
-- **Direct execution** — PostgreSQL, MySQL, SQLite, and compatible databases (Doris, StarRocks, etc.) can run without opening DBX
-- **Writes enabled by default** — regular `INSERT` / `UPDATE` / `DELETE` statements work out of the box, while dangerous SQL stays blocked unless explicitly enabled
-- **DBX UI integration** — Open tables directly in the DBX desktop app from your AI agent
+- **10 MCP tools** for connections, schemas, SQL, Redis, and DBX UI integration
+- **Precompiled native binaries** with no local Rust, Cargo, Python, or C/C++ build requirement
+- **No `better-sqlite3` runtime dependency** and no Node native-addon ABI coupling
+- **Local, Web, and Docker modes** using the same tool interface
+- **Direct native execution** for supported SQL, Redis, and MongoDB connections
+- **Agent/JDBC database support** through DBX agent infrastructure when the required agent and JRE are installed
+- **SQL safety controls** for writes, destructive SQL, Redis commands, and MongoDB mutations
+- **Connection scoping** for limiting an MCP server to one connection or database
+- **Offline execution** through downloadable native binaries
+- **Optional desktop integration** for opening tables and displaying query results in DBX
-## Quick Start
+## Installation
-### 1. Install
+### npm global install
```bash
npm install -g @dbx-app/mcp-server
```
-Or run directly:
+Then configure the MCP client to run:
-```bash
-npx @dbx-app/mcp-server
+```json
+{
+ "mcpServers": {
+ "dbx": {
+ "command": "dbx-mcp-server"
+ }
+ }
+}
```
-The npm package installs a small Node.js launcher plus a precompiled Rust binary for the current platform. It does not install `better-sqlite3`, compile native modules, or require Rust/Cargo locally. Do not use `--no-optional`, because the platform binary is delivered through npm optional dependencies.
+### npx
+
+No global installation is required:
+
+```json
+{
+ "mcpServers": {
+ "dbx": {
+ "command": "npx",
+ "args": ["-y", "@dbx-app/mcp-server"]
+ }
+ }
+}
+```
+
+The npm package automatically installs the native package matching the current operating system and CPU. Do not install with `--no-optional`, because npm optional dependencies carry the platform binary.
+
+### Native binary / offline install
-### Offline / native binary
+Every package release publishes native archives and `SHA256SUMS` in [GitHub Releases](https://github.com/t8y2/dbx/releases?q=packages-v):
-For an offline machine, download the `dbx-mcp` binary matching the operating system and CPU from the DBX release assets, then configure the MCP client to run that file directly:
+| Platform | Release asset | npm platform package |
+| --- | --- | --- |
+| macOS Apple Silicon | `dbx-mcp-darwin-arm64.tar.gz` | `@dbx-app/mcp-darwin-arm64` |
+| macOS Intel | `dbx-mcp-darwin-x64.tar.gz` | `@dbx-app/mcp-darwin-x64` |
+| Linux glibc ARM64 | `dbx-mcp-linux-arm64-gnu.tar.gz` | `@dbx-app/mcp-linux-arm64-gnu` |
+| Linux glibc x64 | `dbx-mcp-linux-x64-gnu.tar.gz` | `@dbx-app/mcp-linux-x64-gnu` |
+| Windows ARM64 | `dbx-mcp-win32-arm64.zip` | `@dbx-app/mcp-win32-arm64` |
+| Windows x64 | `dbx-mcp-win32-x64.zip` | `@dbx-app/mcp-win32-x64` |
+
+Verify a Unix archive before extracting it:
+
+```bash
+sha256sum --check SHA256SUMS
+tar -xzf dbx-mcp-linux-x64-gnu.tar.gz
+chmod +x dbx-mcp
+```
+
+On macOS, use `shasum -a 256` if `sha256sum` is unavailable. On Windows, use `certutil -hashfile <archive> SHA256` and compare the value with `SHA256SUMS`.
+
+Configure the MCP client to run the extracted file directly:
```json
{
"mcpServers": {
"dbx": {
- "command": "/path/to/dbx-mcp"
+ "command": "/absolute/path/to/dbx-mcp"
}
}
}
```
-The native binary works without Node.js and without opening the DBX desktop app for supported direct database connections. Set `DBX_DATA_DIR` when the DBX database is stored outside the default location. `dbx_open_table` and other desktop bridge features still require a running DBX app.
+Direct native execution does not require Node.js. GitHub package releases are intentionally not marked as the repository's latest release, so they do not replace the latest DBX desktop release.
+
+## Requirements
+
+### npm installation
+
+- Node.js 18.18.0 or newer
+- A supported operating system and CPU from the platform table
+- npm optional dependencies enabled
+
+### Native installation
+
+- No Node.js or npm requirement
+- Linux builds currently require glibc; Alpine/musl is not supported yet
+
+### Database configuration
+
+DBX MCP reads connection profiles from DBX storage. DBX does not need to remain open for native connections. However:
+
+- the connection must already exist in DBX storage, unless it is added through `dbx_add_connection`;
+- DBX Agent/JDBC databases require the matching agent, JDBC driver, and JRE to be installed;
+- `dbx_open_table` and `dbx_execute_and_show` require a running DBX desktop application;
+- DBX Web mode requires a reachable DBX Web server.
+
+## Usage Examples
+
+Ask the MCP client to:
+
+- "List my DBX connections"
+- "Show tables in the production PostgreSQL connection"
+- "Describe the `orders` table"
+- "Build schema context for the billing database"
+- "Count orders created in the last seven days"
+- "Run `INFO memory` on the Redis connection"
+- "Find the latest MongoDB documents in the events collection"
+- "Open the orders table in DBX"
+
+## Tools
+
+| Tool | Description |
+| --- | --- |
+| `dbx_list_connections` | List connections visible to the MCP session |
+| `dbx_add_connection` | Add a connection to local DBX storage |
+| `dbx_remove_connection` | Remove a connection from local DBX storage |
+| `dbx_list_tables` | List tables, views, or collections |
+| `dbx_describe_table` | Return columns and table metadata |
+| `dbx_get_schema_context` | Return compact schema context suitable for an AI model |
+| `dbx_execute_query` | Execute SQL or a supported MongoDB shell command, returning at most 100 rows |
+| `dbx_execute_redis_command` | Execute a Redis command |
+| `dbx_open_table` | Open a table in the running DBX desktop application |
+| `dbx_execute_and_show` | Execute a query and display the result in the DBX desktop application |
+
+When connection scoping is enabled, mutating connection tools and desktop UI tools are hidden.
+
+## Execution Modes
+
+### Local native mode
-### 2. Configure Claude Code
+This is the default. MCP reads DBX connection storage and executes supported connections locally in the Rust process.
-Add to your project's `.mcp.json`:
+Common 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.
+
+DBX connection storage defaults to:
+
+- macOS: `~/Library/Application Support/com.dbx.app/dbx.db`
+- Linux: `~/.local/share/com.dbx.app/dbx.db`
+- Windows: `%APPDATA%\com.dbx.app\dbx.db`
+
+Override the directory with `DBX_DATA_DIR`.
+
+### Agent/JDBC databases
+
+Databases such as Dameng, Kingbase, Oracle, DB2, Hive, Trino, Snowflake, SAP HANA, and other DBX Agent profiles use DBX's Java agent infrastructure rather than a Node.js database driver.
+
+The native npm/GitHub binary does not bundle every proprietary JDBC driver or JRE. Install the database agent through DBX first, or provide a compatible agent installation under the DBX agent directory. Availability depends on the installed driver and license terms of the database vendor.
+
+### DBX Web / Docker mode
+
+Set `DBX_WEB_URL` to use a deployed DBX Web backend instead of local desktop storage:
```json
{
"mcpServers": {
"dbx": {
- "command": "dbx-mcp-server"
+ "command": "dbx-mcp-server",
+ "env": {
+ "DBX_WEB_URL": "https://dbx.example.com",
+ "DBX_WEB_PASSWORD": "your-web-login-password"
+ }
}
}
}
```
-For Windows portable builds, set `DBX_DATA_DIR` to the portable data directory that contains `dbx.db`:
+`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.
+
+### Windows portable DBX
+
+Point `DBX_DATA_DIR` at the portable `data` directory containing `dbx.db`:
```json
{
@@ -74,125 +213,135 @@ For Windows portable builds, set `DBX_DATA_DIR` to the portable data directory t
}
```
-Or for development (from source):
+## Connection Scoping
+
+Restrict one MCP server to a connection or database:
```json
{
"mcpServers": {
- "dbx": {
- "command": "npx",
- "args": ["tsx", "packages/mcp-server/src/index.ts"],
- "cwd": "/path/to/dbx"
+ "dbx-production-readonly": {
+ "command": "dbx-mcp-server",
+ "env": {
+ "DBX_MCP_SCOPE_CONNECTION_NAME": "production-postgres",
+ "DBX_MCP_SCOPE_DATABASE": "analytics",
+ "DBX_MCP_ALLOW_WRITES": "0"
+ }
}
}
}
```
-### 3. Use
+Use either `DBX_MCP_SCOPE_CONNECTION_ID` or `DBX_MCP_SCOPE_CONNECTION_NAME`. The scoped database is optional.
-In Claude Code, just ask:
+## Safety
-- "List my database connections"
-- "Show the tables in my local-pg connection"
-- "Describe the users table"
-- "Query the average salary from employees"
-- "Open the orders table in DBX"
+Regular writes are enabled by default. Force a read-only session with:
-## CLI
+```bash
+DBX_MCP_ALLOW_WRITES=0
+```
-For terminal, script, and Codex workflows, install the dedicated CLI package:
+Dangerous operations such as `DROP`, `TRUNCATE`, `ALTER`, Redis `FLUSHALL`, or dangerous MongoDB mutations remain blocked unless explicitly enabled:
```bash
-npm install -g @dbx-app/cli
-dbx connections list --json
-dbx query local "select 1" --json
+DBX_MCP_ALLOW_DANGEROUS_SQL=1
```
-See the [DBX CLI README](../cli/README.md) for command details.
+MongoDB update/delete operations require a non-empty filter unless dangerous operations are enabled. Aggregation stages such as `$out` and `$merge` are treated as writes.
-## Tools
+SQL text is not included in normal MCP errors or logged by default. Enable temporary diagnostics with `DBX_MCP_DEBUG_SQL=1` and disable it after troubleshooting.
-| Tool | Description |
-| --------------------------- | ---------------------------------------------------- |
-| `dbx_list_connections` | List all database connections configured in DBX |
-| `dbx_add_connection` | Add a new database connection |
-| `dbx_remove_connection` | Remove a database connection |
-| `dbx_list_tables` | List tables and views for a connection |
-| `dbx_describe_table` | Get column definitions for a table |
-| `dbx_get_schema_context` | Get compact table and column context for writing SQL |
-| `dbx_execute_query` | Execute a SQL query (max 100 rows) |
-| `dbx_execute_redis_command` | Execute a Redis command on a Redis connection |
-| `dbx_open_table` | Open a table in DBX desktop app UI |
+## Environment Variables
-## SQL Safety
+| Variable | Purpose |
+| --- | --- |
+| `DBX_DATA_DIR` | Override the local DBX data directory |
+| `DBX_WEB_URL` | Use a DBX Web/Docker backend |
+| `DBX_WEB_PASSWORD` | Authenticate to the DBX Web backend |
+| `DBX_MCP_ALLOW_WRITES` | Set to `0` to force read-only execution |
+| `DBX_MCP_ALLOW_DANGEROUS_SQL` | Set to `1` to allow dangerous SQL, Redis, and MongoDB operations |
+| `DBX_MCP_SCOPE_CONNECTION_ID` | Restrict tools to one connection ID |
+| `DBX_MCP_SCOPE_CONNECTION_NAME` | Restrict tools to one connection name |
+| `DBX_MCP_SCOPE_DATABASE` | Restrict tools to one database |
+| `DBX_MCP_DEBUG_SQL` | Include SQL in temporary diagnostics |
+| `DBX_MCP_BINARY` | Override the native binary used by the npm launcher |
-`dbx_execute_query` accepts multiple SQL statements and executes them one at a time after checking each statement. Regular write statements such as `INSERT`, `UPDATE`, and `DELETE ... WHERE ...` are allowed by default.
+## Troubleshooting
-If you need to force a read-only MCP session, set:
+### Optional platform package was not installed
+
+Reinstall without `--no-optional`:
```bash
-DBX_MCP_ALLOW_WRITES=0
+npm uninstall -g @dbx-app/mcp-server
+npm install -g @dbx-app/mcp-server@latest
```
-Dangerous statements such as `DROP`, `TRUNCATE`, and `ALTER` remain blocked unless you also set:
+Verify the current Node platform:
```bash
-DBX_MCP_ALLOW_DANGEROUS_SQL=1
+node -p 'process.platform + "-" + process.arch'
```
-Redis connections use `dbx_execute_redis_command` instead of `dbx_execute_query`. Redis write commands honor `DBX_MCP_ALLOW_WRITES`; dangerous Redis commands such as `KEYS`, `FLUSHALL`, and `EVAL` require `DBX_MCP_ALLOW_DANGEROUS_SQL=1`.
+### Unsupported Linux distribution
-## SQL Diagnostics Privacy
+The published Linux packages target glibc. Alpine Linux uses musl by default and is not currently supported.
-SQL statements are not included in normal MCP errors and are not logged by default. To enable temporary diagnostics, set `DBX_MCP_DEBUG_SQL=1` (or `DBX_SQL_DEBUG=1`). Diagnostic statements redact quoted literals and common secret assignments, and are truncated to 512 characters. Do not enable this setting unless the resulting diagnostic metadata is appropriate for the environment.
+### `dbx.db` cannot be found
-## How It Works
+Set `DBX_DATA_DIR` to the directory containing `dbx.db`, not to the database file itself.
-```
-AI Agent → MCP Server → Database
- ↓
- DBX SQLite database (dbx.db)
-```
+### Desktop action says DBX is not running
-The MCP server reads your database connections from DBX's SQLite database:
+Database queries can run without the desktop application when the connection is supported locally. `dbx_open_table` and `dbx_execute_and_show` intentionally require DBX desktop to be running.
-- **macOS**: `~/Library/Application Support/com.dbx.app/dbx.db`
-- **Linux**: `~/.local/share/com.dbx.app/dbx.db`
-- **Windows**: `%APPDATA%\com.dbx.app\dbx.db`
+### Agent/JDBC database cannot start
-Windows portable builds store data next to `DBX.exe`, usually in `data\dbx.db`. Set `DBX_DATA_DIR` to that `data` folder instead of copying `dbx.db` into the default directory.
+Open DBX Driver Manager and install/update the matching database agent and JRE. The standalone MCP binary does not redistribute every proprietary JDBC driver.
-## DBX Web / Docker Mode
+### `better-sqlite3` or Node ABI error
-When connecting MCP to a deployed DBX Web instance, set `DBX_WEB_URL` instead of reading local desktop storage:
+The Rust MCP runtime does not depend on `better-sqlite3`. This error normally indicates an older MCP version or the separate TypeScript-based `@dbx-app/cli` package. Upgrade MCP with:
-```json
-{
- "mcpServers": {
- "dbx": {
- "command": "dbx-mcp-server",
- "env": {
- "DBX_WEB_URL": "https://dbx.example.com",
- "DBX_WEB_PASSWORD": "your-web-password"
- }
- }
- }
-}
+```bash
+npm install -g @dbx-app/mcp-server@latest
```
-If the Web instance has password protection enabled, `DBX_WEB_PASSWORD` is required. Use the same password you enter on the DBX Web login page, including the password created by the first-run setup screen. You do not need to set `DBX_PASSWORD` on the DBX Web server just for MCP; `DBX_PASSWORD` is only a server-side environment override. Without `DBX_WEB_PASSWORD`, MCP calls fail before any connection data is returned. Desktop local mode does not use `DBX_WEB_PASSWORD`.
+## Development
-## DBX UI Integration
+Run the Rust server from source:
-The `dbx_open_table` tool communicates with the running DBX app to open tables directly in the UI. This requires DBX to be running. If DBX is not running, the tool will return an error message.
+```bash
+cargo run -p dbx-mcp --no-default-features
+```
-PostgreSQL, MySQL, SQLite, Doris, StarRocks, and Redshift queries run directly from the MCP server. Redis standalone command execution also runs directly. Other database types, plus Redis Sentinel/Cluster or SSH-backed Redis connections, still use the DBX desktop bridge unless `DBX_WEB_URL` is configured.
+Run tests:
-## Requirements
+```bash
+cargo test -p dbx-mcp --no-default-features
+pnpm --filter @dbx-app/mcp-server test
+```
+
+Build a release binary:
+
+```bash
+cargo build --release -p dbx-mcp --no-default-features
+```
+
+The previous TypeScript MCP implementation remains in `packages/mcp-server/src` for migration tests and compatibility reference; it is not the npm runtime entrypoint.
+
+## DBX CLI
+
+`@dbx-app/cli` is a separate terminal-oriented package and currently remains TypeScript/Node.js based:
+
+```bash
+npm install -g @dbx-app/cli
+dbx connections list --json
+dbx query local "select 1" --json
+```
-- [DBX](https://github.com/t8y2/dbx) installed with at least one connection configured
-- Node.js 18.18.0 or newer (only used by the npm launcher)
-- Rust, Cargo, Python, and native build tools are not required
+See the [CLI README](../cli/README.md).
## License
@@ -202,34 +351,39 @@ Apache-2.0
## 中文说明
-[DBX](https://github.com/t8y2/dbx) 的 MCP Server,让 AI 编程助手(Claude Code、Cursor 等)直接使用 DBX 中已配置的数据库连接查询数据。
+DBX MCP Server 是 [DBX](https://github.com/t8y2/dbx) 的 Rust MCP 服务,让 Claude Code、Cursor、Windsurf 等兼容 MCP 的 AI 工具使用 DBX 中已有的连接查询数据库。
-### 特性
+[npm](https://www.npmjs.com/package/@dbx-app/mcp-server) | [原生版本下载](https://github.com/t8y2/dbx/releases?q=packages-v)
-- **零配置** — 自动读取 DBX 的连接配置
-- **9 个工具** — 列出/添加/删除连接、列出表、查看表结构、获取 Schema 上下文、执行 SQL、执行 Redis 命令、在 DBX 中打开表
-- **连接池** — 跨查询复用数据库连接
-- **直接执行** — PostgreSQL、MySQL、SQLite 及兼容数据库(Doris、StarRocks 等)无需打开 DBX 即可查询
-- **默认允许常规写入** — `INSERT` / `UPDATE` / `DELETE` 可直接执行,危险语句仍需显式开启
-- **DBX UI 联动** — 从 AI 助手直接在 DBX 桌面端打开表
+### 架构
-### 快速开始
+```text
+@dbx-app/mcp-server
+└── 轻量 Node.js 启动器
+ └── 当前平台的 Rust dbx-mcp 二进制
+ └── dbx-core 数据库和 Agent 基础设施
+```
-#### 1. 安装
+MCP 协议、连接读取、SQL 安全检查、Schema、Redis、MongoDB、Web 后端和数据库执行均由 Rust 实现。Node.js 只用于保持原有 npm/npx 安装入口不变。
-```bash
-npm install -g @dbx-app/mcp-server
-```
+### 主要能力
+
+- 10 个 MCP 工具
+- 不依赖 `better-sqlite3`,没有 Node 原生模块 ABI 问题
+- 支持本地 DBX、DBX Web 和 Docker
+- 支持预编译原生二进制和离线运行
+- 支持常见 SQL、Redis、MongoDB 直连
+- 支持达梦、金仓、Oracle、DB2、Hive 等 Agent/JDBC 数据库
+- 支持只读、危险操作、连接和数据库作用域限制
+- DBX 桌面端未启动时仍可执行支持本地运行的连接
-或直接运行:
+### npm 安装
```bash
-npx @dbx-app/mcp-server
+npm install -g @dbx-app/mcp-server
```
-#### 2. 配置 Claude Code
-
-在项目的 `.mcp.json` 中添加:
+MCP 配置:
```json
{
@@ -241,115 +395,202 @@ npx @dbx-app/mcp-server
}
```
-Windows 便携版需要在 MCP 配置中设置 `DBX_DATA_DIR`,指向包含 `dbx.db` 的便携版数据目录:
+也可以直接使用 npx:
```json
{
"mcpServers": {
"dbx": {
- "command": "dbx-mcp-server",
- "env": {
- "DBX_DATA_DIR": "D:\\DBX_x64-portable\\data"
- }
+ "command": "npx",
+ "args": ["-y", "@dbx-app/mcp-server"]
}
}
}
```
-#### 3. 使用
+不要使用 `--no-optional`,平台二进制通过 npm `optionalDependencies` 自动安装。
-在 Claude Code 中直接说:
+### 原生二进制和离线安装
-- "列出我的数据库连接"
-- "查看 local-pg 上有哪些表"
-- "查看 users 表的结构"
-- "查询最近 7 天的订单数量"
-- "打开 orders 表"
+每个 packages 版本会在 [GitHub Releases](https://github.com/t8y2/dbx/releases?q=packages-v) 发布以下文件:
-### CLI
+| 平台 | 文件 |
+| --- | --- |
+| macOS Apple Silicon | `dbx-mcp-darwin-arm64.tar.gz` |
+| macOS Intel | `dbx-mcp-darwin-x64.tar.gz` |
+| Linux glibc ARM64 | `dbx-mcp-linux-arm64-gnu.tar.gz` |
+| Linux glibc x64 | `dbx-mcp-linux-x64-gnu.tar.gz` |
+| Windows ARM64 | `dbx-mcp-win32-arm64.zip` |
+| Windows x64 | `dbx-mcp-win32-x64.zip` |
-终端、脚本和 Codex 工作流请安装独立 CLI 包:
+下载后使用 `SHA256SUMS` 校验,并直接配置:
-```bash
-npm install -g @dbx-app/cli
-dbx connections list --json
-dbx query local "select 1" --json
+```json
+{
+ "mcpServers": {
+ "dbx": {
+ "command": "/绝对路径/dbx-mcp"
+ }
+ }
+}
```
-命令详情见 [DBX CLI README](../cli/README.md)。
-
-### 工具列表
+直接运行原生文件不需要 Node.js。Linux 当前只支持 glibc,暂不支持 Alpine/musl。
-| 工具 | 说明 |
-| --------------------------- | ------------------------------------- |
-| `dbx_list_connections` | 列出 DBX 中所有已配置的数据库连接 |
-| `dbx_add_connection` | 添加新的数据库连接 |
-| `dbx_remove_connection` | 删除数据库连接 |
-| `dbx_list_tables` | 列出指定连接的表和视图 |
-| `dbx_describe_table` | 获取表的列定义 |
-| `dbx_get_schema_context` | 获取适合 AI 写 SQL 的紧凑表结构上下文 |
-| `dbx_execute_query` | 执行 SQL 查询(最多返回 100 行) |
-| `dbx_execute_redis_command` | 在 Redis 连接上执行 Redis 命令 |
-| `dbx_open_table` | 在 DBX 桌面端打开指定表 |
-| `dbx_execute_and_show` | 执行查询并在 DBX 中展示结果 |
+### 系统要求
-### SQL 安全
+- npm 安装需要 Node.js 18.18.0 或更高版本
+- 原生二进制不需要 Node.js、Rust、Cargo、Python 或本地编译环境
+- 连接配置需要存在于 DBX 存储中,或通过 `dbx_add_connection` 添加
+- Agent/JDBC 数据库需要提前安装对应 Agent、JDBC Driver 和 JRE
+- `dbx_open_table`、`dbx_execute_and_show` 需要 DBX 桌面端正在运行
-`dbx_execute_query` 支持多条 SQL 语句,会逐条完成安全检查并依次执行。默认允许常规写操作,例如 `INSERT`、`UPDATE`、`DELETE ... WHERE ...`。
+### 工具列表
-如果你希望 MCP 会话强制退回只读,可设置:
+| 工具 | 说明 |
+| --- | --- |
+| `dbx_list_connections` | 列出当前 MCP 会话可见的连接 |
+| `dbx_add_connection` | 添加本地连接配置 |
+| `dbx_remove_connection` | 删除本地连接配置 |
+| `dbx_list_tables` | 列出表、视图或集合 |
+| `dbx_describe_table` | 获取字段和表结构 |
+| `dbx_get_schema_context` | 获取适合 AI 使用的紧凑 Schema 上下文 |
+| `dbx_execute_query` | 执行 SQL 或支持的 MongoDB Shell 命令,最多返回 100 行 |
+| `dbx_execute_redis_command` | 执行 Redis 命令 |
+| `dbx_open_table` | 在 DBX 桌面端打开表 |
+| `dbx_execute_and_show` | 执行查询并在 DBX 桌面端展示结果 |
-```bash
-DBX_MCP_ALLOW_WRITES=0
-```
+### 本地数据目录
-`DROP`、`TRUNCATE`、`ALTER` 等危险语句仍会被拦截,除非额外设置:
+- macOS:`~/Library/Application Support/com.dbx.app/dbx.db`
+- Linux:`~/.local/share/com.dbx.app/dbx.db`
+- Windows:`%APPDATA%\com.dbx.app\dbx.db`
-```bash
-DBX_MCP_ALLOW_DANGEROUS_SQL=1
-```
+通过 `DBX_DATA_DIR` 覆盖默认目录。Windows 便携版应指向 `DBX.exe` 同级、包含 `dbx.db` 的 `data` 文件夹。
-Redis 连接使用 `dbx_execute_redis_command`,不通过 `dbx_execute_query` 执行。Redis 写命令遵循 `DBX_MCP_ALLOW_WRITES`;`KEYS`、`FLUSHALL`、`EVAL` 等危险 Redis 命令需要设置 `DBX_MCP_ALLOW_DANGEROUS_SQL=1`。
+### DBX Web / Docker
-### 工作原理
+```json
+{
+ "mcpServers": {
+ "dbx": {
+ "command": "dbx-mcp-server",
+ "env": {
+ "DBX_WEB_URL": "https://dbx.example.com",
+ "DBX_WEB_PASSWORD": "Web 登录密码"
+ }
+ }
+ }
+}
+```
-MCP Server 从 DBX 的 SQLite 数据库读取连接信息:
+Web 模式不会读取本机 DBX 桌面存储,也不会暴露桌面 UI 工具。
-- **macOS**: `~/Library/Application Support/com.dbx.app/dbx.db`
-- **Linux**: `~/.local/share/com.dbx.app/dbx.db`
-- **Windows**: `%APPDATA%\com.dbx.app\dbx.db`
+### Agent/JDBC 数据库
-Windows 便携版的数据通常在 `DBX.exe` 同级的 `data\dbx.db`。请把 `DBX_DATA_DIR` 设置为这个 `data` 文件夹,不要手工复制 `dbx.db` 到默认目录。
+达梦、人大金仓、Oracle、DB2、Hive、Trino、Snowflake、SAP HANA 等数据库通过 DBX Java Agent/JDBC 基础设施运行,而不是通过 Node.js 数据库驱动运行。
-### DBX Web / Docker 模式
+npm 和 GitHub Release 中的原生 MCP 文件不会捆绑所有厂商的专有 JDBC Driver。请先通过 DBX Driver Manager 安装对应 Agent 和 JRE,或提供兼容的 DBX Agent 目录。
-如果 MCP 连接的是已部署的 DBX Web 实例,请设置 `DBX_WEB_URL`,不要读取本机桌面端存储:
+### 连接作用域和只读模式
```json
{
"mcpServers": {
- "dbx": {
+ "dbx-production-readonly": {
"command": "dbx-mcp-server",
"env": {
- "DBX_WEB_URL": "https://dbx.example.com",
- "DBX_WEB_PASSWORD": "你的 Web 访问密码"
+ "DBX_MCP_SCOPE_CONNECTION_NAME": "production-postgres",
+ "DBX_MCP_SCOPE_DATABASE": "analytics",
+ "DBX_MCP_ALLOW_WRITES": "0"
}
}
}
}
```
-当 Web 实例启用了密码保护时,必须提供 `DBX_WEB_PASSWORD`。这里填写的就是 DBX Web 登录页使用的密码,也包括首次打开 Web 页面时通过 setup 设置的密码。为了让 MCP 可用,不需要在启动 DBX Web 时额外设置 `DBX_PASSWORD`;`DBX_PASSWORD` 只是服务端环境变量覆盖。未提供 `DBX_WEB_PASSWORD` 时,MCP 调用会在返回任何连接数据前失败。桌面本地模式不使用 `DBX_WEB_PASSWORD`。
+作用域模式会隐藏连接增删和桌面 UI 工具。
-### DBX UI 联动
+### SQL 和命令安全
-`dbx_open_table` 工具通过本地 HTTP 接口与运行中的 DBX 应用通信,直接在 UI 中打开表。需要 DBX 正在运行。
+默认允许常规 `INSERT`、`UPDATE`、`DELETE ... WHERE ...`。强制只读:
-PostgreSQL、MySQL、SQLite、Doris、StarRocks、Redshift 查询可由 MCP Server 直接执行。Redis standalone 命令执行也会直接连接。其他数据库类型,以及 Redis Sentinel/Cluster 或 SSH Redis 连接,仍会走 DBX 桌面端 bridge,除非配置了 `DBX_WEB_URL` 使用 Web 后端。
+```bash
+DBX_MCP_ALLOW_WRITES=0
+```
-### 系统要求
+允许 `DROP`、`TRUNCATE`、`ALTER`、Redis `FLUSHALL` 或危险 MongoDB 操作:
+
+```bash
+DBX_MCP_ALLOW_DANGEROUS_SQL=1
+```
+
+MongoDB 更新和删除默认要求非空 filter;`$out`、`$merge` 聚合阶段按写操作处理。
+
+### 环境变量
+
+| 变量 | 用途 |
+| --- | --- |
+| `DBX_DATA_DIR` | 覆盖本地 DBX 数据目录 |
+| `DBX_WEB_URL` | 使用 DBX Web/Docker 后端 |
+| `DBX_WEB_PASSWORD` | DBX Web 登录密码 |
+| `DBX_MCP_ALLOW_WRITES` | 设置为 `0` 强制只读 |
+| `DBX_MCP_ALLOW_DANGEROUS_SQL` | 设置为 `1` 允许危险操作 |
+| `DBX_MCP_SCOPE_CONNECTION_ID` | 限制到指定连接 ID |
+| `DBX_MCP_SCOPE_CONNECTION_NAME` | 限制到指定连接名称 |
+| `DBX_MCP_SCOPE_DATABASE` | 限制到指定数据库 |
+| `DBX_MCP_DEBUG_SQL` | 临时输出 SQL 诊断信息 |
+| `DBX_MCP_BINARY` | 覆盖 npm 启动器使用的原生文件 |
+
+### 常见问题
+
+**提示平台 optional package 未安装**
+
+重新安装并确保没有使用 `--no-optional`:
+
+```bash
+npm uninstall -g @dbx-app/mcp-server
+npm install -g @dbx-app/mcp-server@latest
+```
+
+**提示找不到 `dbx.db`**
+
+将 `DBX_DATA_DIR` 设置为包含 `dbx.db` 的目录,而不是数据库文件路径。
+
+**提示 DBX 未运行**
+
+普通数据库查询不一定需要启动 DBX;只有桌面 UI 工具和仍需 bridge 的连接需要 DBX 运行。
+
+**Agent 数据库无法启动**
-- 已安装 [DBX](https://github.com/t8y2/dbx) 并配置了至少一个数据库连接
-- Node.js 18.18.0 或更高版本(仅用于 npm 启动器)
-- 不需要安装 Rust、Cargo、Python 或本地编译工具
-- 离线直接运行原生二进制时不需要安装 Node.js
+通过 DBX Driver Manager 安装或更新对应数据库 Agent、JDBC Driver 和 JRE。
+
+**出现 `better-sqlite3` 或 Node ABI 错误**
+
+Rust MCP 不依赖 `better-sqlite3`。请升级 MCP;如果错误来自 `@dbx-app/cli`,则属于当前仍为 TypeScript 的独立 CLI 包。
+
+### 开发和测试
+
+```bash
+cargo run -p dbx-mcp --no-default-features
+cargo test -p dbx-mcp --no-default-features
+pnpm --filter @dbx-app/mcp-server test
+cargo build --release -p dbx-mcp --no-default-features
+```
+
+旧 TypeScript MCP 源码仍保留在 `packages/mcp-server/src`,用于迁移测试和兼容参考,不再是 npm 的运行入口。
+
+### DBX CLI
+
+`@dbx-app/cli` 是独立的终端包,目前仍使用 TypeScript/Node.js:
+
+```bash
+npm install -g @dbx-app/cli
+dbx connections list --json
+```
+
+详见 [CLI README](../cli/README.md)。
+
+### License
+
+Apache-2.0