Skip to main content
Glama
url.ts407 B
import { URL } from 'node:url'; export function normalizeUrl(u: string): string { try { const url = new URL(u); const host = url.host.replace(/^www\./i, ''); let pathname = url.pathname || '/'; if (pathname !== '/' && pathname.endsWith('/')) pathname = pathname.slice(0, -1); return `${url.protocol}//${host}${pathname}${url.search ? url.search : ''}`; } catch { return u; } }

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/khanhs-234/tool4lm'

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