MCPcopy Create free account
hub / github.com/agent-tower/core / readInternalApiToken

Function readInternalApiToken

packages/server/src/utils/internal-api-token.ts:19–28  ·  view source on GitHub ↗
(dataDir = resolveDataDir())

Source from the content-addressed store, hash-verified

17 const token = value.trim();
18 return token.length > 0 ? token : null;
19}
20
21export function readInternalApiToken(dataDir = resolveDataDir()): string | null {
22 const tokenPath = getInternalApiTokenPath(dataDir);
23 if (!existsSync(tokenPath)) return null;
24
25 try {
26 return normalizeToken(readFileSync(tokenPath, 'utf-8')) ?? null;
27 } catch {
28 return null;
29 }
30}
31

Callers 1

Calls 3

resolveDataDirFunction · 0.85
getInternalApiTokenPathFunction · 0.85
normalizeTokenFunction · 0.85

Tested by

no test coverage detected