@modelcontextprotocol/inspector-client 0.3.0 → 0.4.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.
@@ -0,0 +1,39 @@
1
+ import { r as reactExports, j as jsxRuntimeExports, S as SESSION_KEYS, h as handleOAuthCallback } from "./index-DVugRvpa.js";
2
+ const OAuthCallback = () => {
3
+ const hasProcessedRef = reactExports.useRef(false);
4
+ reactExports.useEffect(() => {
5
+ const handleCallback = async () => {
6
+ if (hasProcessedRef.current) {
7
+ return;
8
+ }
9
+ hasProcessedRef.current = true;
10
+ const params = new URLSearchParams(window.location.search);
11
+ const code = params.get("code");
12
+ const serverUrl = sessionStorage.getItem(SESSION_KEYS.SERVER_URL);
13
+ if (!code || !serverUrl) {
14
+ console.error("Missing code or server URL");
15
+ window.location.href = "/";
16
+ return;
17
+ }
18
+ try {
19
+ const tokens = await handleOAuthCallback(serverUrl, code);
20
+ sessionStorage.setItem(SESSION_KEYS.ACCESS_TOKEN, tokens.access_token);
21
+ if (tokens.refresh_token) {
22
+ sessionStorage.setItem(
23
+ SESSION_KEYS.REFRESH_TOKEN,
24
+ tokens.refresh_token
25
+ );
26
+ }
27
+ window.location.href = `/?serverUrl=${encodeURIComponent(serverUrl)}`;
28
+ } catch (error) {
29
+ console.error("OAuth callback error:", error);
30
+ window.location.href = "/";
31
+ }
32
+ };
33
+ void handleCallback();
34
+ }, []);
35
+ 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..." }) });
36
+ };
37
+ export {
38
+ OAuthCallback as default
39
+ };