MCPcopy
hub / github.com/codeaashu/claude-code / handleClearAuth

Function handleClearAuth

src/components/mcp/MCPRemoteServerMenu.tsx:303–340  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

301 }
302 }, [server.isAuthenticated, server.config, server.name, onComplete, reconnectMcpServer, isEffectivelyAuthenticated]);
303 const handleClearAuth = async () => {
304 if (server.config.type === 'claudeai-proxy') return;
305 if (server.config) {
306 // First revoke the authentication tokens and clear all auth state
307 await revokeServerTokens(server.name, server.config);
308 logEvent('tengu_mcp_auth_config_clear', {});
309
310 // Disconnect the client and clear the cache
311 await clearServerCache(server.name, {
312 ...server.config,
313 scope: server.scope
314 });
315
316 // Update app state to remove the disconnected server's tools, commands, and resources
317 setAppState(prev_0 => {
318 const newClients_0 = prev_0.mcp.clients.map(c_0 =>
319 // 'failed' is a misnomer here, but we don't really differentiate between "not connected" and "failed" at the moment
320 c_0.name === server.name ? {
321 ...c_0,
322 type: 'failed' as const
323 } : c_0);
324 const newTools_0 = excludeToolsByServer(prev_0.mcp.tools, server.name);
325 const newCommands_0 = excludeCommandsByServer(prev_0.mcp.commands, server.name);
326 const newResources_0 = excludeResourcesByServer(prev_0.mcp.resources, server.name);
327 return {
328 ...prev_0,
329 mcp: {
330 ...prev_0.mcp,
331 clients: newClients_0,
332 tools: newTools_0,
333 commands: newCommands_0,
334 resources: newResources_0
335 }
336 };
337 });
338 onComplete?.(`Authentication cleared for ${server.name}.`);
339 }
340 };
341 if (isAuthenticating) {
342 // XAA: silent exchange (cached id_token → no browser), so don't claim
343 // one will open. If IdP login IS needed, authorizationUrl populates and

Callers 1

MCPRemoteServerMenuFunction · 0.85

Calls 6

revokeServerTokensFunction · 0.85
logEventFunction · 0.85
clearServerCacheFunction · 0.85
excludeToolsByServerFunction · 0.85
excludeCommandsByServerFunction · 0.85
excludeResourcesByServerFunction · 0.85

Tested by

no test coverage detected