Skip to main content
Glama
Dinesh-Satram

Health & Fitness Coach MCP

stores.ts1.99 kB
// Shared in-memory stores for the fitness app // Always starts fresh on application startup import { writeFileSync, readFileSync, existsSync } from 'fs' import { join } from 'path' // File paths for persistence const DATA_DIR = join(process.cwd(), '.tmp') const SESSION_FILE = join(DATA_DIR, 'session.json') // Ensure data directory exists try { if (!existsSync(DATA_DIR)) { require('fs').mkdirSync(DATA_DIR, { recursive: true }) } } catch (error) { console.log('Could not create data directory:', error) } // Always start fresh - clear any existing data on startup function clearAllData(): void { try { console.log('🔄 Starting fresh - clearing all previous data') const files = ['workouts.json', 'nutrition.json', 'plans.json', 'activities.json'] files.forEach(file => { const filePath = join(DATA_DIR, file) if (existsSync(filePath)) { require('fs').unlinkSync(filePath) } }) } catch (error) { console.log('Could not clear data files:', error) } } // Update session timestamp function updateSession(): void { try { const sessionData = { startTime: new Date().toISOString(), } writeFileSync(SESSION_FILE, JSON.stringify(sessionData, null, 2)) } catch (error) { console.log('Could not update session:', error) } } // Initialize fresh session - always clear data on startup clearAllData() updateSession() // Helper functions for in-memory storage only (no file persistence) function createInMemoryStore(): Map<string, any> { return new Map() } // Create stores (always empty on startup) export const workoutStore = createInMemoryStore() export const nutritionStore = createInMemoryStore() export const planStore = createInMemoryStore() export const activitiesStore = createInMemoryStore() console.log('📊 Fresh start - All stores initialized empty') // Note: Removed file persistence - data only exists in memory during session // This ensures the app always starts with a clean slate

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Dinesh-Satram/fitness_coach_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server