@bytebase/dbhub 1.2.0 → 1.2.2
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 +31 -2
- package/dist/{chunk-RSB7DPO2.js → chunk-6QETXS44.js} +56 -1
- package/dist/{chunk-QEFMUQJ2.js → chunk-A4TSDCPY.js} +1 -1
- package/dist/{chunk-CUBIR72I.js → chunk-F5TPYAVO.js} +38 -6
- package/dist/{chunk-PBN2UXB5.js → chunk-IQRBLAB4.js} +1 -1
- package/dist/{chunk-WIQ4DWGY.js → chunk-MF6LSVWK.js} +3 -1
- package/dist/index.js +15 -11
- package/dist/{mariadb-E33EXGJZ.js → mariadb-DQ6P57IX.js} +13 -6
- package/dist/{mysql-RLDQI3SJ.js → mysql-GXDUNLJ6.js} +13 -6
- package/dist/{postgres-6XY2GPQV.js → postgres-2FHS64EO.js} +26 -14
- package/dist/public/assets/{index-DOZ5HOZ9.js → index-BdBaFSHd.js} +38 -38
- package/dist/public/index.html +1 -1
- package/dist/{registry-XMEJF7WW.js → registry-6ABK3M6V.js} +2 -2
- package/dist/{sqlite-CZE6Z36Y.js → sqlite-ASYMU5BI.js} +20 -12
- package/dist/{sqlserver-IIGRXGYK.js → sqlserver-WNVSBFJ3.js} +36 -16
- package/package.json +2 -1
package/dist/public/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>DBHub - Minimal Database MCP Server</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-BdBaFSHd.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-BJ-1UrcV.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
ToolRegistry,
|
|
3
3
|
getToolRegistry,
|
|
4
4
|
initializeToolRegistry
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-F5TPYAVO.js";
|
|
6
6
|
import "./chunk-WVVMH6FJ.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-MF6LSVWK.js";
|
|
8
8
|
export {
|
|
9
9
|
ToolRegistry,
|
|
10
10
|
getToolRegistry,
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
SQLRowLimiter,
|
|
6
6
|
closeQuietly
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6QETXS44.js";
|
|
8
8
|
import {
|
|
9
9
|
ConnectorRegistry,
|
|
10
10
|
SafeURL,
|
|
11
11
|
obfuscateDSNPassword,
|
|
12
12
|
splitSQLStatements
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-MF6LSVWK.js";
|
|
14
14
|
|
|
15
15
|
// src/connectors/sqlite/suppress-experimental-warning.ts
|
|
16
16
|
var installed = false;
|
|
@@ -334,17 +334,20 @@ var SQLiteConnector = class _SQLiteConnector {
|
|
|
334
334
|
let processedStatement = statements[0];
|
|
335
335
|
const trimmedStatement = statements[0].toLowerCase().trim();
|
|
336
336
|
const isReadStatement = trimmedStatement.startsWith("select") || trimmedStatement.startsWith("with") || trimmedStatement.startsWith("explain") || trimmedStatement.startsWith("analyze") || trimmedStatement.startsWith("pragma") && (trimmedStatement.includes("table_info") || trimmedStatement.includes("index_info") || trimmedStatement.includes("index_list") || trimmedStatement.includes("foreign_key_list"));
|
|
337
|
+
let probeApplied = false;
|
|
337
338
|
if (options.maxRows) {
|
|
338
|
-
|
|
339
|
+
const rewrite = SQLRowLimiter.applyMaxRowsWithTruncationProbe(
|
|
340
|
+
processedStatement,
|
|
341
|
+
options.maxRows
|
|
342
|
+
);
|
|
343
|
+
processedStatement = rewrite.sql;
|
|
344
|
+
probeApplied = rewrite.probeApplied;
|
|
339
345
|
}
|
|
340
346
|
if (isReadStatement) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
const rows = this.prepare(processedStatement).all();
|
|
346
|
-
return { resultSets: [{ sql: statements[0], rows, rowCount: rows.length }] };
|
|
347
|
-
}
|
|
347
|
+
const rows = parameters && parameters.length > 0 ? this.prepare(processedStatement).all(...parameters) : this.prepare(processedStatement).all();
|
|
348
|
+
const resultSet = { sql: statements[0], rows, rowCount: rows.length };
|
|
349
|
+
SQLRowLimiter.flagTruncation(resultSet, options.maxRows, probeApplied);
|
|
350
|
+
return { resultSets: [resultSet] };
|
|
348
351
|
} else {
|
|
349
352
|
let result;
|
|
350
353
|
if (parameters && parameters.length > 0) {
|
|
@@ -382,9 +385,14 @@ var SQLiteConnector = class _SQLiteConnector {
|
|
|
382
385
|
if (options.readonly) {
|
|
383
386
|
this.db.exec("PRAGMA query_only = ON");
|
|
384
387
|
}
|
|
385
|
-
const processedStatement = SQLRowLimiter.
|
|
388
|
+
const { sql: processedStatement, probeApplied } = SQLRowLimiter.applyMaxRowsWithTruncationProbe(
|
|
389
|
+
statement,
|
|
390
|
+
options.maxRows
|
|
391
|
+
);
|
|
386
392
|
const rows = this.prepare(processedStatement).all();
|
|
387
|
-
|
|
393
|
+
const resultSet = { sql: statement, rows, rowCount: rows.length };
|
|
394
|
+
SQLRowLimiter.flagTruncation(resultSet, options.maxRows, probeApplied);
|
|
395
|
+
resultSets.push(resultSet);
|
|
388
396
|
}
|
|
389
397
|
return { resultSets };
|
|
390
398
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
sqlServerDynamicSqlPattern,
|
|
4
4
|
sqlServerPassThroughKeywords,
|
|
5
5
|
sqlServerPassThroughPattern
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IQRBLAB4.js";
|
|
7
7
|
import {
|
|
8
8
|
isDriverNotInstalled
|
|
9
9
|
} from "./chunk-WVVMH6FJ.js";
|
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
SQLRowLimiter,
|
|
16
16
|
closeQuietly
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-6QETXS44.js";
|
|
18
18
|
import {
|
|
19
19
|
ConnectorRegistry,
|
|
20
20
|
SafeURL,
|
|
21
21
|
obfuscateDSNPassword,
|
|
22
22
|
splitSQLStatements,
|
|
23
23
|
stripCommentsAndStrings
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-MF6LSVWK.js";
|
|
25
25
|
|
|
26
26
|
// src/connectors/sqlserver/index.ts
|
|
27
27
|
import sql from "mssql";
|
|
@@ -562,12 +562,24 @@ var _SQLServerConnector = class _SQLServerConnector {
|
|
|
562
562
|
}
|
|
563
563
|
try {
|
|
564
564
|
let processedSQL = sqlQuery;
|
|
565
|
+
let probeApplied = false;
|
|
565
566
|
if (options.maxRows) {
|
|
566
|
-
|
|
567
|
+
const rewrite = SQLRowLimiter.applyMaxRowsForSQLServerWithTruncationProbe(
|
|
568
|
+
sqlQuery,
|
|
569
|
+
options.maxRows
|
|
570
|
+
);
|
|
571
|
+
processedSQL = rewrite.sql;
|
|
572
|
+
probeApplied = rewrite.probeApplied;
|
|
567
573
|
}
|
|
568
574
|
const isSingleStatement = splitSQLStatements(processedSQL, "sqlserver").length === 1;
|
|
569
575
|
if (options.readonly) {
|
|
570
|
-
return await this.executeReadOnly(
|
|
576
|
+
return await this.executeReadOnly(
|
|
577
|
+
processedSQL,
|
|
578
|
+
parameters,
|
|
579
|
+
isSingleStatement ? sqlQuery : void 0,
|
|
580
|
+
options.maxRows,
|
|
581
|
+
probeApplied
|
|
582
|
+
);
|
|
571
583
|
}
|
|
572
584
|
const request = this.connection.request();
|
|
573
585
|
const messages = [];
|
|
@@ -585,12 +597,16 @@ var _SQLServerConnector = class _SQLServerConnector {
|
|
|
585
597
|
);
|
|
586
598
|
_SQLServerConnector.bindParameters(request, parameters);
|
|
587
599
|
const result = await request.query(processedSQL);
|
|
600
|
+
const resultSets = _SQLServerConnector.buildResultSets(
|
|
601
|
+
result.recordsets,
|
|
602
|
+
result.rowsAffected,
|
|
603
|
+
isSingleStatement ? sqlQuery : void 0
|
|
604
|
+
);
|
|
605
|
+
if (resultSets.length > 0) {
|
|
606
|
+
SQLRowLimiter.flagTruncation(resultSets[0], options.maxRows, probeApplied);
|
|
607
|
+
}
|
|
588
608
|
return {
|
|
589
|
-
resultSets
|
|
590
|
-
result.recordsets,
|
|
591
|
-
result.rowsAffected,
|
|
592
|
-
isSingleStatement ? processedSQL : void 0
|
|
593
|
-
),
|
|
609
|
+
resultSets,
|
|
594
610
|
...messages.length > 0 ? { messages } : {}
|
|
595
611
|
};
|
|
596
612
|
} catch (error) {
|
|
@@ -718,7 +734,7 @@ var _SQLServerConnector = class _SQLServerConnector {
|
|
|
718
734
|
* Dangerous constructs are rejected before the transaction opens; see
|
|
719
735
|
* assertNoReadOnlyEscapes.
|
|
720
736
|
*/
|
|
721
|
-
async executeReadOnly(processedSQL, parameters,
|
|
737
|
+
async executeReadOnly(processedSQL, parameters, sourceSql, maxRows, probeApplied) {
|
|
722
738
|
this.assertNoReadOnlyEscapes(processedSQL, { transactionControl: true });
|
|
723
739
|
const transaction = new sql.Transaction(this.connection);
|
|
724
740
|
await transaction.begin();
|
|
@@ -754,12 +770,16 @@ var _SQLServerConnector = class _SQLServerConnector {
|
|
|
754
770
|
}
|
|
755
771
|
}
|
|
756
772
|
}
|
|
773
|
+
const resultSets = _SQLServerConnector.buildResultSets(
|
|
774
|
+
result.recordsets,
|
|
775
|
+
result.rowsAffected,
|
|
776
|
+
sourceSql
|
|
777
|
+
);
|
|
778
|
+
if (resultSets.length > 0) {
|
|
779
|
+
SQLRowLimiter.flagTruncation(resultSets[0], maxRows, probeApplied);
|
|
780
|
+
}
|
|
757
781
|
return {
|
|
758
|
-
resultSets
|
|
759
|
-
result.recordsets,
|
|
760
|
-
result.rowsAffected,
|
|
761
|
-
isSingleStatement ? processedSQL : void 0
|
|
762
|
-
),
|
|
782
|
+
resultSets,
|
|
763
783
|
...messages.length > 0 ? { messages } : {}
|
|
764
784
|
};
|
|
765
785
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebase/dbhub",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"mcpName": "io.github.bytebase/dbhub",
|
|
5
5
|
"description": "Minimal, token-efficient Database MCP Server for PostgreSQL, MySQL, SQL Server, SQLite, MariaDB",
|
|
6
6
|
"repository": {
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"zod": "^4.2.0"
|
|
56
56
|
},
|
|
57
57
|
"optionalDependencies": {
|
|
58
|
+
"@aws-sdk/credential-providers": "^3.1001.0",
|
|
58
59
|
"@aws-sdk/rds-signer": "^3.1001.0",
|
|
59
60
|
"@azure/identity": "^4.8.0",
|
|
60
61
|
"mariadb": "^3.4.0",
|