Skip to main content
Glama
errors.ts1.07 kB
export type AppErrorCode = | 'INVALID_INPUT' | 'CONFIG_MISSING' | 'UPSTREAM_HTTP_ERROR' | 'UNKNOWN'; export class AppError extends Error { code: AppErrorCode; status?: number; details?: Record<string, unknown>; constructor(code: AppErrorCode, message: string, opts?: { status?: number; details?: Record<string, unknown> }) { super(message); this.name = 'AppError'; this.code = code; this.status = opts?.status; this.details = opts?.details; } } export function toMcpError(err: unknown) { if (err instanceof AppError) { return { code: err.code, message: sanitize(err.message), status: err.status, details: err.details }; } const msg = err instanceof Error ? err.message : String(err); return { code: 'UNKNOWN' as const, message: sanitize(msg) }; } export function sanitize(input: string): string { const redactions = [process.env.GITLAB_TOKEN, process.env.JIRA_TOKEN].filter(Boolean) as string[]; let out = input; for (const secret of redactions) { out = out.split(secret).join('***'); } return out; }

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/ashabbir/multi-mcp'

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