UNPKG

pocketsmith-mcp

Version:

MCP server for managing budgets via PocketSmith API

99 lines (98 loc) 4.45 kB
/** * @fileoverview Loads, validates, and exports application configuration. * This module centralizes configuration management, sourcing values from * environment variables and `package.json`. It uses Zod for schema validation * to ensure type safety and correctness of configuration parameters. * * Key responsibilities: * - Load environment variables from a `.env` file. * - Read `package.json` for default server name and version. * - Define a Zod schema for all expected environment variables. * - Validate environment variables against the schema. * - Construct and export a comprehensive `config` object. * - Export individual configuration values like `logLevel` and `environment` for convenience. * * @module src/config/index */ /** * Main application configuration object. * Aggregates settings from validated environment variables and `package.json`. */ export declare const config: { /** Information from package.json. */ pkg: { name: string; version: string; }; /** MCP server name. Env `MCP_SERVER_NAME` > `package.json` name > "mcp-ts-template". */ mcpServerName: string; /** MCP server version. Env `MCP_SERVER_VERSION` > `package.json` version > "0.0.0". */ mcpServerVersion: string; /** Logging level. From `MCP_LOG_LEVEL` env var. Default: "debug". */ logLevel: string; /** Absolute path to the logs directory. From `LOGS_DIR` env var. */ logsPath: string | null; /** Runtime environment. From `NODE_ENV` env var. Default: "development". */ environment: string; /** MCP transport type ('stdio' or 'http'). From `MCP_TRANSPORT_TYPE` env var. Default: "stdio". */ mcpTransportType: "stdio" | "http"; /** HTTP server port (if http transport). From `MCP_HTTP_PORT` env var. Default: 3010. */ mcpHttpPort: number; /** HTTP server host (if http transport). From `MCP_HTTP_HOST` env var. Default: "127.0.0.1". */ mcpHttpHost: string; /** Array of allowed CORS origins (http transport). From `MCP_ALLOWED_ORIGINS` (comma-separated). */ mcpAllowedOrigins: string[] | undefined; /** Auth secret key (JWTs, http transport). From `MCP_AUTH_SECRET_KEY`. CRITICAL. */ mcpAuthSecretKey: string | undefined; /** The authentication mode ('jwt' or 'oauth'). From `MCP_AUTH_MODE`. */ mcpAuthMode: "jwt" | "oauth"; /** OAuth 2.1 Issuer URL. From `OAUTH_ISSUER_URL`. */ oauthIssuerUrl: string | undefined; /** OAuth 2.1 JWKS URI. From `OAUTH_JWKS_URI`. */ oauthJwksUri: string | undefined; /** OAuth 2.1 Audience. From `OAUTH_AUDIENCE`. */ oauthAudience: string | undefined; /** OpenRouter App URL. From `OPENROUTER_APP_URL`. Default: "http://localhost:3000". */ openrouterAppUrl: string; /** OpenRouter App Name. From `OPENROUTER_APP_NAME`. Defaults to `mcpServerName`. */ openrouterAppName: string; /** OpenRouter API Key. From `OPENROUTER_API_KEY`. */ openrouterApiKey: string | undefined; /** Default LLM model. From `LLM_DEFAULT_MODEL`. */ llmDefaultModel: string; /** Default LLM temperature. From `LLM_DEFAULT_TEMPERATURE`. */ llmDefaultTemperature: number | undefined; /** Default LLM top_p. From `LLM_DEFAULT_TOP_P`. */ llmDefaultTopP: number | undefined; /** Default LLM max tokens. From `LLM_DEFAULT_MAX_TOKENS`. */ llmDefaultMaxTokens: number | undefined; /** Default LLM top_k. From `LLM_DEFAULT_TOP_K`. */ llmDefaultTopK: number | undefined; /** Default LLM min_p. From `LLM_DEFAULT_MIN_P`. */ llmDefaultMinP: number | undefined; /** OAuth Proxy configurations. Undefined if no related env vars are set. */ oauthProxy: { authorizationUrl: string | undefined; tokenUrl: string | undefined; revocationUrl: string | undefined; issuerUrl: string | undefined; serviceDocumentationUrl: string | undefined; defaultClientRedirectUris: string[] | undefined; } | undefined; /** Supabase configuration. Undefined if no related env vars are set. */ supabase: { url: string; anonKey: string; serviceRoleKey: string | undefined; } | undefined; }; /** * Configured logging level for the application. * Exported for convenience. */ export declare const logLevel: string; /** * Configured runtime environment ("development", "production", etc.). * Exported for convenience. */ export declare const environment: string;