Skip to main content
Glama
index.ts1.79 kB
/** * Configuration management utilities */ import type { ServerConfig } from "../types/index.js"; /** * Default server configuration */ const DEFAULT_CONFIG: ServerConfig = { server: { name: "gemini-rag-mcp", version: "1.0.0", }, mcp: { maxResponseSize: 100000, defaultPageSize: 50, }, logging: { level: process.env.LOG_LEVEL ?? "info", enableDebugConsole: process.env.DEBUG === "true", }, gemini: { apiKey: process.env.GOOGLE_API_KEY ?? "", storeDisplayName: process.env.STORE_DISPLAY_NAME ?? "default", model: process.env.GEMINI_MODEL ?? "gemini-2.5-pro", }, }; /** * Validate server configuration */ export function validateConfig(config: ServerConfig): boolean { try { // Validate MCP configuration if (config.mcp.maxResponseSize <= 0) { throw new Error("MCP maxResponseSize must be positive"); } if (config.mcp.defaultPageSize <= 0) { throw new Error("MCP defaultPageSize must be positive"); } // Validate logging configuration const validLogLevels = ["error", "warn", "info", "debug"]; if (!validLogLevels.includes(config.logging.level)) { throw new Error(`Invalid log level: ${config.logging.level}`); } // Validate Gemini configuration if (!config.gemini.apiKey) { throw new Error("GOOGLE_API_KEY environment variable is required"); } if (!config.gemini.storeDisplayName) { throw new Error("STORE_DISPLAY_NAME environment variable is required"); } return true; } catch (error) { console.error("Configuration validation failed:", error); return false; } } /** * Load configuration from environment variables and defaults */ export function loadConfig(): ServerConfig { return { ...DEFAULT_CONFIG, }; }

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/masseater/gemini-rag-mcp'

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