Skip to main content
Glama

MCP Notes

LogNote.ts2.21 kB
import path from 'path'; import { format } from 'date-fns'; import { Note } from './Note.js'; interface LogNoteOptions { date?: Date; tags?: string[]; } export class LogNote extends Note { template: string; constructor(notesBasePath: string, options: LogNoteOptions = {}) { const date = options.date || new Date(); const dateInfo = { dayOfWeek: format(date, 'EEEE'), fullDate: format(date, 'MMMM d, yyyy'), isoDate: format(date, 'yyyy-MM-dd'), time: format(date, 'h:mm a') }; // Log notes always go in the Log directory with date-based filename const relativePath = path.join('Log', `${dateInfo.isoDate}.md`); super(notesBasePath, relativePath, { ...options, date }); this.template = `# ${this.dateInfo.dayOfWeek}, ${this.dateInfo.fullDate}\n\n`; } addEntry(entry: string): LogNote { // If note doesn't exist yet, initialize with template if (!this.exists && !this.content && this.template) { this.content = this.template; } // Generate a fresh timestamp for this entry const currentTime = format(new Date(), 'h:mm a'); // Add entry with fresh timestamp this.content += `\n### [${currentTime}]\n${entry}`; return this; } async appendEntry(entry: string) { // Load existing content if available if (!this.exists) { await this.load(); // If still no content, load template if (!this.template) { await this.loadTemplate(); } if (!this.content && this.template) { this.content = this.template; } } // Add the entry this.addEntry(entry); // Save the updated note return await this.save(); } // This method is referenced but not implemented in the original JS file // Adding it here for completeness async loadTemplate(): Promise<void> { try { // Implementation would depend on how templates are loaded // For now, we'll just use the default template this.template = `# ${this.dateInfo.dayOfWeek}, ${this.dateInfo.fullDate}\n\n`; } catch (error) { console.error("Error loading template:", error); } } }

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

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