mssql-mcp 2.3.4 → 2.3.5
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 +1 -1
- package/dist/src/constants.d.ts +1 -1
- package/dist/src/constants.js +1 -1
- package/dist/src/transports/stdio.js +14 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/src/constants.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const SERVER_NAME = "mssql-mcp-server";
|
|
2
|
-
export declare const SERVER_VERSION = "2.3.
|
|
2
|
+
export declare const SERVER_VERSION = "2.3.5";
|
|
3
3
|
export declare const DEFAULT_PORT = 1433;
|
|
4
4
|
export declare const DEFAULT_ENCRYPT = true;
|
|
5
5
|
export declare const DEFAULT_TRUST_SERVER_CERTIFICATE = false;
|
package/dist/src/constants.js
CHANGED
|
@@ -2,12 +2,24 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
2
2
|
import { closePoolOnShutdown } from "../db/connection.js";
|
|
3
3
|
export async function runStdioTransport(server) {
|
|
4
4
|
const transport = new StdioServerTransport();
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
let shuttingDown = false;
|
|
6
|
+
const shutdown = async (reason) => {
|
|
7
|
+
if (shuttingDown)
|
|
8
|
+
return;
|
|
9
|
+
shuttingDown = true;
|
|
10
|
+
console.error(`\nShutting down (${reason})...`);
|
|
7
11
|
await closePoolOnShutdown();
|
|
8
12
|
console.error("Server stopped.");
|
|
9
13
|
process.exit(0);
|
|
10
14
|
};
|
|
15
|
+
// Per the MCP stdio spec, the client signals shutdown by closing the child's
|
|
16
|
+
// stdin; the server is expected to exit when stdin reaches EOF. Windows does
|
|
17
|
+
// not reliably deliver OS signals to child processes when the parent exits,
|
|
18
|
+
// so we must also react to stdin EOF and transport close, otherwise orphaned
|
|
19
|
+
// node processes accumulate. See https://github.com/BYMCS/mssql-mcp/issues/2
|
|
20
|
+
transport.onclose = () => shutdown("stdio-close");
|
|
21
|
+
process.stdin.on("end", () => shutdown("stdin-end"));
|
|
22
|
+
process.stdin.on("close", () => shutdown("stdin-close"));
|
|
11
23
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
12
24
|
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
13
25
|
process.on("SIGUSR2", () => shutdown("SIGUSR2"));
|