@aiwerk/mcp-bridge 1.1.5 → 1.1.6

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.
@@ -2,7 +2,7 @@
2
2
  import { readFileSync, existsSync } from "fs";
3
3
  import { join, dirname, resolve } from "path";
4
4
  import { fileURLToPath } from "url";
5
- import { execSync } from "child_process";
5
+ import { execFileSync } from "child_process";
6
6
  import { loadConfig, initConfigDir } from "../src/config.js";
7
7
  import { StandaloneServer } from "../src/standalone-server.js";
8
8
  import { PACKAGE_VERSION } from "../src/protocol.js";
@@ -224,7 +224,7 @@ function cmdInstall(serverName, logger) {
224
224
  process.exit(1);
225
225
  }
226
226
  try {
227
- execSync(`bash "${scriptPath}" "${serverName}"`, { stdio: "inherit" });
227
+ execFileSync("bash", [scriptPath, serverName], { stdio: "inherit" });
228
228
  }
229
229
  catch (err) {
230
230
  process.exit(1);
@@ -57,7 +57,7 @@ export async function fetchToolsList(transport) {
57
57
  cursor = nextCursor;
58
58
  }
59
59
  if (page >= MAX_PAGES) {
60
- console.warn("[mcp-bridge] Tool list pagination exceeded max pages, possible cursor loop");
60
+ process.stderr.write("[mcp-bridge] Tool list pagination exceeded max pages, possible cursor loop\n");
61
61
  }
62
62
  return allTools;
63
63
  }
@@ -1,7 +1,7 @@
1
1
  import { McpTransport, McpRequest, McpResponse, McpServerConfig, McpClientConfig, Logger } from "./types.js";
2
2
  export type PendingRequest = {
3
- resolve: Function;
4
- reject: Function;
3
+ resolve: (value: McpResponse) => void;
4
+ reject: (reason: Error) => void;
5
5
  timeout: NodeJS.Timeout;
6
6
  };
7
7
  /**
@@ -31,7 +31,8 @@ export class BaseTransport {
31
31
  * - Responses with id -> resolve/reject matching pending request
32
32
  */
33
33
  handleMessage(message) {
34
- if (!message.id && message.method === "notifications/tools/list_changed") {
34
+ const hasId = message.id !== undefined && message.id !== null;
35
+ if (!hasId && message.method === "notifications/tools/list_changed") {
35
36
  if (this.onReconnected) {
36
37
  this.onReconnected().catch((error) => {
37
38
  this.logger.error("[mcp-bridge] Failed to refresh tools after list_changed notification:", error);
@@ -39,11 +40,11 @@ export class BaseTransport {
39
40
  }
40
41
  return;
41
42
  }
42
- if (!message.id && message.method) {
43
+ if (!hasId && message.method) {
43
44
  this.logger.debug(`[mcp-bridge] Unhandled ${this.transportName} notification: ${message.method}`);
44
45
  return;
45
46
  }
46
- if (message.id && this.pendingRequests.has(message.id)) {
47
+ if (hasId && this.pendingRequests.has(message.id)) {
47
48
  const pending = this.pendingRequests.get(message.id);
48
49
  clearTimeout(pending.timeout);
49
50
  this.pendingRequests.delete(message.id);
@@ -12,6 +12,9 @@ export class SseTransport extends BaseTransport {
12
12
  warnIfNonTlsRemoteUrl(this.config.url, this.logger);
13
13
  // Validate that all header env vars resolve (fail fast)
14
14
  resolveEnvRecord(this.config.headers || {}, "header");
15
+ if (this.sseAbortController) {
16
+ this.sseAbortController.abort();
17
+ }
15
18
  this.sseAbortController = new AbortController();
16
19
  const connectionTimeout = this.clientConfig.connectionTimeoutMs || 10000;
17
20
  const streamReady = new Promise((resolve, reject) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwerk/mcp-bridge",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Standalone MCP server that multiplexes multiple MCP servers into one interface",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",