Skip to main content
Glama
this-file-path.ts555 B
import { fileURLToPath } from "node:url"; import path from "node:path"; // replacement for __filename and __dirname in esm // see https://humanwhocodes.com/snippets/2023/01/mimicking-dirname-filename-nodejs-esm/ // these must be called with `import.meta.url` passed into the arg // ex: `const __filename = getThisFilename(import.meta.url);` export function getThisFilename(importMetaUrl: string) { return fileURLToPath(importMetaUrl); } export function getThisDirname(importMetaUrl: string) { return path.dirname(getThisFilename(importMetaUrl)); }

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/systeminit/si'

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