/**
* Utility for getting current directory in Jest-compatible way
*/
import { fileURLToPath } from 'url';
import { dirname } from 'path';
/**
* Get current directory in a way that works in both Jest and normal execution
*/
export function getCurrentDirCompat(): string {
try {
// Check if we're in a Jest environment
if (typeof process !== 'undefined' && process.env['NODE_ENV'] === 'test') {
return process.cwd();
}
// Try import.meta.url for normal ESM execution
if (typeof import.meta !== 'undefined' && import.meta.url) {
const __filename = fileURLToPath(import.meta.url);
return dirname(__filename);
}
} catch {
// Fallback for any environment issues
}
// Final fallback
return process.cwd();
}
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/tosin2013/mcp-adr-analysis-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server