@dbx-app/mcp-server 0.4.7 → 0.4.8

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 CHANGED
@@ -79,16 +79,16 @@ See the [DBX CLI README](../cli/README.md) for command details.
79
79
 
80
80
  ## Tools
81
81
 
82
- | Tool | Description |
83
- |---|---|
84
- | `dbx_list_connections` | List all database connections configured in DBX |
85
- | `dbx_add_connection` | Add a new database connection |
86
- | `dbx_remove_connection` | Remove a database connection |
87
- | `dbx_list_tables` | List tables and views for a connection |
88
- | `dbx_describe_table` | Get column definitions for a table |
82
+ | Tool | Description |
83
+ | ------------------------ | ---------------------------------------------------- |
84
+ | `dbx_list_connections` | List all database connections configured in DBX |
85
+ | `dbx_add_connection` | Add a new database connection |
86
+ | `dbx_remove_connection` | Remove a database connection |
87
+ | `dbx_list_tables` | List tables and views for a connection |
88
+ | `dbx_describe_table` | Get column definitions for a table |
89
89
  | `dbx_get_schema_context` | Get compact table and column context for writing SQL |
90
- | `dbx_execute_query` | Execute a SQL query (max 100 rows) |
91
- | `dbx_open_table` | Open a table in DBX desktop app UI |
90
+ | `dbx_execute_query` | Execute a SQL query (max 100 rows) |
91
+ | `dbx_open_table` | Open a table in DBX desktop app UI |
92
92
 
93
93
  ## SQL Safety
94
94
 
@@ -202,16 +202,16 @@ dbx query local "select 1" --json
202
202
 
203
203
  ### 工具列表
204
204
 
205
- | 工具 | 说明 |
206
- |---|---|
207
- | `dbx_list_connections` | 列出 DBX 中所有已配置的数据库连接 |
208
- | `dbx_add_connection` | 添加新的数据库连接 |
209
- | `dbx_remove_connection` | 删除数据库连接 |
210
- | `dbx_list_tables` | 列出指定连接的表和视图 |
211
- | `dbx_describe_table` | 获取表的列定义 |
205
+ | 工具 | 说明 |
206
+ | ------------------------ | ------------------------------------- |
207
+ | `dbx_list_connections` | 列出 DBX 中所有已配置的数据库连接 |
208
+ | `dbx_add_connection` | 添加新的数据库连接 |
209
+ | `dbx_remove_connection` | 删除数据库连接 |
210
+ | `dbx_list_tables` | 列出指定连接的表和视图 |
211
+ | `dbx_describe_table` | 获取表的列定义 |
212
212
  | `dbx_get_schema_context` | 获取适合 AI 写 SQL 的紧凑表结构上下文 |
213
- | `dbx_execute_query` | 执行 SQL 查询(最多返回 100 行) |
214
- | `dbx_open_table` | 在 DBX 桌面端打开指定表 |
213
+ | `dbx_execute_query` | 执行 SQL 查询(最多返回 100 行) |
214
+ | `dbx_open_table` | 在 DBX 桌面端打开指定表 |
215
215
 
216
216
  ### SQL 安全
