toolbox-co-mcp-bridge 1.0.2 → 1.0.3
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 +5 -2
- package/package.json +1 -1
- package/test_sse.mjs +15 -0
package/index.js
CHANGED
|
@@ -3,10 +3,12 @@ import EventSource from "eventsource";
|
|
|
3
3
|
import fetch from "node-fetch";
|
|
4
4
|
import readline from "readline";
|
|
5
5
|
|
|
6
|
-
// The hardcoded remote SSE endpoint for ToolBox Co. SaaS tools
|
|
7
6
|
const sseUrl = "https://toolbox-mcp-1058072229791.us-central1.run.app/sse";
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
// Forcibly cache-bust the EventSource to bypass any aggressive client/network/ISP proxies
|
|
9
|
+
const finalSseUrl = `${sseUrl}?t=${Date.now()}`;
|
|
10
|
+
console.error(`[ToolBox Bridge] Opening strict bypass connection to: ${finalSseUrl}`);
|
|
11
|
+
const es = new EventSource(finalSseUrl);
|
|
10
12
|
let postEndpoint = '';
|
|
11
13
|
const messageQueue = [];
|
|
12
14
|
|
|
@@ -32,6 +34,7 @@ async function sendPost(msg) {
|
|
|
32
34
|
es.addEventListener("endpoint", async (e) => {
|
|
33
35
|
try {
|
|
34
36
|
postEndpoint = new URL(e.data, sseUrl).toString();
|
|
37
|
+
console.error(`[ToolBox Bridge] Successfully received dynamic POST endpoint: ${postEndpoint}`);
|
|
35
38
|
|
|
36
39
|
// Flush any queued messages that arrived before we got the endpoint
|
|
37
40
|
for (const msg of messageQueue) {
|
package/package.json
CHANGED
package/test_sse.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import fetch from "node-fetch";
|
|
2
|
+
|
|
3
|
+
async function main() {
|
|
4
|
+
const sseUrl = "https://toolbox-mcp-1058072229791.us-central1.run.app/sse";
|
|
5
|
+
console.log("Fetching", sseUrl);
|
|
6
|
+
const res = await fetch(sseUrl);
|
|
7
|
+
console.log("Status:", res.status);
|
|
8
|
+
console.log("Headers:", JSON.stringify([...res.headers.entries()]));
|
|
9
|
+
|
|
10
|
+
for await (const chunk of res.body) {
|
|
11
|
+
console.log("Chunk:", chunk.toString());
|
|
12
|
+
break; // just read the first chunk to see the endpoint event
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
main().catch(console.error);
|