@dbx-app/mcp-server 0.4.38 → 0.4.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -51
- package/package.json +7 -7
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -23,8 +23,8 @@ The MCP protocol, connection loading, SQL safety, schema access, Redis support,
|
|
|
23
23
|
- **Local, Web, and Docker modes** using the same tool interface
|
|
24
24
|
- **Direct native execution** for supported SQL, Redis, and MongoDB connections
|
|
25
25
|
- **Agent/JDBC database support** through DBX agent infrastructure when the required agent and JRE are installed
|
|
26
|
-
- **
|
|
27
|
-
- **
|
|
26
|
+
- **DBX-managed access policy** with a connection allowlist and three execution modes
|
|
27
|
+
- **SQL, Redis, and MongoDB safety controls** that reload the policy for every request
|
|
28
28
|
- **Offline execution** through downloadable native binaries
|
|
29
29
|
- **Optional desktop integration** for opening tables and displaying query results in DBX
|
|
30
30
|
|
|
@@ -142,8 +142,8 @@ Ask the MCP client to:
|
|
|
142
142
|
| Tool | Description |
|
|
143
143
|
| --- | --- |
|
|
144
144
|
| `dbx_list_connections` | List connections visible to the MCP session |
|
|
145
|
-
| `dbx_add_connection` | Add a connection to
|
|
146
|
-
| `dbx_remove_connection` | Remove a connection from
|
|
145
|
+
| `dbx_add_connection` | Add a connection to DBX storage |
|
|
146
|
+
| `dbx_remove_connection` | Remove a connection from DBX storage |
|
|
147
147
|
| `dbx_list_tables` | List tables, views, or collections |
|
|
148
148
|
| `dbx_describe_table` | Return columns and table metadata |
|
|
149
149
|
| `dbx_get_schema_context` | Return compact schema context suitable for an AI model |
|
|
@@ -213,42 +213,43 @@ Point `DBX_DATA_DIR` at the portable `data` directory containing `dbx.db`:
|
|
|
213
213
|
}
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
##
|
|
216
|
+
## DBX-managed MCP Policy
|
|
217
217
|
|
|
218
|
-
|
|
218
|
+
DBX stores one authoritative policy under **Settings → MCP** and reloads it for every request:
|
|
219
|
+
|
|
220
|
+
| Permission mode | Allowed operations |
|
|
221
|
+
| --- | --- |
|
|
222
|
+
| Read only | Queries and metadata reads |
|
|
223
|
+
| Data read/write | Regular inserts, effectively filtered updates/deletes, scoped MongoDB mutations, and ordinary Redis writes |
|
|
224
|
+
| Full access | Also permits broad updates/deletes, DDL, `TRUNCATE`, MongoDB destructive operations, and Redis `FLUSH*` |
|
|
225
|
+
|
|
226
|
+
**Allowed connections** controls which stable connection IDs MCP can list or resolve. Connection-level read-only protection, production protection, database credentials, and the allowlist remain upper bounds in every mode.
|
|
227
|
+
|
|
228
|
+
Conditions such as `WHERE TRUE`, `WHERE 1 = 1`, `_id: {$exists: true}`, complementary predicates, and opaque MongoDB filters remain high risk. Unknown Redis commands also fail closed.
|
|
229
|
+
|
|
230
|
+
Legacy connection scope variables can still narrow the DBX allowlist for existing client configurations:
|
|
219
231
|
|
|
220
232
|
```json
|
|
221
233
|
{
|
|
222
234
|
"mcpServers": {
|
|
223
|
-
"dbx-production-
|
|
235
|
+
"dbx-production-scope": {
|
|
224
236
|
"command": "dbx-mcp-server",
|
|
225
237
|
"env": {
|
|
226
238
|
"DBX_MCP_SCOPE_CONNECTION_NAME": "production-postgres",
|
|
227
|
-
"DBX_MCP_SCOPE_DATABASE": "analytics"
|
|
228
|
-
"DBX_MCP_ALLOW_WRITES": "0"
|
|
239
|
+
"DBX_MCP_SCOPE_DATABASE": "analytics"
|
|
229
240
|
}
|
|
230
241
|
}
|
|
231
242
|
}
|
|
232
243
|
}
|
|
233
244
|
```
|
|
234
245
|
|
|
235
|
-
Use
|
|
246
|
+
Use `DBX_MCP_SCOPE_CONNECTION_ID`, comma-separated `DBX_MCP_SCOPE_CONNECTION_IDS`, or `DBX_MCP_SCOPE_CONNECTION_NAME`. ID scopes take precedence over the name scope. The scoped database is optional.
|
|
236
247
|
|
|
237
248
|
## Safety
|
|
238
249
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
DBX_MCP_ALLOW_WRITES=0
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
Dangerous operations such as `DROP`, `TRUNCATE`, `ALTER`, Redis `FLUSHALL`, or dangerous MongoDB mutations remain blocked unless explicitly enabled:
|
|
250
|
+
Choose **Read only**, **Data read/write**, or **Full access** in DBX instead of placing permission flags in client configuration. Updated servers do not let `DBX_MCP_ALLOW_WRITES` or `DBX_MCP_ALLOW_DANGEROUS_SQL` widen the DBX policy. For upgrade compatibility, `DBX_MCP_ALLOW_WRITES=0` (or `false`) keeps MCP read-only until a central policy is saved for the first time; the legacy permission variables are ignored afterward.
|
|
246
251
|
|
|
247
|
-
|
|
248
|
-
DBX_MCP_ALLOW_DANGEROUS_SQL=1
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
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.
|
|
252
|
+
MongoDB update/delete operations require a verifiably effective filter unless Full access is enabled. Aggregation stages such as `$out` and `$merge` are treated as high-risk writes.
|
|
252
253
|
|
|
253
254
|
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.
|
|
254
255
|
|
|
@@ -259,9 +260,9 @@ SQL text is not included in normal MCP errors or logged by default. Enable tempo
|
|
|
259
260
|
| `DBX_DATA_DIR` | Override the local DBX data directory |
|
|
260
261
|
| `DBX_WEB_URL` | Use a DBX Web/Docker backend |
|
|
261
262
|
| `DBX_WEB_PASSWORD` | Authenticate to the DBX Web backend |
|
|
262
|
-
| `DBX_MCP_ALLOW_WRITES` |
|
|
263
|
-
| `
|
|
264
|
-
| `
|
|
263
|
+
| `DBX_MCP_ALLOW_WRITES` | Upgrade compatibility only: `0`/`false` keeps an unconfigured policy read-only |
|
|
264
|
+
| `DBX_MCP_SCOPE_CONNECTION_ID` | Compatibility scope for one connection ID |
|
|
265
|
+
| `DBX_MCP_SCOPE_CONNECTION_IDS` | Compatibility scope for multiple connection IDs |
|
|
265
266
|
| `DBX_MCP_SCOPE_CONNECTION_NAME` | Restrict tools to one connection name |
|
|
266
267
|
| `DBX_MCP_SCOPE_DATABASE` | Restrict tools to one database |
|
|
267
268
|
| `DBX_MCP_DEBUG_SQL` | Include SQL in temporary diagnostics |
|
|
@@ -329,8 +330,6 @@ Build a release binary:
|
|
|
329
330
|
cargo build --release -p dbx-mcp --no-default-features
|
|
330
331
|
```
|
|
331
332
|
|
|
332
|
-
The previous TypeScript MCP implementation remains in `packages/mcp-server/src` for migration tests and compatibility reference; it is not the npm runtime entrypoint.
|
|
333
|
-
|
|
334
333
|
## DBX CLI
|
|
335
334
|
|
|
336
335
|
`@dbx-app/cli` is a separate terminal-oriented package and currently remains TypeScript/Node.js based:
|
|
@@ -450,8 +449,8 @@ MCP 配置:
|
|
|
450
449
|
| 工具 | 说明 |
|
|
451
450
|
| --- | --- |
|
|
452
451
|
| `dbx_list_connections` | 列出当前 MCP 会话可见的连接 |
|
|
453
|
-
| `dbx_add_connection` |
|
|
454
|
-
| `dbx_remove_connection` |
|
|
452
|
+
| `dbx_add_connection` | 添加 DBX 连接配置 |
|
|
453
|
+
| `dbx_remove_connection` | 删除 DBX 连接配置 |
|
|
455
454
|
| `dbx_list_tables` | 列出表、视图或集合 |
|
|
456
455
|
| `dbx_describe_table` | 获取字段和表结构 |
|
|
457
456
|
| `dbx_get_schema_context` | 获取适合 AI 使用的紧凑 Schema 上下文 |
|
|
@@ -492,40 +491,43 @@ Web 模式不会读取本机 DBX 桌面存储,也不会暴露桌面 UI 工具
|
|
|
492
491
|
|
|
493
492
|
npm 和 GitHub Release 中的原生 MCP 文件不会捆绑所有厂商的专有 JDBC Driver。请先通过 DBX Driver Manager 安装对应 Agent 和 JRE,或提供兼容的 DBX Agent 目录。
|
|
494
493
|
|
|
495
|
-
###
|
|
494
|
+
### DBX 管理的 MCP 策略
|
|
495
|
+
|
|
496
|
+
DBX 在 **设置 → MCP** 中保存一份权威策略,并在每次请求时重新读取:
|
|
497
|
+
|
|
498
|
+
| 权限模式 | 允许的操作 |
|
|
499
|
+
| --- | --- |
|
|
500
|
+
| 只读 | 查询和元数据读取 |
|
|
501
|
+
| 数据读写 | 普通插入、带有效过滤条件的更新/删除、范围明确的 MongoDB 修改和普通 Redis 写入 |
|
|
502
|
+
| 完全访问 | 额外允许大范围更新/删除、DDL、`TRUNCATE`、MongoDB 破坏性操作和 Redis `FLUSH*` |
|
|
503
|
+
|
|
504
|
+
**允许访问的连接** 决定 MCP 可以列出和解析哪些稳定连接 ID。连接自身只读、生产库保护、数据库账号权限和 allowlist 在任何模式下都是权限上限。
|
|
505
|
+
|
|
506
|
+
`WHERE TRUE`、`WHERE 1 = 1`、`_id: {$exists: true}`、互补条件或不透明 MongoDB 过滤器仍按高风险处理。未知 Redis 命令也会失败关闭。
|
|
507
|
+
|
|
508
|
+
旧连接 scope 变量可继续兼容读取,但只能进一步收窄 DBX allowlist:
|
|
496
509
|
|
|
497
510
|
```json
|
|
498
511
|
{
|
|
499
512
|
"mcpServers": {
|
|
500
|
-
"dbx-production-
|
|
513
|
+
"dbx-production-scope": {
|
|
501
514
|
"command": "dbx-mcp-server",
|
|
502
515
|
"env": {
|
|
503
516
|
"DBX_MCP_SCOPE_CONNECTION_NAME": "production-postgres",
|
|
504
|
-
"DBX_MCP_SCOPE_DATABASE": "analytics"
|
|
505
|
-
"DBX_MCP_ALLOW_WRITES": "0"
|
|
517
|
+
"DBX_MCP_SCOPE_DATABASE": "analytics"
|
|
506
518
|
}
|
|
507
519
|
}
|
|
508
520
|
}
|
|
509
521
|
}
|
|
510
522
|
```
|
|
511
523
|
|
|
512
|
-
|
|
524
|
+
可使用 `DBX_MCP_SCOPE_CONNECTION_ID`、逗号分隔的 `DBX_MCP_SCOPE_CONNECTION_IDS` 或 `DBX_MCP_SCOPE_CONNECTION_NAME`。ID scope 优先于名称 scope;作用域模式会隐藏连接增删和桌面 UI 工具。
|
|
513
525
|
|
|
514
526
|
### SQL 和命令安全
|
|
515
527
|
|
|
516
|
-
|
|
528
|
+
请在 DBX 中选择 **只读**、**数据读写** 或 **完全访问**,不要在客户端配置中放置权限开关。新版 Server 不允许 `DBX_MCP_ALLOW_WRITES` 或 `DBX_MCP_ALLOW_DANGEROUS_SQL` 放宽 DBX 中央策略。为兼容升级,在中央策略首次保存前,`DBX_MCP_ALLOW_WRITES=0`(或 `false`)仍会保持 MCP 只读;策略保存后旧权限变量即被忽略。
|
|
517
529
|
|
|
518
|
-
|
|
519
|
-
DBX_MCP_ALLOW_WRITES=0
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
允许 `DROP`、`TRUNCATE`、`ALTER`、Redis `FLUSHALL` 或危险 MongoDB 操作:
|
|
523
|
-
|
|
524
|
-
```bash
|
|
525
|
-
DBX_MCP_ALLOW_DANGEROUS_SQL=1
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
MongoDB 更新和删除默认要求非空 filter;`$out`、`$merge` 聚合阶段按写操作处理。
|
|
530
|
+
MongoDB 更新和删除在未启用完全访问时必须提供可验证有效的 filter;`$out`、`$merge` 聚合阶段按高风险写操作处理。
|
|
529
531
|
|
|
530
532
|
### 环境变量
|
|
531
533
|
|
|
@@ -534,9 +536,9 @@ MongoDB 更新和删除默认要求非空 filter;`$out`、`$merge` 聚合阶
|
|
|
534
536
|
| `DBX_DATA_DIR` | 覆盖本地 DBX 数据目录 |
|
|
535
537
|
| `DBX_WEB_URL` | 使用 DBX Web/Docker 后端 |
|
|
536
538
|
| `DBX_WEB_PASSWORD` | DBX Web 登录密码 |
|
|
537
|
-
| `DBX_MCP_ALLOW_WRITES` |
|
|
538
|
-
| `
|
|
539
|
-
| `
|
|
539
|
+
| `DBX_MCP_ALLOW_WRITES` | 仅用于升级兼容:`0`/`false` 使尚未配置的策略保持只读 |
|
|
540
|
+
| `DBX_MCP_SCOPE_CONNECTION_ID` | 兼容旧配置:限制到指定连接 ID |
|
|
541
|
+
| `DBX_MCP_SCOPE_CONNECTION_IDS` | 兼容旧配置:限制到多个连接 ID |
|
|
540
542
|
| `DBX_MCP_SCOPE_CONNECTION_NAME` | 限制到指定连接名称 |
|
|
541
543
|
| `DBX_MCP_SCOPE_DATABASE` | 限制到指定数据库 |
|
|
542
544
|
| `DBX_MCP_DEBUG_SQL` | 临时输出 SQL 诊断信息 |
|
|
@@ -578,8 +580,6 @@ pnpm --filter @dbx-app/mcp-server test
|
|
|
578
580
|
cargo build --release -p dbx-mcp --no-default-features
|
|
579
581
|
```
|
|
580
582
|
|
|
581
|
-
旧 TypeScript MCP 源码仍保留在 `packages/mcp-server/src`,用于迁移测试和兼容参考,不再是 npm 的运行入口。
|
|
582
|
-
|
|
583
583
|
### DBX CLI
|
|
584
584
|
|
|
585
585
|
`@dbx-app/cli` 是独立的终端包,目前仍使用 TypeScript/Node.js:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dbx-app/mcp-server",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.40",
|
|
4
4
|
"description": "MCP server for DBX — query databases from Claude Code, Cursor, and other AI agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agent",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
],
|
|
29
29
|
"type": "module",
|
|
30
30
|
"optionalDependencies": {
|
|
31
|
-
"@dbx-app/mcp-darwin-arm64": "0.4.
|
|
32
|
-
"@dbx-app/mcp-darwin-x64": "0.4.
|
|
33
|
-
"@dbx-app/mcp-linux-arm64-gnu": "0.4.
|
|
34
|
-
"@dbx-app/mcp-linux-x64-gnu": "0.4.
|
|
35
|
-
"@dbx-app/mcp-win32-arm64": "0.4.
|
|
36
|
-
"@dbx-app/mcp-win32-x64": "0.4.
|
|
31
|
+
"@dbx-app/mcp-darwin-arm64": "0.4.40",
|
|
32
|
+
"@dbx-app/mcp-darwin-x64": "0.4.40",
|
|
33
|
+
"@dbx-app/mcp-linux-arm64-gnu": "0.4.40",
|
|
34
|
+
"@dbx-app/mcp-linux-x64-gnu": "0.4.40",
|
|
35
|
+
"@dbx-app/mcp-win32-arm64": "0.4.40",
|
|
36
|
+
"@dbx-app/mcp-win32-x64": "0.4.40"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^22.15.21",
|
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/t8y2/dbx",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.4.
|
|
9
|
+
"version": "0.4.40",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@dbx-app/mcp-server",
|
|
14
|
-
"version": "0.4.
|
|
14
|
+
"version": "0.4.40",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
}
|