MCPcopy Index your code
hub / github.com/codeaashu/claude-code / setMcpAuthCacheEntry

Function setMcpAuthCacheEntry

src/services/mcp/client.ts:293–309  ·  view source on GitHub ↗
(serverId: string)

Source from the content-addressed store, hash-verified

291let writeChain = Promise.resolve()
292
293function setMcpAuthCacheEntry(serverId: string): void {
294 writeChain = writeChain
295 .then(async () => {
296 const cache = await getMcpAuthCache()
297 cache[serverId] = { timestamp: Date.now() }
298 const cachePath = getMcpAuthCachePath()
299 await mkdir(dirname(cachePath), { recursive: true })
300 await writeFile(cachePath, jsonStringify(cache))
301 // Invalidate the read cache so subsequent reads see the new entry.
302 // Safe because writeChain serializes writes: the next write's
303 // getMcpAuthCache() call will re-read the file with this entry present.
304 authCachePromise = null
305 })
306 .catch(() => {
307 // Best-effort cache write
308 })
309}
310
311export function clearMcpAuthCache(): void {
312 authCachePromise = null

Callers 1

handleRemoteAuthFailureFunction · 0.85

Calls 4

getMcpAuthCacheFunction · 0.85
getMcpAuthCachePathFunction · 0.85
mkdirFunction · 0.85
jsonStringifyFunction · 0.85

Tested by

no test coverage detected