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

Function hasMcpDiscoveryButNoToken

src/services/mcp/auth.ts:349–363  ·  view source on GitHub ↗
(
  serverName: string,
  serverConfig: McpSSEServerConfig | McpHTTPServerConfig,
)

Source from the content-addressed store, hash-verified

347 * /mcp to authenticate.
348 */
349export function hasMcpDiscoveryButNoToken(
350 serverName: string,
351 serverConfig: McpSSEServerConfig | McpHTTPServerConfig,
352): boolean {
353 // XAA servers can silently re-auth via cached id_token even without an
354 // access/refresh token — tokens() fires the xaaRefresh path. Skipping the
355 // connection here would make that auto-auth branch unreachable after
356 // invalidateCredentials('tokens') clears the stored tokens.
357 if (isXaaEnabled() && serverConfig.oauth?.xaa) {
358 return false
359 }
360 const serverKey = getServerKey(serverName, serverConfig)
361 const entry = getSecureStorage().read()?.mcpOAuth?.[serverKey]
362 return entry !== undefined && !entry.accessToken && !entry.refreshToken
363}
364
365/**
366 * Revokes a single token on the OAuth server.

Callers 1

processServerFunction · 0.85

Calls 4

isXaaEnabledFunction · 0.85
getServerKeyFunction · 0.85
getSecureStorageFunction · 0.85
readMethod · 0.65

Tested by

no test coverage detected