@mcp-use/client 2.2.1 → 2.2.2
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 +61 -61
- 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
|
@@ -1901,7 +1901,7 @@ var HttpConnector = class extends BaseConnector {
|
|
|
1901
1901
|
};
|
|
1902
1902
|
|
|
1903
1903
|
// src/utils/version.ts
|
|
1904
|
-
var VERSION = "2.2.
|
|
1904
|
+
var VERSION = "2.2.2";
|
|
1905
1905
|
function getPackageVersion() {
|
|
1906
1906
|
return VERSION;
|
|
1907
1907
|
}
|
|
@@ -5864,6 +5864,66 @@ function useMcp(options) {
|
|
|
5864
5864
|
addLog("debug", "Server capabilities:", capabilities2);
|
|
5865
5865
|
setCapabilities(capabilities2);
|
|
5866
5866
|
}
|
|
5867
|
+
if (authProviderRef.current) {
|
|
5868
|
+
let tokens;
|
|
5869
|
+
try {
|
|
5870
|
+
tokens = await authProviderRef.current.tokens?.();
|
|
5871
|
+
} catch (error2) {
|
|
5872
|
+
addLog("warn", "Failed to read OAuth tokens:", error2);
|
|
5873
|
+
tokens = void 0;
|
|
5874
|
+
}
|
|
5875
|
+
if (!isMountedRef.current) {
|
|
5876
|
+
addLog(
|
|
5877
|
+
"debug",
|
|
5878
|
+
"Connection aborted after token fetch for auth tokens - component unmounted"
|
|
5879
|
+
);
|
|
5880
|
+
return "failed";
|
|
5881
|
+
}
|
|
5882
|
+
if (tokens?.access_token) {
|
|
5883
|
+
if (authorizationRef.current?.mode === "mixed") {
|
|
5884
|
+
const authenticatedAuthorization = {
|
|
5885
|
+
...authorizationRef.current,
|
|
5886
|
+
authenticated: true
|
|
5887
|
+
};
|
|
5888
|
+
setAuthorization(authenticatedAuthorization);
|
|
5889
|
+
authorizationRef.current = authenticatedAuthorization;
|
|
5890
|
+
}
|
|
5891
|
+
const expiresAt = getOAuthTokenExpiry(tokens);
|
|
5892
|
+
let tokenEndpoint = null;
|
|
5893
|
+
let resource = null;
|
|
5894
|
+
let clientCreds = null;
|
|
5895
|
+
try {
|
|
5896
|
+
tokenEndpoint = await authProviderRef.current.getTokenEndpoint?.() ?? null;
|
|
5897
|
+
} catch {
|
|
5898
|
+
tokenEndpoint = null;
|
|
5899
|
+
}
|
|
5900
|
+
try {
|
|
5901
|
+
resource = await authProviderRef.current.getResource?.() ?? null;
|
|
5902
|
+
} catch {
|
|
5903
|
+
resource = null;
|
|
5904
|
+
}
|
|
5905
|
+
try {
|
|
5906
|
+
clientCreds = await authProviderRef.current.getClientCredentials?.() ?? null;
|
|
5907
|
+
} catch {
|
|
5908
|
+
clientCreds = null;
|
|
5909
|
+
}
|
|
5910
|
+
if (!isMountedRef.current) {
|
|
5911
|
+
addLog("debug", "Skipping state update - component unmounted");
|
|
5912
|
+
return "failed";
|
|
5913
|
+
}
|
|
5914
|
+
setAuthTokens({
|
|
5915
|
+
access_token: tokens.access_token,
|
|
5916
|
+
token_type: tokens.token_type || "Bearer",
|
|
5917
|
+
expires_at: expiresAt,
|
|
5918
|
+
refresh_token: tokens.refresh_token,
|
|
5919
|
+
scope: tokens.scope,
|
|
5920
|
+
...tokenEndpoint ? { token_endpoint: tokenEndpoint } : {},
|
|
5921
|
+
...resource ? { resource } : {},
|
|
5922
|
+
...clientCreds?.client_id ? { client_id: clientCreds.client_id } : {},
|
|
5923
|
+
...clientCreds?.client_secret ? { client_secret: clientCreds.client_secret } : {}
|
|
5924
|
+
});
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5867
5927
|
successfulTransportRef.current = transportTypeParam;
|
|
5868
5928
|
setState("ready");
|
|
5869
5929
|
const discoverAuthorizationAfterReady = () => {
|
|
@@ -5929,66 +5989,6 @@ function useMcp(options) {
|
|
|
5929
5989
|
setSkills([]);
|
|
5930
5990
|
}
|
|
5931
5991
|
}
|
|
5932
|
-
if (authProviderRef.current) {
|
|
5933
|
-
let tokens;
|
|
5934
|
-
try {
|
|
5935
|
-
tokens = await authProviderRef.current.tokens?.();
|
|
5936
|
-
} catch (error2) {
|
|
5937
|
-
addLog("warn", "Failed to read OAuth tokens:", error2);
|
|
5938
|
-
tokens = void 0;
|
|
5939
|
-
}
|
|
5940
|
-
if (!isMountedRef.current) {
|
|
5941
|
-
addLog(
|
|
5942
|
-
"debug",
|
|
5943
|
-
"Connection aborted after token fetch for auth tokens - component unmounted"
|
|
5944
|
-
);
|
|
5945
|
-
return "failed";
|
|
5946
|
-
}
|
|
5947
|
-
if (tokens?.access_token) {
|
|
5948
|
-
if (authorizationRef.current?.mode === "mixed") {
|
|
5949
|
-
const authenticatedAuthorization = {
|
|
5950
|
-
...authorizationRef.current,
|
|
5951
|
-
authenticated: true
|
|
5952
|
-
};
|
|
5953
|
-
setAuthorization(authenticatedAuthorization);
|
|
5954
|
-
authorizationRef.current = authenticatedAuthorization;
|
|
5955
|
-
}
|
|
5956
|
-
const expiresAt = getOAuthTokenExpiry(tokens);
|
|
5957
|
-
let tokenEndpoint = null;
|
|
5958
|
-
let resource = null;
|
|
5959
|
-
let clientCreds = null;
|
|
5960
|
-
try {
|
|
5961
|
-
tokenEndpoint = await authProviderRef.current.getTokenEndpoint?.() ?? null;
|
|
5962
|
-
} catch {
|
|
5963
|
-
tokenEndpoint = null;
|
|
5964
|
-
}
|
|
5965
|
-
try {
|
|
5966
|
-
resource = await authProviderRef.current.getResource?.() ?? null;
|
|
5967
|
-
} catch {
|
|
5968
|
-
resource = null;
|
|
5969
|
-
}
|
|
5970
|
-
try {
|
|
5971
|
-
clientCreds = await authProviderRef.current.getClientCredentials?.() ?? null;
|
|
5972
|
-
} catch {
|
|
5973
|
-
clientCreds = null;
|
|
5974
|
-
}
|
|
5975
|
-
if (!isMountedRef.current) {
|
|
5976
|
-
addLog("debug", "Skipping state update - component unmounted");
|
|
5977
|
-
return "failed";
|
|
5978
|
-
}
|
|
5979
|
-
setAuthTokens({
|
|
5980
|
-
access_token: tokens.access_token,
|
|
5981
|
-
token_type: tokens.token_type || "Bearer",
|
|
5982
|
-
expires_at: expiresAt,
|
|
5983
|
-
refresh_token: tokens.refresh_token,
|
|
5984
|
-
scope: tokens.scope,
|
|
5985
|
-
...tokenEndpoint ? { token_endpoint: tokenEndpoint } : {},
|
|
5986
|
-
...resource ? { resource } : {},
|
|
5987
|
-
...clientCreds?.client_id ? { client_id: clientCreds.client_id } : {},
|
|
5988
|
-
...clientCreds?.client_secret ? { client_secret: clientCreds.client_secret } : {}
|
|
5989
|
-
});
|
|
5990
|
-
}
|
|
5991
|
-
}
|
|
5992
5992
|
return "success";
|
|
5993
5993
|
} catch (err) {
|
|
5994
5994
|
const error2 = err;
|