@dbx-app/mcp-server 0.4.29 → 0.4.31

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
@@ -124,6 +124,10 @@ DBX_MCP_ALLOW_DANGEROUS_SQL=1
124
124
 
125
125
  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`.
126
126
 
127
+ ## SQL Diagnostics Privacy
128
+
129
+ 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.
130
+
127
131
  ## How It Works
128
132
 
129
133
  ```
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
4
  import { createRequire } from "node:module";
5
5
  import { z } from "zod";
6
- import { buildSchemaContext, createBackend, evaluateRedisCommandSafety, evaluateMongoAggregateSafety, evaluateSqlSafety, formatCell, formatSchemaContext, isMainModule, mdTable, notifyReload, parseMongoAggregateCommand, assessProductionSql, isLikelyMongoMutation, isProductionDatabase, postBridge, sqlSafetyFromEnv, splitSqlStatements, } from "@dbx-app/node-core";
6
+ import { buildSchemaContext, createBackend, evaluateRedisCommandSafety, evaluateMongoAggregateSafety, evaluateSqlSafety, formatCell, formatSchemaContext, isMainModule, mdTable, notifyReload, parseMongoAggregateCommand, assessProductionSql, isLikelyMongoMutation, isProductionDatabase, postBridge, logSqlDiagnostic, sqlSafetyFromEnv, splitSqlStatements, supportsHashLineComments, } from "@dbx-app/node-core";
7
7
  const require = createRequire(import.meta.url);
8
8
  const packageJson = require("../package.json");
9
9
  export const DBX_MCP_PACKAGE_VERSION = packageJson.version ?? "0.0.0";
@@ -174,6 +174,7 @@ export function createDbxMcpServer(backend, options = {}) {
174
174
  database: z.string().optional().describe("Database name"),
175
175
  sql: z.string().describe("SQL query to execute"),
176
176
  }, async ({ connection_id, connection_name, database, sql }) => {
177
+ logSqlDiagnostic("dbx_execute_query", sql, { connection_id, connection_name, database });
177
178
  const { config, error } = await resolveConnection(backend, scope, connection_id, connection_name);
178
179
  if (error)
179
180
  return error;
@@ -182,7 +183,8 @@ export function createDbxMcpServer(backend, options = {}) {
182
183
  return toolError("REDIS_COMMAND_REQUIRED", "Redis connections do not accept SQL through dbx_execute_query. Use dbx_execute_redis_command with a Redis command such as GET key or INFO.");
183
184
  }
184
185
  if (scopedConfig.db_type !== "mongodb") {
185
- const safety = evaluateSqlSafety(sql, { ...sqlSafetyFromEnv(), allowMultipleStatements: true });
186
+ const hashLineComments = supportsHashLineComments(scopedConfig.db_type);
187
+ const safety = evaluateSqlSafety(sql, { ...sqlSafetyFromEnv(), allowMultipleStatements: true, hashLineComments });
186
188
  if (!safety.allowed)
187
189
  return toolError("SQL_BLOCKED", safety.reason ?? "SQL blocked.");
188
190
  const production = assessProductionSql(sql, scopedConfig, database ?? scope.database ?? scopedConfig.database);
@@ -196,7 +198,7 @@ export function createDbxMcpServer(backend, options = {}) {
196
198
  // MongoDB shell commands don't fit the SQL safety evaluator; the backend
197
199
  // (node-core executeQuery) applies command-aware read/write gating.
198
200
  try {
199
- const statements = scopedConfig.db_type === "mongodb" ? [sql] : splitSqlStatements(sql);
201
+ const statements = scopedConfig.db_type === "mongodb" ? [sql] : splitSqlStatements(sql, { hashLineComments: supportsHashLineComments(scopedConfig.db_type) });
200
202
  const results = [];
201
203
  for (const statement of statements) {
202
204
  results.push(await backend.executeQuery(withDatabase(scopedConfig, database ?? scope.database), statement));
@@ -413,7 +415,8 @@ export function createDbxMcpServer(backend, options = {}) {
413
415
  }
414
416
  }
415
417
  else {
416
- const safety = evaluateSqlSafety(sql, { ...safetyOptions, allowMultipleStatements: true });
418
+ const hashLineComments = supportsHashLineComments(config?.db_type);
419
+ const safety = evaluateSqlSafety(sql, { ...safetyOptions, allowMultipleStatements: true, hashLineComments });
417
420
  if (!safety.allowed)
418
421
  return toolError("SQL_BLOCKED", safety.reason ?? "SQL blocked.");
419
422
  }
@@ -430,6 +433,7 @@ export function createDbxMcpServer(backend, options = {}) {
430
433
  }
431
434
  // MongoDB shell commands bypass the SQL safety evaluator; pass MCP
432
435
  // safety flags to the desktop executor for command-aware gating.
436
+ logSqlDiagnostic("dbx_execute_in_app", sql, { connection_id: config.id, connection_name: config.name, database });
433
437
  return bridgeRequest("/execute-query", {
434
438
  connection_id: config.id,
435
439
  connection_name: config.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dbx-app/mcp-server",
3
- "version": "0.4.29",
3
+ "version": "0.4.31",
4
4
  "description": "MCP server for DBX — query databases from Claude Code, Cursor, and other AI agents",
5
5
  "keywords": [
6
6
  "ai-agent",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@modelcontextprotocol/sdk": "^1.12.1",
32
32
  "zod": "^3.25.20",
33
- "@dbx-app/node-core": "^0.4.29"
33
+ "@dbx-app/node-core": "^0.4.31"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@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.29",
9
+ "version": "0.4.31",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@dbx-app/mcp-server",
14
- "version": "0.4.29",
14
+ "version": "0.4.31",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  }