@kingsnow129/database-mcp 0.4.1 → 0.4.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 CHANGED
@@ -13,15 +13,15 @@ It provides tools for:
13
13
  ## Release
14
14
 
15
15
  Current release:
16
- - NPM package: `@kingsnow129/database-mcp@0.4.1`
16
+ - NPM package: `@kingsnow129/database-mcp@0.4.2`
17
17
  - MCP server name: `database-mcp`
18
- - VSIX helper: `database-mcp-helper@0.4.1`
18
+ - VSIX helper: `database-mcp-helper@0.4.2`
19
19
 
20
- ## What Is New In 0.4.1
20
+ ## What Is New In 0.4.2
21
21
 
22
- - Enforced hard read-only mode for all connections (no override).
23
- - Added stronger query safety blocks for execution patterns.
24
- - Allowed spaces in server profile names in VSIX manager (e.g. `QA EUD`).
22
+ - Added SQL Server Windows integrated auth support with `integratedAuth`.
23
+ - Added `--integratedAuth` CLI override handling in `connect` flow.
24
+ - Added optional dependency `msnodesqlv8` for integrated auth SQL Server driver.
25
25
 
26
26
  ## What Was Introduced In 0.4.0
27
27
 
@@ -117,7 +117,7 @@ Build and install locally:
117
117
  cd vscode-extension
118
118
  npm install
119
119
  npm run package
