@mcp-use/client 2.0.0-beta.8 → 2.0.0-beta.9
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/index-browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +15 -17
- package/dist/react/index.js.map +1 -1
- package/dist/react/useMcp.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index-browser.js
CHANGED
package/dist/index.js
CHANGED
package/dist/react/index.js
CHANGED
|
@@ -1473,7 +1473,7 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1473
1473
|
};
|
|
1474
1474
|
|
|
1475
1475
|
// src/utils/version.ts
|
|
1476
|
-
var VERSION = "2.0.0-beta.
|
|
1476
|
+
var VERSION = "2.0.0-beta.8";
|
|
1477
1477
|
function getPackageVersion() {
|
|
1478
1478
|
return VERSION;
|
|
1479
1479
|
}
|
|
@@ -5210,19 +5210,20 @@ function useMcp(options) {
|
|
|
5210
5210
|
addLog("info", "Triggering fresh OAuth authorization...");
|
|
5211
5211
|
const parsedUrl = new URL(url);
|
|
5212
5212
|
const baseUrl = parsedUrl.origin + parsedUrl.pathname.replace(/\/+$/, "");
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5213
|
+
const authResult = await auth2(freshAuthProvider, {
|
|
5214
|
+
serverUrl: baseUrl,
|
|
5215
|
+
fetchFn: freshAuthProvider.getProxyFetch?.()
|
|
5216
|
+
});
|
|
5217
|
+
if (authResult === "AUTHORIZED") {
|
|
5218
5218
|
addLog("info", "OAuth flow completed (tokens obtained)");
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
"OAuth flow initiated (popup/redirect):",
|
|
5223
|
-
err instanceof Error ? err.message : "Redirecting..."
|
|
5224
|
-
);
|
|
5219
|
+
connectingRef.current = false;
|
|
5220
|
+
connectRef.current?.();
|
|
5221
|
+
return;
|
|
5225
5222
|
}
|
|
5223
|
+
if (authResult !== "REDIRECT") {
|
|
5224
|
+
throw new Error(`Unexpected OAuth auth() result: ${authResult}`);
|
|
5225
|
+
}
|
|
5226
|
+
addLog("info", "OAuth authorization redirect initiated");
|
|
5226
5227
|
const newAuthUrl = freshAuthProvider.getLastAttemptedAuthUrl?.();
|
|
5227
5228
|
if (newAuthUrl) {
|
|
5228
5229
|
setAuthUrl(newAuthUrl);
|
|
@@ -5288,11 +5289,8 @@ function useMcp(options) {
|
|
|
5288
5289
|
}
|
|
5289
5290
|
} catch (authError) {
|
|
5290
5291
|
if (!isMountedRef.current) return;
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
"error",
|
|
5294
|
-
`Manual authentication failed: ${authError instanceof Error ? authError.message : String(authError)}`
|
|
5295
|
-
);
|
|
5292
|
+
const error2 = authError instanceof Error ? authError : new Error(String(authError));
|
|
5293
|
+
failConnection(`Manual authentication failed: ${error2.message}`, error2);
|
|
5296
5294
|
}
|
|
5297
5295
|
} else if (currentState === "authenticating") {
|
|
5298
5296
|
addLog(
|