Skip to main content
Glama

MCP Index Notes

by vjsr007
backup.ts940 B
import fs from 'fs'; import path from 'path'; import type { Note } from './types.js'; import { logger } from './logger.js'; export function writeBackup(notes: Note[], dir?: string): string { const backupDir = dir || path.resolve(process.cwd(), 'backups'); if (!fs.existsSync(backupDir)) { fs.mkdirSync(backupDir, { recursive: true }); } const file = path.join( backupDir, `notes-backup-${new Date().toISOString().replace(/[:.]/g, '-')}.json` ); logger.info({ file, count: notes.length }, 'Writing JSON backup'); fs.writeFileSync(file, JSON.stringify({ generatedAt: new Date().toISOString(), notes }, null, 2), 'utf8'); return file; } export function readBackup(file: string): Note[] { logger.info({ file }, 'Reading JSON backup'); const raw = fs.readFileSync(file, 'utf8'); const data = JSON.parse(raw) as { notes?: Note[] } | Note[]; if (Array.isArray(data)) return data; return data.notes ?? []; }

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/vjsr007/mcp-index-notes'

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