120
- code --install-extension database-mcp-helper-0.4.1.vsix --force
120
+ code --install-extension database-mcp-helper-0.4.2.vsix --force
121
121
  ```
122
122
 
123
123
  ## Safety Defaults
package/dist/server.js CHANGED
@@ -17,6 +17,8 @@ dotenv.config();
17
17
 
18
18
  const {Pool: PostgresPool}=pg;
19
19
 
20
+ let sqlMsnodesqlv8Cache;
21
+
20
22
  const SUPPORTED_ENGINES=new Set(["sqlserver","postgres","mysql"]);
21
23
 
22
24
  const CLI_OPTION_MAP={
@@ -35,6 +37,7 @@ const CLI_OPTION_MAP={
35
37
  database: "database",
36
38
  user: "user",
37
39
  password: "password",
40
+ integratedAuth: "integratedAuth",
38
41
  encrypt: "encrypt",
39
42
  ssl: "ssl",
40
43
  trustServerCertificate: "trustServerCertificate",
@@ -69,7 +72,7 @@ function parseCliArgs(argv) {
69
72
 
70
73
  const rawToken=String(token).slice(2);
71
74
  if(rawToken==="help") {
72
- console.error("Supported flags: --target --alias --serverName --defaultAlias --profilesFile --currentServer --currentDatabase --engine --host --connectionString --server --port --database --user --password --encrypt --ssl --trustServerCertificate --readOnly --maxRows");
75
+ console.error("Supported flags: --target --alias --serverName --defaultAlias --profilesFile --currentServer --currentDatabase --engine --host --connectionString --server --port --database --user --password --integratedAuth --encrypt --ssl --trustServerCertificate --readOnly --maxRows");
73
76
  process.exit(0);
74
77
  }
75
78
 
@@ -412,7 +415,12 @@ function buildConfig(overrides={}) {
412
415
  );
413
416
 
414
417
  const integratedAuth=boolFromEnv(
415
- firstDefined(overrides.integratedAuth,serverProfile?.integratedAuth,process.env.DB_INTEGRATED_AUTH),
418
+ firstDefined(
419
+ overrides.integratedAuth,
420
+ cliOptions.integratedAuth,
421
+ serverProfile?.integratedAuth,
422
+ process.env.DB_INTEGRATED_AUTH
423
+ ),
416
424
  false
417
425
  );
418
426
 
@@ -503,12 +511,9 @@ function createSqlServerConfig(config) {
503
511
  };
504
512
 
505
513
  if(config.integratedAuth) {
506
- baseConfig.authentication={
507
- type: "default",
508
- options: {
509
- userName: undefined,
510
- password: undefined
511
- }
514
+ baseConfig.options={
515
+ ...baseConfig.options,
516
+ trustedConnection: true
512
517
  };
513
518
  } else {
514
519
  baseConfig.user=config.user;
@@ -518,6 +523,36 @@ function createSqlServerConfig(config) {
518
523
  return baseConfig;
519
524
  }
520
525
 
526
+ function getSqlServerDriver(config) {
527
+ if(!config.integratedAuth) {
528
+ return {
529
+ module: sql,
530
+ driverName: "tedious"
531
+ };
532
+ }
533
+
534
+ if(process.platform!=="win32") {
535
+ throw new Error("SQL Server integratedAuth is only supported on Windows hosts.");
536
+ }
537
+
538
+ if(sqlMsnodesqlv8Cache===undefined) {
539
+ try {
540
+ sqlMsnodesqlv8Cache=_require("mssql/msnodesqlv8");
541
+ } catch {
542
+ sqlMsnodesqlv8Cache=null;
543
+ }
544
+ }
545
+
546
+ if(!sqlMsnodesqlv8Cache) {
547
+ throw new Error("Integrated auth requires the optional dependency 'msnodesqlv8'. Install it and restart MCP.");
548
+ }
549
+
550
+ return {
551
+ module: sqlMsnodesqlv8Cache,
552
+ driverName: "msnodesqlv8"
553
+ };
554
+ }
555
+
521
556
  function createPostgresConfig(config) {
522
557
  if(config.connectionString) {
523
558
  return {
@@ -670,9 +705,10 @@ async function connectPool(overrides={}) {
670
705
  await closePoolIfAny();
671
706
 
672
707
  if(config.engine==="sqlserver") {
708
+ const sqlDriver=getSqlServerDriver(config);
673
709
  const sqlConfig=createSqlServerConfig(config);
674
- const client=await new sql.ConnectionPool(sqlConfig).connect();
675
- connection={engine: "sqlserver",client};
710
+ const client=await new sqlDriver.module.ConnectionPool(sqlConfig).connect();
711
+ connection={engine: "sqlserver",client,sqlDriver: sqlDriver.driverName};
676
712
  } else if(config.engine==="postgres") {
677
713
  const pgConfig=createPostgresConfig(config);
678
714
  const client=new PostgresPool(pgConfig);
@@ -697,8 +733,10 @@ async function connectPool(overrides={}) {
697
733
  serverName: config.serverName,
698
734
  profileSource: config.profileSource,
699
735
  engine: config.engine,
736
+ sqlDriver: connection?.sqlDriver,
700
737
  host: config.host,
701
738
  database: config.database,
739
+ integratedAuth: config.integratedAuth,
702
740
  readOnly: runtimeSettings.readOnly,
703
741
  maxRows: runtimeSettings.maxRows
704
742
  };
@@ -797,6 +835,7 @@ async function handleToolCall(name,args={}) {
797
835
  ...(args.database? {database: args.database}:{}),
798
836
  ...(args.user? {user: args.user}:{}),
799
837
  ...(args.password? {password: args.password}:{}),
838
+ ...(args.integratedAuth!==undefined? {integratedAuth: Boolean(args.integratedAuth)}:{}),
800
839
  ...(args.maxRows!==undefined? {maxRows: Number(args.maxRows)}:{}),
801
840
  ...(args.encrypt!==undefined? {encrypt: Boolean(args.encrypt)}:{}),
802
841
  ...(args.ssl!==undefined? {ssl: Boolean(args.ssl)}:{}),
@@ -1011,6 +1050,7 @@ server.setRequestHandler(ListToolsRequestSchema,async () => {
1011
1050
  database: {type: "string"},
1012
1051
  user: {type: "string"},
1013
1052
  password: {type: "string"},
1053
+ integratedAuth: {type: "boolean"},
1014
1054
  encrypt: {type: "boolean"},
1015
1055
  ssl: {type: "boolean"},
1016
1056
  trustServerCertificate: {type: "boolean"},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingsnow129/database-mcp",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "mcpName": "io.github.kingsnow129/database-mcp",
5
5
  "description": "Database MCP server for SQL Server, PostgreSQL, and MySQL with profile-based auto resolution",
6
6
  "author": "kingsnow129",
@@ -51,5 +51,8 @@
51
51
  "mysql2": "^3.11.3",
52
52
  "mssql": "^11.0.1",
53
53
  "pg": "^8.13.1"
54
+ },
55
+ "optionalDependencies": {
56
+ "msnodesqlv8": "^4.4.0"
54
57
  }
55
58
  }