Skip to main content
Glama

Rentcast MCP Server

by tandat8503
config.ts•2.27 kB
import dotenv from "dotenv"; import { ServerConfig } from "../types/index.js"; // Load environment variables dotenv.config(); /** * Configuration service for Rentcast MCP Server * Loads all configuration from environment variables with sensible defaults */ export class ConfigService { private static instance: ConfigService; private config: ServerConfig; private constructor() { this.config = this.loadConfig(); } public static getInstance(): ConfigService { if (!ConfigService.instance) { ConfigService.instance = new ConfigService(); } return ConfigService.instance; } public getConfig(): ServerConfig { return this.config; } private loadConfig(): ServerConfig { return { // Rentcast API Configuration rentcastApiKey: this.getRequiredEnv("RENTCAST_API_KEY"), rentcastBaseUrl: this.getEnv( "RENTCAST_BASE_URL", "https://api.rentcast.io/v1", ), timeoutSeconds: this.getNumberEnv("TIMEOUT_SECONDS", 30), }; } private getRequiredEnv(key: string): string { const value = process.env[key]; if (!value) { throw new Error(`Required environment variable ${key} is not set`); } return value; } private getEnv(key: string, defaultValue: string): string { return process.env[key] || defaultValue; } private getNumberEnv(key: string, defaultValue: number): number { const value = process.env[key]; if (!value) return defaultValue; const num = parseInt(value, 10); if (isNaN(num)) { console.warn( `Invalid number for ${key}: ${value}, using default: ${defaultValue}`, ); return defaultValue; } return num; } private getBoolEnv(key: string, defaultValue: boolean): boolean { const value = process.env[key]; if (!value) return defaultValue; return value.toLowerCase() === "true"; } // Getters for specific config values public get rentcastApiKey(): string { return this.config.rentcastApiKey; } public get rentcastBaseUrl(): string { return this.config.rentcastBaseUrl; } public get timeoutSeconds(): number { return this.config.timeoutSeconds; } } // Export singleton instance export const config = ConfigService.getInstance();

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/tandat8503/mcp_rentcast'

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