@mcpc-tech/core 0.3.41 → 0.3.42
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.cjs +18 -3
- package/index.mjs +18 -3
- package/package.json +1 -1
- package/types/src/compose.d.ts +2 -0
- package/types/src/compose.d.ts.map +1 -1
package/index.cjs
CHANGED
|
@@ -20347,6 +20347,7 @@ var ComposableMCPServer = class extends Server {
|
|
|
20347
20347
|
toolManager;
|
|
20348
20348
|
logger = createLogger("mcpc.compose");
|
|
20349
20349
|
fileLoaders = /* @__PURE__ */ new Map();
|
|
20350
|
+
pluginsDisposed = false;
|
|
20350
20351
|
// Legacy property for backward compatibility
|
|
20351
20352
|
get toolNameMapping() {
|
|
20352
20353
|
return this.toolManager.getToolNameMapping();
|
|
@@ -20822,11 +20823,21 @@ var ComposableMCPServer = class extends Server {
|
|
|
20822
20823
|
async disposePlugins() {
|
|
20823
20824
|
await this.pluginManager.dispose();
|
|
20824
20825
|
}
|
|
20826
|
+
/**
|
|
20827
|
+
* Dispose plugins only once to avoid duplicated cleanup in chained handlers.
|
|
20828
|
+
*/
|
|
20829
|
+
async disposePluginsOnce() {
|
|
20830
|
+
if (this.pluginsDisposed) {
|
|
20831
|
+
return;
|
|
20832
|
+
}
|
|
20833
|
+
this.pluginsDisposed = true;
|
|
20834
|
+
await this.disposePlugins();
|
|
20835
|
+
}
|
|
20825
20836
|
/**
|
|
20826
20837
|
* Close the server and ensure all plugins are disposed
|
|
20827
20838
|
*/
|
|
20828
20839
|
async close() {
|
|
20829
|
-
await this.
|
|
20840
|
+
await this.disposePluginsOnce();
|
|
20830
20841
|
await super.close();
|
|
20831
20842
|
}
|
|
20832
20843
|
async compose(name, description, depsConfig = {
|
|
@@ -20931,16 +20942,20 @@ var ComposableMCPServer = class extends Server {
|
|
|
20931
20942
|
server: this,
|
|
20932
20943
|
toolNames: Object.keys(allTools)
|
|
20933
20944
|
});
|
|
20945
|
+
const previousOnClose = this.onclose;
|
|
20934
20946
|
this.onclose = async () => {
|
|
20935
20947
|
await cleanupClients();
|
|
20936
|
-
await this.
|
|
20948
|
+
await this.disposePluginsOnce();
|
|
20937
20949
|
await this.logger.info(`[${name}] Event: closed - cleaned up dependent clients and plugins`);
|
|
20950
|
+
previousOnClose?.();
|
|
20938
20951
|
};
|
|
20952
|
+
const previousOnError = this.onerror;
|
|
20939
20953
|
this.onerror = async (error2) => {
|
|
20940
20954
|
await this.logger.error(`[${name}] Event: error - ${error2?.stack ?? String(error2)}`);
|
|
20941
20955
|
await cleanupClients();
|
|
20942
|
-
await this.
|
|
20956
|
+
await this.disposePluginsOnce();
|
|
20943
20957
|
await this.logger.info(`[${name}] Action: cleaned up dependent clients and plugins`);
|
|
20958
|
+
previousOnError?.(error2);
|
|
20944
20959
|
};
|
|
20945
20960
|
const toolNameToDetailList = Object.entries(allTools);
|
|
20946
20961
|
const publicToolNames = this.getPublicToolNames();
|
package/index.mjs
CHANGED
|
@@ -20334,6 +20334,7 @@ var ComposableMCPServer = class extends Server {
|
|
|
20334
20334
|
toolManager;
|
|
20335
20335
|
logger = createLogger("mcpc.compose");
|
|
20336
20336
|
fileLoaders = /* @__PURE__ */ new Map();
|
|
20337
|
+
pluginsDisposed = false;
|
|
20337
20338
|
// Legacy property for backward compatibility
|
|
20338
20339
|
get toolNameMapping() {
|
|
20339
20340
|
return this.toolManager.getToolNameMapping();
|
|
@@ -20809,11 +20810,21 @@ var ComposableMCPServer = class extends Server {
|
|
|
20809
20810
|
async disposePlugins() {
|
|
20810
20811
|
await this.pluginManager.dispose();
|
|
20811
20812
|
}
|
|
20813
|
+
/**
|
|
20814
|
+
* Dispose plugins only once to avoid duplicated cleanup in chained handlers.
|
|
20815
|
+
*/
|
|
20816
|
+
async disposePluginsOnce() {
|
|
20817
|
+
if (this.pluginsDisposed) {
|
|
20818
|
+
return;
|
|
20819
|
+
}
|
|
20820
|
+
this.pluginsDisposed = true;
|
|
20821
|
+
await this.disposePlugins();
|
|
20822
|
+
}
|
|
20812
20823
|
/**
|
|
20813
20824
|
* Close the server and ensure all plugins are disposed
|
|
20814
20825
|
*/
|
|
20815
20826
|
async close() {
|
|
20816
|
-
await this.
|
|
20827
|
+
await this.disposePluginsOnce();
|
|
20817
20828
|
await super.close();
|
|
20818
20829
|
}
|
|
20819
20830
|
async compose(name, description, depsConfig = {
|
|
@@ -20918,16 +20929,20 @@ var ComposableMCPServer = class extends Server {
|
|
|
20918
20929
|
server: this,
|
|
20919
20930
|
toolNames: Object.keys(allTools)
|
|
20920
20931
|
});
|
|
20932
|
+
const previousOnClose = this.onclose;
|
|
20921
20933
|
this.onclose = async () => {
|
|
20922
20934
|
await cleanupClients();
|
|
20923
|
-
await this.
|
|
20935
|
+
await this.disposePluginsOnce();
|
|
20924
20936
|
await this.logger.info(`[${name}] Event: closed - cleaned up dependent clients and plugins`);
|
|
20937
|
+
previousOnClose?.();
|
|
20925
20938
|
};
|
|
20939
|
+
const previousOnError = this.onerror;
|
|
20926
20940
|
this.onerror = async (error2) => {
|
|
20927
20941
|
await this.logger.error(`[${name}] Event: error - ${error2?.stack ?? String(error2)}`);
|
|
20928
20942
|
await cleanupClients();
|
|
20929
|
-
await this.
|
|
20943
|
+
await this.disposePluginsOnce();
|
|
20930
20944
|
await this.logger.info(`[${name}] Action: cleaned up dependent clients and plugins`);
|
|
20945
|
+
previousOnError?.(error2);
|
|
20931
20946
|
};
|
|
20932
20947
|
const toolNameToDetailList = Object.entries(allTools);
|
|
20933
20948
|
const publicToolNames = this.getPublicToolNames();
|
package/package.json
CHANGED
package/types/src/compose.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class ComposableMCPServer extends Server {
|
|
|
10
10
|
private toolManager: any;
|
|
11
11
|
private logger: any;
|
|
12
12
|
private fileLoaders: any;
|
|
13
|
+
private pluginsDisposed: any;
|
|
13
14
|
get toolNameMapping(): Map<string, string>;
|
|
14
15
|
constructor(_serverInfo: Implementation, options: ServerOptions);
|
|
15
16
|
/**
|
|
@@ -128,6 +129,7 @@ export declare class ComposableMCPServer extends Server {
|
|
|
128
129
|
/**
|
|
129
130
|
* Dispose all plugins and cleanup resources
|
|
130
131
|
*/ disposePlugins(): Promise<void>;
|
|
132
|
+
private disposePluginsOnce: any;
|
|
131
133
|
/**
|
|
132
134
|
* Close the server and ensure all plugins are disposed
|
|
133
135
|
*/ override close(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.d.ts","sources":["../../src/compose.ts"],"names":[],"mappings":"AAAA,SAGE,KAAK,cAAc,EAGnB,KAAK,IAAI,6CAC8C;AACzD,SAAwC,KAAK,MAAM,4BAA4B;AAC/E,cAAc,UAAU,6BAA6B;AACrD,SACE,MAAM,EACN,KAAK,aAAa,oDAC4C;AAGhE,cAAc,iBAAiB,EAAE,UAAU,kCAAkC;AAC7E,cAAc,UAAU,EAAE,YAAY,qBAAqB;AAM3D,cAAc,YAAY,EAAE,UAAU,EAAE,UAAU,4BAA4B;AAe9E,OAAO,cAAM,4BAA4B;EACvC,QAAQ,mBAA6B;EACrC,QAAQ,iBAAyB;EACjC,QAAQ,YAAsC;EAC9C,QAAQ,iBAA4C;
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sources":["../../src/compose.ts"],"names":[],"mappings":"AAAA,SAGE,KAAK,cAAc,EAGnB,KAAK,IAAI,6CAC8C;AACzD,SAAwC,KAAK,MAAM,4BAA4B;AAC/E,cAAc,UAAU,6BAA6B;AACrD,SACE,MAAM,EACN,KAAK,aAAa,oDAC4C;AAGhE,cAAc,iBAAiB,EAAE,UAAU,kCAAkC;AAC7E,cAAc,UAAU,EAAE,YAAY,qBAAqB;AAM3D,cAAc,YAAY,EAAE,UAAU,EAAE,UAAU,4BAA4B;AAe9E,OAAO,cAAM,4BAA4B;EACvC,QAAQ,mBAA6B;EACrC,QAAQ,iBAAyB;EACjC,QAAQ,YAAsC;EAC9C,QAAQ,iBAA4C;EACpD,QAAQ,qBAAwB;EAGhC,IA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