@atolucky6/mcp-mssql-server 0.0.0-stage → 0.1.0

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.
Files changed (105) hide show
  1. package/LICENSE +21 -0
  2. package/cli.js +25 -0
  3. package/config-cli.js +149 -0
  4. package/package.json +7 -4
  5. package/runtime/Azure.Core.dll +0 -0
  6. package/runtime/Azure.Identity.dll +0 -0
  7. package/runtime/McpMsSqlServer.deps.json +1253 -0
  8. package/runtime/McpMsSqlServer.dll +0 -0
  9. package/runtime/McpMsSqlServer.exe +0 -0
  10. package/runtime/McpMsSqlServer.pdb +0 -0
  11. package/runtime/McpMsSqlServer.runtimeconfig.json +13 -0
  12. package/runtime/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  13. package/runtime/Microsoft.Data.SqlClient.dll +0 -0
  14. package/runtime/Microsoft.Extensions.AI.Abstractions.dll +0 -0
  15. package/runtime/Microsoft.Extensions.Caching.Abstractions.dll +0 -0
  16. package/runtime/Microsoft.Extensions.Caching.Memory.dll +0 -0
  17. package/runtime/Microsoft.Extensions.Configuration.Abstractions.dll +0 -0
  18. package/runtime/Microsoft.Extensions.Configuration.Binder.dll +0 -0
  19. package/runtime/Microsoft.Extensions.Configuration.CommandLine.dll +0 -0
  20. package/runtime/Microsoft.Extensions.Configuration.EnvironmentVariables.dll +0 -0
  21. package/runtime/Microsoft.Extensions.Configuration.FileExtensions.dll +0 -0
  22. package/runtime/Microsoft.Extensions.Configuration.Json.dll +0 -0
  23. package/runtime/Microsoft.Extensions.Configuration.UserSecrets.dll +0 -0
  24. package/runtime/Microsoft.Extensions.Configuration.dll +0 -0
  25. package/runtime/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
  26. package/runtime/Microsoft.Extensions.DependencyInjection.dll +0 -0
  27. package/runtime/Microsoft.Extensions.Diagnostics.Abstractions.dll +0 -0
  28. package/runtime/Microsoft.Extensions.Diagnostics.dll +0 -0
  29. package/runtime/Microsoft.Extensions.FileProviders.Abstractions.dll +0 -0
  30. package/runtime/Microsoft.Extensions.FileProviders.Physical.dll +0 -0
  31. package/runtime/Microsoft.Extensions.FileSystemGlobbing.dll +0 -0
  32. package/runtime/Microsoft.Extensions.Hosting.Abstractions.dll +0 -0
  33. package/runtime/Microsoft.Extensions.Hosting.dll +0 -0
  34. package/runtime/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
  35. package/runtime/Microsoft.Extensions.Logging.Configuration.dll +0 -0
  36. package/runtime/Microsoft.Extensions.Logging.Console.dll +0 -0
  37. package/runtime/Microsoft.Extensions.Logging.Debug.dll +0 -0
  38. package/runtime/Microsoft.Extensions.Logging.EventLog.dll +0 -0
  39. package/runtime/Microsoft.Extensions.Logging.EventSource.dll +0 -0
  40. package/runtime/Microsoft.Extensions.Logging.dll +0 -0
  41. package/runtime/Microsoft.Extensions.Options.ConfigurationExtensions.dll +0 -0
  42. package/runtime/Microsoft.Extensions.Options.dll +0 -0
  43. package/runtime/Microsoft.Extensions.Primitives.dll +0 -0
  44. package/runtime/Microsoft.Identity.Client.Broker.dll +0 -0
  45. package/runtime/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  46. package/runtime/Microsoft.Identity.Client.NativeInterop.dll +0 -0
  47. package/runtime/Microsoft.Identity.Client.dll +0 -0
  48. package/runtime/Microsoft.IdentityModel.Abstractions.dll +0 -0
  49. package/runtime/Microsoft.IdentityModel.JsonWebTokens.dll +0 -0
  50. package/runtime/Microsoft.IdentityModel.Logging.dll +0 -0
  51. package/runtime/Microsoft.IdentityModel.Protocols.OpenIdConnect.dll +0 -0
  52. package/runtime/Microsoft.IdentityModel.Protocols.dll +0 -0
  53. package/runtime/Microsoft.IdentityModel.Tokens.dll +0 -0
  54. package/runtime/Microsoft.SqlServer.Server.dll +0 -0
  55. package/runtime/Microsoft.SqlServer.TransactSql.ScriptDom.dll +0 -0
  56. package/runtime/ModelContextProtocol.dll +0 -0
  57. package/runtime/System.ClientModel.dll +0 -0
  58. package/runtime/System.Configuration.ConfigurationManager.dll +0 -0
  59. package/runtime/System.Diagnostics.EventLog.dll +0 -0
  60. package/runtime/System.IdentityModel.Tokens.Jwt.dll +0 -0
  61. package/runtime/System.Memory.Data.dll +0 -0
  62. package/runtime/System.Net.ServerSentEvents.dll +0 -0
  63. package/runtime/System.Security.Cryptography.Pkcs.dll +0 -0
  64. package/runtime/System.Security.Cryptography.ProtectedData.dll +0 -0
  65. package/runtime/cs/Microsoft.Data.SqlClient.resources.dll +0 -0
  66. package/runtime/cs/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  67. package/runtime/de/Microsoft.Data.SqlClient.resources.dll +0 -0
  68. package/runtime/de/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  69. package/runtime/es/Microsoft.Data.SqlClient.resources.dll +0 -0
  70. package/runtime/es/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  71. package/runtime/fr/Microsoft.Data.SqlClient.resources.dll +0 -0
  72. package/runtime/fr/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  73. package/runtime/it/Microsoft.Data.SqlClient.resources.dll +0 -0
  74. package/runtime/it/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  75. package/runtime/ja/Microsoft.Data.SqlClient.resources.dll +0 -0
  76. package/runtime/ja/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  77. package/runtime/ko/Microsoft.Data.SqlClient.resources.dll +0 -0
  78. package/runtime/ko/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  79. package/runtime/pl/Microsoft.Data.SqlClient.resources.dll +0 -0
  80. package/runtime/pl/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  81. package/runtime/pt-BR/Microsoft.Data.SqlClient.resources.dll +0 -0
  82. package/runtime/pt-BR/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  83. package/runtime/ru/Microsoft.Data.SqlClient.resources.dll +0 -0
  84. package/runtime/ru/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  85. package/runtime/runtimes/linux-x64/native/libmsalruntime.so +4 -0
  86. package/runtime/runtimes/osx-arm64/native/msalruntime_arm64.dylib +0 -0
  87. package/runtime/runtimes/osx-x64/native/msalruntime.dylib +0 -0
  88. package/runtime/runtimes/unix/lib/net9.0/Microsoft.Data.SqlClient.dll +0 -0
  89. package/runtime/runtimes/win/lib/net9.0/Microsoft.Data.SqlClient.dll +0 -0
  90. package/runtime/runtimes/win/lib/net9.0/System.Diagnostics.EventLog.Messages.dll +0 -0
  91. package/runtime/runtimes/win/lib/net9.0/System.Diagnostics.EventLog.dll +0 -0
  92. package/runtime/runtimes/win/lib/net9.0/System.Security.Cryptography.Pkcs.dll +0 -0
  93. package/runtime/runtimes/win-arm64/native/Microsoft.Data.SqlClient.SNI.dll +0 -0
  94. package/runtime/runtimes/win-arm64/native/msalruntime_arm64.dll +0 -0
  95. package/runtime/runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.dll +0 -0
  96. package/runtime/runtimes/win-x64/native/msalruntime.dll +0 -0
  97. package/runtime/runtimes/win-x86/native/Microsoft.Data.SqlClient.SNI.dll +0 -0
  98. package/runtime/runtimes/win-x86/native/msalruntime_x86.dll +0 -0
  99. package/runtime/tr/Microsoft.Data.SqlClient.resources.dll +0 -0
  100. package/runtime/tr/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  101. package/runtime/zh-Hans/Microsoft.Data.SqlClient.resources.dll +0 -0
  102. package/runtime/zh-Hans/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  103. package/runtime/zh-Hant/Microsoft.Data.SqlClient.resources.dll +0 -0
  104. package/runtime/zh-Hant/Microsoft.SqlServer.TransactSql.ScriptDom.resources.dll +0 -0
  105. package/README.md +0 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ncdframas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/cli.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require("child_process");
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ const args = process.argv.slice(2);
7
+ if (args[0] === "config") {
8
+ require("./config-cli").run(args.slice(1));
9
+ return;
10
+ }
11
+
12
+ const dll = path.join(__dirname, "runtime", "McpMsSqlServer.dll");
13
+ if (!fs.existsSync(dll)) {
14
+ console.error(`Missing binary: ${dll}. Run npm/publish.ps1 first.`);
15
+ process.exit(1);
16
+ }
17
+
18
+ // stdio must pass through untouched: MCP speaks over stdin/stdout.
19
+ const env = { ...process.env, MCP_CONFIG_PATH: require("./config-cli").resolveConfigDir() };
20
+ const child = spawn("dotnet", [dll, ...args], { stdio: "inherit", env });
21
+ child.on("exit", (code) => process.exit(code ?? 0));
22
+ child.on("error", (err) => {
23
+ console.error(err.code === "ENOENT" ? "The .NET 9 runtime is required: https://dotnet.microsoft.com/download/dotnet/9.0" : err.message);
24
+ process.exit(1);
25
+ });
package/config-cli.js ADDED
@@ -0,0 +1,149 @@
1
+ const fs = require("fs");
2
+ const os = require("os");
3
+ const path = require("path");
4
+
5
+ const USAGE = `Usage: mcp-mssql-server config <command> [options]
6
+
7
+ Commands:
8
+ path Print the config directory
9
+ list List configurations
10
+ show <name> Print a configuration (passwords masked)
11
+ add <name> --connection-string <cs> [--target <db.schema>]...
12
+ Create a configuration with safe defaults
13
+ set <name> <key> <value> Set a value by dot path, e.g. security.maxRowsPerQuery 500
14
+ (value is parsed as JSON, otherwise kept as a string)
15
+ remove <name> Delete a configuration
16
+
17
+ Options:
18
+ --config-dir <dir> Override the config directory
19
+ (default: $MCP_CONFIG_PATH, else ~/.config/mcp-mssql-server)`;
20
+
21
+ function resolveConfigDir(flagDir) {
22
+ return flagDir || process.env.MCP_CONFIG_PATH || path.join(os.homedir(), ".config", "mcp-mssql-server");
23
+ }
24
+
25
+ function defaultConfig(name, connectionString, targets) {
26
+ return {
27
+ name,
28
+ connectionString,
29
+ allowedTargets: targets,
30
+ permissions: { allowRead: true, allowWrite: false, allowDelete: false, allowSchemaChanges: false, allowExecute: false },
31
+ security: {
32
+ requireWhereClause: true, maxRowsPerQuery: 1000, maxRowsPerUpdate: 100, maxRowsPerDelete: 10,
33
+ auditOperations: true, backupRecommendations: true,
34
+ },
35
+ querySettings: { timeoutSeconds: 30, enableQueryPlan: false, allowJoins: true, allowSubqueries: true },
36
+ restrictedTables: [],
37
+ allowedOperations: ["SELECT"],
38
+ };
39
+ }
40
+
41
+ function parseArgs(argv) {
42
+ const positional = [];
43
+ const flags = {};
44
+ for (let i = 0; i < argv.length; i++) {
45
+ if (argv[i].startsWith("--")) {
46
+ const key = argv[i].slice(2);
47
+ const value = argv[++i];
48
+ if (value === undefined) fail(`Missing value for --${key}`);
49
+ (flags[key] ??= []).push(value);
50
+ } else {
51
+ positional.push(argv[i]);
52
+ }
53
+ }
54
+ return { positional, flags };
55
+ }
56
+
57
+ function fail(message) {
58
+ console.error(message);
59
+ process.exit(1);
60
+ }
61
+
62
+ function fileFor(dir, name) {
63
+ // The name becomes a filename; reject anything that could escape the directory.
64
+ if (!/^[A-Za-z0-9_-]+$/.test(name || "")) fail("Name must match [A-Za-z0-9_-]+");
65
+ return path.join(dir, `${name}.json`);
66
+ }
67
+
68
+ function mask(config) {
69
+ const copy = JSON.parse(JSON.stringify(config));
70
+ if (typeof copy.connectionString === "string") {
71
+ copy.connectionString = copy.connectionString.replace(/((?:password|pwd)\s*=)[^;]*/gi, "$1***");
72
+ }
73
+ return copy;
74
+ }
75
+
76
+ function readConfig(file) {
77
+ if (!fs.existsSync(file)) fail(`Not found: ${file}`);
78
+ return JSON.parse(fs.readFileSync(file, "utf8"));
79
+ }
80
+
81
+ function writeConfig(file, config) {
82
+ fs.mkdirSync(path.dirname(file), { recursive: true });
83
+ fs.writeFileSync(file, JSON.stringify(config, null, 2) + "\n", { mode: 0o600 });
84
+ }
85
+
86
+ function run(argv) {
87
+ const { positional, flags } = parseArgs(argv);
88
+ const [command, name, key, value] = positional;
89
+ const dir = resolveConfigDir(flags["config-dir"]?.[0]);
90
+
91
+ switch (command) {
92
+ case "path":
93
+ console.log(dir);
94
+ break;
95
+ case "list": {
96
+ const names = fs.existsSync(dir)
97
+ ? fs.readdirSync(dir).filter((f) => f.endsWith(".json") && !f.endsWith(".procedures.json")).map((f) => f.slice(0, -5))
98
+ : [];
99
+ names.forEach((n) => console.log(n));
100
+ break;
101
+ }
102
+ case "show":
103
+ console.log(JSON.stringify(mask(readConfig(fileFor(dir, name))), null, 2));
104
+ break;
105
+ case "add": {
106
+ const file = fileFor(dir, name);
107
+ if (fs.existsSync(file)) fail(`Already exists: ${file}`);
108
+ const cs = flags["connection-string"]?.[0];
109
+ if (!cs) fail("--connection-string is required");
110
+ const targets = (flags.target ?? []).map((t) => {
111
+ const [database, schema] = t.split(".");
112
+ if (!database || !schema) fail(`Invalid --target '${t}', expected <db>.<schema>`);
113
+ return { database, schema };
114
+ });
115
+ writeConfig(file, defaultConfig(name, cs, targets));
116
+ console.log(`Created ${file}`);
117
+ break;
118
+ }
119
+ case "set": {
120
+ if (!key || value === undefined) fail("Usage: config set <name> <key> <value>");
121
+ const file = fileFor(dir, name);
122
+ const config = readConfig(file);
123
+ const parts = key.split(".");
124
+ let node = config;
125
+ for (const p of parts.slice(0, -1)) {
126
+ if (typeof node[p] !== "object" || node[p] === null) fail(`Unknown key: ${key}`);
127
+ node = node[p];
128
+ }
129
+ const leaf = parts[parts.length - 1];
130
+ if (!(leaf in node)) fail(`Unknown key: ${key}`);
131
+ try { node[leaf] = JSON.parse(value); } catch { node[leaf] = value; }
132
+ writeConfig(file, config);
133
+ console.log(`Updated ${key} in ${file}`);
134
+ break;
135
+ }
136
+ case "remove": {
137
+ const file = fileFor(dir, name);
138
+ if (!fs.existsSync(file)) fail(`Not found: ${file}`);
139
+ fs.unlinkSync(file);
140
+ console.log(`Removed ${file}`);
141
+ break;
142
+ }
143
+ default:
144
+ console.log(USAGE);
145
+ process.exit(command ? 1 : 0);
146
+ }
147
+ }
148
+
149
+ module.exports = { run, resolveConfigDir };
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@atolucky6/mcp-mssql-server",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "MCP server for MS SQL Server (.NET), launched via npx",
5
+ "bin": { "mcp-mssql-server": "cli.js" },
6
+ "files": ["LICENSE", "cli.js", "config-cli.js", "runtime"],
7
+ "engines": { "node": ">=18" },
8
+ "license": "MIT"
9
+ }
Binary file
Binary file