@cyanheads/pubmed-mcp-server
Version:
A Model Context Protocol (MCP) server enabling AI agents to intelligently search, retrieve, and analyze biomedical literature from PubMed via NCBI E-utilities. Built on the mcp-ts-template for robust, production-ready performance.
82 lines (81 loc) • 3.85 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;
/** Defines the logging output mode ('file' or 'stdout'). From `LOG_OUTPUT_MODE`. */
logOutputMode: "file" | "stdout";
/** Absolute path to the logs directory (if logOutputMode is 'file'). From `LOGS_DIR`. */
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;
/** Auth mode ('jwt' or 'oauth'). From `MCP_AUTH_MODE`. */
mcpAuthMode: "jwt" | "oauth";
/** OAuth Issuer URL. From `OAUTH_ISSUER_URL`. */
oauthIssuerUrl: string | undefined;
/** OAuth Audience. From `OAUTH_AUDIENCE`. */
oauthAudience: string | undefined;
/** OAuth JWKS URI. From `OAUTH_JWKS_URI`. */
oauthJwksUri: string | undefined;
/** NCBI API Key. From `NCBI_API_KEY`. */
ncbiApiKey: string | undefined;
/** NCBI Tool Identifier. From `NCBI_TOOL_IDENTIFIER`. Defaults to server name/version. */
ncbiToolIdentifier: string;
/** NCBI Admin Email. From `NCBI_ADMIN_EMAIL`. */
ncbiAdminEmail: string | undefined;
/** NCBI Request Delay in MS. From `NCBI_REQUEST_DELAY_MS`. Dynamically set based on API key presence. */
ncbiRequestDelayMs: number;
/** NCBI Max Retries. From `NCBI_MAX_RETRIES`. */
ncbiMaxRetries: number;
/** 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;
};
/**
* 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;