@jadchene/mcp-gateway-service 0.1.0 → 0.1.1
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/gateway-server.js +12 -1
- package/dist/index.js +4 -2
- package/dist/mcp/client.js +1 -1
- package/package.json +1 -1
package/dist/gateway-server.js
CHANGED
|
@@ -19,6 +19,10 @@ export class GatewayServer {
|
|
|
19
19
|
* Stores the stdio message writer bound to the current process.
|
|
20
20
|
*/
|
|
21
21
|
writer = createMessageWriter(process.stdout);
|
|
22
|
+
/**
|
|
23
|
+
* Stores the startup barrier that must resolve before gateway tools can use the registry.
|
|
24
|
+
*/
|
|
25
|
+
startupBarrier = Promise.resolve();
|
|
22
26
|
/**
|
|
23
27
|
* Creates the gateway server.
|
|
24
28
|
*/
|
|
@@ -26,6 +30,12 @@ export class GatewayServer {
|
|
|
26
30
|
this.registry = registry;
|
|
27
31
|
this.logger = logger;
|
|
28
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Sets the startup barrier used to delay tool handling until the registry is ready.
|
|
35
|
+
*/
|
|
36
|
+
setStartupBarrier(barrier) {
|
|
37
|
+
this.startupBarrier = barrier;
|
|
38
|
+
}
|
|
29
39
|
/**
|
|
30
40
|
* Starts consuming inbound MCP messages from stdin.
|
|
31
41
|
*/
|
|
@@ -64,6 +74,7 @@ export class GatewayServer {
|
|
|
64
74
|
return;
|
|
65
75
|
}
|
|
66
76
|
if (request.method === "tools/call") {
|
|
77
|
+
await this.startupBarrier;
|
|
67
78
|
const result = await this.handleToolCall(request);
|
|
68
79
|
this.writer.write(jsonRpcResult(request.id, result));
|
|
69
80
|
return;
|
|
@@ -176,7 +187,7 @@ export class GatewayServer {
|
|
|
176
187
|
},
|
|
177
188
|
serverInfo: {
|
|
178
189
|
name: "mcp-gateway",
|
|
179
|
-
version: "0.1.
|
|
190
|
+
version: "0.1.1"
|
|
180
191
|
}
|
|
181
192
|
};
|
|
182
193
|
}
|
package/dist/index.js
CHANGED
|
@@ -40,10 +40,12 @@ class Application {
|
|
|
40
40
|
if (!existsSync(this.configPath)) {
|
|
41
41
|
throw new Error(`Config file was not found: ${this.configPath}`);
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
const startup = this.registry.initialize();
|
|
44
|
+
this.server.setStartupBarrier(startup);
|
|
44
45
|
this.server.start();
|
|
45
|
-
this.watcher.start();
|
|
46
46
|
this.registerSignals();
|
|
47
|
+
await startup;
|
|
48
|
+
this.watcher.start();
|
|
47
49
|
this.logger.info("gateway.started", {
|
|
48
50
|
configPath: this.configPath
|
|
49
51
|
});
|
package/dist/mcp/client.js
CHANGED
package/package.json
CHANGED