Skip to main content
Glama

Knowledge Base MCP Server

by jeanibarz
The Unlicense
0
25
  • Linux
  • Apple
utils.ts1.33 kB
import * as crypto from 'crypto'; import * as fsp from 'fs/promises'; import * as path from 'path'; export async function calculateSHA256(filePath: string): Promise<string> { const fileBuffer = await fsp.readFile(filePath); const hashSum = crypto.createHash('sha256'); hashSum.update(fileBuffer); return hashSum.digest('hex'); } /** * Recursively gets all files in a directory, excluding hidden files and directories. * @param dirPath The directory path to search * @returns Array of file paths */ export async function getFilesRecursively(dirPath: string): Promise<string[]> { const files: string[] = []; async function traverse(currentPath: string): Promise<void> { try { const entries = await fsp.readdir(currentPath, { withFileTypes: true }); for (const entry of entries) { // Skip hidden files and directories if (entry.name.startsWith('.')) { continue; } const fullPath = path.join(currentPath, entry.name); if (entry.isDirectory()) { await traverse(fullPath); } else if (entry.isFile()) { files.push(fullPath); } } } catch (error) { console.error(`Error traversing directory ${currentPath}:`, error); } } await traverse(dirPath); return files; }

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/jeanibarz/knowledge-base-mcp-server'

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