@mcp-use/client 2.4.4-canary.0 → 2.4.4
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/auth/session-store.d.ts.map +1 -1
- package/dist/index-browser.js +23 -11
- package/dist/index-browser.js.map +1 -1
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +23 -11
- package/dist/react/index.js.map +1 -1
- package/dist/transport/http.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1659,7 +1659,7 @@ init_connector_telemetry();
|
|
|
1659
1659
|
init_logging();
|
|
1660
1660
|
|
|
1661
1661
|
// src/utils/version.ts
|
|
1662
|
-
var VERSION = "2.4.4
|
|
1662
|
+
var VERSION = "2.4.4";
|
|
1663
1663
|
function getPackageVersion() {
|
|
1664
1664
|
return VERSION;
|
|
1665
1665
|
}
|
|
@@ -2397,7 +2397,11 @@ var OAuthSessionStore = class _OAuthSessionStore {
|
|
|
2397
2397
|
if (legacyData) {
|
|
2398
2398
|
try {
|
|
2399
2399
|
const legacyValue = JSON.parse(legacyData);
|
|
2400
|
-
if (
|
|
2400
|
+
if (typeof legacyValue.issuer !== "string" || !legacyValue.issuer.trim()) {
|
|
2401
|
+
await this.store.remove(legacyKey);
|
|
2402
|
+
return void 0;
|
|
2403
|
+
}
|
|
2404
|
+
if (legacyValue.issuer === ctx.issuer) {
|
|
2401
2405
|
const migratedValue = {
|
|
2402
2406
|
...legacyValue,
|
|
2403
2407
|
issuer: ctx.issuer
|
|
@@ -2415,7 +2419,12 @@ var OAuthSessionStore = class _OAuthSessionStore {
|
|
|
2415
2419
|
}
|
|
2416
2420
|
if (!data) return void 0;
|
|
2417
2421
|
try {
|
|
2418
|
-
|
|
2422
|
+
const value = JSON.parse(data);
|
|
2423
|
+
if (typeof value?.issuer !== "string" || !value.issuer.trim() || ctx && value.issuer !== ctx.issuer) {
|
|
2424
|
+
await this.store.remove(key);
|
|
2425
|
+
return void 0;
|
|
2426
|
+
}
|
|
2427
|
+
return { key, value };
|
|
2419
2428
|
} catch (e) {
|
|
2420
2429
|
console.warn(
|
|
2421
2430
|
`[${this.storageKeyPrefix}] Failed to parse ${kind.replace("_", " ")}:`,
|
|
@@ -3084,6 +3093,7 @@ import {
|
|
|
3084
3093
|
discoverOAuthProtectedResourceMetadata,
|
|
3085
3094
|
SdkError,
|
|
3086
3095
|
SdkHttpError,
|
|
3096
|
+
selectResourceURL,
|
|
3087
3097
|
StreamableHTTPClientTransport,
|
|
3088
3098
|
UnauthorizedError as UnauthorizedError2
|
|
3089
3099
|
} from "@modelcontextprotocol/client";
|
|
@@ -3256,19 +3266,20 @@ var HttpConnector = class extends BaseConnector {
|
|
|
3256
3266
|
await this.completeInteractiveAuthorization();
|
|
3257
3267
|
}
|
|
3258
3268
|
async discoverAuthorization() {
|
|
3259
|
-
|
|
3269
|
+
const provider = this.oauthProvider;
|
|
3270
|
+
if (!this.detectMixedAuth || !provider || this.hadAccessTokenAtConnect) {
|
|
3260
3271
|
return this.authorizationCache;
|
|
3261
3272
|
}
|
|
3262
3273
|
if (this.authorizationDiscovery) return this.authorizationDiscovery;
|
|
3263
|
-
this.authorizationDiscovery = this.discoverMixedAuthorization(
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
);
|
|
3274
|
+
this.authorizationDiscovery = this.discoverMixedAuthorization(
|
|
3275
|
+
provider
|
|
3276
|
+
).then((authorization) => {
|
|
3277
|
+
if (!authorization) this.authorizationDiscovery = null;
|
|
3278
|
+
return authorization;
|
|
3279
|
+
});
|
|
3269
3280
|
return this.authorizationDiscovery;
|
|
3270
3281
|
}
|
|
3271
|
-
async discoverMixedAuthorization() {
|
|
3282
|
+
async discoverMixedAuthorization(provider) {
|
|
3272
3283
|
const controller = new AbortController();
|
|
3273
3284
|
let timeout;
|
|
3274
3285
|
const discoveryTimeout = new Promise((_, reject) => {
|
|
@@ -3290,6 +3301,7 @@ var HttpConnector = class extends BaseConnector {
|
|
|
3290
3301
|
),
|
|
3291
3302
|
discoveryTimeout
|
|
3292
3303
|
]);
|
|
3304
|
+
await selectResourceURL(this.baseUrl, provider, metadata);
|
|
3293
3305
|
this.authorizationCache = {
|
|
3294
3306
|
mode: "mixed",
|
|
3295
3307
|
authenticated: false,
|