INNER CODE UNIT · TypeScript
readMcpBearerTokenFromConfig
lazy-dinosaur/ccxt-mcp · src/index.ts:76
function readMcpBearerTokenFromConfig(configFilePath: string): string {
if (!fs.existsSync(configFilePath)) {
throw new Error(`Config file not found: ${configFilePath}`);
}
const raw = fs.readFileSync(configFilePath, "utf-8");
const parsed = JSON.parse(raw);
const tokenFromRoot =
typeof parsed?.mcpBearerToken === "string"
? parsed.mcpBearerToken.trim()
: "";
if (tokenFromRoot) {
return tokenFromRoot;
}
const tokenFromMcpServer =