@atom8n/inspector
Advanced tools
Sorry, the diff of this file is too big to display
| import { u as useToast, r as reactExports, j as jsxRuntimeExports, p as parseOAuthCallbackParams, g as generateOAuthErrorDescription, S as SESSION_KEYS, I as InspectorOAuthClientProvider, a as auth } from "./index-DX-fMD_5.js"; | ||
| const OAuthCallback = ({ onConnect }) => { | ||
| const { toast } = useToast(); | ||
| const hasProcessedRef = reactExports.useRef(false); | ||
| reactExports.useEffect(() => { | ||
| const handleCallback = async () => { | ||
| if (hasProcessedRef.current) { | ||
| return; | ||
| } | ||
| hasProcessedRef.current = true; | ||
| const notifyError = (description) => void toast({ | ||
| title: "OAuth Authorization Error", | ||
| description, | ||
| variant: "destructive" | ||
| }); | ||
| const params = parseOAuthCallbackParams(window.location.search); | ||
| if (!params.successful) { | ||
| return notifyError(generateOAuthErrorDescription(params)); | ||
| } | ||
| const serverUrl = sessionStorage.getItem(SESSION_KEYS.SERVER_URL); | ||
| if (!serverUrl) { | ||
| return notifyError("Missing Server URL"); | ||
| } | ||
| let result; | ||
| try { | ||
| const serverAuthProvider = new InspectorOAuthClientProvider(serverUrl); | ||
| result = await auth(serverAuthProvider, { | ||
| serverUrl, | ||
| authorizationCode: params.code | ||
| }); | ||
| } catch (error) { | ||
| console.error("OAuth callback error:", error); | ||
| return notifyError(`Unexpected error occurred: ${error}`); | ||
| } | ||
| if (result !== "AUTHORIZED") { | ||
| return notifyError( | ||
| `Expected to be authorized after providing auth code, got: ${result}` | ||
| ); | ||
| } | ||
| toast({ | ||
| title: "Success", | ||
| description: "Successfully authenticated with OAuth", | ||
| variant: "default" | ||
| }); | ||
| onConnect(serverUrl); | ||
| }; | ||
| handleCallback().finally(() => { | ||
| window.history.replaceState({}, document.title, "/"); | ||
| }); | ||
| }, [toast, onConnect]); | ||
| return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-screen", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg text-gray-500", children: "Processing OAuth callback..." }) }); | ||
| }; | ||
| export { | ||
| OAuthCallback as default | ||
| }; |
| import { r as reactExports, S as SESSION_KEYS, p as parseOAuthCallbackParams, j as jsxRuntimeExports, g as generateOAuthErrorDescription } from "./index-DX-fMD_5.js"; | ||
| const OAuthDebugCallback = ({ onConnect }) => { | ||
| reactExports.useEffect(() => { | ||
| let isProcessed = false; | ||
| const handleCallback = async () => { | ||
| if (isProcessed) { | ||
| return; | ||
| } | ||
| isProcessed = true; | ||
| const params = parseOAuthCallbackParams(window.location.search); | ||
| if (!params.successful) { | ||
| const errorMsg = generateOAuthErrorDescription(params); | ||
| onConnect({ errorMsg }); | ||
| return; | ||
| } | ||
| const serverUrl = sessionStorage.getItem(SESSION_KEYS.SERVER_URL); | ||
| const storedState = sessionStorage.getItem( | ||
| SESSION_KEYS.AUTH_DEBUGGER_STATE | ||
| ); | ||
| let restoredState = null; | ||
| if (storedState) { | ||
| try { | ||
| restoredState = JSON.parse(storedState); | ||
| if (restoredState && typeof restoredState.resource === "string") { | ||
| restoredState.resource = new URL(restoredState.resource); | ||
| } | ||
| if (restoredState && typeof restoredState.authorizationUrl === "string") { | ||
| restoredState.authorizationUrl = new URL( | ||
| restoredState.authorizationUrl | ||
| ); | ||
| } | ||
| sessionStorage.removeItem(SESSION_KEYS.AUTH_DEBUGGER_STATE); | ||
| } catch (e) { | ||
| console.error("Failed to parse stored auth state:", e); | ||
| } | ||
| } | ||
| if (!serverUrl) { | ||
| return; | ||
| } | ||
| if (!params.code) { | ||
| onConnect({ errorMsg: "Missing authorization code" }); | ||
| return; | ||
| } | ||
| onConnect({ authorizationCode: params.code, restoredState }); | ||
| }; | ||
| handleCallback().finally(() => { | ||
| if (sessionStorage.getItem(SESSION_KEYS.SERVER_URL)) { | ||
| window.history.replaceState({}, document.title, "/"); | ||
| } | ||
| }); | ||
| return () => { | ||
| isProcessed = true; | ||
| }; | ||
| }, [onConnect]); | ||
| const callbackParams = parseOAuthCallbackParams(window.location.search); | ||
| return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-screen", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 p-4 bg-secondary rounded-md max-w-md", children: [ | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-2 text-sm", children: "Please copy this authorization code and return to the Auth Debugger:" }), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "block p-2 bg-muted rounded-sm overflow-x-auto text-xs", children: callbackParams.successful && "code" in callbackParams ? callbackParams.code : `No code found: ${callbackParams.error}, ${callbackParams.error_description}` }), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-4 text-xs text-muted-foreground", children: "Close this tab and paste the code in the OAuth flow to complete authentication." }) | ||
| ] }) }); | ||
| }; | ||
| export { | ||
| OAuthDebugCallback as default | ||
| }; |
@@ -8,3 +8,3 @@ <!doctype html> | ||
| <title>MCP Inspector</title> | ||
| <script type="module" crossorigin src="/assets/index-X0ShsfCy.js"></script> | ||
| <script type="module" crossorigin src="/assets/index-DX-fMD_5.js"></script> | ||
| <link rel="stylesheet" crossorigin href="/assets/index-BFYf86Uc.css"> | ||
@@ -11,0 +11,0 @@ </head> |
+1
-1
@@ -6,3 +6,3 @@ { | ||
| }, | ||
| "version": "0.17.23", | ||
| "version": "0.17.24", | ||
| "description": "Model Context Protocol inspector", | ||
@@ -9,0 +9,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
| import { u as useToast, r as reactExports, j as jsxRuntimeExports, p as parseOAuthCallbackParams, g as generateOAuthErrorDescription, S as SESSION_KEYS, I as InspectorOAuthClientProvider, a as auth, b as readPendingCredentialAuth, s as saveCredentialAuthResult, i as initializeInspectorConfig } from "./index-X0ShsfCy.js"; | ||
| const OAuthCallback = ({ onConnect }) => { | ||
| const { toast } = useToast(); | ||
| const hasProcessedRef = reactExports.useRef(false); | ||
| reactExports.useEffect(() => { | ||
| const handleCallback = async () => { | ||
| if (hasProcessedRef.current) { | ||
| return; | ||
| } | ||
| hasProcessedRef.current = true; | ||
| const notifyError = (description) => void toast({ | ||
| title: "OAuth Authorization Error", | ||
| description, | ||
| variant: "destructive" | ||
| }); | ||
| const params = parseOAuthCallbackParams(window.location.search); | ||
| if (!params.successful) { | ||
| return notifyError(generateOAuthErrorDescription(params)); | ||
| } | ||
| const serverUrl = sessionStorage.getItem(SESSION_KEYS.SERVER_URL); | ||
| if (!serverUrl) { | ||
| return notifyError("Missing Server URL"); | ||
| } | ||
| let result; | ||
| try { | ||
| const serverAuthProvider = new InspectorOAuthClientProvider(serverUrl); | ||
| result = await auth(serverAuthProvider, { | ||
| serverUrl, | ||
| authorizationCode: params.code | ||
| }); | ||
| } catch (error) { | ||
| console.error("OAuth callback error:", error); | ||
| return notifyError(`Unexpected error occurred: ${error}`); | ||
| } | ||
| if (result !== "AUTHORIZED") { | ||
| return notifyError( | ||
| `Expected to be authorized after providing auth code, got: ${result}` | ||
| ); | ||
| } | ||
| const pendingCredentialAuth = readPendingCredentialAuth(); | ||
| if (pendingCredentialAuth) { | ||
| try { | ||
| const serverAuthProvider = new InspectorOAuthClientProvider( | ||
| serverUrl | ||
| ); | ||
| const [tokens, clientInformation] = await Promise.all([ | ||
| serverAuthProvider.tokens(), | ||
| serverAuthProvider.clientInformation() | ||
| ]); | ||
| if (!tokens) { | ||
| throw new Error("OAuth completed without tokens"); | ||
| } | ||
| await saveCredentialAuthResult({ | ||
| config: initializeInspectorConfig("inspectorConfig_v1"), | ||
| pendingAuth: pendingCredentialAuth, | ||
| tokens, | ||
| clientId: (clientInformation == null ? void 0 : clientInformation.client_id) || pendingCredentialAuth.clientId | ||
| }); | ||
| sessionStorage.removeItem(SESSION_KEYS.PENDING_CREDENTIAL_AUTH); | ||
| toast({ | ||
| title: "Success", | ||
| description: `Saved OAuth tokens for ${pendingCredentialAuth.serverName}`, | ||
| variant: "default" | ||
| }); | ||
| } catch (error) { | ||
| console.error("Credential OAuth save error:", error); | ||
| sessionStorage.removeItem(SESSION_KEYS.PENDING_CREDENTIAL_AUTH); | ||
| return notifyError( | ||
| `Authenticated, but failed to save credential tokens: ${error instanceof Error ? error.message : String(error)}` | ||
| ); | ||
| } | ||
| } | ||
| toast({ | ||
| title: "Success", | ||
| description: "Successfully authenticated with OAuth", | ||
| variant: "default" | ||
| }); | ||
| onConnect(serverUrl); | ||
| }; | ||
| handleCallback().finally(() => { | ||
| window.history.replaceState({}, document.title, "/"); | ||
| }); | ||
| }, [toast, onConnect]); | ||
| return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-screen", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-lg text-gray-500", children: "Processing OAuth callback..." }) }); | ||
| }; | ||
| export { | ||
| OAuthCallback as default | ||
| }; |
| import { r as reactExports, S as SESSION_KEYS, p as parseOAuthCallbackParams, j as jsxRuntimeExports, g as generateOAuthErrorDescription } from "./index-X0ShsfCy.js"; | ||
| const OAuthDebugCallback = ({ onConnect }) => { | ||
| reactExports.useEffect(() => { | ||
| let isProcessed = false; | ||
| const handleCallback = async () => { | ||
| if (isProcessed) { | ||
| return; | ||
| } | ||
| isProcessed = true; | ||
| const params = parseOAuthCallbackParams(window.location.search); | ||
| if (!params.successful) { | ||
| const errorMsg = generateOAuthErrorDescription(params); | ||
| onConnect({ errorMsg }); | ||
| return; | ||
| } | ||
| const serverUrl = sessionStorage.getItem(SESSION_KEYS.SERVER_URL); | ||
| const storedState = sessionStorage.getItem( | ||
| SESSION_KEYS.AUTH_DEBUGGER_STATE | ||
| ); | ||
| let restoredState = null; | ||
| if (storedState) { | ||
| try { | ||
| restoredState = JSON.parse(storedState); | ||
| if (restoredState && typeof restoredState.resource === "string") { | ||
| restoredState.resource = new URL(restoredState.resource); | ||
| } | ||
| if (restoredState && typeof restoredState.authorizationUrl === "string") { | ||
| restoredState.authorizationUrl = new URL( | ||
| restoredState.authorizationUrl | ||
| ); | ||
| } | ||
| sessionStorage.removeItem(SESSION_KEYS.AUTH_DEBUGGER_STATE); | ||
| } catch (e) { | ||
| console.error("Failed to parse stored auth state:", e); | ||
| } | ||
| } | ||
| if (!serverUrl) { | ||
| return; | ||
| } | ||
| if (!params.code) { | ||
| onConnect({ errorMsg: "Missing authorization code" }); | ||
| return; | ||
| } | ||
| onConnect({ authorizationCode: params.code, restoredState }); | ||
| }; | ||
| handleCallback().finally(() => { | ||
| if (sessionStorage.getItem(SESSION_KEYS.SERVER_URL)) { | ||
| window.history.replaceState({}, document.title, "/"); | ||
| } | ||
| }); | ||
| return () => { | ||
| isProcessed = true; | ||
| }; | ||
| }, [onConnect]); | ||
| const callbackParams = parseOAuthCallbackParams(window.location.search); | ||
| return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center h-screen", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-4 p-4 bg-secondary rounded-md max-w-md", children: [ | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mb-2 text-sm", children: "Please copy this authorization code and return to the Auth Debugger:" }), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "block p-2 bg-muted rounded-sm overflow-x-auto text-xs", children: callbackParams.successful && "code" in callbackParams ? callbackParams.code : `No code found: ${callbackParams.error}, ${callbackParams.error_description}` }), | ||
| /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "mt-4 text-xs text-muted-foreground", children: "Close this tab and paste the code in the OAuth flow to complete authentication." }) | ||
| ] }) }); | ||
| }; | ||
| export { | ||
| OAuthDebugCallback as default | ||
| }; |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Network access
Supply chain riskThis module accesses the network.
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 6 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
2317688
0.62%58781
0.51%63
10.53%42
13.51%