@cyanheads/filesystem-mcp-server
Version:
A Model Context Protocol (MCP) server for platform-agnostic file capabilities, including advanced search and replace, and directory tree traversal
84 lines (83 loc) • 4.02 kB
TypeScript
/**
* @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: {
/** 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;
/** 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;
/** 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;
/** Gemini API Key. From `GEMINI_API_KEY`. */
geminiApiKey: string | 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;
/** Base directory for filesystem operations. From `FS_BASE_DIRECTORY`. If set, operations are restricted to this path. Will be an absolute path. */
fsBaseDirectory: string | 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;