Skip to content

Commit 454a609

Browse files
committed
wip auth debugger
1 parent 6ab7ac3 commit 454a609

File tree

4 files changed

+768
-1
lines changed

4 files changed

+768
-1
lines changed

client/src/App.tsx

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,20 @@ import { useDraggablePane } from "./lib/hooks/useDraggablePane";
2929
import { StdErrNotification } from "./lib/notificationTypes";
3030

3131
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
32+
import { Button } from "@/components/ui/button";
3233
import {
3334
Bell,
3435
Files,
3536
FolderTree,
3637
Hammer,
3738
Hash,
39+
Key,
3840
MessageSquare,
3941
} from "lucide-react";
4042

4143
import { z } from "zod";
4244
import "./App.css";
45+
import AuthDebugger from "./components/AuthDebugger";
4346
import ConsoleTab from "./components/ConsoleTab";
4447
import HistoryAndNotifications from "./components/History";
4548
import PingTab from "./components/PingTab";
@@ -136,6 +139,7 @@ const App = () => {
136139
}
137140
>
138141
>([]);
142+
const [showAuthDebugger, setShowAuthDebugger] = useState(false);
139143
const nextRequestId = useRef(0);
140144
const rootsRef = useRef<Root[]>([]);
141145

@@ -238,6 +242,14 @@ const App = () => {
238242
[connectMcpServer],
239243
);
240244

245+
// Auto-connect to previously saved serverURL after OAuth callback
246+
const onOAuthDebugConnect = useCallback(() => {
247+
// setSseUrl(serverUrl);
248+
// setTransportType("sse");
249+
// void connectMcpServer();
250+
setShowAuthDebugger(true);
251+
}, []);
252+
241253
useEffect(() => {
242254
fetch(`${getMCPProxyAddress(config)}/config`)
243255
.then((response) => response.json())
@@ -482,6 +494,17 @@ const App = () => {
482494
);
483495
}
484496

497+
if (window.location.pathname === "/oauth/callback/debug") {
498+
const OAuthCallback = React.lazy(
499+
() => import("./components/OAuthDebugCallback"),
500+
);
501+
return (
502+
<Suspense fallback={<div>Loading...</div>}>
503+
<OAuthCallback onConnect={onOAuthDebugConnect} />
504+
</Suspense>
505+
);
506+
}
507+
485508
return (
486509
<div className="flex h-screen bg-background">
487510
<Sidebar
@@ -569,6 +592,10 @@ const App = () => {
569592
<FolderTree className="w-4 h-4 mr-2" />
570593
Roots
571594
</TabsTrigger>
595+
<TabsTrigger value="auth">
596+
<Key className="w-4 h-4 mr-2" />
597+
Auth
598+
</TabsTrigger>
572599
</TabsList>
573600

574601
<div className="w-full">
@@ -700,15 +727,44 @@ const App = () => {
700727
setRoots={setRoots}
701728
onRootsChange={handleRootsChange}
702729
/>
730+
<AuthDebugger
731+
sseUrl={sseUrl}
732+
bearerToken={bearerToken}
733+
headerName={headerName}
734+
setBearerToken={setBearerToken}
735+
setHeaderName={setHeaderName}
736+
onBack={() => setShowAuthDebugger(false)}
737+
/>
703738
</>
704739
)}
705740
</div>
706741
</Tabs>
742+
) : showAuthDebugger ? (
743+
<AuthDebugger
744+
sseUrl={sseUrl}
745+
bearerToken={bearerToken}
746+
headerName={headerName}
747+
setBearerToken={setBearerToken}
748+
setHeaderName={setHeaderName}
749+
onBack={() => setShowAuthDebugger(false)}
750+
/>
707751
) : (
708-
<div className="flex items-center justify-center h-full">
752+
<div className="flex flex-col items-center justify-center h-full gap-4">
709753
<p className="text-lg text-gray-500">
710754
Connect to an MCP server to start inspecting
711755
</p>
756+
<div className="flex items-center gap-2">
757+
<p className="text-sm text-muted-foreground">
758+
Need to configure authentication?
759+
</p>
760+
<Button
761+
variant="outline"
762+
size="sm"
763+
onClick={() => setShowAuthDebugger(true)}
764+
>
765+
Open Auth Settings
766+
</Button>
767+
</div>
712768
</div>
713769
)}
714770
</div>

0 commit comments

Comments
 (0)