@jadchene/mcp-gateway-service 0.3.3 → 0.3.4
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/dist/index.js +18 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,6 +7,10 @@ import { GatewayServer } from "./gateway-server.js";
|
|
|
7
7
|
import { Logger } from "./logger.js";
|
|
8
8
|
import { ServiceRegistry } from "./service-registry.js";
|
|
9
9
|
import { VERSION } from "./version.js";
|
|
10
|
+
/**
|
|
11
|
+
* Lists OS signals that should trigger a graceful gateway shutdown.
|
|
12
|
+
*/
|
|
13
|
+
export const SHUTDOWN_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
10
14
|
/**
|
|
11
15
|
* Boots the MCP gateway process and wires config reload handling.
|
|
12
16
|
*/
|
|
@@ -68,22 +72,25 @@ class Application {
|
|
|
68
72
|
await this.registry.dispose();
|
|
69
73
|
process.exit(0);
|
|
70
74
|
};
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
for (const signal of SHUTDOWN_SIGNALS) {
|
|
76
|
+
process.on(signal, () => void shutdown(signal));
|
|
77
|
+
}
|
|
73
78
|
process.stdin.on("end", () => void shutdown("stdin-end"));
|
|
74
79
|
process.stdin.on("close", () => void shutdown("stdin-close"));
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
process.
|
|
80
|
-
|
|
82
|
+
if (import.meta.main) {
|
|
83
|
+
const application = new Application();
|
|
84
|
+
if (process.argv.includes("-v") || process.argv.includes("--version")) {
|
|
85
|
+
process.stdout.write(`${VERSION}\n`);
|
|
86
|
+
process.exit(0);
|
|
87
|
+
}
|
|
88
|
+
void application.start().catch((error) => {
|
|
89
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
90
|
+
process.stderr.write(`${message}\n`);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
});
|
|
81
93
|
}
|
|
82
|
-
void application.start().catch((error) => {
|
|
83
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
84
|
-
process.stderr.write(`${message}\n`);
|
|
85
|
-
process.exit(1);
|
|
86
|
-
});
|
|
87
94
|
function getConfigPath() {
|
|
88
95
|
const args = process.argv.slice(2);
|
|
89
96
|
const configIndex = args.indexOf("--config");
|
package/package.json
CHANGED