Skip to main content
Glama

Binal Digital Twin MCP Server

by binal182
url-resolver.ts•1.28 kB
export function resolveApiDomain(): string { // Client-side resolution (when window is available) if (typeof window !== 'undefined') { // Use the current browser location for client-side const { protocol, host } = window.location; return `${protocol}//${host}`; } // Server-side resolution // Priority order for external-facing URLs: // 1. Custom domain from environment variable (for manual override) if (process.env.CUSTOM_DOMAIN) { return `https://${process.env.CUSTOM_DOMAIN}`; } // 2. Vercel's production URL (best for external-facing, includes custom domains) if (process.env.VERCEL_PROJECT_PRODUCTION_URL) { return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`; } // 3. Next.js public URL (for manual configuration) if (process.env.NEXT_PUBLIC_APP_URL) { return process.env.NEXT_PUBLIC_APP_URL; } // 4. Fallback to localhost for development const port = process.env.PORT || '3000'; return `http://localhost:${port}`; } export function getBaseApiUrl(): string { return `${resolveApiDomain()}/api`; } export function getMcpEndpointUrl(): string { return `${getBaseApiUrl()}/mcp`; } export function isLocalDevelopment(): boolean { return resolveApiDomain().includes('localhost'); }

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/binal182/binal-mcpserver'

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