mcp-use 1.6.3-canary.0 → 1.7.0-canary.1
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/chunk-JQKKMUCT.js +0 -0
- package/dist/chunk-PE7UMCVO.js +377 -0
- package/dist/{chunk-BWOTID2D.js → chunk-QSLJXXMG.js} +3 -346
- package/dist/chunk-R5DJJ4IV.js +942 -0
- package/dist/{chunk-SJEHVCPM.js → chunk-XN2PU4PS.js} +100 -23
- package/dist/index.cjs +132 -29
- package/dist/index.js +8 -5
- package/dist/oauth-CNGBFOZW.js +29 -0
- package/dist/src/agents/index.js +1 -1
- package/dist/src/auth/browser-provider.d.ts +2 -0
- package/dist/src/auth/browser-provider.d.ts.map +1 -1
- package/dist/src/auth/callback.d.ts.map +1 -1
- package/dist/src/auth/index.cjs +396 -0
- package/dist/src/auth/index.js +10 -0
- package/dist/src/auth/types.d.ts +3 -1
- package/dist/src/auth/types.d.ts.map +1 -1
- package/dist/src/browser.cjs +36 -8
- package/dist/src/browser.js +6 -4
- package/dist/src/connectors/http.d.ts.map +1 -1
- package/dist/src/react/index.cjs +132 -29
- package/dist/src/react/index.js +3 -2
- package/dist/src/react/types.d.ts +12 -1
- package/dist/src/react/types.d.ts.map +1 -1
- package/dist/src/react/useMcp.d.ts.map +1 -1
- package/dist/src/server/context-storage.d.ts +54 -0
- package/dist/src/server/context-storage.d.ts.map +1 -0
- package/dist/src/server/index.cjs +1409 -410
- package/dist/src/server/index.d.ts +4 -1
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/server/index.js +420 -412
- package/dist/src/server/mcp-server.d.ts +50 -81
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/dist/src/server/oauth/index.d.ts +13 -0
- package/dist/src/server/oauth/index.d.ts.map +1 -0
- package/dist/src/server/oauth/middleware.d.ts +19 -0
- package/dist/src/server/oauth/middleware.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/auth0.d.ts +22 -0
- package/dist/src/server/oauth/providers/auth0.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/custom.d.ts +19 -0
- package/dist/src/server/oauth/providers/custom.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/keycloak.d.ts +22 -0
- package/dist/src/server/oauth/providers/keycloak.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/supabase.d.ts +24 -0
- package/dist/src/server/oauth/providers/supabase.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/types.d.ts +138 -0
- package/dist/src/server/oauth/providers/types.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/workos.d.ts +30 -0
- package/dist/src/server/oauth/providers/workos.d.ts.map +1 -0
- package/dist/src/server/oauth/providers.d.ts +208 -0
- package/dist/src/server/oauth/providers.d.ts.map +1 -0
- package/dist/src/server/oauth/routes.d.ts +33 -0
- package/dist/src/server/oauth/routes.d.ts.map +1 -0
- package/dist/src/server/oauth/utils.d.ts +155 -0
- package/dist/src/server/oauth/utils.d.ts.map +1 -0
- package/dist/src/server/types/common.d.ts +47 -0
- package/dist/src/server/types/common.d.ts.map +1 -1
- package/dist/src/server/types/context.d.ts +34 -0
- package/dist/src/server/types/context.d.ts.map +1 -0
- package/dist/src/server/types/index.d.ts +2 -1
- package/dist/src/server/types/index.d.ts.map +1 -1
- package/dist/src/server/types/tool.d.ts +82 -9
- package/dist/src/server/types/tool.d.ts.map +1 -1
- package/dist/src/server/utils/index.d.ts +6 -0
- package/dist/src/server/utils/index.d.ts.map +1 -0
- package/dist/src/server/utils/response-helpers.d.ts +151 -0
- package/dist/src/server/utils/response-helpers.d.ts.map +1 -0
- package/dist/src/server/utils/runtime.d.ts +25 -0
- package/dist/src/server/utils/runtime.d.ts.map +1 -0
- package/dist/src/task_managers/streamable_http.d.ts +1 -0
- package/dist/src/task_managers/streamable_http.d.ts.map +1 -1
- package/dist/tsup.config.d.ts.map +1 -1
- package/package.json +14 -5
- /package/dist/{chunk-MCF5P6GJ.js → chunk-GVVPUU5K.js} +0 -0
|
@@ -428,6 +428,7 @@ var HttpConnector = class extends BaseConnector {
|
|
|
428
428
|
stop: /* @__PURE__ */ __name(async () => {
|
|
429
429
|
if (this.streamableTransport) {
|
|
430
430
|
try {
|
|
431
|
+
await this.streamableTransport.terminateSession();
|
|
431
432
|
await this.streamableTransport.close();
|
|
432
433
|
} catch (e) {
|
|
433
434
|
logger.warn(`Error closing Streamable HTTP transport: ${e}`);
|
|
@@ -452,6 +453,8 @@ var HttpConnector = class extends BaseConnector {
|
|
|
452
453
|
async connectWithSse(baseUrl) {
|
|
453
454
|
try {
|
|
454
455
|
this.connectionManager = new SseConnectionManager(baseUrl, {
|
|
456
|
+
authProvider: this.opts.authProvider,
|
|
457
|
+
// ← Pass OAuth provider to SDK (same as streamable HTTP)
|
|
455
458
|
requestInit: {
|
|
456
459
|
headers: this.headers
|
|
457
460
|
}
|
|
@@ -782,350 +785,6 @@ var WebSocketConnector = class extends BaseConnector {
|
|
|
782
785
|
}
|
|
783
786
|
};
|
|
784
787
|
|
|
785
|
-
// src/auth/browser-provider.ts
|
|
786
|
-
import { sanitizeUrl } from "strict-url-sanitise";
|
|
787
|
-
var BrowserOAuthClientProvider = class {
|
|
788
|
-
static {
|
|
789
|
-
__name(this, "BrowserOAuthClientProvider");
|
|
790
|
-
}
|
|
791
|
-
serverUrl;
|
|
792
|
-
storageKeyPrefix;
|
|
793
|
-
serverUrlHash;
|
|
794
|
-
clientName;
|
|
795
|
-
clientUri;
|
|
796
|
-
callbackUrl;
|
|
797
|
-
preventAutoAuth;
|
|
798
|
-
onPopupWindow;
|
|
799
|
-
constructor(serverUrl, options = {}) {
|
|
800
|
-
this.serverUrl = serverUrl;
|
|
801
|
-
this.storageKeyPrefix = options.storageKeyPrefix || "mcp:auth";
|
|
802
|
-
this.serverUrlHash = this.hashString(serverUrl);
|
|
803
|
-
this.clientName = options.clientName || "mcp-use";
|
|
804
|
-
this.clientUri = options.clientUri || (typeof window !== "undefined" ? window.location.origin : "");
|
|
805
|
-
this.callbackUrl = sanitizeUrl(
|
|
806
|
-
options.callbackUrl || (typeof window !== "undefined" ? new URL("/oauth/callback", window.location.origin).toString() : "/oauth/callback")
|
|
807
|
-
);
|
|
808
|
-
this.preventAutoAuth = options.preventAutoAuth;
|
|
809
|
-
this.onPopupWindow = options.onPopupWindow;
|
|
810
|
-
}
|
|
811
|
-
// --- SDK Interface Methods ---
|
|
812
|
-
get redirectUrl() {
|
|
813
|
-
return sanitizeUrl(this.callbackUrl);
|
|
814
|
-
}
|
|
815
|
-
get clientMetadata() {
|
|
816
|
-
return {
|
|
817
|
-
redirect_uris: [this.redirectUrl],
|
|
818
|
-
token_endpoint_auth_method: "none",
|
|
819
|
-
// Public client
|
|
820
|
-
grant_types: ["authorization_code", "refresh_token"],
|
|
821
|
-
response_types: ["code"],
|
|
822
|
-
client_name: this.clientName,
|
|
823
|
-
client_uri: this.clientUri
|
|
824
|
-
// scope: 'openid profile email mcp', // Example scopes, adjust as needed
|
|
825
|
-
};
|
|
826
|
-
}
|
|
827
|
-
async clientInformation() {
|
|
828
|
-
const key = this.getKey("client_info");
|
|
829
|
-
const data = localStorage.getItem(key);
|
|
830
|
-
if (!data) return void 0;
|
|
831
|
-
try {
|
|
832
|
-
return JSON.parse(data);
|
|
833
|
-
} catch (e) {
|
|
834
|
-
console.warn(
|
|
835
|
-
`[${this.storageKeyPrefix}] Failed to parse client information:`,
|
|
836
|
-
e
|
|
837
|
-
);
|
|
838
|
-
localStorage.removeItem(key);
|
|
839
|
-
return void 0;
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
// NOTE: The SDK's auth() function uses this if dynamic registration is needed.
|
|
843
|
-
// Ensure your OAuthClientInformationFull matches the expected structure if DCR is used.
|
|
844
|
-
async saveClientInformation(clientInformation) {
|
|
845
|
-
const key = this.getKey("client_info");
|
|
846
|
-
localStorage.setItem(key, JSON.stringify(clientInformation));
|
|
847
|
-
}
|
|
848
|
-
async tokens() {
|
|
849
|
-
const key = this.getKey("tokens");
|
|
850
|
-
const data = localStorage.getItem(key);
|
|
851
|
-
if (!data) return void 0;
|
|
852
|
-
try {
|
|
853
|
-
return JSON.parse(data);
|
|
854
|
-
} catch (e) {
|
|
855
|
-
console.warn(`[${this.storageKeyPrefix}] Failed to parse tokens:`, e);
|
|
856
|
-
localStorage.removeItem(key);
|
|
857
|
-
return void 0;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
async saveTokens(tokens) {
|
|
861
|
-
const key = this.getKey("tokens");
|
|
862
|
-
localStorage.setItem(key, JSON.stringify(tokens));
|
|
863
|
-
localStorage.removeItem(this.getKey("code_verifier"));
|
|
864
|
-
localStorage.removeItem(this.getKey("last_auth_url"));
|
|
865
|
-
}
|
|
866
|
-
async saveCodeVerifier(codeVerifier) {
|
|
867
|
-
const key = this.getKey("code_verifier");
|
|
868
|
-
localStorage.setItem(key, codeVerifier);
|
|
869
|
-
}
|
|
870
|
-
async codeVerifier() {
|
|
871
|
-
const key = this.getKey("code_verifier");
|
|
872
|
-
const verifier = localStorage.getItem(key);
|
|
873
|
-
if (!verifier) {
|
|
874
|
-
throw new Error(
|
|
875
|
-
`[${this.storageKeyPrefix}] Code verifier not found in storage for key ${key}. Auth flow likely corrupted or timed out.`
|
|
876
|
-
);
|
|
877
|
-
}
|
|
878
|
-
return verifier;
|
|
879
|
-
}
|
|
880
|
-
/**
|
|
881
|
-
* Generates and stores the authorization URL with state, without opening a popup.
|
|
882
|
-
* Used when preventAutoAuth is enabled to provide the URL for manual navigation.
|
|
883
|
-
* @param authorizationUrl The fully constructed authorization URL from the SDK.
|
|
884
|
-
* @returns The full authorization URL with state parameter.
|
|
885
|
-
*/
|
|
886
|
-
async prepareAuthorizationUrl(authorizationUrl) {
|
|
887
|
-
const state = globalThis.crypto.randomUUID();
|
|
888
|
-
const stateKey = `${this.storageKeyPrefix}:state_${state}`;
|
|
889
|
-
const stateData = {
|
|
890
|
-
serverUrlHash: this.serverUrlHash,
|
|
891
|
-
expiry: Date.now() + 1e3 * 60 * 10,
|
|
892
|
-
// State expires in 10 minutes
|
|
893
|
-
// Store provider options needed to reconstruct on callback
|
|
894
|
-
providerOptions: {
|
|
895
|
-
serverUrl: this.serverUrl,
|
|
896
|
-
storageKeyPrefix: this.storageKeyPrefix,
|
|
897
|
-
clientName: this.clientName,
|
|
898
|
-
clientUri: this.clientUri,
|
|
899
|
-
callbackUrl: this.callbackUrl
|
|
900
|
-
}
|
|
901
|
-
};
|
|
902
|
-
localStorage.setItem(stateKey, JSON.stringify(stateData));
|
|
903
|
-
authorizationUrl.searchParams.set("state", state);
|
|
904
|
-
const authUrlString = authorizationUrl.toString();
|
|
905
|
-
const sanitizedAuthUrl = sanitizeUrl(authUrlString);
|
|
906
|
-
localStorage.setItem(this.getKey("last_auth_url"), sanitizedAuthUrl);
|
|
907
|
-
return sanitizedAuthUrl;
|
|
908
|
-
}
|
|
909
|
-
/**
|
|
910
|
-
* Redirects the user agent to the authorization URL, storing necessary state.
|
|
911
|
-
* This now adheres to the SDK's void return type expectation for the interface.
|
|
912
|
-
* @param authorizationUrl The fully constructed authorization URL from the SDK.
|
|
913
|
-
*/
|
|
914
|
-
async redirectToAuthorization(authorizationUrl) {
|
|
915
|
-
if (this.preventAutoAuth) return;
|
|
916
|
-
const sanitizedAuthUrl = await this.prepareAuthorizationUrl(authorizationUrl);
|
|
917
|
-
const popupFeatures = "width=600,height=700,resizable=yes,scrollbars=yes,status=yes";
|
|
918
|
-
try {
|
|
919
|
-
const popup = window.open(
|
|
920
|
-
sanitizedAuthUrl,
|
|
921
|
-
`mcp_auth_${this.serverUrlHash}`,
|
|
922
|
-
popupFeatures
|
|
923
|
-
);
|
|
924
|
-
if (this.onPopupWindow) {
|
|
925
|
-
this.onPopupWindow(sanitizedAuthUrl, popupFeatures, popup);
|
|
926
|
-
}
|
|
927
|
-
if (!popup || popup.closed || typeof popup.closed === "undefined") {
|
|
928
|
-
console.warn(
|
|
929
|
-
`[${this.storageKeyPrefix}] Popup likely blocked by browser. Manual navigation might be required using the stored URL.`
|
|
930
|
-
);
|
|
931
|
-
} else {
|
|
932
|
-
popup.focus();
|
|
933
|
-
console.info(
|
|
934
|
-
`[${this.storageKeyPrefix}] Redirecting to authorization URL in popup.`
|
|
935
|
-
);
|
|
936
|
-
}
|
|
937
|
-
} catch (e) {
|
|
938
|
-
console.error(
|
|
939
|
-
`[${this.storageKeyPrefix}] Error opening popup window:`,
|
|
940
|
-
e
|
|
941
|
-
);
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
// --- Helper Methods ---
|
|
945
|
-
/**
|
|
946
|
-
* Retrieves the last URL passed to `redirectToAuthorization`. Useful for manual fallback.
|
|
947
|
-
*/
|
|
948
|
-
getLastAttemptedAuthUrl() {
|
|
949
|
-
const storedUrl = localStorage.getItem(this.getKey("last_auth_url"));
|
|
950
|
-
return storedUrl ? sanitizeUrl(storedUrl) : null;
|
|
951
|
-
}
|
|
952
|
-
clearStorage() {
|
|
953
|
-
const prefixPattern = `${this.storageKeyPrefix}_${this.serverUrlHash}_`;
|
|
954
|
-
const statePattern = `${this.storageKeyPrefix}:state_`;
|
|
955
|
-
const keysToRemove = [];
|
|
956
|
-
let count = 0;
|
|
957
|
-
for (let i = 0; i < localStorage.length; i++) {
|
|
958
|
-
const key = localStorage.key(i);
|
|
959
|
-
if (!key) continue;
|
|
960
|
-
if (key.startsWith(prefixPattern)) {
|
|
961
|
-
keysToRemove.push(key);
|
|
962
|
-
} else if (key.startsWith(statePattern)) {
|
|
963
|
-
try {
|
|
964
|
-
const item = localStorage.getItem(key);
|
|
965
|
-
if (item) {
|
|
966
|
-
const state = JSON.parse(item);
|
|
967
|
-
if (state.serverUrlHash === this.serverUrlHash) {
|
|
968
|
-
keysToRemove.push(key);
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
} catch (e) {
|
|
972
|
-
console.warn(
|
|
973
|
-
`[${this.storageKeyPrefix}] Error parsing state key ${key} during clearStorage:`,
|
|
974
|
-
e
|
|
975
|
-
);
|
|
976
|
-
}
|
|
977
|
-
}
|
|
978
|
-
}
|
|
979
|
-
const uniqueKeysToRemove = [...new Set(keysToRemove)];
|
|
980
|
-
uniqueKeysToRemove.forEach((key) => {
|
|
981
|
-
localStorage.removeItem(key);
|
|
982
|
-
count++;
|
|
983
|
-
});
|
|
984
|
-
return count;
|
|
985
|
-
}
|
|
986
|
-
hashString(str) {
|
|
987
|
-
let hash = 0;
|
|
988
|
-
for (let i = 0; i < str.length; i++) {
|
|
989
|
-
const char = str.charCodeAt(i);
|
|
990
|
-
hash = (hash << 5) - hash + char;
|
|
991
|
-
hash = hash & hash;
|
|
992
|
-
}
|
|
993
|
-
return Math.abs(hash).toString(16);
|
|
994
|
-
}
|
|
995
|
-
getKey(keySuffix) {
|
|
996
|
-
return `${this.storageKeyPrefix}_${this.serverUrlHash}_${keySuffix}`;
|
|
997
|
-
}
|
|
998
|
-
};
|
|
999
|
-
|
|
1000
|
-
// src/auth/callback.ts
|
|
1001
|
-
import { auth } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
1002
|
-
async function onMcpAuthorization() {
|
|
1003
|
-
const queryParams = new URLSearchParams(window.location.search);
|
|
1004
|
-
const code = queryParams.get("code");
|
|
1005
|
-
const state = queryParams.get("state");
|
|
1006
|
-
const error = queryParams.get("error");
|
|
1007
|
-
const errorDescription = queryParams.get("error_description");
|
|
1008
|
-
const logPrefix = "[mcp-callback]";
|
|
1009
|
-
console.log(`${logPrefix} Handling callback...`, {
|
|
1010
|
-
code,
|
|
1011
|
-
state,
|
|
1012
|
-
error,
|
|
1013
|
-
errorDescription
|
|
1014
|
-
});
|
|
1015
|
-
let provider = null;
|
|
1016
|
-
let storedStateData = null;
|
|
1017
|
-
const stateKey = state ? `mcp:auth:state_${state}` : null;
|
|
1018
|
-
try {
|
|
1019
|
-
if (error) {
|
|
1020
|
-
throw new Error(
|
|
1021
|
-
`OAuth error: ${error} - ${errorDescription || "No description provided."}`
|
|
1022
|
-
);
|
|
1023
|
-
}
|
|
1024
|
-
if (!code) {
|
|
1025
|
-
throw new Error(
|
|
1026
|
-
"Authorization code not found in callback query parameters."
|
|
1027
|
-
);
|
|
1028
|
-
}
|
|
1029
|
-
if (!state || !stateKey) {
|
|
1030
|
-
throw new Error(
|
|
1031
|
-
"State parameter not found or invalid in callback query parameters."
|
|
1032
|
-
);
|
|
1033
|
-
}
|
|
1034
|
-
const storedStateJSON = localStorage.getItem(stateKey);
|
|
1035
|
-
if (!storedStateJSON) {
|
|
1036
|
-
throw new Error(
|
|
1037
|
-
`Invalid or expired state parameter "${state}". No matching state found in storage.`
|
|
1038
|
-
);
|
|
1039
|
-
}
|
|
1040
|
-
try {
|
|
1041
|
-
storedStateData = JSON.parse(storedStateJSON);
|
|
1042
|
-
} catch (e) {
|
|
1043
|
-
throw new Error("Failed to parse stored OAuth state.");
|
|
1044
|
-
}
|
|
1045
|
-
if (!storedStateData.expiry || storedStateData.expiry < Date.now()) {
|
|
1046
|
-
localStorage.removeItem(stateKey);
|
|
1047
|
-
throw new Error(
|
|
1048
|
-
"OAuth state has expired. Please try initiating authentication again."
|
|
1049
|
-
);
|
|
1050
|
-
}
|
|
1051
|
-
if (!storedStateData.providerOptions) {
|
|
1052
|
-
throw new Error("Stored state is missing required provider options.");
|
|
1053
|
-
}
|
|
1054
|
-
const { serverUrl, ...providerOptions } = storedStateData.providerOptions;
|
|
1055
|
-
console.log(
|
|
1056
|
-
`${logPrefix} Re-instantiating provider for server: ${serverUrl}`
|
|
1057
|
-
);
|
|
1058
|
-
provider = new BrowserOAuthClientProvider(serverUrl, providerOptions);
|
|
1059
|
-
console.log(`${logPrefix} Calling SDK auth() to exchange code...`);
|
|
1060
|
-
const baseUrl = new URL(serverUrl).origin;
|
|
1061
|
-
const authResult = await auth(provider, {
|
|
1062
|
-
serverUrl: baseUrl,
|
|
1063
|
-
authorizationCode: code
|
|
1064
|
-
});
|
|
1065
|
-
if (authResult === "AUTHORIZED") {
|
|
1066
|
-
console.log(
|
|
1067
|
-
`${logPrefix} Authorization successful via SDK auth(). Notifying opener...`
|
|
1068
|
-
);
|
|
1069
|
-
if (window.opener && !window.opener.closed) {
|
|
1070
|
-
window.opener.postMessage(
|
|
1071
|
-
{ type: "mcp_auth_callback", success: true },
|
|
1072
|
-
window.location.origin
|
|
1073
|
-
);
|
|
1074
|
-
window.close();
|
|
1075
|
-
} else {
|
|
1076
|
-
console.warn(
|
|
1077
|
-
`${logPrefix} No opener window detected. Redirecting to root.`
|
|
1078
|
-
);
|
|
1079
|
-
const pathParts = window.location.pathname.split("/").filter(Boolean);
|
|
1080
|
-
const basePath = pathParts.length > 0 && pathParts[pathParts.length - 1] === "callback" ? "/" + pathParts.slice(0, -2).join("/") : "/";
|
|
1081
|
-
window.location.href = basePath || "/";
|
|
1082
|
-
}
|
|
1083
|
-
localStorage.removeItem(stateKey);
|
|
1084
|
-
} else {
|
|
1085
|
-
console.warn(
|
|
1086
|
-
`${logPrefix} SDK auth() returned unexpected status: ${authResult}`
|
|
1087
|
-
);
|
|
1088
|
-
throw new Error(
|
|
1089
|
-
`Unexpected result from authentication library: ${authResult}`
|
|
1090
|
-
);
|
|
1091
|
-
}
|
|
1092
|
-
} catch (err) {
|
|
1093
|
-
console.error(`${logPrefix} Error during OAuth callback handling:`, err);
|
|
1094
|
-
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
1095
|
-
if (window.opener && !window.opener.closed) {
|
|
1096
|
-
window.opener.postMessage(
|
|
1097
|
-
{ type: "mcp_auth_callback", success: false, error: errorMessage },
|
|
1098
|
-
window.location.origin
|
|
1099
|
-
);
|
|
1100
|
-
}
|
|
1101
|
-
try {
|
|
1102
|
-
document.body.innerHTML = `
|
|
1103
|
-
<div style="font-family: sans-serif; padding: 20px;">
|
|
1104
|
-
<h1>Authentication Error</h1>
|
|
1105
|
-
<p style="color: red; background-color: #ffebeb; border: 1px solid red; padding: 10px; border-radius: 4px;">
|
|
1106
|
-
${errorMessage}
|
|
1107
|
-
</p>
|
|
1108
|
-
<p>You can close this window or <a href="#" onclick="window.close(); return false;">click here to close</a>.</p>
|
|
1109
|
-
<pre style="font-size: 0.8em; color: #555; margin-top: 20px; white-space: pre-wrap;">${err instanceof Error ? err.stack : ""}</pre>
|
|
1110
|
-
</div>
|
|
1111
|
-
`;
|
|
1112
|
-
} catch (displayError) {
|
|
1113
|
-
console.error(
|
|
1114
|
-
`${logPrefix} Could not display error in callback window:`,
|
|
1115
|
-
displayError
|
|
1116
|
-
);
|
|
1117
|
-
}
|
|
1118
|
-
if (stateKey) {
|
|
1119
|
-
localStorage.removeItem(stateKey);
|
|
1120
|
-
}
|
|
1121
|
-
if (provider) {
|
|
1122
|
-
localStorage.removeItem(provider.getKey("code_verifier"));
|
|
1123
|
-
localStorage.removeItem(provider.getKey("last_auth_url"));
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
__name(onMcpAuthorization, "onMcpAuthorization");
|
|
1128
|
-
|
|
1129
788
|
// src/client/base.ts
|
|
1130
789
|
var BaseMCPClient = class {
|
|
1131
790
|
static {
|
|
@@ -1310,7 +969,5 @@ export {
|
|
|
1310
969
|
ConnectionManager,
|
|
1311
970
|
HttpConnector,
|
|
1312
971
|
WebSocketConnector,
|
|
1313
|
-
BrowserOAuthClientProvider,
|
|
1314
|
-
onMcpAuthorization,
|
|
1315
972
|
BrowserMCPClient
|
|
1316
973
|
};
|