mcp-use 1.1.2-canary.0 → 1.1.3-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/{chunk-TJXUCAST.js → chunk-62GFHYCL.js} +2 -1
- package/dist/{chunk-Y4OEPGCW.js → chunk-B5SNLEZM.js} +17 -10
- package/dist/index.cjs +18 -10
- package/dist/index.js +2 -2
- package/dist/src/auth/callback.d.ts.map +1 -1
- package/dist/src/browser.cjs +2 -1
- package/dist/src/browser.js +1 -1
- package/dist/src/react/index.cjs +18 -10
- package/dist/src/react/index.js +2 -2
- package/dist/src/react/useMcp.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -245,7 +245,8 @@ async function onMcpAuthorization() {
|
|
|
245
245
|
console.log(`${logPrefix} Re-instantiating provider for server: ${serverUrl}`);
|
|
246
246
|
provider = new BrowserOAuthClientProvider(serverUrl, providerOptions);
|
|
247
247
|
console.log(`${logPrefix} Calling SDK auth() to exchange code...`);
|
|
248
|
-
const
|
|
248
|
+
const baseUrl = new URL(serverUrl).origin;
|
|
249
|
+
const authResult = await auth(provider, { serverUrl: baseUrl, authorizationCode: code });
|
|
249
250
|
if (authResult === "AUTHORIZED") {
|
|
250
251
|
console.log(`${logPrefix} Authorization successful via SDK auth(). Notifying opener...`);
|
|
251
252
|
if (window.opener && !window.opener.closed) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BrowserOAuthClientProvider
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-62GFHYCL.js";
|
|
4
4
|
import {
|
|
5
5
|
__name
|
|
6
6
|
} from "./chunk-SHUYVCID.js";
|
|
@@ -321,7 +321,8 @@ function useMcp(options) {
|
|
|
321
321
|
}
|
|
322
322
|
try {
|
|
323
323
|
assert(url, "Server URL is required for authentication");
|
|
324
|
-
const
|
|
324
|
+
const baseUrl = new URL(url).origin;
|
|
325
|
+
const authResult = await auth(authProviderRef.current, { serverUrl: baseUrl });
|
|
325
326
|
if (!isMountedRef.current) return "failed";
|
|
326
327
|
if (authResult === "AUTHORIZED") {
|
|
327
328
|
addLog("info", "Authentication successful via existing token or refresh. Retrying transport connection...");
|
|
@@ -364,7 +365,7 @@ function useMcp(options) {
|
|
|
364
365
|
finalStatus = httpResult;
|
|
365
366
|
}
|
|
366
367
|
}
|
|
367
|
-
if (finalStatus === "success" || finalStatus === "failed") {
|
|
368
|
+
if (finalStatus === "success" || finalStatus === "failed" || finalStatus === "auth_redirect") {
|
|
368
369
|
connectingRef.current = false;
|
|
369
370
|
}
|
|
370
371
|
addLog("debug", `Connection sequence finished with status: ${finalStatus}`);
|
|
@@ -415,7 +416,8 @@ function useMcp(options) {
|
|
|
415
416
|
try {
|
|
416
417
|
assert(authProviderRef.current, "Auth Provider not available for tool re-auth");
|
|
417
418
|
assert(url, "Server URL is required for authentication");
|
|
418
|
-
const
|
|
419
|
+
const baseUrl = new URL(url).origin;
|
|
420
|
+
const authResult = await auth(authProviderRef.current, { serverUrl: baseUrl });
|
|
419
421
|
if (!isMountedRef.current) return;
|
|
420
422
|
if (authResult === "AUTHORIZED") {
|
|
421
423
|
addLog("info", "Re-authentication successful. Retrying tool call is recommended, or reconnecting.");
|
|
@@ -472,7 +474,8 @@ function useMcp(options) {
|
|
|
472
474
|
try {
|
|
473
475
|
assert(authProviderRef.current, "Auth Provider not available for manual auth");
|
|
474
476
|
assert(url, "Server URL is required for authentication");
|
|
475
|
-
const
|
|
477
|
+
const baseUrl = new URL(url).origin;
|
|
478
|
+
const authResult = await auth(authProviderRef.current, { serverUrl: baseUrl });
|
|
476
479
|
if (!isMountedRef.current) return;
|
|
477
480
|
if (authResult === "AUTHORIZED") {
|
|
478
481
|
addLog("info", "Manual authentication successful. Re-attempting connection...");
|
|
@@ -599,12 +602,16 @@ function useMcp(options) {
|
|
|
599
602
|
authTimeoutRef.current = null;
|
|
600
603
|
if (event.data.success) {
|
|
601
604
|
addLog("info", "Authentication successful via popup. Reconnecting client...");
|
|
602
|
-
if (
|
|
603
|
-
|
|
604
|
-
connectRef.current();
|
|
605
|
-
} else {
|
|
606
|
-
addLog("warn", "Connection already in progress, skipping reconnection from auth callback");
|
|
605
|
+
if (connectingRef.current) {
|
|
606
|
+
addLog("debug", "Connection attempt already in progress, resetting flag to allow reconnection.");
|
|
607
607
|
}
|
|
608
|
+
connectingRef.current = false;
|
|
609
|
+
setTimeout(() => {
|
|
610
|
+
if (isMountedRef.current) {
|
|
611
|
+
addLog("debug", "Initiating reconnection after successful auth callback.");
|
|
612
|
+
connectRef.current();
|
|
613
|
+
}
|
|
614
|
+
}, 100);
|
|
608
615
|
} else {
|
|
609
616
|
failConnectionRef.current(`Authentication failed in callback: ${event.data.error || "Unknown reason."}`);
|
|
610
617
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -4674,7 +4674,8 @@ async function onMcpAuthorization() {
|
|
|
4674
4674
|
console.log(`${logPrefix} Re-instantiating provider for server: ${serverUrl}`);
|
|
4675
4675
|
provider = new BrowserOAuthClientProvider(serverUrl, providerOptions);
|
|
4676
4676
|
console.log(`${logPrefix} Calling SDK auth() to exchange code...`);
|
|
4677
|
-
const
|
|
4677
|
+
const baseUrl = new URL(serverUrl).origin;
|
|
4678
|
+
const authResult = await (0, import_auth.auth)(provider, { serverUrl: baseUrl, authorizationCode: code });
|
|
4678
4679
|
if (authResult === "AUTHORIZED") {
|
|
4679
4680
|
console.log(`${logPrefix} Authorization successful via SDK auth(). Notifying opener...`);
|
|
4680
4681
|
if (window.opener && !window.opener.closed) {
|
|
@@ -5031,7 +5032,8 @@ function useMcp(options) {
|
|
|
5031
5032
|
}
|
|
5032
5033
|
try {
|
|
5033
5034
|
assert(url, "Server URL is required for authentication");
|
|
5034
|
-
const
|
|
5035
|
+
const baseUrl = new URL(url).origin;
|
|
5036
|
+
const authResult = await (0, import_auth2.auth)(authProviderRef.current, { serverUrl: baseUrl });
|
|
5035
5037
|
if (!isMountedRef.current) return "failed";
|
|
5036
5038
|
if (authResult === "AUTHORIZED") {
|
|
5037
5039
|
addLog("info", "Authentication successful via existing token or refresh. Retrying transport connection...");
|
|
@@ -5074,7 +5076,7 @@ function useMcp(options) {
|
|
|
5074
5076
|
finalStatus = httpResult;
|
|
5075
5077
|
}
|
|
5076
5078
|
}
|
|
5077
|
-
if (finalStatus === "success" || finalStatus === "failed") {
|
|
5079
|
+
if (finalStatus === "success" || finalStatus === "failed" || finalStatus === "auth_redirect") {
|
|
5078
5080
|
connectingRef.current = false;
|
|
5079
5081
|
}
|
|
5080
5082
|
addLog("debug", `Connection sequence finished with status: ${finalStatus}`);
|
|
@@ -5125,7 +5127,8 @@ function useMcp(options) {
|
|
|
5125
5127
|
try {
|
|
5126
5128
|
assert(authProviderRef.current, "Auth Provider not available for tool re-auth");
|
|
5127
5129
|
assert(url, "Server URL is required for authentication");
|
|
5128
|
-
const
|
|
5130
|
+
const baseUrl = new URL(url).origin;
|
|
5131
|
+
const authResult = await (0, import_auth2.auth)(authProviderRef.current, { serverUrl: baseUrl });
|
|
5129
5132
|
if (!isMountedRef.current) return;
|
|
5130
5133
|
if (authResult === "AUTHORIZED") {
|
|
5131
5134
|
addLog("info", "Re-authentication successful. Retrying tool call is recommended, or reconnecting.");
|
|
@@ -5182,7 +5185,8 @@ function useMcp(options) {
|
|
|
5182
5185
|
try {
|
|
5183
5186
|
assert(authProviderRef.current, "Auth Provider not available for manual auth");
|
|
5184
5187
|
assert(url, "Server URL is required for authentication");
|
|
5185
|
-
const
|
|
5188
|
+
const baseUrl = new URL(url).origin;
|
|
5189
|
+
const authResult = await (0, import_auth2.auth)(authProviderRef.current, { serverUrl: baseUrl });
|
|
5186
5190
|
if (!isMountedRef.current) return;
|
|
5187
5191
|
if (authResult === "AUTHORIZED") {
|
|
5188
5192
|
addLog("info", "Manual authentication successful. Re-attempting connection...");
|
|
@@ -5309,12 +5313,16 @@ function useMcp(options) {
|
|
|
5309
5313
|
authTimeoutRef.current = null;
|
|
5310
5314
|
if (event.data.success) {
|
|
5311
5315
|
addLog("info", "Authentication successful via popup. Reconnecting client...");
|
|
5312
|
-
if (
|
|
5313
|
-
|
|
5314
|
-
connectRef.current();
|
|
5315
|
-
} else {
|
|
5316
|
-
addLog("warn", "Connection already in progress, skipping reconnection from auth callback");
|
|
5316
|
+
if (connectingRef.current) {
|
|
5317
|
+
addLog("debug", "Connection attempt already in progress, resetting flag to allow reconnection.");
|
|
5317
5318
|
}
|
|
5319
|
+
connectingRef.current = false;
|
|
5320
|
+
setTimeout(() => {
|
|
5321
|
+
if (isMountedRef.current) {
|
|
5322
|
+
addLog("debug", "Initiating reconnection after successful auth callback.");
|
|
5323
|
+
connectRef.current();
|
|
5324
|
+
}
|
|
5325
|
+
}, 100);
|
|
5318
5326
|
} else {
|
|
5319
5327
|
failConnectionRef.current(`Authentication failed in callback: ${event.data.error || "Unknown reason."}`);
|
|
5320
5328
|
}
|
package/dist/index.js
CHANGED
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
} from "./chunk-4SWVHFJH.js";
|
|
25
25
|
import {
|
|
26
26
|
useMcp
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-B5SNLEZM.js";
|
|
28
28
|
import {
|
|
29
29
|
BrowserOAuthClientProvider,
|
|
30
30
|
onMcpAuthorization
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-62GFHYCL.js";
|
|
32
32
|
import {
|
|
33
33
|
Logger,
|
|
34
34
|
logger
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../../../src/auth/callback.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAsB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"callback.d.ts","sourceRoot":"","sources":["../../../src/auth/callback.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,wBAAsB,kBAAkB,kBA8HvC"}
|
package/dist/src/browser.cjs
CHANGED
|
@@ -4063,7 +4063,8 @@ async function onMcpAuthorization() {
|
|
|
4063
4063
|
console.log(`${logPrefix} Re-instantiating provider for server: ${serverUrl}`);
|
|
4064
4064
|
provider = new BrowserOAuthClientProvider(serverUrl, providerOptions);
|
|
4065
4065
|
console.log(`${logPrefix} Calling SDK auth() to exchange code...`);
|
|
4066
|
-
const
|
|
4066
|
+
const baseUrl = new URL(serverUrl).origin;
|
|
4067
|
+
const authResult = await (0, import_auth.auth)(provider, { serverUrl: baseUrl, authorizationCode: code });
|
|
4067
4068
|
if (authResult === "AUTHORIZED") {
|
|
4068
4069
|
console.log(`${logPrefix} Authorization successful via SDK auth(). Notifying opener...`);
|
|
4069
4070
|
if (window.opener && !window.opener.closed) {
|
package/dist/src/browser.js
CHANGED
package/dist/src/react/index.cjs
CHANGED
|
@@ -535,7 +535,8 @@ function useMcp(options) {
|
|
|
535
535
|
}
|
|
536
536
|
try {
|
|
537
537
|
assert(url, "Server URL is required for authentication");
|
|
538
|
-
const
|
|
538
|
+
const baseUrl = new URL(url).origin;
|
|
539
|
+
const authResult = await (0, import_auth.auth)(authProviderRef.current, { serverUrl: baseUrl });
|
|
539
540
|
if (!isMountedRef.current) return "failed";
|
|
540
541
|
if (authResult === "AUTHORIZED") {
|
|
541
542
|
addLog("info", "Authentication successful via existing token or refresh. Retrying transport connection...");
|
|
@@ -578,7 +579,7 @@ function useMcp(options) {
|
|
|
578
579
|
finalStatus = httpResult;
|
|
579
580
|
}
|
|
580
581
|
}
|
|
581
|
-
if (finalStatus === "success" || finalStatus === "failed") {
|
|
582
|
+
if (finalStatus === "success" || finalStatus === "failed" || finalStatus === "auth_redirect") {
|
|
582
583
|
connectingRef.current = false;
|
|
583
584
|
}
|
|
584
585
|
addLog("debug", `Connection sequence finished with status: ${finalStatus}`);
|
|
@@ -629,7 +630,8 @@ function useMcp(options) {
|
|
|
629
630
|
try {
|
|
630
631
|
assert(authProviderRef.current, "Auth Provider not available for tool re-auth");
|
|
631
632
|
assert(url, "Server URL is required for authentication");
|
|
632
|
-
const
|
|
633
|
+
const baseUrl = new URL(url).origin;
|
|
634
|
+
const authResult = await (0, import_auth.auth)(authProviderRef.current, { serverUrl: baseUrl });
|
|
633
635
|
if (!isMountedRef.current) return;
|
|
634
636
|
if (authResult === "AUTHORIZED") {
|
|
635
637
|
addLog("info", "Re-authentication successful. Retrying tool call is recommended, or reconnecting.");
|
|
@@ -686,7 +688,8 @@ function useMcp(options) {
|
|
|
686
688
|
try {
|
|
687
689
|
assert(authProviderRef.current, "Auth Provider not available for manual auth");
|
|
688
690
|
assert(url, "Server URL is required for authentication");
|
|
689
|
-
const
|
|
691
|
+
const baseUrl = new URL(url).origin;
|
|
692
|
+
const authResult = await (0, import_auth.auth)(authProviderRef.current, { serverUrl: baseUrl });
|
|
690
693
|
if (!isMountedRef.current) return;
|
|
691
694
|
if (authResult === "AUTHORIZED") {
|
|
692
695
|
addLog("info", "Manual authentication successful. Re-attempting connection...");
|
|
@@ -813,12 +816,16 @@ function useMcp(options) {
|
|
|
813
816
|
authTimeoutRef.current = null;
|
|
814
817
|
if (event.data.success) {
|
|
815
818
|
addLog("info", "Authentication successful via popup. Reconnecting client...");
|
|
816
|
-
if (
|
|
817
|
-
|
|
818
|
-
connectRef.current();
|
|
819
|
-
} else {
|
|
820
|
-
addLog("warn", "Connection already in progress, skipping reconnection from auth callback");
|
|
819
|
+
if (connectingRef.current) {
|
|
820
|
+
addLog("debug", "Connection attempt already in progress, resetting flag to allow reconnection.");
|
|
821
821
|
}
|
|
822
|
+
connectingRef.current = false;
|
|
823
|
+
setTimeout(() => {
|
|
824
|
+
if (isMountedRef.current) {
|
|
825
|
+
addLog("debug", "Initiating reconnection after successful auth callback.");
|
|
826
|
+
connectRef.current();
|
|
827
|
+
}
|
|
828
|
+
}, 100);
|
|
822
829
|
} else {
|
|
823
830
|
failConnectionRef.current(`Authentication failed in callback: ${event.data.error || "Unknown reason."}`);
|
|
824
831
|
}
|
|
@@ -941,7 +948,8 @@ async function onMcpAuthorization() {
|
|
|
941
948
|
console.log(`${logPrefix} Re-instantiating provider for server: ${serverUrl}`);
|
|
942
949
|
provider = new BrowserOAuthClientProvider(serverUrl, providerOptions);
|
|
943
950
|
console.log(`${logPrefix} Calling SDK auth() to exchange code...`);
|
|
944
|
-
const
|
|
951
|
+
const baseUrl = new URL(serverUrl).origin;
|
|
952
|
+
const authResult = await (0, import_auth2.auth)(provider, { serverUrl: baseUrl, authorizationCode: code });
|
|
945
953
|
if (authResult === "AUTHORIZED") {
|
|
946
954
|
console.log(`${logPrefix} Authorization successful via SDK auth(). Notifying opener...`);
|
|
947
955
|
if (window.opener && !window.opener.closed) {
|
package/dist/src/react/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useMcp
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-B5SNLEZM.js";
|
|
4
4
|
import {
|
|
5
5
|
onMcpAuthorization
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-62GFHYCL.js";
|
|
7
7
|
import "../../chunk-SHUYVCID.js";
|
|
8
8
|
export {
|
|
9
9
|
onMcpAuthorization,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMcp.d.ts","sourceRoot":"","sources":["../../../src/react/useMcp.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS9D,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"useMcp.d.ts","sourceRoot":"","sources":["../../../src/react/useMcp.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS9D,wBAAgB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CA4vB3D"}
|