@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/react/index.js
CHANGED
|
@@ -456,6 +456,7 @@ import {
|
|
|
456
456
|
discoverOAuthProtectedResourceMetadata,
|
|
457
457
|
SdkError,
|
|
458
458
|
SdkHttpError,
|
|
459
|
+
selectResourceURL,
|
|
459
460
|
StreamableHTTPClientTransport,
|
|
460
461
|
UnauthorizedError as UnauthorizedError2
|
|
461
462
|
} from "@modelcontextprotocol/client";
|
|
@@ -1626,19 +1627,20 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1626
1627
|
await this.completeInteractiveAuthorization();
|
|
1627
1628
|
}
|
|
1628
1629
|
async discoverAuthorization() {
|
|
1629
|
-
|
|
1630
|
+
const provider = this.oauthProvider;
|
|
1631
|
+
if (!this.detectMixedAuth || !provider || this.hadAccessTokenAtConnect) {
|
|
1630
1632
|
return this.authorizationCache;
|
|
1631
1633
|
}
|
|
1632
1634
|
if (this.authorizationDiscovery) return this.authorizationDiscovery;
|
|
1633
|
-
this.authorizationDiscovery = this.discoverMixedAuthorization(
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
);
|
|
1635
|
+
this.authorizationDiscovery = this.discoverMixedAuthorization(
|
|
1636
|
+
provider
|
|
1637
|
+
).then((authorization) => {
|
|
1638
|
+
if (!authorization) this.authorizationDiscovery = null;
|
|
1639
|
+
return authorization;
|
|
1640
|
+
});
|
|
1639
1641
|
return this.authorizationDiscovery;
|
|
1640
1642
|
}
|
|
1641
|
-
async discoverMixedAuthorization() {
|
|
1643
|
+
async discoverMixedAuthorization(provider) {
|
|
1642
1644
|
const controller = new AbortController();
|
|
1643
1645
|
let timeout;
|
|
1644
1646
|
const discoveryTimeout = new Promise((_, reject) => {
|
|
@@ -1660,6 +1662,7 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1660
1662
|
),
|
|
1661
1663
|
discoveryTimeout
|
|
1662
1664
|
]);
|
|
1665
|
+
await selectResourceURL(this.baseUrl, provider, metadata);
|
|
1663
1666
|
this.authorizationCache = {
|
|
1664
1667
|
mode: "mixed",
|
|
1665
1668
|
authenticated: false,
|
|
@@ -1976,7 +1979,7 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1976
1979
|
};
|
|
1977
1980
|
|
|
1978
1981
|
// src/utils/version.ts
|
|
1979
|
-
var VERSION = "2.4.4
|
|
1982
|
+
var VERSION = "2.4.4";
|
|
1980
1983
|
function getPackageVersion() {
|
|
1981
1984
|
return VERSION;
|
|
1982
1985
|
}
|
|
@@ -2325,7 +2328,11 @@ var OAuthSessionStore = class _OAuthSessionStore {
|
|
|
2325
2328
|
if (legacyData) {
|
|
2326
2329
|
try {
|
|
2327
2330
|
const legacyValue = JSON.parse(legacyData);
|
|
2328
|
-
if (
|
|
2331
|
+
if (typeof legacyValue.issuer !== "string" || !legacyValue.issuer.trim()) {
|
|
2332
|
+
await this.store.remove(legacyKey);
|
|
2333
|
+
return void 0;
|
|
2334
|
+
}
|
|
2335
|
+
if (legacyValue.issuer === ctx.issuer) {
|
|
2329
2336
|
const migratedValue = {
|
|
2330
2337
|
...legacyValue,
|
|
2331
2338
|
issuer: ctx.issuer
|
|
@@ -2343,7 +2350,12 @@ var OAuthSessionStore = class _OAuthSessionStore {
|
|
|
2343
2350
|
}
|
|
2344
2351
|
if (!data) return void 0;
|
|
2345
2352
|
try {
|
|
2346
|
-
|
|
2353
|
+
const value = JSON.parse(data);
|
|
2354
|
+
if (typeof value?.issuer !== "string" || !value.issuer.trim() || ctx && value.issuer !== ctx.issuer) {
|
|
2355
|
+
await this.store.remove(key);
|
|
2356
|
+
return void 0;
|
|
2357
|
+
}
|
|
2358
|
+
return { key, value };
|
|
2347
2359
|
} catch (e) {
|
|
2348
2360
|
console.warn(
|
|
2349
2361
|
`[${this.storageKeyPrefix}] Failed to parse ${kind.replace("_", " ")}:`,
|