mcp-proxy-conductor 0.1.2 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +22 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -115,7 +115,7 @@ import {
115
115
  } from "@modelcontextprotocol/sdk/types.js";
116
116
 
117
117
  // src/version.ts
118
- var VERSION = "0.1.2";
118
+ var VERSION = "0.1.3";
119
119
 
120
120
  // src/registry/connection.ts
121
121
  var EMPTY = { tools: [], resources: [], prompts: [] };
@@ -576,6 +576,22 @@ async function createConductor(opts = {}) {
576
576
  }
577
577
  };
578
578
  }
579
+ function installShutdownHandlers(conductor, proc = process) {
580
+ let shuttingDown = false;
581
+ const shutdown = async (signal) => {
582
+ if (shuttingDown) return;
583
+ shuttingDown = true;
584
+ try {
585
+ await conductor.manager.closeAll();
586
+ } catch (err) {
587
+ console.error(`ai-conductor shutdown error on ${signal}:`, err);
588
+ } finally {
589
+ proc.exit(0);
590
+ }
591
+ };
592
+ proc.on("SIGINT", shutdown);
593
+ proc.on("SIGTERM", shutdown);
594
+ }
579
595
  function isMainModule(argv1, importMetaUrl) {
580
596
  if (!argv1) return false;
581
597
  try {
@@ -585,12 +601,16 @@ function isMainModule(argv1, importMetaUrl) {
585
601
  }
586
602
  }
587
603
  if (isMainModule(process.argv[1], import.meta.url)) {
588
- createConductor().then((c) => c.start()).catch((err) => {
604
+ createConductor().then(async (c) => {
605
+ installShutdownHandlers(c);
606
+ await c.start();
607
+ }).catch((err) => {
589
608
  console.error("ai-conductor failed to start:", err);
590
609
  process.exit(1);
591
610
  });
592
611
  }
593
612
  export {
594
613
  createConductor,
614
+ installShutdownHandlers,
595
615
  isMainModule
596
616
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-proxy-conductor",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Local MCP proxy that aggregates dynamically managed downstream MCP servers, managed at runtime without restarting the client.",
5
5
  "type": "module",
6
6
  "license": "MIT",