Skip to main content
Glama
urls.ts1.01 kB
import { NEON_CONSOLE_HOST } from '../../constants.js'; import { NotFoundError } from '../../server/errors.js'; export enum CONSOLE_URLS { ORGANIZATION = '/app/:orgId/projects', PROJECT = '/app/projects/:projectId', PROJECT_BRANCH = '/app/projects/:projectId/branches/:branchId', } type ExtractPathParams<T extends string> = T extends `${string}:${infer Param}/${infer Rest}` ? { [k in Param | keyof ExtractPathParams<`/${Rest}`>]: string | number } : T extends `${string}:${infer Param}` ? Record<Param, string | number> : Record<string, never>; export function generateConsoleUrl<T extends CONSOLE_URLS>( url: T, params: ExtractPathParams<T>, ): string { const link = url.replace(/:([a-zA-Z0-9_]+)/g, (_, key) => { if ((params as any)[key] === undefined) { throw new NotFoundError(`Missing parameter '${key}' for url '${url}'`); } return encodeURIComponent(String((params as any)[key])); }); return new URL(link, NEON_CONSOLE_HOST).toString(); }

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/neondatabase-labs/mcp-server-neon'

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