UNPKG

@atlas-kitchen/atlas-mcp

Version:

Model Context Protocol server for Atlas restaurant management system - enables Claude to interact with restaurant orders, menus, and reports

34 lines 954 B
import { mkdirSync, readFileSync, writeFileSync, unlinkSync } from 'fs'; import { join } from 'path'; import { homedir } from 'os'; const CACHE_DIR = join(homedir(), '.atlas-mcp'); const CACHE_FILE = join(CACHE_DIR, 'cache.json'); function ensureDir() { mkdirSync(CACHE_DIR, { recursive: true, mode: 0o700 }); } export function saveCache(data) { ensureDir(); writeFileSync(CACHE_FILE, JSON.stringify(data), { mode: 0o600 }); } export function loadCache() { try { const raw = readFileSync(CACHE_FILE, 'utf-8'); const data = JSON.parse(raw); if (data && typeof data.accessToken === 'string' && typeof data.refreshToken === 'string') { return data; } return null; } catch { return null; } } export function clearCache() { try { unlinkSync(CACHE_FILE); } catch { // ignore if file doesn't exist } } //# sourceMappingURL=token-cache.js.map