@mcp-use/client 2.2.0 → 2.2.1-canary.0
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/dist/.tsbuildinfo +1 -1
- package/dist/core/base.d.ts +3 -1
- package/dist/core/base.d.ts.map +1 -1
- package/dist/index-browser.js +15 -2
- package/dist/index-browser.js.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +15 -2
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/core/base.d.ts
CHANGED
|
@@ -214,7 +214,9 @@ export declare abstract class BaseMCPClient {
|
|
|
214
214
|
* lifecycle of connections and provide methods for calling tools, listing
|
|
215
215
|
* resources, and more.
|
|
216
216
|
*
|
|
217
|
-
* If a session already exists for the server, it will be replaced with a new
|
|
217
|
+
* If a session already exists for the server, it will be replaced with a new
|
|
218
|
+
* one and the previous session is disconnected; any previously returned
|
|
219
|
+
* reference to it becomes unusable.
|
|
218
220
|
*
|
|
219
221
|
* @param serverName - The name of the server as defined in the client configuration
|
|
220
222
|
* @param autoInitialize - Whether to automatically initialize the session (default: true)
|
package/dist/core/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/core/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EACV,gBAAgB,EAEhB,oBAAoB,EACpB,YAAY,EACb,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAiBlD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,8BAAsB,aAAa;IACjC;;OAEG;IACH,SAAS,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,EAAE,gBAAgB,GACzB,OAAO,CAAC,mBAAmB,CAAC;IAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACU,aAAa,CACxB,UAAU,EAAE,MAAM,EAClB,cAAc,UAAO,GACpB,OAAO,CAAC,UAAU,CAAC;IAiGtB;;;;;;;;;OASG;IACU,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIhE;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACU,iBAAiB,CAC5B,cAAc,UAAO,GACpB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IActC;;;;;OAKG;IACU,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAIjE;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAQxD;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACI,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU;IAUrD;;;;;;;;;;;;;;;;;;;OAmBG;IACI,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAMzD;;;;;;;;;;;;;;;;;;;;OAoBG;IACU,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4B5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACU,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB9C,yCAAyC;IAC5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAGpC"}
|
package/dist/index-browser.js
CHANGED
|
@@ -128,7 +128,7 @@ var Logger = class {
|
|
|
128
128
|
var logger = Logger.get();
|
|
129
129
|
|
|
130
130
|
// src/utils/version.ts
|
|
131
|
-
var VERSION = "2.2.0";
|
|
131
|
+
var VERSION = "2.2.1-canary.0";
|
|
132
132
|
function getPackageVersion() {
|
|
133
133
|
return VERSION;
|
|
134
134
|
}
|
|
@@ -4201,7 +4201,9 @@ var BaseMCPClient = class {
|
|
|
4201
4201
|
* lifecycle of connections and provide methods for calling tools, listing
|
|
4202
4202
|
* resources, and more.
|
|
4203
4203
|
*
|
|
4204
|
-
* If a session already exists for the server, it will be replaced with a new
|
|
4204
|
+
* If a session already exists for the server, it will be replaced with a new
|
|
4205
|
+
* one and the previous session is disconnected; any previously returned
|
|
4206
|
+
* reference to it becomes unusable.
|
|
4205
4207
|
*
|
|
4206
4208
|
* @param serverName - The name of the server as defined in the client configuration
|
|
4207
4209
|
* @param autoInitialize - Whether to automatically initialize the session (default: true)
|
|
@@ -4274,10 +4276,21 @@ var BaseMCPClient = class {
|
|
|
4274
4276
|
await completeOAuthFlow(oauthProvider, httpConfig.url);
|
|
4275
4277
|
session = await openSession();
|
|
4276
4278
|
}
|
|
4279
|
+
const previous = this.sessions[serverName];
|
|
4277
4280
|
this.sessions[serverName] = session;
|
|
4278
4281
|
if (!this.activeSessions.includes(serverName)) {
|
|
4279
4282
|
this.activeSessions.push(serverName);
|
|
4280
4283
|
}
|
|
4284
|
+
if (previous && previous !== session) {
|
|
4285
|
+
try {
|
|
4286
|
+
logger.debug(`Disconnecting replaced session for server ${serverName}`);
|
|
4287
|
+
await previous.disconnect();
|
|
4288
|
+
} catch (e) {
|
|
4289
|
+
logger.error(
|
|
4290
|
+
`Error disconnecting replaced session for server '${serverName}': ${e}`
|
|
4291
|
+
);
|
|
4292
|
+
}
|
|
4293
|
+
}
|
|
4281
4294
|
return session;
|
|
4282
4295
|
}
|
|
4283
4296
|
/**
|