@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/index.js
CHANGED
|
@@ -1526,7 +1526,7 @@ init_connector_telemetry();
|
|
|
1526
1526
|
init_logging();
|
|
1527
1527
|
|
|
1528
1528
|
// src/utils/version.ts
|
|
1529
|
-
var VERSION = "2.2.0";
|
|
1529
|
+
var VERSION = "2.2.1-canary.0";
|
|
1530
1530
|
function getPackageVersion() {
|
|
1531
1531
|
return VERSION;
|
|
1532
1532
|
}
|
|
@@ -4321,7 +4321,9 @@ var BaseMCPClient = class {
|
|
|
4321
4321
|
* lifecycle of connections and provide methods for calling tools, listing
|
|
4322
4322
|
* resources, and more.
|
|
4323
4323
|
*
|
|
4324
|
-
* If a session already exists for the server, it will be replaced with a new
|
|
4324
|
+
* If a session already exists for the server, it will be replaced with a new
|
|
4325
|
+
* one and the previous session is disconnected; any previously returned
|
|
4326
|
+
* reference to it becomes unusable.
|
|
4325
4327
|
*
|
|
4326
4328
|
* @param serverName - The name of the server as defined in the client configuration
|
|
4327
4329
|
* @param autoInitialize - Whether to automatically initialize the session (default: true)
|
|
@@ -4394,10 +4396,21 @@ var BaseMCPClient = class {
|
|
|
4394
4396
|
await completeOAuthFlow(oauthProvider, httpConfig.url);
|
|
4395
4397
|
session = await openSession();
|
|
4396
4398
|
}
|
|
4399
|
+
const previous = this.sessions[serverName];
|
|
4397
4400
|
this.sessions[serverName] = session;
|
|
4398
4401
|
if (!this.activeSessions.includes(serverName)) {
|
|
4399
4402
|
this.activeSessions.push(serverName);
|
|
4400
4403
|
}
|
|
4404
|
+
if (previous && previous !== session) {
|
|
4405
|
+
try {
|
|
4406
|
+
logger.debug(`Disconnecting replaced session for server ${serverName}`);
|
|
4407
|
+
await previous.disconnect();
|
|
4408
|
+
} catch (e) {
|
|
4409
|
+
logger.error(
|
|
4410
|
+
`Error disconnecting replaced session for server '${serverName}': ${e}`
|
|
4411
|
+
);
|
|
4412
|
+
}
|
|
4413
|
+
}
|
|
4401
4414
|
return session;
|
|
4402
4415
|
}
|
|
4403
4416
|
/**
|