217
217
 
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, rqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, databend, gaussdb, kwdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, iris, neo4j, cassandra, bigquery, kylin, sundb, tdengine, iotdb, xugu, jdbc, access";
5
+ export declare const DBX_CONNECTION_TYPE_DESCRIPTION = "Database type: postgres, mysql, sqlite, rqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, etcd, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, databend, gaussdb, kwdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, iris, neo4j, cassandra, bigquery, kylin, sundb, tdengine, iotdb, 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,8 @@ 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, rqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, databend, gaussdb, kwdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, iris, neo4j, cassandra, bigquery, kylin, sundb, tdengine, iotdb, xugu, jdbc, access";
26
+ export const DBX_CONNECTION_TYPE_DESCRIPTION = "Database type: postgres, mysql, sqlite, rqlite, redis, duckdb, clickhouse, sqlserver, mongodb, oracle, elasticsearch, etcd, doris, starrocks, redshift, dameng, kingbase, highgo, vastbase, goldendb, databend, gaussdb, kwdb, yashandb, databricks, saphana, teradata, vertica, firebird, exasol, opengauss, oceanbase-oracle, gbase, h2, snowflake, trino, hive, db2, informix, iris, neo4j, cassandra, bigquery, kylin, sundb, tdengine, iotdb, xugu, jdbc, access";
27
+ const FILE_CAPABLE_CONNECTION_TYPES = new Set(["sqlite", "duckdb", "access", "h2"]);
27
28
  export function createDbxMcpServer(backend, options = {}) {
28
29
  const isWebMode = options.isWebMode ?? !!process.env.DBX_WEB_URL;
29
30
  const server = new McpServer({
@@ -63,13 +64,7 @@ export function createDbxMcpServer(backend, options = {}) {
63
64
  const columns = await backend.describeTable(withDatabase(config, database), table, schema);
64
65
  if (columns.length === 0)
65
66
  return text("No columns found.");
66
- const rows = columns.map((c) => [
67
- c.is_primary_key ? `${c.name} (PK)` : c.name,
68
- c.data_type,
69
- c.is_nullable ? "YES" : "NO",
70
- c.column_default ?? "",
71
- c.comment ?? "",
72
- ]);
67
+ const rows = columns.map((c) => [c.is_primary_key ? `${c.name} (PK)` : c.name, c.data_type, c.is_nullable ? "YES" : "NO", c.column_default ?? "", c.comment ?? ""]);
73
68
  return text(mdTable(["Column", "Type", "Nullable", "Default", "Comment"], rows));
74
69
  });
75
70
  server.tool("dbx_execute_query", "Execute a SQL query on a database connection (max 100 rows returned)", {
@@ -95,9 +90,7 @@ export function createDbxMcpServer(backend, options = {}) {
95
90
  }
96
91
  if (results.length === 1)
97
92
  return formatQueryToolResult(results[0]);
98
- return text(results
99
- .map((result, index) => formatQueryToolResult(result, `Statement ${index + 1}`).content[0].text)
100
- .join("\n\n"));
93
+ return text(results.map((result, index) => formatQueryToolResult(result, `Statement ${index + 1}`).content[0].text).join("\n\n"));
101
94
  }
102
95
  catch (e) {
103
96
  const msg = e instanceof Error ? e.message : String(e);
@@ -136,9 +129,14 @@ export function createDbxMcpServer(backend, options = {}) {
136
129
  const existing = await backend.findConnection(name);
137
130
  if (existing)
138
131
  return text(`Connection "${name}" already exists.`);
139
- const FILE_BASED_TYPES = new Set(["sqlite", "duckdb", "access"]);
140
- const DEFAULT_PORTS = { kwdb: 26257, rqlite: 4001, tdengine: 6041, iotdb: 6667, xugu: 5138 };
141
- const resolvedPort = port ?? DEFAULT_PORTS[db_type] ?? (FILE_BASED_TYPES.has(db_type) ? 0 : undefined);
132
+ const DEFAULT_PORTS = {
133
+ kwdb: 26257,
134
+ rqlite: 4001,
135
+ tdengine: 6041,
136
+ iotdb: 6667,
137
+ xugu: 5138,
138
+ };
139
+ const resolvedPort = port ?? DEFAULT_PORTS[db_type] ?? (FILE_CAPABLE_CONNECTION_TYPES.has(db_type) ? 0 : undefined);
142
140
  if (resolvedPort === undefined)
143
141
  return text("Port is required for this database type.");
144
142
  const config = await backend.addConnection({
package/package.json CHANGED
@@ -1,46 +1,46 @@
1
1
  {
2
2
  "name": "@dbx-app/mcp-server",
3
- "version": "0.4.7",
4
- "mcpName": "io.github.t8y2/dbx",
3
+ "version": "0.4.8",
5
4
  "description": "MCP server for DBX — query databases from Claude Code, Cursor, and other AI agents",
6
- "type": "module",
7
- "engines": {
8
- "node": ">=22.13.0"
9
- },
10
- "bin": {
11
- "mcp-server": "dist/index.js",
12
- "dbx-mcp-server": "dist/index.js"
13
- },
14
- "files": [
15
- "dist",
16
- "server.json"
17
- ],
18
5
  "keywords": [
19
- "mcp",
6
+ "ai-agent",
7
+ "claude",
20
8
  "database",
21
9
  "dbx",
22
- "claude",
23
- "postgresql",
10
+ "mcp",
24
11
  "mysql",
25
- "ai-agent"
12
+ "postgresql"
26
13
  ],
14
+ "homepage": "https://github.com/t8y2/dbx/tree/main/packages/mcp-server",
27
15
  "license": "Apache-2.0",
28
16
  "repository": {
29
17
  "type": "git",
30
18
  "url": "https://github.com/t8y2/dbx",
31
19
  "directory": "packages/mcp-server"
32
20
  },
33
- "homepage": "https://github.com/t8y2/dbx/tree/main/packages/mcp-server",
21
+ "bin": {
22
+ "dbx-mcp-server": "dist/index.js",
23
+ "mcp-server": "dist/index.js"
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "server.json"
28
+ ],
29
+ "type": "module",
34
30
  "dependencies": {
35
31
  "@modelcontextprotocol/sdk": "^1.12.1",
36
32
  "zod": "^3.25.20",
37
- "@dbx-app/node-core": "^0.4.7"
33
+ "@dbx-app/node-core": "^0.4.8"
38
34
  },
39
35
  "devDependencies": {
40
36
  "@types/node": "^22.15.21",
41
37
  "tsx": "^4.19.4",
42
38
  "typescript": "^5.8.3"
43
39
  },
40
+ "engines": {
41
+ "node": ">=22.13.0"
42
+ },
43
+ "mcpName": "io.github.t8y2/dbx",
44
44
  "scripts": {
45
45
  "start": "tsx src/index.ts",
46
46
  "test": "pnpm --filter @dbx-app/mcp-server build && vitest run --config vitest.config.ts",
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.7",
9
+ "version": "0.4.8",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@dbx-app/mcp-server",
14
- "version": "0.4.7",
14
+ "version": "0.4.8",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  }