Skip to main content
Glama
by frahman5
config.tsโ€ข1.56 kB
import { config } from 'dotenv'; import { z } from 'zod'; config(); const ConfigSchema = z.object({ // Bitso API Configuration apiKey: z.string().min(1, 'BITSO_API_KEY environment variable is required'), apiSecret: z.string().min(1, 'BITSO_API_SECRET environment variable is required'), apiEndpoint: z.string().url().default('https://stage.bitso.com'), // General Configuration cacheTtlSeconds: z.number().int().positive().default(300), timeout: z.number().int().positive().default(30000), // Optional Configuration defaultLimit: z.number().int().positive().default(25), debug: z.boolean().default(false), }); export type Config = z.infer<typeof ConfigSchema>; export function loadConfig(): Config { try { const rawConfig = { apiKey: process.env.BITSO_API_KEY, apiSecret: process.env.BITSO_API_SECRET, apiEndpoint: process.env.BITSO_API_ENDPOINT, cacheTtlSeconds: process.env.CACHE_TTL_SECONDS ? parseInt(process.env.CACHE_TTL_SECONDS, 10) : undefined, timeout: process.env.TIMEOUT ? parseInt(process.env.TIMEOUT, 10) : undefined, defaultLimit: process.env.DEFAULT_LIMIT ? parseInt(process.env.DEFAULT_LIMIT, 10) : undefined, debug: process.env.DEBUG === 'true', }; return ConfigSchema.parse(rawConfig); } catch (error) { if (error instanceof z.ZodError) { const errorMessages = error.errors.map(err => `${err.path.join('.')}: ${err.message}`).join(', '); throw new Error(`Configuration validation failed: ${errorMessages}`); } throw error; } }

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/frahman5/bitso-mcp'

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