Skip to main content
Glama
config.ts1.38 kB
/** * Configuration for the MCP Bridge connection. * * This module provides configuration options for connecting to Tauri apps, * with support for environment variables and sensible defaults. */ export interface BridgeConfig { host: string; port: number; } /** * Gets the default host for MCP Bridge connections. * * Resolution priority: * 1. MCP_BRIDGE_HOST environment variable * 2. TAURI_DEV_HOST environment variable (set by Tauri CLI for mobile dev) * 3. 'localhost' (default) */ export function getDefaultHost(): string { // eslint-disable-next-line no-process-env return process.env.MCP_BRIDGE_HOST || process.env.TAURI_DEV_HOST || 'localhost'; } /** * Gets the default port for MCP Bridge connections. * * Resolution priority: * 1. MCP_BRIDGE_PORT environment variable * 2. 9223 (default) */ export function getDefaultPort(): number { // eslint-disable-next-line no-process-env const port = process.env.MCP_BRIDGE_PORT; return port ? parseInt(port, 10) : 9223; } /** * Gets the full bridge configuration from environment variables. */ export function getConfig(): BridgeConfig { return { host: getDefaultHost(), port: getDefaultPort(), }; } /** * Builds a WebSocket URL from host and port. */ export function buildWebSocketURL(host: string, port: number): string { return `ws://${host}:${port}`; }

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/hypothesi/mcp-server-tauri'

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