@dbx-app/mcp-server 0.4.5 → 0.4.6
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 +10 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -2
- package/package.json +3 -3
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ MCP server for [DBX](https://github.com/t8y2/dbx) — lets AI agents (Claude Cod
|
|
|
10
10
|
- **8 tools** — List/add/remove connections, list tables, describe table, get schema context, execute SQL, open table in DBX UI
|
|
11
11
|
- **Connection pooling** — Reuses database connections across queries
|
|
12
12
|
- **Direct execution** — PostgreSQL, MySQL, SQLite, and compatible databases (Doris, StarRocks, etc.) can run without opening DBX
|
|
13
|
-
- **
|
|
13
|
+
- **Writes enabled by default** — regular `INSERT` / `UPDATE` / `DELETE` statements work out of the box, while dangerous SQL stays blocked unless explicitly enabled
|
|
14
14
|
- **DBX UI integration** — Open tables directly in the DBX desktop app from your AI agent
|
|
15
15
|
|
|
16
16
|
## Quick Start
|
|
@@ -92,10 +92,12 @@ See the [DBX CLI README](../cli/README.md) for command details.
|
|
|
92
92
|
|
|
93
93
|
## SQL Safety
|
|
94
94
|
|
|
95
|
-
`dbx_execute_query` accepts multiple SQL statements and executes them one at a time after checking each statement.
|
|
95
|
+
`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.
|
|
96
|
+
|
|
97
|
+
If you need to force a read-only MCP session, set:
|
|
96
98
|
|
|
97
99
|
```bash
|
|
98
|
-
DBX_MCP_ALLOW_WRITES=
|
|
100
|
+
DBX_MCP_ALLOW_WRITES=0
|
|
99
101
|
```
|
|
100
102
|
|
|
101
103
|
Dangerous statements such as `DROP`, `TRUNCATE`, and `ALTER` remain blocked unless you also set:
|
|
@@ -145,7 +147,7 @@ MIT
|
|
|
145
147
|
- **8 个工具** — 列出/添加/删除连接、列出表、查看表结构、获取 Schema 上下文、执行 SQL、在 DBX 中打开表
|
|
146
148
|
- **连接池** — 跨查询复用数据库连接
|
|
147
149
|
- **直接执行** — PostgreSQL、MySQL、SQLite 及兼容数据库(Doris、StarRocks 等)无需打开 DBX 即可查询
|
|
148
|
-
-
|
|
150
|
+
- **默认允许常规写入** — `INSERT` / `UPDATE` / `DELETE` 可直接执行,危险语句仍需显式开启
|
|
149
151
|
- **DBX UI 联动** — 从 AI 助手直接在 DBX 桌面端打开表
|
|
150
152
|
|
|
151
153
|
### 快速开始
|
|
@@ -213,10 +215,12 @@ dbx query local "select 1" --json
|
|
|
213
215
|
|
|
214
216
|
### SQL 安全
|
|
215
217
|
|
|
216
|
-
`dbx_execute_query` 支持多条 SQL
|
|
218
|
+
`dbx_execute_query` 支持多条 SQL 语句,会逐条完成安全检查并依次执行。默认允许常规写操作,例如 `INSERT`、`UPDATE`、`DELETE ... WHERE ...`。
|
|
219
|
+
|
|
220
|
+
如果你希望 MCP 会话强制退回只读,可设置:
|
|
217
221
|
|
|
218
222
|
```bash
|
|
219
|
-
DBX_MCP_ALLOW_WRITES=
|
|
223
|
+
DBX_MCP_ALLOW_WRITES=0
|
|
220
224
|
```
|
|
221
225
|
|
|
222
226
|
`DROP`、`TRUNCATE`、`ALTER` 等危险语句仍会被拦截,除非额外设置:
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { type Backend } from "@dbx-app/node-core";
|
|
4
4
|
export declare const DBX_MCP_PACKAGE_VERSION: string;
|
|
5
|
-
export declare const DBX_CONNECTION_TYPE_DESCRIPTION = "Database type: postgres, mysql, sqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, gaussdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, neo4j, cassandra, bigquery, kylin, sundb, tdengine, xugu, jdbc, access";
|
|
5
|
+
export declare const DBX_CONNECTION_TYPE_DESCRIPTION = "Database type: postgres, mysql, sqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, gaussdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, iris, neo4j, cassandra, bigquery, kylin, sundb, tdengine, xugu, jdbc, access";
|
|
6
6
|
export declare function createDbxMcpServer(backend: Backend, options?: {
|
|
7
7
|
isWebMode?: boolean;
|
|
8
8
|
}): McpServer;
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,7 @@ function formatQueryToolResult(result, title) {
|
|
|
23
23
|
const rows = result.rows.map((r) => result.columns.map((c) => formatCell(r[c])));
|
|
24
24
|
return text(`${prefix}${mdTable(result.columns, rows)}\n\n${result.row_count} row(s)`);
|
|
25
25
|
}
|
|
26
|
-
export const DBX_CONNECTION_TYPE_DESCRIPTION = "Database type: postgres, mysql, sqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, gaussdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, neo4j, cassandra, bigquery, kylin, sundb, tdengine, xugu, jdbc, access";
|
|
26
|
+
export const DBX_CONNECTION_TYPE_DESCRIPTION = "Database type: postgres, mysql, sqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, gaussdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, iris, neo4j, cassandra, bigquery, kylin, sundb, tdengine, xugu, jdbc, access";
|
|
27
27
|
export function createDbxMcpServer(backend, options = {}) {
|
|
28
28
|
const isWebMode = options.isWebMode ?? !!process.env.DBX_WEB_URL;
|
|
29
29
|
const server = new McpServer({
|
|
@@ -95,7 +95,9 @@ export function createDbxMcpServer(backend, options = {}) {
|
|
|
95
95
|
}
|
|
96
96
|
if (results.length === 1)
|
|
97
97
|
return formatQueryToolResult(results[0]);
|
|
98
|
-
return text(results
|
|
98
|
+
return text(results
|
|
99
|
+
.map((result, index) => formatQueryToolResult(result, `Statement ${index + 1}`).content[0].text)
|
|
100
|
+
.join("\n\n"));
|
|
99
101
|
}
|
|
100
102
|
catch (e) {
|
|
101
103
|
const msg = e instanceof Error ? e.message : String(e);
|
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.6",
|
|
4
4
|
"mcpName": "io.github.t8y2/dbx",
|
|
5
5
|
"description": "MCP server for DBX — query databases from Claude Code, Cursor, and other AI agents",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
36
36
|
"zod": "^3.25.20",
|
|
37
|
-
"@dbx-app/node-core": "^0.4.
|
|
37
|
+
"@dbx-app/node-core": "^0.4.6"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^22.15.21",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"start": "tsx src/index.ts",
|
|
46
|
-
"test": "pnpm --filter @dbx-app/
|
|
46
|
+
"test": "pnpm --filter @dbx-app/mcp-server build && tsx --test tests/*.test.ts",
|
|
47
47
|
"build": "pnpm --filter @dbx-app/node-core build && tsc"
|
|
48
48
|
}
|
|
49
49
|
}
|
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.6",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@dbx-app/mcp-server",
|
|
14
|
-
"version": "0.4.
|
|
14
|
+
"version": "0.4.6",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
}
|