Skip to main content
Glama

mcp-neurolora

by aindreyway
safe-fs.ts1.15 kB
import { promises as fs } from 'fs'; import path from 'path'; /** * Read file from the filesystem */ export async function safeReadFile(filePath: string): Promise<string> { try { const absolutePath = path.resolve(filePath); return await fs.readFile(absolutePath, 'utf-8'); } catch (error) { if (error instanceof Error) { throw new Error(`Failed to read file: ${error.message}`); } throw error; } } /** * Write file to a directory */ export async function safeWriteFile( filePath: string, content: string, append: boolean = false ): Promise<void> { // Always use absolute paths const absolutePath = path.resolve(filePath); const dir = path.dirname(absolutePath); try { // Create directory if it doesn't exist await fs.mkdir(dir, { recursive: true }); // Write or append to the file if (append) { await fs.appendFile(absolutePath, content, 'utf-8'); } else { await fs.writeFile(absolutePath, content, 'utf-8'); } } catch (error) { if (error instanceof Error) { throw new Error(`Failed to write file: ${error.message}`); } throw 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/aindreyway/mcp-neurolora'

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