toolbox-co-mcp-bridge 1.0.9 → 1.0.10
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/index.js +16 -4
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
import express from "express";
|
|
2
3
|
import cors from "cors";
|
|
3
4
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
5
|
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
6
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
7
|
import crypto from "crypto";
|
|
6
8
|
import bcrypt from "bcryptjs";
|
|
7
9
|
import yaml from "yaml";
|
|
@@ -562,7 +564,17 @@ app.post("/message", express.json(), async (req, res) => {
|
|
|
562
564
|
await transport.handlePostMessage(req, res, req.body);
|
|
563
565
|
});
|
|
564
566
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
567
|
+
if (process.argv.includes("--stdio")) {
|
|
568
|
+
const mcpServer = createServer();
|
|
569
|
+
const transport = new StdioServerTransport();
|
|
570
|
+
mcpServer.connect(transport).then(() => {
|
|
571
|
+
console.error("ToolBox Co MCP Server running on stdio");
|
|
572
|
+
}).catch((err) => {
|
|
573
|
+
console.error("Failed to start Stdio transport:", err);
|
|
574
|
+
});
|
|
575
|
+
} else {
|
|
576
|
+
const PORT = process.env.PORT || 8080;
|
|
577
|
+
app.listen(PORT, () => {
|
|
578
|
+
console.log(`ToolBox Mega MCP Server listening on port ${PORT}`);
|
|
579
|
+
});
|
|
580
|
+
}
|