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

58 lines 1.54 kB
import { v4 as uuidv4 } from 'uuid'; export class AuthManager { tokens = null; merchantId = null; outletId = null; clientUuid; constructor() { this.clientUuid = uuidv4(); } setTokens(tokens) { this.tokens = tokens; } getTokens() { return this.tokens; } getAccessToken() { return this.tokens?.accessToken || null; } setMerchantContext(merchantId, outletId) { this.merchantId = merchantId; this.outletId = outletId || null; } getMerchantId() { return this.merchantId; } getOutletId() { return this.outletId; } getClientUuid() { return this.clientUuid; } getHeaders() { const headers = { 'Content-Type': 'application/json', }; if (this.tokens?.accessToken) { headers['Authorization'] = `Bearer ${this.tokens.accessToken}`; } if (this.merchantId) { headers['X-Merchant-ID'] = this.merchantId; } if (this.outletId) { headers['X-Outlet-ID'] = this.outletId; } headers['X-Client-UUID'] = this.clientUuid; headers['X-Client-Name'] = process.env.ATLAS_CLIENT_NAME || 'atlas-mcp-1.0.0'; return headers; } clear() { this.tokens = null; this.merchantId = null; this.outletId = null; } isAuthenticated() { return this.tokens !== null && this.tokens.accessToken !== null; } } //# sourceMappingURL=auth.js.map