MCPcopy Index your code
hub / github.com/modelcontextprotocol/inspector / AuthDebugger

Function AuthDebugger

client/src/components/AuthDebugger.tsx:62–339  ·  view source on GitHub ↗
({
  serverUrl: serverUrl,
  onBack,
  authState,
  updateAuthState,
  config,
  connectionType,
}: AuthDebuggerProps)

Source from the content-addressed store, hash-verified

60};
61
62const AuthDebugger = ({
63 serverUrl: serverUrl,
64 onBack,
65 authState,
66 updateAuthState,
67 config,
68 connectionType,
69}: AuthDebuggerProps) => {
70 // Check for existing tokens on mount
71 useEffect(() => {
72 if (serverUrl && !authState.oauthTokens) {
73 const checkTokens = async () => {
74 try {
75 const provider = new DebugInspectorOAuthClientProvider(serverUrl);
76 const existingTokens = await provider.tokens();
77 if (existingTokens) {
78 updateAuthState({
79 oauthTokens: existingTokens,
80 oauthStep: "complete",
81 });
82 }
83 } catch (error) {
84 console.error("Failed to load existing OAuth tokens:", error);
85 }
86 };
87 checkTokens();
88 }
89 }, [serverUrl, updateAuthState, authState.oauthTokens]);
90
91 const startOAuthFlow = useCallback(() => {
92 if (!serverUrl) {
93 updateAuthState({
94 statusMessage: {
95 type: "error",
96 message:
97 "Please enter a server URL in the sidebar before authenticating",
98 },
99 });
100 return;
101 }
102
103 updateAuthState({
104 oauthStep: "metadata_discovery",
105 authorizationUrl: null,
106 statusMessage: null,
107 latestError: null,
108 });
109 }, [serverUrl, updateAuthState]);
110
111 const fetchFn = useMemo(
112 () =>
113 connectionType === "proxy" && config
114 ? createProxyFetch(config)
115 : undefined,
116 [connectionType, config],
117 );
118
119 const stateMachine = useMemo(

Callers

nothing calls this directly

Calls 6

executeStepMethod · 0.95
clearMethod · 0.95
createProxyFetchFunction · 0.90
validateRedirectUrlFunction · 0.90
checkTokensFunction · 0.85
updateAuthStateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…