forked from modelcontextprotocol/servers
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
42 lines (39 loc) · 1.28 KB
/
index.ts
File metadata and controls
42 lines (39 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env node
// Parse command line arguments first
const args = process.argv.slice(2);
const scriptName = args[0] || "stdio";
async function run() {
try {
// Dynamically import only the requested module to prevent all modules from initializing
switch (scriptName) {
case "stdio":
// Import and run the default server
await import("./transports/stdio.js");
break;
case "sse":
// Import and run the SSE server
await import("./transports/sse.js");
break;
case "streamableHttp":
// Import and run the streamable HTTP server
await import("./transports/streamableHttp.js");
break;
default:
console.error(`-`.repeat(53));
console.error(` Everything Server Launcher`);
console.error(` Usage: node ./index.js [stdio|sse|streamableHttp]`);
console.error(` Default transport: stdio`);
console.error(`-`.repeat(53));
console.error(`Unknown transport: ${scriptName}`);
console.log("Available transports:");
console.log("- stdio");
console.log("- sse");
console.log("- streamableHttp");
process.exit(1);
}
} catch (error) {
console.error("Error running script:", error);
process.exit(1);
}
}
await run();