Skip to main content
Glama

1MCP Server

FileHelpers.ts1.04 kB
import fs from 'fs'; import { tmpdir } from 'os'; import path from 'path'; /** * File and directory testing utilities * Handles temporary file/directory management for tests */ export class FileHelpers { /** * Create a temporary directory for testing */ static createTempDir(prefix: string = 'mcp-test'): string { const tempDir = path.join(tmpdir(), `${prefix}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`); fs.mkdirSync(tempDir, { recursive: true }); return tempDir; } /** * Clean up a temporary directory */ static cleanupTempDir(tempDir: string): void { if (fs.existsSync(tempDir)) { fs.rmSync(tempDir, { recursive: true, force: true }); } } /** * Create a temporary file with content */ static createTempFile(content: string, extension: string = '.json'): string { const tempDir = FileHelpers.createTempDir(); const filePath = path.join(tempDir, `test-file${extension}`); fs.writeFileSync(filePath, content, 'utf8'); return filePath; } }

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/1mcp-app/agent'

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