@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/react/index.js
CHANGED
|
@@ -1901,7 +1901,7 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1901
1901
|
};
|
|
1902
1902
|
|
|
1903
1903
|
// src/utils/version.ts
|
|
1904
|
-
var VERSION = "2.2.0";
|
|
1904
|
+
var VERSION = "2.2.1-canary.0";
|
|
1905
1905
|
function getPackageVersion() {
|
|
1906
1906
|
return VERSION;
|
|
1907
1907
|
}
|
|
@@ -4185,7 +4185,9 @@ var BaseMCPClient = class {
|
|
|
4185
4185
|
* lifecycle of connections and provide methods for calling tools, listing
|
|
4186
4186
|
* resources, and more.
|
|
4187
4187
|
*
|
|
4188
|
-
* If a session already exists for the server, it will be replaced with a new
|
|
4188
|
+
* If a session already exists for the server, it will be replaced with a new
|
|
4189
|
+
* one and the previous session is disconnected; any previously returned
|
|
4190
|
+
* reference to it becomes unusable.
|
|
4189
4191
|
*
|
|
4190
4192
|
* @param serverName - The name of the server as defined in the client configuration
|
|
4191
4193
|
* @param autoInitialize - Whether to automatically initialize the session (default: true)
|
|
@@ -4258,10 +4260,21 @@ var BaseMCPClient = class {
|
|
|
4258
4260
|
await completeOAuthFlow(oauthProvider, httpConfig.url);
|
|
4259
4261
|
session = await openSession();
|
|
4260
4262
|
}
|
|
4263
|
+
const previous = this.sessions[serverName];
|
|
4261
4264
|
this.sessions[serverName] = session;
|
|
4262
4265
|
if (!this.activeSessions.includes(serverName)) {
|
|
4263
4266
|
this.activeSessions.push(serverName);
|
|
4264
4267
|
}
|
|
4268
|
+
if (previous && previous !== session) {
|
|
4269
|
+
try {
|
|
4270
|
+
logger.debug(`Disconnecting replaced session for server ${serverName}`);
|
|
4271
|
+
await previous.disconnect();
|
|
4272
|
+
} catch (e) {
|
|
4273
|
+
logger.error(
|
|
4274
|
+
`Error disconnecting replaced session for server '${serverName}': ${e}`
|
|
4275
|
+
);
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4265
4278
|
return session;
|
|
4266
4279
|
}
|
|
4267
4280
|
/**
|