Skip to main content
Glama
mednabouli

MCP Multi-Context Hook Generator

by mednabouli
hooks.ts868 B
import fs from 'fs'; import path from 'path'; import { glob } from 'glob'; interface GeneratorOptions { outputDir: string; useSWRInfinite?: boolean; graphqlInfiniteQueries?: string[]; } export function crawlHooks(rootPath: string) { const dir = path.join(rootPath, 'hooks'); if (!fs.existsSync(dir)) return []; const files = glob.sync('**/*.ts', { cwd: dir }); return files.map((file: any) => { const content = fs.readFileSync(path.join(dir, file), 'utf-8'); const match = content.match(/type\s+(\w+)Props\s*=\s*{([^}]*)}/); const props: Record<string, string> = {}; if (match) { match[2].split('\n').forEach((line: string) => { const [key, val] = line.split(':').map((s) => s.trim()); if (key && val) props[key] = val; }); } return { name: path.basename(file, '.tsx'), props, path: file }; }); }

Latest Blog Posts

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/mednabouli/MCPV2'

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