Skip to main content
Glama
defaults.ts1.71 kB
import { fileURLToPath } from "url"; import { dirname, join } from "path"; import { readFileSync } from "fs"; interface ResourceHandler { (uri: URL): Promise<{ contents: Array<{ uri: string; text: string; }>; }>; } interface ProcessedResource { id: string; uri: string; name: string; description: string; mimetype: string; handler: ResourceHandler; } export const processDefaultsResources = (): ProcessedResource[] => { const currentDir = dirname(fileURLToPath(import.meta.url)); const defaultsPath = join(currentDir, "static", "defaults.json"); const defaults = JSON.parse(readFileSync(defaultsPath, "utf8")); return Object.entries(defaults).map(([key, value]) => { const resourceName = key .split("_") .map((word) => word.charAt(0).toUpperCase() + word.slice(1)) .join(" ") .replace(/Docs$/, " Docs"); const resourceDescription = key .split("_") .map((word, index) => index === 0 ? word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() : word.toLowerCase() ) .join(" ") .concat(" llms.txt"); return { id: key, name: resourceName, description: resourceDescription, mimetype: "text/plain", uri: value as string, handler: async (uri: URL) => { const response = await fetch(uri.href); const text = await response.text(); return { contents: [ { uri: uri.href, name: resourceName, description: resourceDescription, text, mimetype: "text/plain", }, ], }; }, }; }); };

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/maverickg59/sushimcp'

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